Ice-3.5.1/0000775000076400007640000000000012223561505010365 5ustar mesmesIce-3.5.1/ICE_LICENSE0000644000076400007640000000460012223561476012057 0ustar mesmesCopyright (c) 2003-2013 ZeroC, Inc. All rights reserved. This copy of Ice is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. Ice is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License version 2 along with this program; if not, see http://www.gnu.org/licenses. Linking Ice statically or dynamically with other software (such as a library, module or application) is making a combined work based on Ice. Thus, the terms and conditions of the GNU General Public License version 2 cover this combined work. If such software can only be used together with Ice, then not only the combined work but the software itself is a work derived from Ice and as such shall be licensed under the terms of the GNU General Public License version 2. This includes the situation where Ice is only being used through an abstraction layer. As a special exception to the above, ZeroC grants to the contributors for the following projects the permission to license their Ice-based software under the terms of the GNU Lesser General Public License (LGPL) version 2.1 or of the BSD license: - Orca Robotics (http://orca-robotics.sourceforge.net) - Mumble (http://mumble.sourceforge.net) This exception does not extend to the parts of Ice used by these projects, or to any other derived work: as a whole, any work based on Ice shall be licensed under the terms and conditions of the GNU General Public License version 2. You may also combine Ice with any software not derived from Ice, provided the license of such software is compatible with the GNU General Public License version 2. In addition, as a special exception, ZeroC grants you permission to combine Ice with: - the OpenSSL library, or with a modified version of the OpenSSL library that uses the same license as OpenSSL - any library not derived from Ice and licensed under the terms of the Apache License, version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) If you modify this copy of Ice, you may extend any of the exceptions provided above to your version of Ice, but you are not obligated to do so. Ice-3.5.1/rb/0000755000076400007640000000000012223561504010765 5ustar mesmesIce-3.5.1/rb/ruby/0000755000076400007640000000000012223561477011757 5ustar mesmesIce-3.5.1/rb/ruby/Glacier2.rb0000644000076400007640000000065112223561477013736 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** require 'Glacier2/Router' require 'Glacier2/PermissionsVerifier' require 'Glacier2/Metrics' Ice-3.5.1/rb/ruby/.depend0000644000076400007640000001616612223561477013231 0ustar mesmesIce/LocalException.rb: $(slicedir)/Ice/LocalException.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice Ice/Communicator.rb: $(slicedir)/Ice/Communicator.ice $(slicedir)/Ice/LoggerF.ice $(slicedir)/Ice/StatsF.ice $(slicedir)/Ice/InstrumentationF.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/ObjectFactoryF.ice $(slicedir)/Ice/RouterF.ice $(slicedir)/Ice/LocatorF.ice $(slicedir)/Ice/PluginF.ice $(slicedir)/Ice/ImplicitContextF.ice $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ConnectionF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/Properties.ice $(slicedir)/Ice/BuiltinSequences.ice Ice/CommunicatorF.rb: $(slicedir)/Ice/CommunicatorF.ice Ice/Logger.rb: $(slicedir)/Ice/Logger.ice Ice/LoggerF.rb: $(slicedir)/Ice/LoggerF.ice Ice/BuiltinSequences.rb: $(slicedir)/Ice/BuiltinSequences.ice Ice/ObjectAdapterF.rb: $(slicedir)/Ice/ObjectAdapterF.ice Ice/Properties.rb: $(slicedir)/Ice/Properties.ice $(slicedir)/Ice/BuiltinSequences.ice Ice/PropertiesF.rb: $(slicedir)/Ice/PropertiesF.ice Ice/ObjectFactory.rb: $(slicedir)/Ice/ObjectFactory.ice Ice/ObjectFactoryF.rb: $(slicedir)/Ice/ObjectFactoryF.ice Ice/Identity.rb: $(slicedir)/Ice/Identity.ice Ice/Current.rb: $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/ConnectionF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice Ice/ImplicitContextF.rb: $(slicedir)/Ice/ImplicitContextF.ice Ice/ImplicitContext.rb: $(slicedir)/Ice/ImplicitContext.ice $(slicedir)/Ice/LocalException.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/ConnectionF.ice Ice/Router.rb: $(slicedir)/Ice/Router.ice $(slicedir)/Ice/BuiltinSequences.ice Ice/RouterF.rb: $(slicedir)/Ice/RouterF.ice Ice/Plugin.rb: $(slicedir)/Ice/Plugin.ice $(slicedir)/Ice/LoggerF.ice $(slicedir)/Ice/BuiltinSequences.ice Ice/PluginF.rb: $(slicedir)/Ice/PluginF.ice Ice/Locator.rb: $(slicedir)/Ice/Locator.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/ProcessF.ice Ice/LocatorF.rb: $(slicedir)/Ice/LocatorF.ice Ice/StatsF.rb: $(slicedir)/Ice/StatsF.ice Ice/Stats.rb: $(slicedir)/Ice/Stats.ice Ice/Process.rb: $(slicedir)/Ice/Process.ice Ice/ProcessF.rb: $(slicedir)/Ice/ProcessF.ice Ice/FacetMap.rb: $(slicedir)/Ice/FacetMap.ice Ice/Connection.rb: $(slicedir)/Ice/Connection.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Endpoint.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/EndpointF.ice Ice/ConnectionF.rb: $(slicedir)/Ice/ConnectionF.ice Ice/SliceChecksumDict.rb: $(slicedir)/Ice/SliceChecksumDict.ice Ice/Endpoint.rb: $(slicedir)/Ice/Endpoint.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/EndpointF.ice Ice/EndpointF.rb: $(slicedir)/Ice/EndpointF.ice Ice/EndpointTypes.rb: $(slicedir)/Ice/EndpointTypes.ice Ice/Version.rb: $(slicedir)/Ice/Version.ice Ice/InstrumentationF.rb: $(slicedir)/Ice/InstrumentationF.ice Ice/Instrumentation.rb: $(slicedir)/Ice/Instrumentation.ice $(slicedir)/Ice/EndpointF.ice $(slicedir)/Ice/ConnectionF.ice $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice Ice/Metrics.rb: $(slicedir)/Ice/Metrics.ice $(slicedir)/Ice/BuiltinSequences.ice Glacier2/RouterF.rb: $(slicedir)/Glacier2/RouterF.ice Glacier2/Router.rb: $(slicedir)/Glacier2/Router.ice $(slicedir)/Ice/Router.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Glacier2/Session.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/Glacier2/PermissionsVerifier.ice Glacier2/Session.rb: $(slicedir)/Glacier2/Session.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Glacier2/SSLInfo.ice Glacier2/PermissionsVerifierF.rb: $(slicedir)/Glacier2/PermissionsVerifierF.ice Glacier2/PermissionsVerifier.rb: $(slicedir)/Glacier2/PermissionsVerifier.ice $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/Ice/BuiltinSequences.ice Glacier2/SSLInfo.rb: $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/Ice/BuiltinSequences.ice Glacier2/Metrics.rb: $(slicedir)/Glacier2/Metrics.ice $(slicedir)/Ice/Metrics.ice $(slicedir)/Ice/BuiltinSequences.ice IceBox/IceBox.rb: $(slicedir)/IceBox/IceBox.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/CommunicatorF.ice $(slicedir)/Ice/PropertiesF.ice $(slicedir)/Ice/SliceChecksumDict.ice IceGrid/Admin.rb: $(slicedir)/IceGrid/Admin.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/Properties.ice $(slicedir)/Ice/SliceChecksumDict.ice $(slicedir)/Glacier2/Session.ice $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/IceGrid/Exception.ice $(slicedir)/IceGrid/Descriptor.ice IceGrid/Descriptor.rb: $(slicedir)/IceGrid/Descriptor.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/BuiltinSequences.ice IceGrid/Exception.rb: $(slicedir)/IceGrid/Exception.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/BuiltinSequences.ice IceGrid/FileParser.rb: $(slicedir)/IceGrid/FileParser.ice $(slicedir)/IceGrid/Admin.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/Properties.ice $(slicedir)/Ice/SliceChecksumDict.ice $(slicedir)/Glacier2/Session.ice $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/IceGrid/Exception.ice $(slicedir)/IceGrid/Descriptor.ice IceGrid/Locator.rb: $(slicedir)/IceGrid/Locator.ice $(slicedir)/Ice/Locator.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/ProcessF.ice IceGrid/Observer.rb: $(slicedir)/IceGrid/Observer.ice $(slicedir)/Glacier2/Session.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/IceGrid/Exception.ice $(slicedir)/IceGrid/Descriptor.ice $(slicedir)/IceGrid/Admin.ice $(slicedir)/Ice/Properties.ice $(slicedir)/Ice/SliceChecksumDict.ice IceGrid/Query.rb: $(slicedir)/IceGrid/Query.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/IceGrid/Exception.ice IceGrid/Registry.rb: $(slicedir)/IceGrid/Registry.ice $(slicedir)/IceGrid/Exception.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/IceGrid/Session.ice $(slicedir)/Glacier2/Session.ice $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/IceGrid/Admin.ice $(slicedir)/Ice/Properties.ice $(slicedir)/Ice/SliceChecksumDict.ice $(slicedir)/IceGrid/Descriptor.ice IceGrid/Session.rb: $(slicedir)/IceGrid/Session.ice $(slicedir)/Glacier2/Session.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/IceGrid/Exception.ice IceGrid/UserAccountMapper.rb: $(slicedir)/IceGrid/UserAccountMapper.ice IcePatch2/FileInfo.rb: $(slicedir)/IcePatch2/FileInfo.ice $(slicedir)/Ice/BuiltinSequences.ice IcePatch2/FileServer.rb: $(slicedir)/IcePatch2/FileServer.ice $(slicedir)/IcePatch2/FileInfo.ice $(slicedir)/Ice/BuiltinSequences.ice IceStorm/IceStorm.rb: $(slicedir)/IceStorm/IceStorm.ice $(slicedir)/Ice/SliceChecksumDict.ice $(slicedir)/IceStorm/Metrics.ice $(slicedir)/Ice/Metrics.ice $(slicedir)/Ice/BuiltinSequences.ice IceStorm/Metrics.rb: $(slicedir)/IceStorm/Metrics.ice $(slicedir)/Ice/Metrics.ice $(slicedir)/Ice/BuiltinSequences.ice Ice-3.5.1/rb/ruby/IceBox.rb0000644000076400007640000000054512223561477013461 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** require 'IceBox/IceBox' Ice-3.5.1/rb/ruby/IceGrid.rb0000644000076400007640000000110312223561477013605 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** require 'IceGrid/Admin.rb' require 'IceGrid/Descriptor.rb' require 'IceGrid/FileParser.rb' require 'IceGrid/Locator.rb' require 'IceGrid/Observer.rb' require 'IceGrid/Query.rb' require 'IceGrid/Registry.rb' require 'IceGrid/UserAccountMapper.rb' Ice-3.5.1/rb/ruby/IceStorm.rb0000644000076400007640000000060412223561477014031 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** require 'IceStorm/IceStorm' require 'IceStorm/Metrics' Ice-3.5.1/rb/ruby/IcePatch2.rb0000644000076400007640000000055412223561477014052 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** require 'IcePatch2/FileServer' Ice-3.5.1/rb/ruby/Ice.rb0000644000076400007640000004733112223561477013014 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** require 'IceRuby' require 'thread' module Ice # # Convenience function for locating the directory containing the # Slice files. # def Ice.getSliceDir # # Get the parent of the directory containing this file # (Ice.rb). # rbHome = File::join(File::dirname(__FILE__), "..") # # For an installation from a source distribution, a binary # tarball, or a Windows installer, the "slice" directory is a # sibling of the "rb" directory. # dir = File::join(rbHome, "slice") if File::exists?(dir) return File::expand_path(dir) end # # In a source distribution, the "slice" directory is one level # higher. # dir = File::join(rbHome, "..", "slice") if File::exists?(dir) return File::expand_path(dir) end if RUBY_PLATFORM =~ /linux/i iceVer = Ice::stringVersion # # Check the default RPM location. # dir = File::join("/", "usr", "share", "Ice-" + iceVer, "slice") if File::exists?(dir) return dir end end return nil end # # Exceptions. # class Exception < ::StandardError def ice_name to_s end def inspect return ::Ice::__stringifyException(self) end end class UserException < Exception end class LocalException < Exception end # # Object. # T_Object = Ice.__declareClass('::Ice::Object') T_ObjectPrx = Ice.__declareProxy('::Ice::Object') module Object_mixin def ice_isA(id, current=nil) return ice_ids().include?(id) end def ice_ping(current=nil) end attr_accessor :_ice_slicedData # Only used for instances of preserved classes. end class Object include Object_mixin def Object.ice_staticId() '::Ice::Object' end end T_Object.defineClass(nil, -1, true, false, nil, [], []) Object_mixin::ICE_TYPE = T_Object T_ObjectPrx.defineProxy(ObjectPrx, T_Object) ObjectPrx::ICE_TYPE = T_ObjectPrx # # LocalObject. # T_LocalObject = Ice.__declareLocalClass('::Ice::LocalObject') T_LocalObject.defineClass(nil, -1, true, false, nil, [], []) # # UnknownSlicedObject. # class UnknownSlicedObject include ::Ice::Object_mixin attr_accessor :unknownTypeId end T_UnknownSlicedObject = Ice.__declareClass('::Ice::UnknownSlicedObject') T_UnknownSlicedObject.defineClass(UnknownSlicedObject, -1, false, true, nil, [], []) UnknownSlicedObject::ICE_TYPE = T_UnknownSlicedObject # # InitializationData. # class InitializationData def initialize(properties=nil, logger=nil) @properties = properties @logger = logger end attr_accessor :properties, :logger end # # SlicedData # class SlicedData attr_accessor :slices # array of SliceInfo end # # SliceInfo # class SliceInfo attr_accessor :typeId, :bytes, :objects end class FormatType include Comparable def initialize(val) fail("invalid value #{val} for FormatType") unless(val >= 0 and val < 3) @val = val end def FormatType.from_int(val) raise IndexError, "#{val} is out of range 0..2" if(val < 0 || val > 2) @@_values[val] end def to_s @@_names[@val] end def to_i @val end def <=>(other) other.is_a?(FormatType) or raise ArgumentError, "value must be a FormatType" @val <=> other.to_i end def hash @val.hash end def inspect @@_names[@val] + "(#{@val})" end def FormatType.each(&block) @@_values.each(&block) end @@_names = ['DefaultFormat', 'CompactFormat', 'SlicedFormat'] @@_values = [FormatType.new(0), FormatType.new(1), FormatType.new(2)] DefaultFormat = @@_values[0] CompactFormat = @@_values[1] SlicedFormat = @@_values[2] private_class_method :new end # # Slice checksum dictionary. # SliceChecksums = {} end # # Include certain generated files. # require 'Ice/BuiltinSequences.rb' require 'Ice/Current.rb' require 'Ice/EndpointTypes.rb' require 'Ice/LocalException.rb' require 'Ice/Locator.rb' require 'Ice/Logger.rb' require 'Ice/ObjectFactory.rb' require 'Ice/Process.rb' require 'Ice/Router.rb' require 'Ice/Endpoint.rb' require 'Ice/Version.rb' require 'Ice/Instrumentation.rb' require 'Ice/Metrics.rb' module Ice # # Reopen Identity to add the <=> method. # class Identity def <=>(other) n = self.name <=> other.name if n == 0 return self.category <=> other.category else return n end end end # # Note the interface is the same as the C++ CtrlCHandler # implementation, however, the implementation is different. # class CtrlCHandler def initialize if @@_self != nil raise RuntimeError, "Only a single instance of a CtrlCHandler can be instantiated." end @@_self = self # State variables. These are not class static variables. @condVar = ConditionVariable.new @mutex = Mutex.new @queue = Array.new @done = false @callback = nil # # Setup and install signal handlers # if Signal.list.has_key?('HUP') Signal.trap('HUP') { signalHandler('HUP') } end Signal.trap('INT') { signalHandler('INT') } Signal.trap('TERM') { signalHandler('TERM') } @thr = Thread.new { main } end # Dequeue and dispatch signals. def main while true sig, callback = @mutex.synchronize { while @queue.empty? and not @done @condVar.wait(@mutex) end if @done return end @queue.shift } if callback callback.call(sig) end end end # Destroy the object. Wait for the thread to terminate and cleanup # the internal state. def destroy @mutex.synchronize { @done = true @condVar.signal } # Wait for the thread to terminate @thr.join # # Cleanup any state set by the CtrlCHandler. # if Signal.list.has_key?('HUP') Signal.trap('HUP', 'SIG_DFL') end Signal.trap('INT', 'SIG_DFL') Signal.trap('TERM', 'SIG_DFL') @@_self = nil end def setCallback(callback) @mutex.synchronize { @callback = callback } end def getCallback @mutex.synchronize { return @callback } end # Private. Only called by the signal handling mechanism. def signalHandler(sig) @mutex.synchronize { # # The signal AND the current callback are queued together. # @queue = @queue.push([sig, @callback]) @condVar.signal } end @@_self = nil end # # Ice::Application. # class Application def initialize(signalPolicy=HandleSignals) @@_signalPolicy = signalPolicy end def main(args, configFile=nil, initData=nil) if @@_communicator Ice::getProcessLogger().error($0 + ": only one instance of the Application class can be used") return false end if @@_signalPolicy == HandleSignals @@_ctrlCHandler = CtrlCHandler.new end @@_interrupted = false @@_appName = $0 status = 0 begin if initData.nil? initData = InitializationData.new end if configFile initData.properties = Ice::createProperties initData.properties.load(configFile) end initData.properties = Ice::createProperties(args, initData.properties) @@_appName = initData.properties.getPropertyWithDefault("Ice.ProgramName", @@_appName) @@_application = self @@_communicator = Ice::initialize(args, initData) @@_destroyed = false # # Used by destroyOnInterruptCallback. # @@_nohup = @@_communicator.getProperties().getPropertyAsInt("Ice.Nohup") > 0 # # The default is to destroy when a signal is received. # if @@_signalPolicy == HandleSignals Application::destroyOnInterrupt end status = run(args) rescue => ex Ice::getProcessLogger().error($!.inspect + "\n" + ex.backtrace.join("\n")) status = 1 end # # Don't want any new interrupt and at this point (post-run), # it would not make sense to release a held signal to run # shutdown or destroy. # if @@_signalPolicy == HandleSignals Application::ignoreInterrupt end @@_mutex.synchronize { while @@_callbackInProgress @@_condVar.wait(@@_mutex) end if @@_destroyed @@_communicator = nil else @@_destroyed = true end # # And _communicator != 0, meaning will be destroyed # next, _destroyed = true also ensures that any # remaining callback won't do anything # @@_application = nil } if @@_communicator begin @@_communicator.destroy() rescue => ex Ice::getProcessLogger().error($!.inspect + "\n" + ex.backtrace.join("\n")) status = 1 end @@_communicator = nil end if @@_signalPolicy == HandleSignals @@_ctrlCHandler.destroy() @@_ctrlCHandler = nil end return status end def interruptCallback(sig) end def Application.appName @@_appName end def Application.communicator @@_communicator end def Application.destroyOnInterrupt if @@_signalPolicy == HandleSignals @@_mutex.synchronize { if @@_ctrlCHandler.getCallback == @@_holdInterruptCallbackProc @@_released = true @@_condVar.signal end @@_ctrlCHandler.setCallback(@@_destroyOnInterruptCallbackProc) } else Ice::getProcessLogger().error(@@_appName + ": warning: interrupt method called on Application configured to not handle interrupts.") end end # No support for this since no server side in Ice for ruby. #def Application.shutdownOnInterrupt #end def Application.ignoreInterrupt if @@_signalPolicy == HandleSignals @@_mutex.synchronize { if @@_ctrlCHandler.getCallback == @@_holdInterruptCallbackProc @@_released = true @@_condVar.signal end @@_ctrlCHandler.setCallback(nil) } else Ice::getProcessLogger().error(@@_appName + ": warning: interrupt method called on Application configured to not handle interrupts.") end end def Application.callbackOnInterrupt() if @@_signalPolicy == HandleSignals @@_mutex.synchronize { if @@_ctrlCHandler.getCallback == @@_holdInterruptCallbackProc @@_released = true @@_condVar.signal end @@_ctrlCHandler.setCallback(@@_callbackOnInterruptCallbackProc) } else Ice::getProcessLogger().error(@@_appName + ": warning: interrupt method called on Application configured to not handle interrupts.") end end def Application.holdInterrupt if @@_signalPolicy == HandleSignals @@_mutex.synchronize { if @@_ctrlCHandler.getCallback != @@_holdInterruptCallbackProc @@_previousCallback = @@_ctrlCHandler.getCallback @@_released = false @@_ctrlCHandler.setCallback(@@_holdInterruptCallbackProc) end # else, we were already holding signals } else Ice::getProcessLogger().error(@@_appName + ": warning: interrupt method called on Application configured to not handle interrupts.") end end def Application.releaseInterrupt if @@_signalPolicy == HandleSignals @@_mutex.synchronize { if @@_ctrlCHandler.getCallback == @@_holdInterruptCallbackProc # # Note that it's very possible no signal is held; # in this case the callback is just replaced and # setting _released to true and signalling _condVar # do no harm. # @@_released = true @@_ctrlCHandler.setCallback(@@_previousCallback) @@_condVar.signal end # Else nothing to release. } else Ice::getProcessLogger().error(@@_appName + ": warning: interrupt method called on Application configured to not handle interrupts.") end end def Application.interrupted @@_mutex.synchronize { return @@_interrupted } end def Application.holdInterruptCallback(sig) callback = @@_mutex.synchronize { while not @@_released @@_condVar.wait(@@_mutex) end if @@_destroyed return end @@_ctrlCHandler.getCallback } # # Use the current callback to process this (old) signal. # if callback callback.call(sig) end end def Application.destroyOnInterruptCallback(sig) @@_mutex.synchronize { if @@_destroyed or @@_nohup and sig == 'HUP' return end @@_callbackInProcess = true @@_interrupted = true @@_destroyed = true } begin @@_communicator.destroy() rescue => ex Ice::getProcessLogger().error($!.inspect + "\n" + @@_appName + " (while destroying in response to signal " + sig + "):\n" + ex.backtrace.join("\n")) end @@_mutex.synchronize { @@_callbackInProcess = false @@_condVar.signal } end def Application.callbackOnInterruptCallback(sig) # For SIGHUP the user callback is always called. It can # decide what to do. @@_mutex.synchronize { if @@_destroyed # # Being destroyed by main thread. # return end @@_interrupted = true @@_callbackInProcess = true } begin @@_application.interruptCallback(sig) rescue => ex Ice::getProcessLogger().error($!.inspect + "\n" + @@_appName + " (while interrupting in response to signal " + sig + "):\n" + ex.backtrace.join("\n")) end @@_mutex.synchronize { @@_callbackInProcess = false @@_condVar.signal } end HandleSignals = 0 NoSignalHandling = 1 @@_appName = nil @@_communicator = nil @@_application = nil @@_ctrlCHandler = nil @@_previousCallback = nil @@_interrupted = false @@_released = false @@_destroyed = false @@_callbackInProgress = false @@_condVar = ConditionVariable.new @@_mutex = Mutex.new @@_holdInterruptCallbackProc = Proc.new { |sig| Application::holdInterruptCallback(sig) } @@_destroyOnInterruptCallbackProc = Proc.new { |sig| Application::destroyOnInterruptCallback(sig) } @@_callbackOnInterruptCallbackProc = Proc.new { |sig| Application::callbackOnInterruptCallback(sig) } @@_signalPolicy = HandleSignals end # # Proxy comparison functions. # def Ice.proxyIdentityCompare(lhs, rhs) if (lhs && !lhs.is_a?(ObjectPrx)) || (rhs && !rhs.is_a?(ObjectPrx)) raise TypeError, 'argument is not a proxy' end if lhs.nil? && rhs.nil? return 0 elsif lhs.nil? && rhs return -1 elsif lhs && rhs.nil? return 1 else return lhs.ice_getIdentity() <=> rhs.ice_getIdentity() end end def Ice.proxyIdentityEqual(lhs, rhs) return proxyIdentityCompare(lhs, rhs) == 0 end def Ice.proxyIdentityAndFacetCompare(lhs, rhs) n = proxyIdentityCompare(lhs, rhs) if n == 0 && lhs && rhs n = lhs.ice_getFacet() <=> rhs.ice_getFacet() end return n end def Ice.proxyIdentityAndFacetEqual(lhs, rhs) return proxyIdentityAndFacetCompare(lhs, rhs) == 0 end Protocol_1_0 = ProtocolVersion.new(1, 0) Encoding_1_0 = EncodingVersion.new(1, 0) Encoding_1_1 = EncodingVersion.new(1, 1) end Ice::Object_mixin::OP_ice_isA = ::Ice::__defineOperation('ice_isA', ::Ice::OperationMode::Idempotent, ::Ice::OperationMode::Nonmutating, false, nil, [[::Ice::T_string, false, 0]], [], [::Ice::T_bool, false, 0], []) Ice::Object_mixin::OP_ice_ping = ::Ice::__defineOperation('ice_ping', ::Ice::OperationMode::Idempotent, ::Ice::OperationMode::Nonmutating, false, nil, [], [], nil, []) Ice::Object_mixin::OP_ice_ids = ::Ice::__defineOperation('ice_ids', ::Ice::OperationMode::Idempotent, ::Ice::OperationMode::Nonmutating, false, nil, [], [], [::Ice::T_StringSeq, false, 0], []) Ice::Object_mixin::OP_ice_id = ::Ice::__defineOperation('ice_id', ::Ice::OperationMode::Idempotent, ::Ice::OperationMode::Nonmutating, false, nil, [], [], [::Ice::T_string, false, 0], []) Ice-3.5.1/rb/ruby/Makefile0000644000076400007640000001236112223561477013422 0ustar mesmes# ********************************************************************** # # 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 = .. include $(top_srcdir)/config/Make.rules # # IMPORTANT: If you add or remove Slice files, you also need to check Ice.rb! # ICE_SRCS = Ice/LocalException.rb \ Ice/Communicator.rb \ Ice/CommunicatorF.rb \ Ice/Logger.rb \ Ice/LoggerF.rb \ Ice/BuiltinSequences.rb \ Ice/ObjectAdapterF.rb \ Ice/PropertiesAdmin.rb \ Ice/Properties.rb \ Ice/PropertiesF.rb \ Ice/ObjectFactory.rb \ Ice/ObjectFactoryF.rb \ Ice/Identity.rb \ Ice/Current.rb \ Ice/ImplicitContextF.rb \ Ice/ImplicitContext.rb \ Ice/Router.rb \ Ice/RouterF.rb \ Ice/Plugin.rb \ Ice/PluginF.rb \ Ice/Locator.rb \ Ice/LocatorF.rb \ Ice/StatsF.rb \ Ice/Stats.rb \ Ice/Process.rb \ Ice/ProcessF.rb \ Ice/FacetMap.rb \ Ice/Connection.rb \ Ice/ConnectionF.rb \ Ice/SliceChecksumDict.rb \ Ice/Endpoint.rb \ Ice/EndpointF.rb \ Ice/EndpointTypes.rb \ Ice/Version.rb \ Ice/InstrumentationF.rb \ Ice/Instrumentation.rb \ Ice/Metrics.rb # # IMPORTANT: If you add or remove Slice files, you also need to check Glacier2.rb! # GLACIER2_SRCS = Glacier2/RouterF.rb \ Glacier2/Router.rb \ Glacier2/Session.rb \ Glacier2/PermissionsVerifierF.rb \ Glacier2/PermissionsVerifier.rb \ Glacier2/SSLInfo.rb \ Glacier2/Metrics.rb # # IMPORTANT: If you add or remove Slice files, you also need to check IceBox.rb! # ICEBOX_SRCS = IceBox/IceBox.rb # # IMPORTANT: If you add or remove Slice files, you also need to check IceGrid.rb! # ICEGRID_SRCS = IceGrid/Admin.rb \ IceGrid/Descriptor.rb \ IceGrid/Exception.rb \ IceGrid/FileParser.rb \ IceGrid/Locator.rb \ IceGrid/Observer.rb \ IceGrid/Query.rb \ IceGrid/Registry.rb \ IceGrid/Session.rb \ IceGrid/UserAccountMapper.rb # # IMPORTANT: If you add or remove Slice files, you also need to check IcePatch2.rb! # ICEPATCH2_SRCS = IcePatch2/FileInfo.rb \ IcePatch2/FileServer.rb # # IMPORTANT: If you add or remove Slice files, you also need to check IceStorm.rb! # ICESTORM_SRCS = IceStorm/IceStorm.rb \ IceStorm/Metrics.rb ALL_SRCS = $(ICE_SRCS) \ $(GLACIER2_SRCS) \ $(ICEBOX_SRCS) \ $(ICEGRID_SRCS) \ $(ICEPATCH2_SRCS) \ $(ICESTORM_SRCS) ICE_SLICE = $(patsubst %.rb,$(slicedir)/%.ice,$(ICE_SRCS)) GLACIER2_SLICE = $(patsubst %.rb,$(slicedir)/%.ice,$(GLACIER2_SRCS)) ICEBOX_SLICE = $(patsubst %.rb,$(slicedir)/%.ice,$(ICEBOX_SRCS)) ICEGRID_SLICE = $(patsubst %.rb,$(slicedir)/%.ice,$(ICEGRID_SRCS)) ICEPATCH2_SLICE = $(patsubst %.rb,$(slicedir)/%.ice,$(ICEPATCH2_SRCS)) ICESTORM_SLICE = $(patsubst %.rb,$(slicedir)/%.ice,$(ICESTORM_SRCS)) MODULES = Glacier2 Ice IceBox IceGrid IcePatch2 IceStorm all:: $(ALL_SRCS) SLICE2RBFLAGS += --ice Ice/%.rb: $(slicedir)/Ice/%.ice $(SLICE2RB) $(SLICEPARSERLIB) @mkdir -p $(notdir $( #include #include using namespace std; using namespace IceRuby; static VALUE _endpointClass; static VALUE _endpointInfoClass; static VALUE _ipEndpointInfoClass; static VALUE _tcpEndpointInfoClass; static VALUE _udpEndpointInfoClass; static VALUE _opaqueEndpointInfoClass; // ********************************************************************** // Endpoint // ********************************************************************** extern "C" void IceRuby_Endpoint_free(Ice::EndpointPtr* p) { assert(p); delete p; } VALUE IceRuby::createEndpoint(const Ice::EndpointPtr& p) { return Data_Wrap_Struct(_endpointClass, 0, IceRuby_Endpoint_free, new Ice::EndpointPtr(p)); } extern "C" VALUE IceRuby_Endpoint_toString(VALUE self) { ICE_RUBY_TRY { Ice::EndpointPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); string s = (*p)->toString(); return createString(s); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Endpoint_getInfo(VALUE self) { ICE_RUBY_TRY { Ice::EndpointPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); Ice::EndpointInfoPtr info = (*p)->getInfo(); return createEndpointInfo(info); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Endpoint_cmp(VALUE self, VALUE other) { ICE_RUBY_TRY { if(NIL_P(other)) { return INT2NUM(1); } if(!checkEndpoint(other)) { throw RubyException(rb_eTypeError, "argument must be a endpoint"); } Ice::EndpointPtr p1 = Ice::EndpointPtr(*reinterpret_cast(DATA_PTR(self))); Ice::EndpointPtr p2 = Ice::EndpointPtr(*reinterpret_cast(DATA_PTR(other))); if(p1 < p2) { return INT2NUM(-1); } else if(p1 == p2) { return INT2NUM(0); } else { return INT2NUM(1); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Endpoint_equals(VALUE self, VALUE other) { return IceRuby_Endpoint_cmp(self, other) == INT2NUM(0) ? Qtrue : Qfalse; } // ********************************************************************** // EndpointInfo // ********************************************************************** extern "C" void IceRuby_EndpointInfo_free(Ice::EndpointPtr* p) { assert(p); delete p; } VALUE IceRuby::createEndpointInfo(const Ice::EndpointInfoPtr& p) { VALUE info; if(Ice::TCPEndpointInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_tcpEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); Ice::TCPEndpointInfoPtr tcp = Ice::TCPEndpointInfoPtr::dynamicCast(p); rb_ivar_set(info, rb_intern("@host"), createString(tcp->host)); rb_ivar_set(info, rb_intern("@port"), INT2FIX(tcp->port)); } else if(Ice::UDPEndpointInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_udpEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); Ice::UDPEndpointInfoPtr udp = Ice::UDPEndpointInfoPtr::dynamicCast(p); rb_ivar_set(info, rb_intern("@host"), createString(udp->host)); rb_ivar_set(info, rb_intern("@port"), INT2FIX(udp->port)); rb_ivar_set(info, rb_intern("@mcastInterface"), createString(udp->mcastInterface)); rb_ivar_set(info, rb_intern("@mcastTtl"), INT2FIX(udp->mcastTtl)); } else if(Ice::OpaqueEndpointInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_opaqueEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); Ice::OpaqueEndpointInfoPtr opaque = Ice::OpaqueEndpointInfoPtr::dynamicCast(p); Ice::ByteSeq b = opaque->rawBytes; VALUE v = callRuby(rb_str_new, reinterpret_cast(&b[0]), static_cast(b.size())); rb_ivar_set(info, rb_intern("@rawBytes"), v); rb_ivar_set(info, rb_intern("@rawEncoding"), createEncodingVersion(opaque->rawEncoding)); } else if(Ice::IPEndpointInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_ipEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); Ice::IPEndpointInfoPtr ip = Ice::IPEndpointInfoPtr::dynamicCast(p); rb_ivar_set(info, rb_intern("@host"), createString(ip->host)); rb_ivar_set(info, rb_intern("@port"), INT2FIX(ip->port)); } else { info = Data_Wrap_Struct(_endpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); } rb_ivar_set(info, rb_intern("@timeout"), INT2FIX(p->timeout)); rb_ivar_set(info, rb_intern("@compress"), p->compress ? Qtrue : Qfalse); return info; } extern "C" VALUE IceRuby_EndpointInfo_type(VALUE self) { ICE_RUBY_TRY { Ice::EndpointInfoPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); Ice::Short type = (*p)->type(); return INT2FIX(type); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_EndpointInfo_datagram(VALUE self) { ICE_RUBY_TRY { Ice::EndpointInfoPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); bool result = (*p)->datagram(); return result ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_EndpointInfo_secure(VALUE self) { ICE_RUBY_TRY { Ice::EndpointInfoPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); bool result = (*p)->secure(); return result ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } void IceRuby::initEndpoint(VALUE iceModule) { // // Endpoint. // _endpointClass = rb_define_class_under(iceModule, "Endpoint", rb_cObject); // // Instance methods. // rb_define_method(_endpointClass, "toString", CAST_METHOD(IceRuby_Endpoint_toString), 0); rb_define_method(_endpointClass, "getInfo", CAST_METHOD(IceRuby_Endpoint_getInfo), 0); rb_define_method(_endpointClass, "to_s", CAST_METHOD(IceRuby_Endpoint_toString), 0); rb_define_method(_endpointClass, "inspect", CAST_METHOD(IceRuby_Endpoint_toString), 0); rb_define_method(_endpointClass, "<=>", CAST_METHOD(IceRuby_Endpoint_cmp), 1); rb_define_method(_endpointClass, "==", CAST_METHOD(IceRuby_Endpoint_equals), 1); rb_define_method(_endpointClass, "eql?", CAST_METHOD(IceRuby_Endpoint_equals), 1); // // EndpointInfo. // _endpointInfoClass = rb_define_class_under(iceModule, "EndpointInfo", rb_cObject); // // Instance methods. // rb_define_method(_endpointInfoClass, "type", CAST_METHOD(IceRuby_EndpointInfo_type), 0); rb_define_method(_endpointInfoClass, "datagram", CAST_METHOD(IceRuby_EndpointInfo_datagram), 0); rb_define_method(_endpointInfoClass, "secure", CAST_METHOD(IceRuby_EndpointInfo_secure), 0); // // Instance members. // rb_define_attr(_endpointInfoClass, "protocol", 1, 0); rb_define_attr(_endpointInfoClass, "encoding", 1, 0); rb_define_attr(_endpointInfoClass, "timeout", 1, 0); rb_define_attr(_endpointInfoClass, "compress", 1, 0); // // IPEndpointInfo // _ipEndpointInfoClass = rb_define_class_under(iceModule, "IPEndpointInfo", _endpointInfoClass); // // Instance members. // rb_define_attr(_ipEndpointInfoClass, "host", 1, 0); rb_define_attr(_ipEndpointInfoClass, "port", 1, 0); // // TCPEndpointInfo // _tcpEndpointInfoClass = rb_define_class_under(iceModule, "TCPEndpointInfo", _ipEndpointInfoClass); // // UDPEndpointInfo // _udpEndpointInfoClass = rb_define_class_under(iceModule, "UDPEndpointInfo", _ipEndpointInfoClass); // // Instance members. // rb_define_attr(_udpEndpointInfoClass, "mcastInterface", 1, 0); rb_define_attr(_udpEndpointInfoClass, "mcastTtl", 1, 0); // // OpaqueEndpointInfo // _opaqueEndpointInfoClass = rb_define_class_under(iceModule, "OpaqueEndpointInfo", _endpointInfoClass); // // Instance members. // rb_define_attr(_opaqueEndpointInfoClass, "rawBytes", 1, 0); rb_define_attr(_opaqueEndpointInfoClass, "rawEncoding", 1, 0); } bool IceRuby::checkEndpoint(VALUE v) { return callRuby(rb_obj_is_kind_of, v, _endpointClass) == Qtrue; } Ice-3.5.1/rb/src/IceRuby/Logger.h0000644000076400007640000000113512223561477014517 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_LOGGER_H #define ICE_RUBY_LOGGER_H #include #include namespace IceRuby { bool initLogger(VALUE); // // Create an object that delegates to a C++ implementation. // VALUE createLogger(const Ice::LoggerPtr&); } #endif Ice-3.5.1/rb/src/IceRuby/Properties.cpp0000644000076400007640000002422612223561477015775 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace IceRuby; static VALUE _propertiesClass; extern "C" void IceRuby_Properties_free(Ice::PropertiesPtr* p) { assert(p); delete p; } extern "C" VALUE IceRuby_createProperties(int argc, VALUE* argv, VALUE self) { ICE_RUBY_TRY { Ice::StringSeq seq; if(argc >= 1 && !NIL_P(argv[0]) && !arrayToStringSeq(argv[0], seq)) { throw RubyException(rb_eTypeError, "invalid array argument to Ice::createProperties"); } Ice::PropertiesPtr defaults; if(argc == 2) { if(!NIL_P(argv[1]) && callRuby(rb_obj_is_instance_of, argv[1], _propertiesClass) == Qfalse) { throw RubyException(rb_eTypeError, "invalid properties argument to Ice::createProperties"); } defaults = getProperties(argv[1]); } // // Insert the program name (stored in the Ruby global variable $0) as the first // element of the sequence. // volatile VALUE progName = callRuby(rb_gv_get, "$0"); seq.insert(seq.begin(), getString(progName)); Ice::PropertiesPtr obj; if(argc >= 1) { obj = Ice::createProperties(seq, defaults); } else { obj = Ice::createProperties(); } // // Replace the contents of the given argument list with the filtered arguments. // if(argc > 0 && !NIL_P(argv[0])) { callRuby(rb_ary_clear, argv[0]); // // We start at index 1 in order to skip the element that we inserted earlier. // for(Ice::StringSeq::size_type i = 1; i < seq.size(); ++i) { volatile VALUE str = createString(seq[i]); callRuby(rb_ary_push, argv[0], str); } } return createProperties(obj); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_getProperty(VALUE self, VALUE key) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); string k = getString(key); string v = p->getProperty(k); return createString(v); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_getPropertyWithDefault(VALUE self, VALUE key, VALUE def) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); string k = getString(key); string d = getString(def); string v = p->getPropertyWithDefault(k, d); return createString(v); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_getPropertyAsInt(VALUE self, VALUE key) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); string k = getString(key); Ice::Int v = p->getPropertyAsInt(k); return INT2FIX(v); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_getPropertyAsIntWithDefault(VALUE self, VALUE key, VALUE def) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); string k = getString(key); Ice::Int d = getInteger(def); Ice::Int v = p->getPropertyAsIntWithDefault(k, d); return INT2FIX(v); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_getPropertyAsList(VALUE self, VALUE key) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); string k = getString(key); Ice::StringSeq v = p->getPropertyAsList(k); return stringSeqToArray(v); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_getPropertyAsListWithDefault(VALUE self, VALUE key, VALUE def) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); string k = getString(key); Ice::StringSeq d; if(!arrayToStringSeq(def, d)) { throw RubyException(rb_eTypeError, "invalid array argument to Ice::getPropertyAsListWithDefault"); } Ice::StringSeq v = p->getPropertyAsListWithDefault(k, d); return stringSeqToArray(v); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_getPropertiesForPrefix(VALUE self, VALUE prefix) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); string pfx = getString(prefix); Ice::PropertyDict dict = p->getPropertiesForPrefix(pfx); volatile VALUE result = callRuby(rb_hash_new); for(Ice::PropertyDict::const_iterator q = dict.begin(); q != dict.end(); ++q) { volatile VALUE key = createString(q->first); volatile VALUE value = createString(q->second); callRuby(rb_hash_aset, result, key, value); } return result; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_setProperty(VALUE self, VALUE key, VALUE value) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); string k = getString(key); string v = getString(value); p->setProperty(k, v); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_getCommandLineOptions(VALUE self) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); Ice::StringSeq options = p->getCommandLineOptions(); return stringSeqToArray(options); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_parseCommandLineOptions(VALUE self, VALUE prefix, VALUE options) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); string pfx = getString(prefix); Ice::StringSeq seq; if(!arrayToStringSeq(options, seq)) { throw RubyException(rb_eTypeError, "invalid array argument to Ice::parseCommandLineOptions"); } Ice::StringSeq filtered = p->parseCommandLineOptions(pfx, seq); return stringSeqToArray(filtered); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_parseIceCommandLineOptions(VALUE self, VALUE options) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); Ice::StringSeq seq; if(!arrayToStringSeq(options, seq)) { throw RubyException(rb_eTypeError, "invalid array argument to Ice::parseIceCommandLineOptions"); } Ice::StringSeq filtered = p->parseIceCommandLineOptions(seq); return stringSeqToArray(filtered); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_load(VALUE self, VALUE file) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); string f = getString(file); p->load(f); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_clone(VALUE self) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); Ice::PropertiesPtr props = p->clone(); return createProperties(props); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Properties_to_s(VALUE self) { ICE_RUBY_TRY { Ice::PropertiesPtr p = getProperties(self); Ice::PropertyDict dict = p->getPropertiesForPrefix(""); string str; for(Ice::PropertyDict::const_iterator q = dict.begin(); q != dict.end(); ++q) { if(q != dict.begin()) { str.append("\n"); } str.append(q->first + "=" + q->second); } return createString(str); } ICE_RUBY_CATCH return Qnil; } void IceRuby::initProperties(VALUE iceModule) { rb_define_module_function(iceModule, "createProperties", CAST_METHOD(IceRuby_createProperties), -1); _propertiesClass = rb_define_class_under(iceModule, "PropertiesI", rb_cObject); rb_define_method(_propertiesClass, "getProperty", CAST_METHOD(IceRuby_Properties_getProperty), 1); rb_define_method(_propertiesClass, "getPropertyWithDefault", CAST_METHOD(IceRuby_Properties_getPropertyWithDefault), 2); rb_define_method(_propertiesClass, "getPropertyAsInt", CAST_METHOD(IceRuby_Properties_getPropertyAsInt), 1); rb_define_method(_propertiesClass, "getPropertyAsIntWithDefault", CAST_METHOD(IceRuby_Properties_getPropertyAsIntWithDefault), 2); rb_define_method(_propertiesClass, "getPropertyAsList", CAST_METHOD(IceRuby_Properties_getPropertyAsList), 1); rb_define_method(_propertiesClass, "getPropertyAsListWithDefault", CAST_METHOD(IceRuby_Properties_getPropertyAsListWithDefault), 2); rb_define_method(_propertiesClass, "getPropertiesForPrefix", CAST_METHOD(IceRuby_Properties_getPropertiesForPrefix), 1); rb_define_method(_propertiesClass, "setProperty", CAST_METHOD(IceRuby_Properties_setProperty), 2); rb_define_method(_propertiesClass, "getCommandLineOptions", CAST_METHOD(IceRuby_Properties_getCommandLineOptions), 0); rb_define_method(_propertiesClass, "parseCommandLineOptions", CAST_METHOD(IceRuby_Properties_parseCommandLineOptions), 2); rb_define_method(_propertiesClass, "parseIceCommandLineOptions", CAST_METHOD(IceRuby_Properties_parseIceCommandLineOptions), 1); rb_define_method(_propertiesClass, "load", CAST_METHOD(IceRuby_Properties_load), 1); rb_define_method(_propertiesClass, "clone", CAST_METHOD(IceRuby_Properties_clone), 0); rb_define_method(_propertiesClass, "to_s", CAST_METHOD(IceRuby_Properties_to_s), 0); } Ice::PropertiesPtr IceRuby::getProperties(VALUE v) { Ice::PropertiesPtr* p = reinterpret_cast(DATA_PTR(v)); assert(p); return *p; } VALUE IceRuby::createProperties(const Ice::PropertiesPtr& p) { return Data_Wrap_Struct(_propertiesClass, 0, IceRuby_Properties_free, new Ice::PropertiesPtr(p)); } Ice-3.5.1/rb/src/IceRuby/Connection.h0000644000076400007640000000115612223561477015402 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_CONNECTION_H #define ICE_RUBY_CONNECTION_H #include #include namespace IceRuby { void initConnection(VALUE); VALUE createConnection(const Ice::ConnectionPtr&); VALUE createConnectionInfo(const Ice::ConnectionInfoPtr&); } #endif Ice-3.5.1/rb/src/IceRuby/Operation.h0000644000076400007640000000143512223561477015243 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_OPERATION_H #define ICE_RUBY_OPERATION_H #include #include namespace IceRuby { class Operation : public IceUtil::Shared { public: virtual ~Operation(); virtual VALUE invoke(const Ice::ObjectPrx&, VALUE, VALUE) = 0; virtual void deprecate(const std::string&) = 0; }; typedef IceUtil::Handle OperationPtr; bool initOperation(VALUE); OperationPtr getOperation(VALUE); } #endif Ice-3.5.1/rb/src/IceRuby/.depend0000644000076400007640000010251412223561477014372 0ustar mesmesConnection$(OBJEXT): Connection.cpp Connection.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/Connection.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/Ice/Endpoint.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h Endpoint.h Util.h Communicator$(OBJEXT): Communicator.cpp Communicator.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h ImplicitContext.h $(ice_cpp_dir)/include/Ice/ImplicitContext.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ConnectionF.h Logger.h $(ice_cpp_dir)/include/Ice/Logger.h ObjectFactory.h $(ice_cpp_dir)/include/Ice/ObjectFactory.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h Properties.h $(ice_cpp_dir)/include/Ice/PropertiesF.h Proxy.h Types.h Util.h $(ice_cpp_dir)/include/Ice/Stream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/IceUtil/OutputUtil.h $(ice_cpp_dir)/include/Ice/Communicator.h $(ice_cpp_dir)/include/Ice/Outgoing.h $(ice_cpp_dir)/include/Ice/Incoming.h $(ice_cpp_dir)/include/Ice/ServantLocatorF.h $(ice_cpp_dir)/include/Ice/ServantManagerF.h $(ice_cpp_dir)/include/Ice/IncomingAsync.h $(ice_cpp_dir)/include/Ice/Direct.h $(ice_cpp_dir)/include/Ice/LoggerF.h $(ice_cpp_dir)/include/Ice/StatsF.h $(ice_cpp_dir)/include/Ice/InstrumentationF.h $(ice_cpp_dir)/include/Ice/RouterF.h $(ice_cpp_dir)/include/Ice/LocatorF.h $(ice_cpp_dir)/include/Ice/PluginF.h $(ice_cpp_dir)/include/Ice/ImplicitContextF.h $(ice_cpp_dir)/include/Ice/Properties.h $(ice_cpp_dir)/include/Ice/Initialize.h $(ice_cpp_dir)/include/Ice/Dispatcher.h $(ice_cpp_dir)/include/Ice/StringConverter.h $(ice_cpp_dir)/include/Ice/Plugin.h $(ice_cpp_dir)/include/IceUtil/Unicode.h $(ice_cpp_dir)/include/Ice/Locator.h $(ice_cpp_dir)/include/Ice/FactoryTableInit.h $(ice_cpp_dir)/include/Ice/ProcessF.h $(ice_cpp_dir)/include/Ice/Router.h Endpoint$(OBJEXT): Endpoint.cpp Endpoint.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/Connection.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/Ice/Endpoint.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h Util.h Init$(OBJEXT): Init.cpp Communicator.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h ImplicitContext.h $(ice_cpp_dir)/include/Ice/ImplicitContext.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ConnectionF.h Logger.h $(ice_cpp_dir)/include/Ice/Logger.h Operation.h Properties.h $(ice_cpp_dir)/include/Ice/PropertiesF.h Proxy.h Slice.h Types.h Util.h $(ice_cpp_dir)/include/Ice/Stream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/IceUtil/OutputUtil.h Connection.h $(ice_cpp_dir)/include/Ice/Connection.h $(ice_cpp_dir)/include/Ice/Endpoint.h Endpoint.h ImplicitContext$(OBJEXT): ImplicitContext.cpp ImplicitContext.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/ImplicitContext.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ConnectionF.h Util.h $(ice_cpp_dir)/include/Ice/Initialize.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/PropertiesF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/LoggerF.h $(ice_cpp_dir)/include/Ice/StatsF.h $(ice_cpp_dir)/include/Ice/InstrumentationF.h $(ice_cpp_dir)/include/Ice/Dispatcher.h $(ice_cpp_dir)/include/Ice/StringConverter.h $(ice_cpp_dir)/include/Ice/Plugin.h $(ice_cpp_dir)/include/IceUtil/Unicode.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h Logger$(OBJEXT): Logger.cpp Logger.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/Logger.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h Util.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/Initialize.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/PropertiesF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/LoggerF.h $(ice_cpp_dir)/include/Ice/StatsF.h $(ice_cpp_dir)/include/Ice/InstrumentationF.h $(ice_cpp_dir)/include/Ice/Dispatcher.h $(ice_cpp_dir)/include/Ice/StringConverter.h $(ice_cpp_dir)/include/Ice/Plugin.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/IceUtil/Unicode.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h ObjectFactory$(OBJEXT): ObjectFactory.cpp ObjectFactory.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectFactory.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h Types.h Util.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/Stream.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/IceUtil/OutputUtil.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h Operation$(OBJEXT): Operation.cpp Operation.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h Proxy.h Types.h Util.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/Stream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/IceUtil/OutputUtil.h $(ice_cpp_dir)/include/Ice/Communicator.h $(ice_cpp_dir)/include/Ice/Outgoing.h $(ice_cpp_dir)/include/Ice/Incoming.h $(ice_cpp_dir)/include/Ice/ServantLocatorF.h $(ice_cpp_dir)/include/Ice/ServantManagerF.h $(ice_cpp_dir)/include/Ice/IncomingAsync.h $(ice_cpp_dir)/include/Ice/Direct.h $(ice_cpp_dir)/include/Ice/LoggerF.h $(ice_cpp_dir)/include/Ice/StatsF.h $(ice_cpp_dir)/include/Ice/InstrumentationF.h $(ice_cpp_dir)/include/Ice/RouterF.h $(ice_cpp_dir)/include/Ice/LocatorF.h $(ice_cpp_dir)/include/Ice/PluginF.h $(ice_cpp_dir)/include/Ice/ImplicitContextF.h $(ice_cpp_dir)/include/Ice/Properties.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/Ice/Initialize.h $(ice_cpp_dir)/include/Ice/PropertiesF.h $(ice_cpp_dir)/include/Ice/Dispatcher.h $(ice_cpp_dir)/include/Ice/StringConverter.h $(ice_cpp_dir)/include/Ice/Plugin.h $(ice_cpp_dir)/include/IceUtil/Unicode.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/Logger.h $(ice_cpp_dir)/include/Slice/RubyUtil.h $(ice_cpp_dir)/include/Slice/Parser.h Properties$(OBJEXT): Properties.cpp Properties.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/PropertiesF.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h Util.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/Initialize.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/LoggerF.h $(ice_cpp_dir)/include/Ice/StatsF.h $(ice_cpp_dir)/include/Ice/InstrumentationF.h $(ice_cpp_dir)/include/Ice/Dispatcher.h $(ice_cpp_dir)/include/Ice/StringConverter.h $(ice_cpp_dir)/include/Ice/Plugin.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/IceUtil/Unicode.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/Properties.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/Ice/Outgoing.h $(ice_cpp_dir)/include/Ice/Incoming.h $(ice_cpp_dir)/include/Ice/ServantLocatorF.h $(ice_cpp_dir)/include/Ice/ServantManagerF.h $(ice_cpp_dir)/include/Ice/IncomingAsync.h $(ice_cpp_dir)/include/Ice/Direct.h Proxy$(OBJEXT): Proxy.cpp $(ice_cpp_dir)/include/IceUtil/DisableWarnings.h Proxy.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h Communicator.h Connection.h $(ice_cpp_dir)/include/Ice/Connection.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/Ice/Endpoint.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h Endpoint.h Util.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/Locator.h $(ice_cpp_dir)/include/Ice/Outgoing.h $(ice_cpp_dir)/include/Ice/Incoming.h $(ice_cpp_dir)/include/Ice/ServantLocatorF.h $(ice_cpp_dir)/include/Ice/ServantManagerF.h $(ice_cpp_dir)/include/Ice/IncomingAsync.h $(ice_cpp_dir)/include/Ice/Direct.h $(ice_cpp_dir)/include/Ice/FactoryTableInit.h $(ice_cpp_dir)/include/Ice/ProcessF.h $(ice_cpp_dir)/include/Ice/Router.h Slice$(OBJEXT): Slice.cpp Slice.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h Util.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Slice/Preprocessor.h $(ice_cpp_dir)/include/Slice/RubyUtil.h $(ice_cpp_dir)/include/Slice/Parser.h $(ice_cpp_dir)/include/IceUtil/OutputUtil.h $(ice_cpp_dir)/include/IceUtil/Options.h $(ice_cpp_dir)/include/IceUtil/RecMutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h Types$(OBJEXT): Types.cpp Types.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h Util.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/Stream.h $(ice_cpp_dir)/include/Ice/CommunicatorF.h $(ice_cpp_dir)/include/Ice/Object.h $(ice_cpp_dir)/include/IceUtil/Mutex.h $(ice_cpp_dir)/include/IceUtil/Lock.h $(ice_cpp_dir)/include/IceUtil/ThreadException.h $(ice_cpp_dir)/include/IceUtil/Time.h $(ice_cpp_dir)/include/IceUtil/MutexProtocol.h $(ice_cpp_dir)/include/Ice/GCShared.h $(ice_cpp_dir)/include/Ice/GCCountMap.h $(ice_cpp_dir)/include/Ice/IncomingAsyncF.h $(ice_cpp_dir)/include/Ice/Proxy.h $(ice_cpp_dir)/include/Ice/ProxyFactoryF.h $(ice_cpp_dir)/include/Ice/ConnectionIF.h $(ice_cpp_dir)/include/Ice/RequestHandlerF.h $(ice_cpp_dir)/include/Ice/EndpointIF.h $(ice_cpp_dir)/include/Ice/EndpointF.h $(ice_cpp_dir)/include/Ice/EndpointTypes.h $(ice_cpp_dir)/include/Ice/ReferenceF.h $(ice_cpp_dir)/include/Ice/OutgoingAsync.h $(ice_cpp_dir)/include/IceUtil/Monitor.h $(ice_cpp_dir)/include/IceUtil/Cond.h $(ice_cpp_dir)/include/IceUtil/Timer.h $(ice_cpp_dir)/include/IceUtil/Thread.h $(ice_cpp_dir)/include/IceUtil/UniquePtr.h $(ice_cpp_dir)/include/Ice/OutgoingAsyncF.h $(ice_cpp_dir)/include/Ice/InstanceF.h $(ice_cpp_dir)/include/Ice/BasicStream.h $(ice_cpp_dir)/include/Ice/ObjectFactoryF.h $(ice_cpp_dir)/include/Ice/ObjectFactoryManagerF.h $(ice_cpp_dir)/include/Ice/Buffer.h $(ice_cpp_dir)/include/Ice/Protocol.h $(ice_cpp_dir)/include/Ice/SlicedDataF.h $(ice_cpp_dir)/include/Ice/UserExceptionFactory.h $(ice_cpp_dir)/include/Ice/FactoryTable.h $(ice_cpp_dir)/include/Ice/ObserverHelper.h $(ice_cpp_dir)/include/Ice/Instrumentation.h $(ice_cpp_dir)/include/IceUtil/OutputUtil.h Proxy.h $(ice_cpp_dir)/include/IceUtil/InputUtil.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/Ice/SlicedData.h Util$(OBJEXT): Util.cpp Util.h Config.h $(ice_cpp_dir)/include/Ice/Config.h $(ice_cpp_dir)/include/IceUtil/Config.h $(ice_cpp_dir)/include/Ice/Current.h $(ice_cpp_dir)/include/Ice/ProxyF.h $(ice_cpp_dir)/include/IceUtil/Shared.h $(ice_cpp_dir)/include/Ice/ProxyHandle.h $(ice_cpp_dir)/include/IceUtil/Handle.h $(ice_cpp_dir)/include/IceUtil/Exception.h $(ice_cpp_dir)/include/Ice/ObjectF.h $(ice_cpp_dir)/include/Ice/Handle.h $(ice_cpp_dir)/include/Ice/Exception.h $(ice_cpp_dir)/include/Ice/Format.h $(ice_cpp_dir)/include/Ice/StreamF.h $(ice_cpp_dir)/include/Ice/LocalObject.h $(ice_cpp_dir)/include/Ice/LocalObjectF.h $(ice_cpp_dir)/include/Ice/StreamHelpers.h $(ice_cpp_dir)/include/IceUtil/ScopedArray.h $(ice_cpp_dir)/include/IceUtil/Iterator.h $(ice_cpp_dir)/include/IceUtil/Optional.h $(ice_cpp_dir)/include/Ice/ObjectAdapterF.h $(ice_cpp_dir)/include/Ice/UndefSysMacros.h $(ice_cpp_dir)/include/Ice/ConnectionF.h $(ice_cpp_dir)/include/Ice/Identity.h $(ice_cpp_dir)/include/Ice/Version.h $(ice_cpp_dir)/include/Ice/LocalException.h $(ice_cpp_dir)/include/Ice/BuiltinSequences.h $(ice_cpp_dir)/include/Ice/Protocol.h Ice-3.5.1/rb/src/IceRuby/Init.cpp0000644000076400007640000000204512223561477014537 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include using namespace std; using namespace IceRuby; static VALUE iceModule; extern "C" { void ICE_DECLSPEC_EXPORT Init_IceRuby() { iceModule = rb_define_module("Ice"); initCommunicator(iceModule); initLogger(iceModule); initOperation(iceModule); initProperties(iceModule); initProxy(iceModule); initSlice(iceModule); initTypes(iceModule); initImplicitContext(iceModule); initUtil(iceModule); initConnection(iceModule); initEndpoint(iceModule); } } Ice-3.5.1/rb/src/IceRuby/Config.h0000644000076400007640000000452312223561477014511 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_CONFIG_H #define ICE_RUBY_CONFIG_H // // This file includes and should always be included first. // #include // // COMPILERFIX: This is required to prevent annoying warnings with aCC. // The aCC -mt option causes the definition of the _POSIX_C_SOURCE macro // (with another lower value.) and this is causing a warning because of // the redefinition. // //#if defined(__HP_aCC) && defined(_POSIX_C_SOURCE) //# undef _POSIX_C_SOURCE //#endif // // Ruby defines _FILE_OFFSET_BITS without a guard; we undefine it to // avoid a warning // #if defined(__SUNPRO_CC) && defined(_FILE_OFFSET_BITS) #undef _FILE_OFFSET_BITS #endif #include // // The Ruby header file win32/win32.h defines a number of macros for // functions like shutdown() and close() that wreak havoc. // #ifdef _WIN32 # undef shutdown # undef close # undef read # undef write # undef sleep #endif extern "C" { typedef VALUE(*ICE_RUBY_ENTRY_POINT)(...); } #define CAST_METHOD(X) reinterpret_cast(X) // // These macros are defined in Ruby 1.9 but not in 1.8. We define them here // to maintain compatibility with 1.8. // #ifndef RARRAY_PTR # define RARRAY_PTR(v) RARRAY(v)->ptr #endif #ifndef RARRAY_LEN # define RARRAY_LEN(v) RARRAY(v)->len #endif #ifndef RSTRING_PTR # define RSTRING_PTR(v) RSTRING(v)->ptr #endif #ifndef RSTRING_LEN # define RSTRING_LEN(v) RSTRING(v)->len #endif #ifndef RFLOAT_VALUE # define RFLOAT_VALUE(v) RFLOAT(v)->value #endif #ifndef RBIGNUM_LEN # define RBIGNUM_LEN(v) RBIGNUM(v)->len #endif // // The definition of RBIGNUM_DIGITS in 1.8.7p248+ causes a compilation error (see bug 4653), // so we undefine it and use our own definition below. Note that the macro HAVE_RUBY_RUBY_H // is only defined in Ruby 1.9. // #ifndef HAVE_RUBY_RUBY_H # undef RBIGNUM_DIGITS #endif #ifndef RBIGNUM_DIGITS # define RBIGNUM_DIGITS(v) ((BDIGIT*)RBIGNUM(v)->digits) #endif #ifndef RBIGNUM_SIGN # define RBIGNUM_SIGN(v) RBIGNUM(v)->sign #endif #endif Ice-3.5.1/rb/src/IceRuby/Util.cpp0000644000076400007640000004777212223561477014571 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #ifdef HAVE_RUBY_ENCODING_H # include #endif using namespace std; using namespace IceRuby; namespace { #ifndef NDEBUG bool checkIsInstance(VALUE p, const char* type) { volatile VALUE rbType = callRuby(rb_path2class, type); assert(!NIL_P(rbType)); return callRuby(rb_obj_is_instance_of, p, rbType) == Qtrue; } #endif template bool setVersion(VALUE p, const T& version, const char* type) { assert(checkIsInstance(p, type)); VALUE major = callRuby(rb_int2inum, version.major); VALUE minor = callRuby(rb_int2inum, version.minor); rb_ivar_set(p, rb_intern("@major"), major); rb_ivar_set(p, rb_intern("@minor"), minor); return true; } template bool getVersion(VALUE p, T& v, const char* type) { assert(checkIsInstance(p, type)); volatile VALUE major = callRuby(rb_ivar_get, p, rb_intern("@major")); volatile VALUE minor = callRuby(rb_ivar_get, p, rb_intern("@minor")); long m; m = getInteger(major); if(m < 0 || m > 255) { throw RubyException(rb_eTypeError, "version major must be a value between 0 and 255"); return false; } v.major = m; m = getInteger(minor); if(m < 0 || m > 255) { throw RubyException(rb_eTypeError, "version minor must be a value between 0 and 255"); return false; } v.minor = m; return true; } template VALUE createVersion(const T& version, const char* type) { volatile VALUE rbType = callRuby(rb_path2class, type); assert(!NIL_P(rbType)); volatile VALUE obj = callRuby(rb_class_new_instance, 0, static_cast(0), rbType); if(!setVersion(obj, version, type)) { return Qnil; } return obj; } template VALUE versionToString(VALUE p, const char* type) { volatile VALUE rbType = callRuby(rb_path2class, type); assert(!NIL_P(rbType)); if(callRuby(rb_obj_is_instance_of, p, rbType) != Qtrue) { throw RubyException(rb_eTypeError, "argument is not an instance of %s", type); } T v; if(!getVersion(p, v, type)) { return Qnil; } ICE_RUBY_TRY { string s = IceInternal::versionToString(v); return createString(s); } ICE_RUBY_CATCH return Qnil; } template VALUE stringToVersion(VALUE p, const char* type) { string str = getString(p); ICE_RUBY_TRY { T v = IceInternal::stringToVersion(str); return createVersion(v, type); } ICE_RUBY_CATCH return Qnil; } char Ice_ProtocolVersion[] = "Ice::ProtocolVersion"; char Ice_EncodingVersion[] = "Ice::EncodingVersion"; } extern "C" VALUE IceRuby_stringVersion(int /*argc*/, VALUE* /*argv*/, VALUE /*self*/) { ICE_RUBY_TRY { string s = ICE_STRING_VERSION; return createString(s); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_intVersion(int /*argc*/, VALUE* /*argv*/, VALUE /*self*/) { ICE_RUBY_TRY { return INT2FIX(ICE_INT_VERSION); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_currentProtocol(int /*argc*/, VALUE* /*argv*/, VALUE /*self*/) { ICE_RUBY_TRY { return createProtocolVersion(Ice::currentProtocol); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_currentProtocolEncoding(int /*argc*/, VALUE* /*argv*/, VALUE /*self*/) { ICE_RUBY_TRY { return createEncodingVersion(Ice::currentProtocolEncoding); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_currentEncoding(int /*argc*/, VALUE* /*argv*/, VALUE /*self*/) { ICE_RUBY_TRY { return createEncodingVersion(Ice::currentEncoding); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_protocolVersionToString(VALUE /*self*/, VALUE v) { return versionToString(v, Ice_ProtocolVersion); } extern "C" VALUE IceRuby_stringToProtocolVersion(VALUE /*self*/, VALUE v) { return stringToVersion(v, Ice_ProtocolVersion); } extern "C" VALUE IceRuby_encodingVersionToString(VALUE /*self*/, VALUE v) { return versionToString(v, Ice_EncodingVersion); } extern "C" VALUE IceRuby_stringToEncodingVersion(VALUE /*self*/, VALUE v) { return stringToVersion(v, Ice_EncodingVersion); } void IceRuby::initUtil(VALUE iceModule) { rb_define_module_function(iceModule, "stringVersion", CAST_METHOD(IceRuby_stringVersion), -1); rb_define_module_function(iceModule, "intVersion", CAST_METHOD(IceRuby_intVersion), -1); rb_define_module_function(iceModule, "currentProtocol", CAST_METHOD(IceRuby_currentProtocol), -1); rb_define_module_function(iceModule, "currentProtocolEncoding", CAST_METHOD(IceRuby_currentProtocolEncoding), -1); rb_define_module_function(iceModule, "currentEncoding", CAST_METHOD(IceRuby_currentEncoding), -1); rb_define_module_function(iceModule, "protocolVersionToString", CAST_METHOD(IceRuby_protocolVersionToString), 1); rb_define_module_function(iceModule, "stringToProtocolVersion", CAST_METHOD(IceRuby_stringToProtocolVersion), 1); rb_define_module_function(iceModule, "encodingVersionToString", CAST_METHOD(IceRuby_encodingVersionToString), 1); rb_define_module_function(iceModule, "stringToEncodingVersion", CAST_METHOD(IceRuby_stringToEncodingVersion), 1); } IceRuby::RubyException::RubyException() { ex = rb_gv_get("$!"); } IceRuby::RubyException::RubyException(VALUE exv) : ex(exv) { } IceRuby::RubyException::RubyException(VALUE exClass, const char* fmt, ...) { va_list args; char buf[BUFSIZ]; va_start(args, fmt); vsnprintf(buf, BUFSIZ, fmt, args); buf[BUFSIZ - 1] = '\0'; va_end(args); ex = callRuby(rb_exc_new2, exClass, buf); } ostream& IceRuby::RubyException::operator<<(ostream& ostr) const { volatile VALUE cls = rb_class_path(CLASS_OF(ex)); volatile VALUE msg = rb_obj_as_string(ex); ostr << RSTRING_PTR(cls) << ": " << RSTRING_PTR(msg); return ostr; } bool IceRuby::isString(VALUE val) { return TYPE(val) == T_STRING || callRuby(rb_respond_to, val, rb_intern("to_str")) != 0; } bool IceRuby::isArray(VALUE val) { return TYPE(val) == T_ARRAY || callRuby(rb_respond_to, val, rb_intern("to_arr")) != 0; } bool IceRuby::isHash(VALUE val) { return TYPE(val) == T_HASH || callRuby(rb_respond_to, val, rb_intern("to_hash")) != 0; } string IceRuby::getString(VALUE val) { volatile VALUE result = callRuby(rb_string_value, &val); return string(RSTRING_PTR(result), RSTRING_LEN(result)); } VALUE IceRuby::createString(const string& str) { #ifdef HAVE_RUBY_ENCODING_H return callRuby(rb_enc_str_new, str.c_str(), static_cast(str.size()), rb_utf8_encoding()); #else return callRuby(rb_str_new, str.c_str(), static_cast(str.size())); #endif } long IceRuby::getInteger(VALUE val) { if(!FIXNUM_P(val) && TYPE(val) != T_BIGNUM) { val = callRuby(rb_Integer, val); } if(FIXNUM_P(val)) { return FIX2LONG(val); } else if(TYPE(val) == T_BIGNUM) { Ice::Long l = getLong(val); if(l >= static_cast(INT_MIN) && l <= static_cast(INT_MAX)) { return static_cast(l); } } throw RubyException(rb_eTypeError, "unable to convert value to an integer"); } #define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT) #define BIGUP(x) ((BDIGIT_DBL)(x) << BITSPERDIG) Ice::Long IceRuby::getLong(VALUE val) { // // The rb_num2ll function raises exceptions, but we can't call it using callProtected // because its return type is long long and not VALUE. // volatile VALUE v = callRuby(rb_Integer, val); if(NIL_P(v)) { throw RubyException(rb_eTypeError, "unable to convert value to a long"); } if(FIXNUM_P(v)) { return FIX2LONG(v); } else { assert(TYPE(v) == T_BIGNUM); long len = RBIGNUM_LEN(v); if(len > SIZEOF_LONG_LONG/SIZEOF_BDIGITS) { throw RubyException(rb_eRangeError, "bignum too big to convert into long"); } BDIGIT *ds = RBIGNUM_DIGITS(v); BDIGIT_DBL num = 0; while(len--) { num = BIGUP(num); num += ds[len]; } Ice::Long l = static_cast(num); if(l < 0 && (RBIGNUM_SIGN(v) || l != LLONG_MIN)) { throw RubyException(rb_eRangeError, "bignum too big to convert into long"); } if (!RBIGNUM_SIGN(v)) { return -l; } return l; } } bool IceRuby::arrayToStringSeq(VALUE val, vector& seq) { volatile VALUE arr = callRuby(rb_check_array_type, val); if(NIL_P(arr)) { return false; } for(long i = 0; i < RARRAY_LEN(arr); ++i) { string s = getString(RARRAY_PTR(arr)[i]); seq.push_back(getString(RARRAY_PTR(arr)[i])); } return true; } VALUE IceRuby::stringSeqToArray(const vector& seq) { volatile VALUE result = createArray(seq.size()); long i = 0; if(seq.size() > 0) { for(vector::const_iterator p = seq.begin(); p != seq.end(); ++p, ++i) { RARRAY_PTR(result)[i] = createString(*p); } } return result; } namespace { struct HashToContextIterator : public IceRuby::HashIterator { HashToContextIterator(Ice::Context& c) : ctx(c) { } virtual void element(VALUE key, VALUE value) { string kstr = IceRuby::getString(key); string vstr = IceRuby::getString(value); ctx[kstr] = vstr; } Ice::Context& ctx; }; } bool IceRuby::hashToContext(VALUE val, Ice::Context& ctx) { if(TYPE(val) != T_HASH) { val = callRuby(rb_convert_type, val, T_HASH, "Hash", "to_hash"); if(NIL_P(val)) { return false; } } HashToContextIterator iter(ctx); hashIterate(val, iter); return true; } VALUE IceRuby::contextToHash(const Ice::Context& ctx) { volatile VALUE result = callRuby(rb_hash_new); for(Ice::Context::const_iterator p = ctx.begin(); p != ctx.end(); ++p) { volatile VALUE key = callRuby(rb_str_new, p->first.c_str(), static_cast(p->first.size())); volatile VALUE value = callRuby(rb_str_new, p->second.c_str(), static_cast(p->second.size())); callRuby(rb_hash_aset, result, key, value); } return result; } extern "C" VALUE IceRuby_Util_hash_foreach_callback(VALUE val, VALUE arg) { VALUE key = rb_ary_entry(val, 0); VALUE value = rb_ary_entry(val, 1); // // We can't allow any C++ exceptions to propagate out of this function. // ICE_RUBY_TRY { IceRuby::HashIterator* iter = reinterpret_cast(arg); iter->element(key, value); } ICE_RUBY_CATCH return val; } extern "C" { typedef VALUE (*ICE_RUBY_HASH_FOREACH_CALLBACK)(...); } void IceRuby::hashIterate(VALUE h, HashIterator& iter) { assert(TYPE(h) == T_HASH); callRuby(rb_iterate, rb_each, h, reinterpret_cast(IceRuby_Util_hash_foreach_callback), reinterpret_cast(&iter)); } Ice::Identity IceRuby::getIdentity(VALUE v) { volatile VALUE cls = callRuby(rb_path2class, "Ice::Identity"); assert(!NIL_P(cls)); if(callRuby(rb_obj_is_kind_of, v, cls) == Qfalse) { throw RubyException(rb_eTypeError, "value is not an Ice::Identity"); } volatile VALUE name = callRuby(rb_iv_get, v, "@name"); volatile VALUE category = callRuby(rb_iv_get, v, "@category"); if(!NIL_P(category) && !isString(category)) { throw RubyException(rb_eTypeError, "identity category must be a string"); } if(NIL_P(name) || !isString(name)) { throw RubyException(rb_eTypeError, "identity name must be a string"); } Ice::Identity result; result.name = getString(name); if(!NIL_P(category)) { result.category = getString(category); } return result; } VALUE IceRuby::createIdentity(const Ice::Identity& id) { volatile VALUE cls = callRuby(rb_path2class, "Ice::Identity"); assert(!NIL_P(cls)); volatile VALUE result = callRuby(rb_class_new_instance, 0, reinterpret_cast(0), cls); volatile VALUE name = callRuby(rb_str_new, id.name.c_str(), static_cast(id.name.size())); volatile VALUE category = callRuby(rb_str_new, id.category.c_str(), static_cast(id.category.size())); callRuby(rb_iv_set, result, "@name", name); callRuby(rb_iv_set, result, "@category", category); return result; } VALUE IceRuby::createProtocolVersion(const Ice::ProtocolVersion& v) { return createVersion(v, Ice_ProtocolVersion); } VALUE IceRuby::createEncodingVersion(const Ice::EncodingVersion& v) { return createVersion(v, Ice_EncodingVersion); } bool IceRuby::getEncodingVersion(VALUE p, Ice::EncodingVersion& v) { volatile VALUE cls = callRuby(rb_path2class, Ice_EncodingVersion); assert(!NIL_P(cls)); if(callRuby(rb_obj_is_kind_of, p, cls) == Qfalse) { throw RubyException(rb_eTypeError, "value is not an Ice::EncodingVersion"); } if(!getVersion(p, v, Ice_EncodingVersion)) { return false; } return true; } VALUE IceRuby::callProtected(RubyFunction func, VALUE arg) { int error = 0; volatile VALUE result = rb_protect(func, arg, &error); if(error) { throw RubyException(); } return result; } static void setExceptionMembers(const Ice::LocalException& ex, VALUE p) { // // Transfer data members from Ice exception to Ruby exception. // try { ex.ice_throw(); } catch(const Ice::InitializationException& e) { volatile VALUE v = createString(e.reason); callRuby(rb_iv_set, p, "@reason", v); } catch(const Ice::PluginInitializationException& e) { volatile VALUE v = createString(e.reason); callRuby(rb_iv_set, p, "@reason", v); } catch(const Ice::AlreadyRegisteredException& e) { volatile VALUE v; v = createString(e.kindOfObject); callRuby(rb_iv_set, p, "@kindOfObject", v); v = createString(e.id); callRuby(rb_iv_set, p, "@id", v); } catch(const Ice::NotRegisteredException& e) { volatile VALUE v; v = createString(e.kindOfObject); callRuby(rb_iv_set, p, "@kindOfObject", v); v = createString(e.id); callRuby(rb_iv_set, p, "@id", v); } catch(const Ice::TwowayOnlyException& e) { volatile VALUE v = createString(e.operation); callRuby(rb_iv_set, p, "@operation", v); } catch(const Ice::UnknownException& e) { volatile VALUE v = createString(e.unknown); callRuby(rb_iv_set, p, "@unknown", v); } catch(const Ice::ObjectAdapterDeactivatedException& e) { volatile VALUE v = createString(e.name); callRuby(rb_iv_set, p, "@name", v); } catch(const Ice::ObjectAdapterIdInUseException& e) { volatile VALUE v = createString(e.id); callRuby(rb_iv_set, p, "@id", v); } catch(const Ice::NoEndpointException& e) { volatile VALUE v = createString(e.proxy); callRuby(rb_iv_set, p, "@proxy", v); } catch(const Ice::EndpointParseException& e) { volatile VALUE v = createString(e.str); callRuby(rb_iv_set, p, "@str", v); } catch(const Ice::IdentityParseException& e) { volatile VALUE v = createString(e.str); callRuby(rb_iv_set, p, "@str", v); } catch(const Ice::ProxyParseException& e) { volatile VALUE v = createString(e.str); callRuby(rb_iv_set, p, "@str", v); } catch(const Ice::IllegalIdentityException& e) { volatile VALUE v = IceRuby::createIdentity(e.id); callRuby(rb_iv_set, p, "@id", v); } catch(const Ice::RequestFailedException& e) { volatile VALUE v; v = IceRuby::createIdentity(e.id); callRuby(rb_iv_set, p, "@id", v); v = createString(e.facet); callRuby(rb_iv_set, p, "@facet", v); v = createString(e.operation); callRuby(rb_iv_set, p, "@operation", v); } catch(const Ice::FileException& e) { volatile VALUE v = INT2FIX(e.error); callRuby(rb_iv_set, p, "@error", v); v = createString(e.path); callRuby(rb_iv_set, p, "@path", v); } catch(const Ice::SyscallException& e) // This must appear after all subclasses of SyscallException. { volatile VALUE v = INT2FIX(e.error); callRuby(rb_iv_set, p, "@error", v); } catch(const Ice::DNSException& e) { volatile VALUE v; v = INT2FIX(e.error); callRuby(rb_iv_set, p, "@error", v); v = createString(e.host); callRuby(rb_iv_set, p, "@host", v); } catch(const Ice::UnsupportedProtocolException& e) { VALUE m; m = createProtocolVersion(e.bad); callRuby(rb_iv_set, p, "@bad", m); m = createProtocolVersion(e.supported); callRuby(rb_iv_set, p, "@supported", m); } catch(const Ice::UnsupportedEncodingException& e) { VALUE m; m = createEncodingVersion(e.bad); callRuby(rb_iv_set, p, "@bad", m); m = createEncodingVersion(e.supported); callRuby(rb_iv_set, p, "@supported", m); } catch(const Ice::NoObjectFactoryException& e) { volatile VALUE v; v = createString(e.reason); callRuby(rb_iv_set, p, "@reason", v); v = createString(e.type); callRuby(rb_iv_set, p, "@type", v); } catch(const Ice::UnexpectedObjectException& e) { volatile VALUE v; v = createString(e.reason); callRuby(rb_iv_set, p, "@reason", v); v = createString(e.type); callRuby(rb_iv_set, p, "@type", v); v = createString(e.expectedType); callRuby(rb_iv_set, p, "@expectedType", v); } catch(const Ice::ProtocolException& e) // This must appear after all subclasses of ProtocolException. { volatile VALUE v = createString(e.reason); callRuby(rb_iv_set, p, "@reason", v); } catch(const Ice::FeatureNotSupportedException& e) { volatile VALUE v = createString(e.unsupportedFeature); callRuby(rb_iv_set, p, "@unsupportedFeature", v); } catch(const Ice::SecurityException& e) { volatile VALUE v = createString(e.reason); callRuby(rb_iv_set, p, "@reason", v); } catch(const Ice::LocalException&) { // // Nothing to do. // } } VALUE IceRuby::createArrayHelper(long sz) { VALUE arr = callRuby(rb_ary_new2, sz); if(sz > 0) { callRubyVoid(rb_ary_store, arr, sz - 1, Qnil); } return arr; } VALUE IceRuby::convertLocalException(const Ice::LocalException& ex) { // // We cannot throw a C++ exception or raise a Ruby exception. If an error // occurs while we are converting the exception, we do our best to return // an appropriate Ruby exception. // try { string name = ex.ice_name(); volatile VALUE cls = callRuby(rb_path2class, name.c_str()); if(NIL_P(cls)) { throw RubyException(rb_eRuntimeError, "exception class `%s' not found", name.c_str()); } volatile VALUE result = callRuby(rb_class_new_instance, 0, reinterpret_cast(0), cls); setExceptionMembers(ex, result); return result; } catch(const RubyException& e) { return e.ex; } catch(...) { string msg = "failure occurred while converting exception " + ex.ice_name(); return rb_exc_new2(rb_eRuntimeError, msg.c_str()); } } Ice-3.5.1/rb/src/IceRuby/Properties.h0000644000076400007640000000113412223561477015433 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_PROPERTIES_H #define ICE_RUBY_PROPERTIES_H #include #include namespace IceRuby { void initProperties(VALUE); Ice::PropertiesPtr getProperties(VALUE); VALUE createProperties(const Ice::PropertiesPtr&); } #endif Ice-3.5.1/rb/src/IceRuby/Connection.cpp0000644000076400007640000002135412223561477015737 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace IceRuby; static VALUE _connectionClass; static VALUE _connectionInfoClass; static VALUE _ipConnectionInfoClass; static VALUE _tcpConnectionInfoClass; static VALUE _udpConnectionInfoClass; // ********************************************************************** // Connection // ********************************************************************** extern "C" void IceRuby_Connection_free(Ice::ConnectionPtr* p) { assert(p); delete p; } VALUE IceRuby::createConnection(const Ice::ConnectionPtr& p) { return Data_Wrap_Struct(_connectionClass, 0, IceRuby_Connection_free, new Ice::ConnectionPtr(p)); } extern "C" VALUE IceRuby_Connection_close(VALUE self, VALUE b) { ICE_RUBY_TRY { Ice::ConnectionPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); (*p)->close(RTEST(b)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Connection_flushBatchRequests(VALUE self) { ICE_RUBY_TRY { Ice::ConnectionPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); (*p)->flushBatchRequests(); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Connection_type(VALUE self) { ICE_RUBY_TRY { Ice::ConnectionPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); string s = (*p)->type(); return createString(s); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Connection_timeout(VALUE self) { ICE_RUBY_TRY { Ice::ConnectionPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); Ice::Int timeout = (*p)->timeout(); return INT2FIX(timeout); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Connection_getInfo(VALUE self) { ICE_RUBY_TRY { Ice::ConnectionPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); Ice::ConnectionInfoPtr info = (*p)->getInfo(); return createConnectionInfo(info); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Connection_getEndpoint(VALUE self) { ICE_RUBY_TRY { Ice::ConnectionPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); Ice::EndpointPtr endpoint = (*p)->getEndpoint(); return createEndpoint(endpoint); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Connection_toString(VALUE self) { ICE_RUBY_TRY { Ice::ConnectionPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); string s = (*p)->toString(); return createString(s); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Connection_equals(VALUE self, VALUE other) { ICE_RUBY_TRY { if(NIL_P(other)) { return Qfalse; } if(callRuby(rb_obj_is_kind_of, other, _connectionClass) != Qtrue) { throw RubyException(rb_eTypeError, "argument must be a connection"); } Ice::ConnectionPtr* p1 = reinterpret_cast(DATA_PTR(self)); Ice::ConnectionPtr* p2 = reinterpret_cast(DATA_PTR(other)); return *p1 == *p2 ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } // ********************************************************************** // ConnectionInfo // ********************************************************************** extern "C" void IceRuby_ConnectionInfo_free(Ice::ConnectionInfoPtr* p) { assert(p); delete p; } VALUE IceRuby::createConnectionInfo(const Ice::ConnectionInfoPtr& p) { VALUE info; if(Ice::TCPConnectionInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_tcpConnectionInfoClass, 0, IceRuby_ConnectionInfo_free, new Ice::ConnectionInfoPtr(p)); Ice::TCPConnectionInfoPtr tcp = Ice::TCPConnectionInfoPtr::dynamicCast(p); rb_ivar_set(info, rb_intern("@localAddress"), createString(tcp->localAddress)); rb_ivar_set(info, rb_intern("@localPort"), INT2FIX(tcp->localPort)); rb_ivar_set(info, rb_intern("@remoteAddress"), createString(tcp->remoteAddress)); rb_ivar_set(info, rb_intern("@remotePort"), INT2FIX(tcp->remotePort)); } else if(Ice::UDPConnectionInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_udpConnectionInfoClass, 0, IceRuby_ConnectionInfo_free, new Ice::ConnectionInfoPtr(p)); Ice::UDPConnectionInfoPtr udp = Ice::UDPConnectionInfoPtr::dynamicCast(p); rb_ivar_set(info, rb_intern("@localAddress"), createString(udp->localAddress)); rb_ivar_set(info, rb_intern("@localPort"), INT2FIX(udp->localPort)); rb_ivar_set(info, rb_intern("@remoteAddress"), createString(udp->remoteAddress)); rb_ivar_set(info, rb_intern("@remotePort"), INT2FIX(udp->remotePort)); rb_ivar_set(info, rb_intern("@mcastAddress"), createString(udp->mcastAddress)); rb_ivar_set(info, rb_intern("@mcastPort"), INT2FIX(udp->mcastPort)); } else if(Ice::IPConnectionInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_ipConnectionInfoClass, 0, IceRuby_ConnectionInfo_free, new Ice::ConnectionInfoPtr(p)); Ice::IPConnectionInfoPtr ip = Ice::IPConnectionInfoPtr::dynamicCast(p); rb_ivar_set(info, rb_intern("@localAddress"), createString(ip->localAddress)); rb_ivar_set(info, rb_intern("@localPort"), INT2FIX(ip->localPort)); rb_ivar_set(info, rb_intern("@remoteAddress"), createString(ip->remoteAddress)); rb_ivar_set(info, rb_intern("@remotePort"), INT2FIX(ip->remotePort)); } else { info = Data_Wrap_Struct(_connectionInfoClass, 0, IceRuby_ConnectionInfo_free, new Ice::ConnectionInfoPtr(p)); } rb_ivar_set(info, rb_intern("@incoming"), p->incoming ? Qtrue : Qfalse); rb_ivar_set(info, rb_intern("@adapterName"), createString(p->adapterName)); return info; } void IceRuby::initConnection(VALUE iceModule) { // // Connection. // _connectionClass = rb_define_class_under(iceModule, "ConnectionI", rb_cObject); // // Instance methods. // rb_define_method(_connectionClass, "close", CAST_METHOD(IceRuby_Connection_close), 1); rb_define_method(_connectionClass, "flushBatchRequests", CAST_METHOD(IceRuby_Connection_flushBatchRequests), 0); rb_define_method(_connectionClass, "type", CAST_METHOD(IceRuby_Connection_type), 0); rb_define_method(_connectionClass, "timeout", CAST_METHOD(IceRuby_Connection_timeout), 0); rb_define_method(_connectionClass, "getInfo", CAST_METHOD(IceRuby_Connection_getInfo), 0); rb_define_method(_connectionClass, "getEndpoint", CAST_METHOD(IceRuby_Connection_getEndpoint), 0); rb_define_method(_connectionClass, "toString", CAST_METHOD(IceRuby_Connection_toString), 0); rb_define_method(_connectionClass, "to_s", CAST_METHOD(IceRuby_Connection_toString), 0); rb_define_method(_connectionClass, "inspect", CAST_METHOD(IceRuby_Connection_toString), 0); rb_define_method(_connectionClass, "==", CAST_METHOD(IceRuby_Connection_equals), 1); rb_define_method(_connectionClass, "eql?", CAST_METHOD(IceRuby_Connection_equals), 1); // // ConnectionInfo. // _connectionInfoClass = rb_define_class_under(iceModule, "ConnectionInfo", rb_cObject); // // Instance members. // rb_define_attr(_connectionInfoClass, "incoming", 1, 0); rb_define_attr(_connectionInfoClass, "adapterName", 1, 0); // // IPConnectionInfo // _ipConnectionInfoClass = rb_define_class_under(iceModule, "IPConnectionInfo", _connectionInfoClass); // // Instance members. // rb_define_attr(_ipConnectionInfoClass, "localAddress", 1, 0); rb_define_attr(_ipConnectionInfoClass, "localPort", 1, 0); rb_define_attr(_ipConnectionInfoClass, "remoteAddress", 1, 0); rb_define_attr(_ipConnectionInfoClass, "remotePort", 1, 0); // // TCPConnectionInfo // _tcpConnectionInfoClass = rb_define_class_under(iceModule, "TCPConnectionInfo", _ipConnectionInfoClass); // // UDPConnectionInfo // _udpConnectionInfoClass = rb_define_class_under(iceModule, "UDPConnectionInfo", _ipConnectionInfoClass); // // Instance members. // rb_define_attr(_udpConnectionInfoClass, "mcastAddress", 1, 0); rb_define_attr(_udpConnectionInfoClass, "mcastPort", 1, 0); } Ice-3.5.1/rb/src/IceRuby/Proxy.cpp0000644000076400007640000010000612223561477014751 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include using namespace std; using namespace IceRuby; static VALUE _proxyClass; // ********************************************************************** // ObjectPrx // ********************************************************************** extern "C" void IceRuby_ObjectPrx_mark(Ice::ObjectPrx* p) { // // We need to mark the communicator associated with this proxy. // assert(p); volatile VALUE communicator = lookupCommunicator((*p)->ice_getCommunicator()); assert(!NIL_P(communicator)); rb_gc_mark(communicator); } extern "C" void IceRuby_ObjectPrx_free(Ice::ObjectPrx* p) { assert(p); delete p; } // // Returns true if a context was provided. // static bool checkArgs(const char* name, int numArgs, int argc, VALUE* argv, Ice::Context& ctx) { if(argc < numArgs || argc > numArgs + 1) { throw RubyException(rb_eArgError, "%s expects %d argument%s including an optional context hash", name, numArgs + 1, numArgs + 1 == 1 ? "" : "s"); } if(argc == numArgs + 1) { if(!hashToContext(argv[numArgs], ctx)) { throw RubyException(rb_eArgError, "%s: invalid context hash", name); } return true; } return false; } extern "C" VALUE IceRuby_ObjectPrx_ice_getHash(VALUE self) { rb_warning("ice_getHash is deprecated, use hash instead."); ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return INT2FIX(p->__hash()); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_hash(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return INT2FIX(p->__hash()); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getCommunicator(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::CommunicatorPtr communicator = p->ice_getCommunicator(); return lookupCommunicator(communicator); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_toString(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); string s = p->ice_toString(); return createString(s); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_isA(int argc, VALUE* argv, VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::Context ctx; bool haveContext = checkArgs("ice_isA", 1, argc, argv, ctx); string id = getString(argv[0]); bool result; if(haveContext) { result = p->ice_isA(id, ctx); } else { result = p->ice_isA(id); } return result ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_ping(int argc, VALUE* argv, VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::Context ctx; bool haveContext = checkArgs("ice_ping", 0, argc, argv, ctx); if(haveContext) { p->ice_ping(ctx); } else { p->ice_ping(); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_ids(int argc, VALUE* argv, VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::Context ctx; bool haveContext = checkArgs("ice_ids", 0, argc, argv, ctx); vector ids; if(haveContext) { ids = p->ice_ids(ctx); } else { ids = p->ice_ids(); } volatile VALUE result = createArray(ids.size()); long i = 0; for(vector::iterator q = ids.begin(); q != ids.end(); ++q, ++i) { RARRAY_PTR(result)[i] = createString(*q); } return result; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_id(int argc, VALUE* argv, VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::Context ctx; bool haveContext = checkArgs("ice_id", 0, argc, argv, ctx); string id; if(haveContext) { id = p->ice_id(ctx); } else { id = p->ice_id(); } return createString(id); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getIdentity(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createIdentity(p->ice_getIdentity()); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_identity(VALUE self, VALUE id) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::Identity ident = getIdentity(id); return createProxy(p->ice_identity(ident)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getContext(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return contextToHash(p->ice_getContext()); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_context(VALUE self, VALUE ctx) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::Context context; if(!NIL_P(ctx) && !hashToContext(ctx, context)) { throw RubyException(rb_eTypeError, "argument is not a context hash"); } return createProxy(p->ice_context(context), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getFacet(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); string facet = p->ice_getFacet(); return createString(facet); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_facet(VALUE self, VALUE facet) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); string f = getString(facet); return createProxy(p->ice_facet(f)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getAdapterId(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); string id = p->ice_getAdapterId(); return createString(id); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_adapterId(VALUE self, VALUE id) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); string idstr = getString(id); return createProxy(p->ice_adapterId(idstr), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getEndpoints(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::EndpointSeq seq = p->ice_getEndpoints(); volatile VALUE result = createArray(seq.size()); long i = 0; for(Ice::EndpointSeq::iterator q = seq.begin(); q != seq.end(); ++q, ++i) { RARRAY_PTR(result)[i] = createEndpoint(*q); } return result; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_endpoints(VALUE self, VALUE seq) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); if(!NIL_P(seq) && !isArray(seq)) { throw RubyException(rb_eTypeError, "ice_endpoints requires an array of endpoints"); } Ice::EndpointSeq endpoints; if(!NIL_P(seq)) { volatile VALUE arr = callRuby(rb_check_array_type, seq); if(NIL_P(seq)) { throw RubyException(rb_eTypeError, "unable to convert value to an array of endpoints"); } for(long i = 0; i < RARRAY_LEN(arr); ++i) { if(!checkEndpoint(RARRAY_PTR(arr)[i])) { throw RubyException(rb_eTypeError, "array element is not an Ice::Endpoint"); } Ice::EndpointPtr* e = reinterpret_cast(DATA_PTR(RARRAY_PTR(arr)[i])); assert(e); endpoints.push_back(*e); } } return createProxy(p->ice_endpoints(endpoints), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getLocatorCacheTimeout(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::Int t = p->ice_getLocatorCacheTimeout(); return INT2FIX(t); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getConnectionId(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); string connectionId = p->ice_getConnectionId(); return createString(connectionId); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_locatorCacheTimeout(VALUE self, VALUE timeout) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); long t = getInteger(timeout); return createProxy(p->ice_locatorCacheTimeout(static_cast(t)), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_isConnectionCached(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return p->ice_isConnectionCached() ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_connectionCached(VALUE self, VALUE b) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createProxy(p->ice_connectionCached(RTEST(b)), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getEndpointSelection(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::EndpointSelectionType type = p->ice_getEndpointSelection(); volatile VALUE cls = callRuby(rb_path2class, "Ice::EndpointSelectionType"); assert(!NIL_P(cls)); return callRuby(rb_funcall, cls, rb_intern("from_int"), 1, INT2NUM(static_cast(type))); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_endpointSelection(VALUE self, VALUE type) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); volatile VALUE cls = callRuby(rb_path2class, "Ice::EndpointSelectionType"); assert(!NIL_P(cls)); if(callRuby(rb_obj_is_instance_of, type, cls) == Qfalse) { throw RubyException(rb_eTypeError, "argument must be an Ice::EndpointSelectionType enumerator"); } volatile VALUE val = callRuby(rb_funcall, type, rb_intern("to_i"), 0); Ice::EndpointSelectionType t = static_cast(getInteger(val)); return createProxy(p->ice_endpointSelection(t), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_isSecure(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return p->ice_isSecure() ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_secure(VALUE self, VALUE b) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createProxy(p->ice_secure(RTEST(b)), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getEncodingVersion(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createEncodingVersion(p->ice_getEncodingVersion()); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_encodingVersion(VALUE self, VALUE v) { Ice::EncodingVersion val; if(getEncodingVersion(v, val)) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createProxy(p->ice_encodingVersion(val), rb_class_of(self)); } ICE_RUBY_CATCH } return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_isPreferSecure(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return p->ice_isPreferSecure() ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_preferSecure(VALUE self, VALUE b) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createProxy(p->ice_preferSecure(RTEST(b)), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getRouter(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::RouterPrx router = p->ice_getRouter(); if(router) { volatile VALUE cls = callRuby(rb_path2class, "Ice::RouterPrx"); assert(!NIL_P(cls)); return createProxy(router, cls); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_router(VALUE self, VALUE router) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::RouterPrx proxy; if(!NIL_P(router)) { if(!checkProxy(router)) { throw RubyException(rb_eTypeError, "argument must be a proxy"); } proxy = Ice::RouterPrx::uncheckedCast(getProxy(router)); } return createProxy(p->ice_router(proxy), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getLocator(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::LocatorPrx locator = p->ice_getLocator(); if(locator) { volatile VALUE cls = callRuby(rb_path2class, "Ice::LocatorPrx"); assert(!NIL_P(cls)); return createProxy(locator, cls); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_locator(VALUE self, VALUE locator) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::LocatorPrx proxy; if(!NIL_P(locator)) { if(!checkProxy(locator)) { throw RubyException(rb_eTypeError, "argument must be a proxy"); } proxy = Ice::LocatorPrx::uncheckedCast(getProxy(locator)); } return createProxy(p->ice_locator(proxy), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_twoway(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createProxy(p->ice_twoway(), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_isTwoway(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return p->ice_isTwoway() ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_oneway(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createProxy(p->ice_oneway(), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_isOneway(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return p->ice_isOneway() ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_batchOneway(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createProxy(p->ice_batchOneway(), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_isBatchOneway(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return p->ice_isBatchOneway() ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_datagram(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createProxy(p->ice_datagram(), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_isDatagram(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return p->ice_isDatagram() ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_batchDatagram(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createProxy(p->ice_batchDatagram(), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_isBatchDatagram(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return p->ice_isBatchDatagram() ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_compress(VALUE self, VALUE b) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); return createProxy(p->ice_compress(RTEST(b)), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_timeout(VALUE self, VALUE t) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::Int timeout = static_cast(getInteger(t)); return createProxy(p->ice_timeout(timeout), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_connectionId(VALUE self, VALUE id) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); string idstr = getString(id); return createProxy(p->ice_connectionId(idstr), rb_class_of(self)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getConnection(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::ConnectionPtr conn = p->ice_getConnection(); return createConnection(conn); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_getCachedConnection(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); Ice::ConnectionPtr conn = p->ice_getCachedConnection(); if(conn) { return createConnection(conn); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_flushBatchRequests(VALUE self) { ICE_RUBY_TRY { Ice::ObjectPrx p = getProxy(self); p->ice_flushBatchRequests(); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_cmp(VALUE self, VALUE other) { ICE_RUBY_TRY { if(NIL_P(other)) { return INT2NUM(1); } if(!checkProxy(other)) { throw RubyException(rb_eTypeError, "argument must be a proxy"); } Ice::ObjectPrx p1 = getProxy(self); Ice::ObjectPrx p2 = getProxy(other); if(p1 < p2) { return INT2NUM(-1); } else if(p1 == p2) { return INT2NUM(0); } else { return INT2NUM(1); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_equals(VALUE self, VALUE other) { return IceRuby_ObjectPrx_cmp(self, other) == INT2NUM(0) ? Qtrue : Qfalse; } static VALUE checkedCastImpl(const Ice::ObjectPrx& p, const string& id, VALUE facet, VALUE ctx, VALUE type) { Ice::ObjectPrx target; if(NIL_P(facet)) { target = p; } else { target = p->ice_facet(getString(facet)); } try { if(NIL_P(ctx)) { if(target->ice_isA(id)) { return createProxy(target, type); } } else { Ice::Context c; #ifndef NDEBUG bool b = #endif hashToContext(ctx, c); assert(b); if(target->ice_isA(id, c)) { return createProxy(target, type); } } } catch(const Ice::FacetNotExistException&) { // Ignore. } return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_checkedCast(int argc, VALUE* args, VALUE self) { // // ice_checkedCast is called from generated code, therefore we always expect // to receive all four arguments. // ICE_RUBY_TRY { if(argc < 1 || argc > 3) { throw RubyException(rb_eArgError, "checkedCast requires a proxy argument and optional facet and context"); } if(NIL_P(args[0])) { return Qnil; } if(!checkProxy(args[0])) { throw RubyException(rb_eArgError, "checkedCast requires a proxy argument"); } Ice::ObjectPrx p = getProxy(args[0]); volatile VALUE facet = Qnil; volatile VALUE ctx = Qnil; if(argc == 3) { if(!NIL_P(args[1]) && !isString(args[1])) { throw RubyException(rb_eArgError, "facet argument to checkedCast must be a string"); } facet = args[1]; if(!NIL_P(args[2]) && !isHash(args[2])) { throw RubyException(rb_eArgError, "context argument to checkedCast must be a hash"); } ctx = args[2]; } else if(argc == 2) { if(isString(args[1])) { facet = args[1]; } else if(isHash(args[1])) { ctx = args[1]; } else { throw RubyException(rb_eArgError, "second argument to checkedCast must be a facet or context"); } } return checkedCastImpl(p, "::Ice::Object", facet, ctx, Qnil); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_uncheckedCast(int argc, VALUE* args, VALUE self) { ICE_RUBY_TRY { if(argc < 1 || argc > 2) { throw RubyException(rb_eArgError, "uncheckedCast requires a proxy argument and an optional facet"); } if(NIL_P(args[0])) { return Qnil; } if(!checkProxy(args[0])) { throw RubyException(rb_eArgError, "uncheckedCast requires a proxy argument"); } volatile VALUE facet = Qnil; if(argc == 2) { facet = args[1]; } Ice::ObjectPrx p = getProxy(args[0]); if(!NIL_P(facet)) { return createProxy(p->ice_facet(getString(facet))); } else { return createProxy(p); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_checkedCast(VALUE self, VALUE obj, VALUE id, VALUE facetOrCtx, VALUE ctx) { // // ice_checkedCast is called from generated code, therefore we always expect // to receive all four arguments. // ICE_RUBY_TRY { if(NIL_P(obj)) { return Qnil; } if(!checkProxy(obj)) { throw RubyException(rb_eArgError, "checkedCast requires a proxy argument"); } Ice::ObjectPrx p = getProxy(obj); string idstr = getString(id); volatile VALUE facet = Qnil; if(isString(facetOrCtx)) { facet = facetOrCtx; } else if(isHash(facetOrCtx)) { if(!NIL_P(ctx)) { throw RubyException(rb_eArgError, "facet argument to checkedCast must be a string"); } ctx = facetOrCtx; } else if(!NIL_P(facetOrCtx)) { throw RubyException(rb_eArgError, "second argument to checkedCast must be a facet or context"); } if(!NIL_P(ctx) && !isHash(ctx)) { throw RubyException(rb_eArgError, "context argument to checkedCast must be a hash"); } return checkedCastImpl(p, idstr, facet, ctx, self); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_ice_uncheckedCast(VALUE self, VALUE obj, VALUE facet) { ICE_RUBY_TRY { if(NIL_P(obj)) { return Qnil; } if(!checkProxy(obj)) { throw RubyException(rb_eArgError, "uncheckedCast requires a proxy argument"); } Ice::ObjectPrx p = getProxy(obj); if(!NIL_P(facet)) { return createProxy(p->ice_facet(getString(facet)), self); } else { return createProxy(p, self); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ObjectPrx_new(int /*argc*/, VALUE* /*args*/, VALUE self) { ICE_RUBY_TRY { throw RubyException(rb_eRuntimeError, "a proxy cannot be created via new"); } ICE_RUBY_CATCH return Qnil; } void IceRuby::initProxy(VALUE iceModule) { // // ObjectPrx. // _proxyClass = rb_define_class_under(iceModule, "ObjectPrx", rb_cObject); // // Instance methods. // rb_define_method(_proxyClass, "ice_getHash", CAST_METHOD(IceRuby_ObjectPrx_ice_getHash), 0); rb_define_method(_proxyClass, "ice_getCommunicator", CAST_METHOD(IceRuby_ObjectPrx_ice_getCommunicator), 0); rb_define_method(_proxyClass, "ice_toString", CAST_METHOD(IceRuby_ObjectPrx_ice_toString), 0); rb_define_method(_proxyClass, "ice_isA", CAST_METHOD(IceRuby_ObjectPrx_ice_isA), -1); rb_define_method(_proxyClass, "ice_ping", CAST_METHOD(IceRuby_ObjectPrx_ice_ping), -1); rb_define_method(_proxyClass, "ice_ids", CAST_METHOD(IceRuby_ObjectPrx_ice_ids), -1); rb_define_method(_proxyClass, "ice_id", CAST_METHOD(IceRuby_ObjectPrx_ice_id), -1); rb_define_method(_proxyClass, "ice_getIdentity", CAST_METHOD(IceRuby_ObjectPrx_ice_getIdentity), 0); rb_define_method(_proxyClass, "ice_identity", CAST_METHOD(IceRuby_ObjectPrx_ice_identity), 1); rb_define_method(_proxyClass, "ice_getContext", CAST_METHOD(IceRuby_ObjectPrx_ice_getContext), 0); rb_define_method(_proxyClass, "ice_context", CAST_METHOD(IceRuby_ObjectPrx_ice_context), 1); rb_define_method(_proxyClass, "ice_getFacet", CAST_METHOD(IceRuby_ObjectPrx_ice_getFacet), 0); rb_define_method(_proxyClass, "ice_facet", CAST_METHOD(IceRuby_ObjectPrx_ice_facet), 1); rb_define_method(_proxyClass, "ice_getAdapterId", CAST_METHOD(IceRuby_ObjectPrx_ice_getAdapterId), 0); rb_define_method(_proxyClass, "ice_adapterId", CAST_METHOD(IceRuby_ObjectPrx_ice_adapterId), 1); rb_define_method(_proxyClass, "ice_getEndpoints", CAST_METHOD(IceRuby_ObjectPrx_ice_getEndpoints), 0); rb_define_method(_proxyClass, "ice_endpoints", CAST_METHOD(IceRuby_ObjectPrx_ice_endpoints), 1); rb_define_method(_proxyClass, "ice_getLocatorCacheTimeout", CAST_METHOD(IceRuby_ObjectPrx_ice_getLocatorCacheTimeout), 0); rb_define_method(_proxyClass, "ice_getConnectionId", CAST_METHOD(IceRuby_ObjectPrx_ice_getConnectionId), 0); rb_define_method(_proxyClass, "ice_locatorCacheTimeout", CAST_METHOD(IceRuby_ObjectPrx_ice_locatorCacheTimeout), 1); rb_define_method(_proxyClass, "ice_isConnectionCached", CAST_METHOD(IceRuby_ObjectPrx_ice_isConnectionCached), 0); rb_define_method(_proxyClass, "ice_connectionCached", CAST_METHOD(IceRuby_ObjectPrx_ice_connectionCached), 1); rb_define_method(_proxyClass, "ice_getEndpointSelection", CAST_METHOD(IceRuby_ObjectPrx_ice_getEndpointSelection), 0); rb_define_method(_proxyClass, "ice_endpointSelection", CAST_METHOD(IceRuby_ObjectPrx_ice_endpointSelection), 1); rb_define_method(_proxyClass, "ice_isSecure", CAST_METHOD(IceRuby_ObjectPrx_ice_isSecure), 0); rb_define_method(_proxyClass, "ice_secure", CAST_METHOD(IceRuby_ObjectPrx_ice_secure), 1); rb_define_method(_proxyClass, "ice_getEncodingVersion", CAST_METHOD(IceRuby_ObjectPrx_ice_getEncodingVersion), 0); rb_define_method(_proxyClass, "ice_encodingVersion", CAST_METHOD(IceRuby_ObjectPrx_ice_encodingVersion), 1); rb_define_method(_proxyClass, "ice_isPreferSecure", CAST_METHOD(IceRuby_ObjectPrx_ice_isPreferSecure), 0); rb_define_method(_proxyClass, "ice_preferSecure", CAST_METHOD(IceRuby_ObjectPrx_ice_preferSecure), 1); rb_define_method(_proxyClass, "ice_getRouter", CAST_METHOD(IceRuby_ObjectPrx_ice_getRouter), 0); rb_define_method(_proxyClass, "ice_router", CAST_METHOD(IceRuby_ObjectPrx_ice_router), 1); rb_define_method(_proxyClass, "ice_getLocator", CAST_METHOD(IceRuby_ObjectPrx_ice_getLocator), 0); rb_define_method(_proxyClass, "ice_locator", CAST_METHOD(IceRuby_ObjectPrx_ice_locator), 1); rb_define_method(_proxyClass, "ice_twoway", CAST_METHOD(IceRuby_ObjectPrx_ice_twoway), 0); rb_define_method(_proxyClass, "ice_isTwoway", CAST_METHOD(IceRuby_ObjectPrx_ice_isTwoway), 0); rb_define_method(_proxyClass, "ice_oneway", CAST_METHOD(IceRuby_ObjectPrx_ice_oneway), 0); rb_define_method(_proxyClass, "ice_isOneway", CAST_METHOD(IceRuby_ObjectPrx_ice_isOneway), 0); rb_define_method(_proxyClass, "ice_batchOneway", CAST_METHOD(IceRuby_ObjectPrx_ice_batchOneway), 0); rb_define_method(_proxyClass, "ice_isBatchOneway", CAST_METHOD(IceRuby_ObjectPrx_ice_isBatchOneway), 0); rb_define_method(_proxyClass, "ice_datagram", CAST_METHOD(IceRuby_ObjectPrx_ice_datagram), 0); rb_define_method(_proxyClass, "ice_isDatagram", CAST_METHOD(IceRuby_ObjectPrx_ice_isDatagram), 0); rb_define_method(_proxyClass, "ice_batchDatagram", CAST_METHOD(IceRuby_ObjectPrx_ice_batchDatagram), 0); rb_define_method(_proxyClass, "ice_isBatchDatagram", CAST_METHOD(IceRuby_ObjectPrx_ice_isBatchDatagram), 0); rb_define_method(_proxyClass, "ice_compress", CAST_METHOD(IceRuby_ObjectPrx_ice_compress), 1); rb_define_method(_proxyClass, "ice_timeout", CAST_METHOD(IceRuby_ObjectPrx_ice_timeout), 1); rb_define_method(_proxyClass, "ice_connectionId", CAST_METHOD(IceRuby_ObjectPrx_ice_connectionId), 1); rb_define_method(_proxyClass, "ice_getConnection", CAST_METHOD(IceRuby_ObjectPrx_ice_getConnection), 0); rb_define_method(_proxyClass, "ice_getCachedConnection", CAST_METHOD(IceRuby_ObjectPrx_ice_getCachedConnection), 0); rb_define_method(_proxyClass, "ice_flushBatchRequests", CAST_METHOD(IceRuby_ObjectPrx_ice_flushBatchRequests), 0); rb_define_method(_proxyClass, "hash", CAST_METHOD(IceRuby_ObjectPrx_hash), 0); rb_define_method(_proxyClass, "to_s", CAST_METHOD(IceRuby_ObjectPrx_ice_toString), 0); rb_define_method(_proxyClass, "inspect", CAST_METHOD(IceRuby_ObjectPrx_ice_toString), 0); rb_define_method(_proxyClass, "<=>", CAST_METHOD(IceRuby_ObjectPrx_cmp), 1); rb_define_method(_proxyClass, "==", CAST_METHOD(IceRuby_ObjectPrx_equals), 1); rb_define_method(_proxyClass, "eql?", CAST_METHOD(IceRuby_ObjectPrx_equals), 1); // // Static methods. // rb_define_singleton_method(_proxyClass, "checkedCast", CAST_METHOD(IceRuby_ObjectPrx_checkedCast), -1); rb_define_singleton_method(_proxyClass, "uncheckedCast", CAST_METHOD(IceRuby_ObjectPrx_uncheckedCast), -1); rb_define_singleton_method(_proxyClass, "ice_checkedCast", CAST_METHOD(IceRuby_ObjectPrx_ice_checkedCast), 4); rb_define_singleton_method(_proxyClass, "ice_uncheckedCast", CAST_METHOD(IceRuby_ObjectPrx_ice_uncheckedCast), 2); rb_define_singleton_method(_proxyClass, "new", CAST_METHOD(IceRuby_ObjectPrx_new), -1); } VALUE IceRuby::createProxy(const Ice::ObjectPrx& p, VALUE cls) { // // If cls is nil then the proxy has the base type Ice::ObjectPrx. // if(NIL_P(cls)) { return Data_Wrap_Struct(_proxyClass, IceRuby_ObjectPrx_mark, IceRuby_ObjectPrx_free, new Ice::ObjectPrx(p)); } else { return Data_Wrap_Struct(cls, IceRuby_ObjectPrx_mark, IceRuby_ObjectPrx_free, new Ice::ObjectPrx(p)); } } Ice::ObjectPrx IceRuby::getProxy(VALUE v) { Ice::ObjectPrx* p = reinterpret_cast(DATA_PTR(v)); return *p; } bool IceRuby::checkProxy(VALUE v) { return callRuby(rb_obj_is_kind_of, v, _proxyClass) == Qtrue; } Ice-3.5.1/rb/src/IceRuby/Operation.cpp0000644000076400007640000004245412223561477015604 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace IceRuby; using namespace Slice::Ruby; static VALUE _operationClass; namespace IceRuby { class ParamInfo : public UnmarshalCallback { public: virtual void unmarshaled(VALUE, VALUE, void*); TypeInfoPtr type; bool optional; int tag; int pos; }; typedef IceUtil::Handle ParamInfoPtr; typedef list ParamInfoList; class OperationI : public Operation { public: OperationI(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); virtual VALUE invoke(const Ice::ObjectPrx&, VALUE, VALUE); virtual void deprecate(const string&); private: string _name; Ice::OperationMode _mode; Ice::OperationMode _sendMode; bool _amd; Ice::FormatType _format; ParamInfoList _inParams; ParamInfoList _optionalInParams; ParamInfoList _outParams; ParamInfoList _optionalOutParams; ParamInfoPtr _returnType; ExceptionInfoList _exceptions; string _dispatchName; bool _sendsClasses; bool _returnsClasses; string _deprecateMessage; void convertParams(VALUE, ParamInfoList&, int, bool&); ParamInfoPtr convertParam(VALUE, int); void prepareRequest(const Ice::ObjectPrx&, VALUE, Ice::OutputStreamPtr&, pair&); VALUE unmarshalResults(const vector&, const Ice::CommunicatorPtr&); VALUE unmarshalException(const vector&, const Ice::CommunicatorPtr&); bool validateException(VALUE) const; void checkTwowayOnly(const Ice::ObjectPrx&) const; }; typedef IceUtil::Handle OperationIPtr; class UserExceptionReaderFactoryI : public Ice::UserExceptionReaderFactory { public: UserExceptionReaderFactoryI(const Ice::CommunicatorPtr& communicator) : _communicator(communicator) { } virtual void createAndThrow(const string& id) const { ExceptionInfoPtr info = lookupExceptionInfo(id); if(info) { throw ExceptionReader(_communicator, info); } } private: const Ice::CommunicatorPtr _communicator; }; } extern "C" void IceRuby_Operation_free(OperationPtr* p) { delete p; } extern "C" VALUE IceRuby_defineOperation(VALUE /*self*/, VALUE name, VALUE mode, VALUE sendMode, VALUE amd, VALUE format, VALUE inParams, VALUE outParams, VALUE returnType, VALUE exceptions) { ICE_RUBY_TRY { OperationIPtr op = new OperationI(name, mode, sendMode, amd, format, inParams, outParams, returnType, exceptions); return Data_Wrap_Struct(_operationClass, 0, IceRuby_Operation_free, new OperationPtr(op)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Operation_invoke(VALUE self, VALUE proxy, VALUE opArgs, VALUE ctx) { ICE_RUBY_TRY { assert(TYPE(opArgs) == T_ARRAY); OperationPtr op = getOperation(self); assert(op); return op->invoke(getProxy(proxy), opArgs, ctx); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Operation_deprecate(VALUE self, VALUE msg) { ICE_RUBY_TRY { OperationPtr op = getOperation(self); assert(op); op->deprecate(getString(msg)); } ICE_RUBY_CATCH return Qnil; } // // Operation implementation. // IceRuby::Operation::~Operation() { } // // ParamInfo implementation. // void IceRuby::ParamInfo::unmarshaled(VALUE val, VALUE target, void* closure) { assert(TYPE(target) == T_ARRAY); long i = reinterpret_cast(closure); RARRAY_PTR(target)[i] = val; } // // OperationI implementation. // IceRuby::OperationI::OperationI(VALUE name, VALUE mode, VALUE sendMode, VALUE amd, VALUE format, VALUE inParams, VALUE outParams, VALUE returnType, VALUE exceptions) { _name = getString(name); _amd = amd == Qtrue; if(_amd) { _dispatchName = fixIdent(_name, IdentNormal) + "_async"; } else { _dispatchName = fixIdent(_name, IdentNormal); } // // mode // volatile VALUE modeValue = callRuby(rb_funcall, mode, rb_intern("to_i"), 0); assert(TYPE(modeValue) == T_FIXNUM); _mode = static_cast(FIX2LONG(modeValue)); // // sendMode // volatile VALUE sendModeValue = callRuby(rb_funcall, sendMode, rb_intern("to_i"), 0); assert(TYPE(sendModeValue) == T_FIXNUM); _sendMode = static_cast(FIX2LONG(sendModeValue)); // // format // if(format == Qnil) { _format = Ice::DefaultFormat; } else { volatile VALUE formatValue = callRuby(rb_funcall, format, rb_intern("to_i"), 0); assert(TYPE(formatValue) == T_FIXNUM); _format = static_cast(FIX2LONG(formatValue)); } // // returnType // _returnsClasses = false; if(!NIL_P(returnType)) { _returnType = convertParam(returnType, 0); if(!_returnType->optional) { _returnsClasses = _returnType->type->usesClasses(); } } // // inParams // _sendsClasses = false; convertParams(inParams, _inParams, 0, _sendsClasses); // // outParams // convertParams(outParams, _outParams, NIL_P(returnType) ? 0 : 1, _returnsClasses); class SortFn { public: static bool compare(const ParamInfoPtr& lhs, const ParamInfoPtr& rhs) { return lhs->tag < rhs->tag; } static bool isRequired(const ParamInfoPtr& i) { return !i->optional; } }; // // The inParams list represents the parameters in the order of declaration. // We also need a sorted list of optional parameters. // ParamInfoList l = _inParams; copy(l.begin(), remove_if(l.begin(), l.end(), SortFn::isRequired), back_inserter(_optionalInParams)); _optionalInParams.sort(SortFn::compare); // // The outParams list represents the parameters in the order of declaration. // We also need a sorted list of optional parameters. If the return value is // optional, we must include it in this list. // l = _outParams; copy(l.begin(), remove_if(l.begin(), l.end(), SortFn::isRequired), back_inserter(_optionalOutParams)); if(_returnType && _returnType->optional) { _optionalOutParams.push_back(_returnType); } _optionalOutParams.sort(SortFn::compare); // // exceptions // for(long i = 0; i < RARRAY_LEN(exceptions); ++i) { _exceptions.push_back(getException(RARRAY_PTR(exceptions)[i])); } } VALUE IceRuby::OperationI::invoke(const Ice::ObjectPrx& proxy, VALUE args, VALUE hctx) { Ice::CommunicatorPtr communicator = proxy->ice_getCommunicator(); // // Marshal the input parameters to a byte sequence. // Ice::OutputStreamPtr os; pair params; prepareRequest(proxy, args, os, params); if(!_deprecateMessage.empty()) { rb_warning("%s", _deprecateMessage.c_str()); _deprecateMessage.clear(); // Only show the warning once. } checkTwowayOnly(proxy); // // Invoke the operation. // Ice::ByteSeq result; bool status; if(!NIL_P(hctx)) { Ice::Context ctx; if(!hashToContext(hctx, ctx)) { throw RubyException(rb_eArgError, "context argument must be nil or a hash"); } status = proxy->ice_invoke(_name, _sendMode, params, result, ctx); } else { status = proxy->ice_invoke(_name, _sendMode, params, result); } // // Process the reply. // if(proxy->ice_isTwoway()) { if(!status) { // // Unmarshal a user exception. // volatile VALUE ex = unmarshalException(result, communicator); throw RubyException(ex); } else if(_outParams.size() > 0 || _returnType) { // // Unmarshal the results. If there is more than one value to be returned, then return them // in an array of the form [result, outParam1, ...]. Otherwise just return the value. // volatile VALUE results = unmarshalResults(result, communicator); if(RARRAY_LEN(results)> 1) { return results; } else { return RARRAY_PTR(results)[0]; } } } return Qnil; } void IceRuby::OperationI::deprecate(const string& msg) { if(!msg.empty()) { _deprecateMessage = msg; } else { _deprecateMessage = "operation " + _name + " is deprecated"; } } void IceRuby::OperationI::convertParams(VALUE v, ParamInfoList& params, int posOffset, bool& usesClasses) { assert(TYPE(v) == T_ARRAY); for(long i = 0; i < RARRAY_LEN(v); ++i) { ParamInfoPtr param = convertParam(RARRAY_PTR(v)[i], i + posOffset); params.push_back(param); if(!param->optional && !usesClasses) { usesClasses = param->type->usesClasses(); } } } ParamInfoPtr IceRuby::OperationI::convertParam(VALUE v, int pos) { assert(TYPE(v) == T_ARRAY); ParamInfoPtr param = new ParamInfo; param->type = getType(RARRAY_PTR(v)[0]); param->optional = static_cast(RTEST(RARRAY_PTR(v)[1])); param->tag = static_cast(getInteger(RARRAY_PTR(v)[2])); param->pos = pos; return param; } void IceRuby::OperationI::prepareRequest(const Ice::ObjectPrx& proxy, VALUE args, Ice::OutputStreamPtr& os, pair& params) { params.first = params.second = static_cast(0); // // Validate the number of arguments. // long argc = RARRAY_LEN(args); long paramCount = static_cast(_inParams.size()); if(argc != paramCount) { string fixedName = fixIdent(_name, IdentNormal); throw RubyException(rb_eArgError, "%s expects %ld in parameters", fixedName.c_str(), paramCount); } if(!_inParams.empty()) { // // Marshal the in parameters. // os = Ice::createOutputStream(proxy->ice_getCommunicator()); os->startEncapsulation(proxy->ice_getEncodingVersion(), _format); ObjectMap objectMap; ParamInfoList::iterator p; // // Validate the supplied arguments. // for(p = _inParams.begin(); p != _inParams.end(); ++p) { ParamInfoPtr info = *p; volatile VALUE arg = RARRAY_PTR(args)[info->pos]; if((!info->optional || arg != Unset) && !info->type->validate(arg)) { string opName = fixIdent(_name, IdentNormal); throw RubyException(rb_eTypeError, "invalid value for argument %ld in operation `%s'", info->pos + 1, opName.c_str()); } } // // Marshal the required parameters. // for(p = _inParams.begin(); p != _inParams.end(); ++p) { ParamInfoPtr info = *p; if(!info->optional) { volatile VALUE arg = RARRAY_PTR(args)[info->pos]; info->type->marshal(arg, os, &objectMap, false); } } // // Marshal the optional parameters. // for(p = _optionalInParams.begin(); p != _optionalInParams.end(); ++p) { ParamInfoPtr info = *p; volatile VALUE arg = RARRAY_PTR(args)[info->pos]; if(arg != Unset && os->writeOptional(info->tag, info->type->optionalFormat())) { info->type->marshal(arg, os, &objectMap, true); } } if(_sendsClasses) { os->writePendingObjects(); } os->endEncapsulation(); params = os->finished(); } } VALUE IceRuby::OperationI::unmarshalResults(const vector& bytes, const Ice::CommunicatorPtr& communicator) { int numResults = static_cast(_outParams.size()); if(_returnType) { numResults++; } assert(numResults > 0); volatile VALUE results = createArray(numResults); // // Unmarshal the results. If there is more than one value to be returned, then return them // in a tuple of the form (result, outParam1, ...). Otherwise just return the value. // Ice::InputStreamPtr is = Ice::wrapInputStream(communicator, bytes); // // Store a pointer to a local SlicedDataUtil object as the stream's closure. // This is necessary to support object unmarshaling (see ObjectReader). // SlicedDataUtil util; assert(!is->closure()); is->closure(&util); is->startEncapsulation(); ParamInfoList::iterator p; // // Unmarshal the required out parameters. // for(p = _outParams.begin(); p != _outParams.end(); ++p) { ParamInfoPtr info = *p; if(!info->optional) { void* closure = reinterpret_cast(info->pos); info->type->unmarshal(is, info, results, closure, false); } } // // Unmarshal the required return value, if any. // if(_returnType && !_returnType->optional) { assert(_returnType->pos == 0); void* closure = reinterpret_cast(_returnType->pos); _returnType->type->unmarshal(is, _returnType, results, closure, false); } // // Unmarshal the optional results. This includes an optional return value. // for(p = _optionalOutParams.begin(); p != _optionalOutParams.end(); ++p) { ParamInfoPtr info = *p; if(is->readOptional(info->tag, info->type->optionalFormat())) { void* closure = reinterpret_cast(info->pos); info->type->unmarshal(is, info, results, closure, true); } else { RARRAY_PTR(results)[info->pos] = Unset; } } if(_returnsClasses) { is->readPendingObjects(); } is->endEncapsulation(); util.update(); return results; } VALUE IceRuby::OperationI::unmarshalException(const vector& bytes, const Ice::CommunicatorPtr& communicator) { Ice::InputStreamPtr is = Ice::wrapInputStream(communicator, bytes); // // Store a pointer to a local SlicedDataUtil object as the stream's closure. // This is necessary to support object unmarshaling (see ObjectReader). // SlicedDataUtil util; assert(!is->closure()); is->closure(&util); is->startEncapsulation(); try { Ice::UserExceptionReaderFactoryPtr factory = new UserExceptionReaderFactoryI(communicator); is->throwException(factory); } catch(const ExceptionReader& r) { is->endEncapsulation(); volatile VALUE ex = r.getException(); if(validateException(ex)) { util.update(); Ice::SlicedDataPtr slicedData = r.getSlicedData(); if(slicedData) { SlicedDataUtil::setMember(ex, slicedData); } return ex; } else { volatile VALUE cls = CLASS_OF(ex); volatile VALUE path = callRuby(rb_class_path, cls); assert(TYPE(path) == T_STRING); Ice::UnknownUserException e(__FILE__, __LINE__); e.unknown = RSTRING_PTR(path); throw e; } } throw Ice::UnknownUserException(__FILE__, __LINE__, "unknown exception"); #ifdef __SUNPRO_CC return 0; #endif } bool IceRuby::OperationI::validateException(VALUE ex) const { for(ExceptionInfoList::const_iterator p = _exceptions.begin(); p != _exceptions.end(); ++p) { if(callRuby(rb_obj_is_kind_of, ex, (*p)->rubyClass)) { return true; } } return false; } void IceRuby::OperationI::checkTwowayOnly(const Ice::ObjectPrx& proxy) const { if((_returnType != 0 || !_outParams.empty()) && !proxy->ice_isTwoway()) { Ice::TwowayOnlyException ex(__FILE__, __LINE__); ex.operation = _name; throw ex; } } bool IceRuby::initOperation(VALUE iceModule) { rb_define_module_function(iceModule, "__defineOperation", CAST_METHOD(IceRuby_defineOperation), 9); // // Define a class to represent an operation. // _operationClass = rb_define_class_under(iceModule, "IceRuby_Operation", rb_cObject); rb_define_method(_operationClass, "invoke", CAST_METHOD(IceRuby_Operation_invoke), 3); rb_define_method(_operationClass, "deprecate", CAST_METHOD(IceRuby_Operation_deprecate), 1); return true; } IceRuby::OperationPtr IceRuby::getOperation(VALUE obj) { assert(TYPE(obj) == T_DATA); assert(rb_obj_is_instance_of(obj, _operationClass) == Qtrue); OperationPtr* p = reinterpret_cast(DATA_PTR(obj)); return *p; } Ice-3.5.1/rb/src/IceRuby/Proxy.h0000644000076400007640000000117312223561477014423 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_PROXY_H #define ICE_RUBY_PROXY_H #include #include #include namespace IceRuby { void initProxy(VALUE); VALUE createProxy(const Ice::ObjectPrx&, VALUE = Qnil); Ice::ObjectPrx getProxy(VALUE); bool checkProxy(VALUE); } #endif Ice-3.5.1/rb/src/IceRuby/Endpoint.h0000644000076400007640000000117312223561477015062 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_ENDPOINT_H #define ICE_RUBY_ENDPOINT_H #include #include namespace IceRuby { void initEndpoint(VALUE); VALUE createEndpoint(const Ice::EndpointPtr&); VALUE createEndpointInfo(const Ice::EndpointInfoPtr&); bool checkEndpoint(VALUE); } #endif Ice-3.5.1/rb/src/IceRuby/Logger.cpp0000644000076400007640000000644712223561477015065 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace IceRuby; static VALUE _loggerClass; extern "C" void IceRuby_Logger_free(Ice::LoggerPtr* p) { assert(p); delete p; } VALUE IceRuby::createLogger(const Ice::LoggerPtr& p) { return Data_Wrap_Struct(_loggerClass, 0, IceRuby_Logger_free, new Ice::LoggerPtr(p)); } extern "C" VALUE IceRuby_Logger_print(VALUE self, VALUE message) { ICE_RUBY_TRY { Ice::LoggerPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); string msg = getString(message); (*p)->print(msg); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Logger_trace(VALUE self, VALUE category, VALUE message) { ICE_RUBY_TRY { Ice::LoggerPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); string cat = getString(category); string msg = getString(message); (*p)->trace(cat, msg); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Logger_warning(VALUE self, VALUE message) { ICE_RUBY_TRY { Ice::LoggerPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); string msg = getString(message); (*p)->warning(msg); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Logger_error(VALUE self, VALUE message) { ICE_RUBY_TRY { Ice::LoggerPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); string msg = getString(message); (*p)->error(msg); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Logger_cloneWithPrefix(VALUE self, VALUE prefix) { ICE_RUBY_TRY { Ice::LoggerPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); string pfx = getString(prefix); Ice::LoggerPtr clone = (*p)->cloneWithPrefix(pfx); return createLogger(clone); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_getProcessLogger() { ICE_RUBY_TRY { Ice::LoggerPtr logger = Ice::getProcessLogger(); return createLogger(logger); } ICE_RUBY_CATCH return Qnil; } bool IceRuby::initLogger(VALUE iceModule) { // // Logger. // _loggerClass = rb_define_class_under(iceModule, "LoggerI", rb_cObject); // // Instance methods. // rb_define_method(_loggerClass, "print", CAST_METHOD(IceRuby_Logger_print), 1); rb_define_method(_loggerClass, "trace", CAST_METHOD(IceRuby_Logger_trace), 2); rb_define_method(_loggerClass, "warning", CAST_METHOD(IceRuby_Logger_warning), 1); rb_define_method(_loggerClass, "error", CAST_METHOD(IceRuby_Logger_error), 1); rb_define_method(_loggerClass, "cloneWithPrefix", CAST_METHOD(IceRuby_Logger_cloneWithPrefix), 1); // // Global methods. // rb_define_module_function(iceModule, "getProcessLogger", CAST_METHOD(IceRuby_getProcessLogger), 0); return true; } Ice-3.5.1/rb/src/IceRuby/ObjectFactory.h0000644000076400007640000000230412223561477016035 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_OBJECT_FACTORY_H #define ICE_RUBY_OBJECT_FACTORY_H #include #include #include #include namespace IceRuby { // // Each communicator registers an instance of ObjectFactory as its // default object factory. This instance delegates to registered Ruby // objects, and instantiates concrete classes when no factory is present. // class ObjectFactory : public Ice::ObjectFactory, public IceUtil::Mutex { public: ObjectFactory(); ~ObjectFactory(); virtual Ice::ObjectPtr create(const std::string&); virtual void destroy(); void add(VALUE, const std::string&); VALUE find(const std::string&); void mark(); private: typedef std::map FactoryMap; FactoryMap _factoryMap; }; typedef IceUtil::Handle ObjectFactoryPtr; } #endif Ice-3.5.1/rb/src/IceRuby/Communicator.h0000644000076400007640000000115412223561477015741 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_COMMUNICATOR_H #define ICE_RUBY_COMMUNICATOR_H #include #include namespace IceRuby { void initCommunicator(VALUE); Ice::CommunicatorPtr getCommunicator(VALUE); VALUE lookupCommunicator(const Ice::CommunicatorPtr&); } #endif Ice-3.5.1/rb/src/IceRuby/ImplicitContext.h0000644000076400007640000000120512223561477016415 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_IMPLICIT_CONTEXT_H #define ICE_RUBY_IMPLICIT_CONTEXT_H #include #include namespace IceRuby { void initImplicitContext(VALUE); Ice::ImplicitContextPtr getImplicitContext(VALUE); VALUE createImplicitContext(const Ice::ImplicitContextPtr&); } #endif Ice-3.5.1/rb/src/IceRuby/ObjectFactory.cpp0000644000076400007640000000612012223561477016370 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace IceRuby; IceRuby::ObjectFactory::ObjectFactory() { } IceRuby::ObjectFactory::~ObjectFactory() { assert(_factoryMap.empty()); } Ice::ObjectPtr IceRuby::ObjectFactory::create(const string& id) { Lock sync(*this); // // Get the type information. // ClassInfoPtr info; if(id == Ice::Object::ice_staticId()) { // // When the ID is that of Ice::Object, it indicates that the stream has not // found a factory and is providing us an opportunity to preserve the object. // info = lookupClassInfo("::Ice::UnknownSlicedObject"); } else { info = lookupClassInfo(id); } if(!info) { return 0; } // // Check if the application has registered a factory for this id. // FactoryMap::iterator p = _factoryMap.find(id); if(p != _factoryMap.end()) { // // Invoke the create method on the Ruby factory object. // volatile VALUE str = createString(id); volatile VALUE obj = callRuby(rb_funcall, p->second, rb_intern("create"), 1, str); if(NIL_P(obj)) { return 0; } return new ObjectReader(obj, info); } // // Instantiate the object. // volatile VALUE obj = callRuby(rb_class_new_instance, 0, reinterpret_cast(0), info->rubyClass); assert(!NIL_P(obj)); return new ObjectReader(obj, info); } void IceRuby::ObjectFactory::destroy() { Lock sync(*this); for(FactoryMap::iterator p = _factoryMap.begin(); p != _factoryMap.end(); ++p) { // // Invoke the destroy method on each registered Ruby factory. // try { callRuby(rb_funcall, p->second, rb_intern("destroy"), 0); } catch(const RubyException&) { // Ignore. } } _factoryMap.clear(); } void IceRuby::ObjectFactory::add(VALUE factory, const string& id) { Lock sync(*this); FactoryMap::iterator p = _factoryMap.find(id); if(p != _factoryMap.end()) { Ice::AlreadyRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "object factory"; ex.id = id; throw ex; } _factoryMap.insert(FactoryMap::value_type(id, factory)); } VALUE IceRuby::ObjectFactory::find(const string& id) { Lock sync(*this); FactoryMap::iterator p = _factoryMap.find(id); if(p == _factoryMap.end()) { return Qnil; } return p->second; } void IceRuby::ObjectFactory::mark() { for(FactoryMap::iterator p = _factoryMap.begin(); p != _factoryMap.end(); ++p) { rb_gc_mark(p->second); } } Ice-3.5.1/rb/src/IceRuby/Slice.h0000644000076400007640000000072412223561477014342 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_SLICE_H #define ICE_RUBY_SLICE_H #include namespace IceRuby { void initSlice(VALUE); } #endif Ice-3.5.1/rb/src/IceRuby/Util.h0000644000076400007640000002753412223561477014230 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_UTIL_H #define ICE_RUBY_UTIL_H #include #include namespace IceRuby { void initUtil(VALUE); class RubyException { public: // // This constructor uses the interpreter's last error result as the exception. // RubyException(); // // The Ruby exception object is supplied. // RubyException(VALUE); // // The Ruby exception object is supplied along with a message. // RubyException(VALUE, const char*, ...); std::ostream& operator<<(std::ostream&) const; VALUE ex; }; // // Returns true if the value is a string or can be converted into a string. // bool isString(VALUE); // // Returns true if the value is an array or can be converted into an array. // bool isArray(VALUE); // // Returns true if the value is a hash or can be converted into a hash. // bool isHash(VALUE); // // Convert a Ruby value into a string. May raise RubyException. // std::string getString(VALUE); // // Create a Ruby string. May raise RubyException. // VALUE createString(const std::string&); // // Convert a Ruby value into a long. May raise RubyException. // long getInteger(VALUE); // // Convert a Ruby value into an Ice::Long. May raise RubyException. // Ice::Long getLong(VALUE); // // Convert a Ruby array into a vector. Returns true on // success and false if the value is not an array. May raise // RubyException. // bool arrayToStringSeq(VALUE, std::vector&); // // Convert a vector of strings into a Ruby array. May raise // RubyException. // VALUE stringSeqToArray(const std::vector&); // // Convert a Ruby hash to Ice::Context. Returns true on success // and false if the value is not a hash. May raise RubyException. // bool hashToContext(VALUE, Ice::Context&); // // Convert Ice::Context to a hash. May raise RubyException. // VALUE contextToHash(const Ice::Context&); // // Abstract class representing an iterator for a Ruby hash collection. // class HashIterator { public: virtual ~HashIterator() {} virtual void element(VALUE, VALUE) = 0; }; // // Iterate over the elements in a Ruby hash. The iterator's // element method is invoked for each entry. May raise // RubyException. // void hashIterate(VALUE, HashIterator&); // // Convert a Ruby value into Ice::Identity. May raise RubyException. // Ice::Identity getIdentity(VALUE); // // Create an instance of Ice::Identity. May raise RubyException. // VALUE createIdentity(const Ice::Identity&); // // Create a Ruby instance of Ice.ProtocolVersion. // VALUE createProtocolVersion(const Ice::ProtocolVersion&); // // Create a Ruby instance of Ice.EncodingVersion. // VALUE createEncodingVersion(const Ice::EncodingVersion&); // // Extracts the members of an encoding version. // bool getEncodingVersion(VALUE, Ice::EncodingVersion&); // // The callRuby functions are used to invoke Ruby C API functions // while translating any Ruby exception into RubyException so that // C++ objects are cleaned up properly. Overloadings are provided // to support API functions that accept multiple arguments. // template VALUE callRuby(Fun fun); template VALUE callRuby(Fun fun, T1 t1); template VALUE callRuby(Fun fun, T1 t1, T2 t2); template VALUE callRuby(Fun fun, T1 t1, T2 t2, T3 t3); template VALUE callRuby(Fun fun, T1 t1, T2 t2, T3 t3, T4 t4); extern "C" typedef VALUE (*RubyFunction)(VALUE); VALUE callProtected(RubyFunction, VALUE); template class RF_0 { public: RF_0(Fun f) : _f(f) {} inline VALUE operator()() { return _f(); } static inline VALUE call(RF_0* f) { return (*f)(); } private: Fun _f; }; template inline VALUE callRuby(Fun fun) { typedef RF_0 RF; RF f(fun); return callProtected(RubyFunction(RF::call), reinterpret_cast(&f)); } template class RF_1 { public: RF_1(Fun f, T1 t1) : _f(f), _t1(t1) {} inline VALUE operator()() { return _f(_t1); } static inline VALUE call(RF_1* f) { return (*f)(); } private: Fun _f; T1 _t1; }; template inline VALUE callRuby(Fun fun, T1 t1) { typedef RF_1 RF; RF f(fun, t1); return callProtected(RubyFunction(RF::call), reinterpret_cast(&f)); } template class RF_2 { public: RF_2(Fun f, T1 t1, T2 t2) : _f(f), _t1(t1), _t2(t2) {} inline VALUE operator()() { return _f(_t1, _t2); } static inline VALUE call(RF_2* f) { return (*f)(); } private: Fun _f; T1 _t1; T2 _t2; }; template inline VALUE callRuby(Fun fun, T1 t1, T2 t2) { typedef RF_2 RF; RF f(fun, t1, t2); return callProtected(RubyFunction(RF::call), reinterpret_cast(&f)); } template class RF_3 { public: RF_3(Fun f, T1 t1, T2 t2, T3 t3) : _f(f), _t1(t1), _t2(t2), _t3(t3) {} inline VALUE operator()() { return _f(_t1, _t2, _t3); } static inline VALUE call(RF_3* f) { return (*f)(); } private: Fun _f; T1 _t1; T2 _t2; T3 _t3; }; template inline VALUE callRuby(Fun fun, T1 t1, T2 t2, T3 t3) { typedef RF_3 RF; RF f(fun, t1, t2, t3); return callProtected(RubyFunction(RF::call), reinterpret_cast(&f)); } template class RF_4 { public: RF_4(Fun f, T1 t1, T2 t2, T3 t3, T4 t4) : _f(f), _t1(t1), _t2(t2), _t3(t3), _t4(t4) {} inline VALUE operator()() { return _f(_t1, _t2, _t3, _t4); } static inline VALUE call(RF_4* f) { return (*f)(); } private: Fun _f; T1 _t1; T2 _t2; T3 _t3; T4 _t4; }; template inline VALUE callRuby(Fun fun, T1 t1, T2 t2, T3 t3, T4 t4) { typedef RF_4 RF; RF f(fun, t1, t2, t3, t4); return callProtected(RubyFunction(RF::call), reinterpret_cast(&f)); } // // The callRubyVoid functions are used to invoke Ruby C API functions // while translating any Ruby exception into RubyException so that // C++ objects are cleaned up properly. Overloadings are provided // to support API functions that accept multiple arguments. // template void callRubyVoid(Fun fun); template void callRubyVoid(Fun fun, T1 t1); template void callRubyVoid(Fun fun, T1 t1, T2 t2); template void callRubyVoid(Fun fun, T1 t1, T2 t2, T3 t3); template void callRubyVoid(Fun fun, T1 t1, T2 t2, T3 t3, T4 t4); template class RFV_0 { public: RFV_0(Fun f) : _f(f) {} inline void operator()() { _f(); } static inline VALUE call(RFV_0* f) { (*f)(); return Qnil; } private: Fun _f; }; template inline void callRubyVoid(Fun fun) { typedef RFV_0 RF; RF f(fun); callProtected(RubyFunction(RF::call), reinterpret_cast(&f)); } template class RFV_1 { public: RFV_1(Fun f, T1 t1) : _f(f), _t1(t1) {} inline void operator()() { _f(_t1); } static inline VALUE call(RFV_1* f) { (*f)(); return Qnil; } private: Fun _f; T1 _t1; }; template inline void callRubyVoid(Fun fun, T1 t1) { typedef RFV_1 RF; RF f(fun, t1); callProtected(RubyFunction(RF::call), reinterpret_cast(&f)); } template class RFV_2 { public: RFV_2(Fun f, T1 t1, T2 t2) : _f(f), _t1(t1), _t2(t2) {} inline void operator()() { _f(_t1, _t2); } static inline VALUE call(RFV_2* f) { (*f)(); return Qnil; } private: Fun _f; T1 _t1; T2 _t2; }; template inline void callRubyVoid(Fun fun, T1 t1, T2 t2) { typedef RFV_2 RF; RF f(fun, t1, t2); callProtected(RubyFunction(RF::call), reinterpret_cast(&f)); } template class RFV_3 { public: RFV_3(Fun f, T1 t1, T2 t2, T3 t3) : _f(f), _t1(t1), _t2(t2), _t3(t3) {} inline void operator()() { _f(_t1, _t2, _t3); } static inline VALUE call(RFV_3* f) { (*f)(); return Qnil; } private: Fun _f; T1 _t1; T2 _t2; T3 _t3; }; template inline void callRubyVoid(Fun fun, T1 t1, T2 t2, T3 t3) { typedef RFV_3 RF; RF f(fun, t1, t2, t3); callProtected(RubyFunction(RF::call), reinterpret_cast(&f)); } template class RFV_4 { public: RFV_4(Fun f, T1 t1, T2 t2, T3 t3, T4 t4) : _f(f), _t1(t1), _t2(t2), _t3(t3), _t4(t4) {} inline void operator()() { _f(_t1, _t2, _t3, _t4); } static inline VALUE call(RFV_4* f) { (*f)(); return Qnil; } private: Fun _f; T1 _t1; T2 _t2; T3 _t3; T4 _t4; }; template inline void callRubyVoid(Fun fun, T1 t1, T2 t2, T3 t3, T4 t4) { typedef RFV_4 RF; RF f(fun, t1, t2, t3, t4); callProtected(RubyFunction(RF::call), reinterpret_cast(&f)); } VALUE createArrayHelper(long); // // Create an array with the given size. May raise RubyException. // // Note that the length of the array returned by this function is already // set to the requested size. This prevents the array's elements from being // prematurely garbage-collected, but it means the array must be populated // via direct access to its buffer and not by pushing elements onto the // array using rb_ary_push: // // VALUE arr = createArray(size); // for(long i = 0; i < size; ++i) // { // RARRAY_PTR(arr)[i] = ...; // } // template inline VALUE createArray(T sz) { return createArrayHelper(static_cast(sz)); } // // Create the Ruby equivalent of an Ice local exception. // VALUE convertLocalException(const Ice::LocalException&); } // // The macros ICE_RUBY_TRY and ICE_RUBY_CATCH must be used in place of try/catch in // every entry point into the extension. They handle the translation of C++ // exceptions into Ruby exceptions and ensure that C++ objects are cleaned up properly. // #define ICE_RUBY_TRY \ volatile VALUE __ice_ex = Qnil; \ \ goto __ice_start; \ \ __ice_handle_exception: \ rb_exc_raise(__ice_ex); \ \ __ice_start: \ try #define ICE_RUBY_RETHROW(ex) \ __ice_ex = ex; \ goto __ice_handle_exception; #define ICE_RUBY_CATCH \ catch(const ::IceRuby::RubyException& ex) \ { \ ICE_RUBY_RETHROW(ex.ex); \ } \ catch(const ::Ice::LocalException& ex) \ { \ ICE_RUBY_RETHROW(convertLocalException(ex)); \ } \ catch(const ::Ice::Exception& ex) \ { \ string __ice_msg = "unknown Ice exception: " + ex.ice_name(); \ ICE_RUBY_RETHROW(rb_exc_new2(rb_eRuntimeError, __ice_msg.c_str())); \ } \ catch(const std::bad_alloc& ex) \ { \ ICE_RUBY_RETHROW(rb_exc_new2(rb_eNoMemError, ex.what())); \ } \ catch(const std::exception& ex) \ { \ ICE_RUBY_RETHROW(rb_exc_new2(rb_eRuntimeError, ex.what())); \ } \ catch(...) \ { \ ICE_RUBY_RETHROW(rb_exc_new2(rb_eRuntimeError, "caught unknown C++ exception")); \ } #endif Ice-3.5.1/rb/src/IceRuby/Types.cpp0000644000076400007640000023002512223561477014741 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include // // Required for RHASH_SIZE to work properly with Ruby 1.8.x. // T_ZOMBIE is only defined in Ruby 1.9. // #ifndef T_ZOMBIE # include "st.h" #endif #ifndef RHASH_SIZE # define RHASH_SIZE(v) RHASH(v)->tbl->num_entries #endif using namespace std; using namespace IceRuby; using namespace IceUtil; using namespace IceUtilInternal; static VALUE _typeInfoClass, _exceptionInfoClass, _unsetTypeClass; typedef map ClassInfoMap; static ClassInfoMap _classInfoMap; typedef map CompactIdMap; static CompactIdMap _compactIdMap; typedef map ProxyInfoMap; static ProxyInfoMap _proxyInfoMap; typedef map ExceptionInfoMap; static ExceptionInfoMap _exceptionInfoMap; namespace IceRuby { VALUE Unset; class InfoMapDestroyer { public: ~InfoMapDestroyer(); }; static InfoMapDestroyer infoMapDestroyer; class ReadObjectCallback : public Ice::ReadObjectCallback { public: ReadObjectCallback(const ClassInfoPtr&, const UnmarshalCallbackPtr&, VALUE, void*); virtual void invoke(const Ice::ObjectPtr&); private: ClassInfoPtr _info; UnmarshalCallbackPtr _cb; VALUE _target; void* _closure; }; string escapeString(const string& str) { static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789" "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' "; static const set charSet(basicSourceChars.begin(), basicSourceChars.end()); ostringstream out; for(string::const_iterator c = str.begin(); c != str.end(); ++c) { if(charSet.find(*c) == charSet.end()) { unsigned char uc = *c; // char may be signed, so make it positive ostringstream s; s << "\\"; // Print as octal if not in basic source character set s.width(3); s.fill('0'); s << oct; s << static_cast(uc); out << s.str(); } else { out << *c; // Print normally if in basic source character set } } return out.str(); } } // // addClassInfo() // static void addClassInfo(const string& id, const ClassInfoPtr& info) { // // Do not assert. An application may load statically- // translated definitions and then dynamically load // duplicate definitions. // // assert(_classInfoMap.find(id) == _classInfoMap.end()); ClassInfoMap::iterator p = _classInfoMap.find(id); if(p != _classInfoMap.end()) { _classInfoMap.erase(p); } _classInfoMap.insert(ClassInfoMap::value_type(id, info)); } // // addProxyInfo() // static void addProxyInfo(const string& id, const ProxyInfoPtr& info) { // // Do not assert. An application may load statically- // translated definitions and then dynamically load // duplicate definitions. // // assert(_proxyInfoMap.find(id) == _proxyInfoMap.end()); ProxyInfoMap::iterator p = _proxyInfoMap.find(id); if(p != _proxyInfoMap.end()) { _proxyInfoMap.erase(p); } _proxyInfoMap.insert(ProxyInfoMap::value_type(id, info)); } // // lookupProxyInfo() // static IceRuby::ProxyInfoPtr lookupProxyInfo(const string& id) { ProxyInfoMap::iterator p = _proxyInfoMap.find(id); if(p != _proxyInfoMap.end()) { return p->second; } return 0; } // // addExceptionInfo() // static void addExceptionInfo(const string& id, const ExceptionInfoPtr& info) { // // Do not assert. An application may load statically- // translated definitions and then dynamically load // duplicate definitions. // // assert(_exceptionInfoMap.find(id) == _exceptionInfoMap.end()); _exceptionInfoMap.insert(ExceptionInfoMap::value_type(id, info)); } // // SlicedDataUtil implementation // VALUE IceRuby::SlicedDataUtil::_slicedDataType = Qnil; VALUE IceRuby::SlicedDataUtil::_sliceInfoType = Qnil; IceRuby::SlicedDataUtil::SlicedDataUtil() { } IceRuby::SlicedDataUtil::~SlicedDataUtil() { // // Make sure we break any cycles among the ObjectReaders in preserved slices. // for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) { Ice::SlicedDataPtr slicedData = (*p)->getSlicedData(); for(Ice::SliceInfoSeq::const_iterator q = slicedData->slices.begin(); q != slicedData->slices.end(); ++q) { // // Don't just call (*q)->objects.clear(), as releasing references // to the objects could have unexpected side effects. We exchange // the vector into a temporary and then let the temporary fall out // of scope. // vector tmp; tmp.swap((*q)->objects); } } } void IceRuby::SlicedDataUtil::add(const ObjectReaderPtr& reader) { assert(reader->getSlicedData()); _readers.insert(reader); } void IceRuby::SlicedDataUtil::update() { for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) { setMember((*p)->getObject(), (*p)->getSlicedData()); } } void IceRuby::SlicedDataUtil::setMember(VALUE obj, const Ice::SlicedDataPtr& slicedData) { // // Create a Ruby equivalent of the SlicedData object. // assert(slicedData); if(_slicedDataType == Qnil) { _slicedDataType = callRuby(rb_path2class, "Ice::SlicedData"); assert(!NIL_P(_slicedDataType)); } if(_sliceInfoType == Qnil) { _sliceInfoType = callRuby(rb_path2class, "Ice::SliceInfo"); assert(!NIL_P(_sliceInfoType)); } volatile VALUE sd = callRuby(rb_class_new_instance, 0, static_cast(0), _slicedDataType); Ice::Int sz = slicedData->slices.size(); volatile VALUE slices = createArray(sz); callRuby(rb_iv_set, sd, "@slices", slices); // // Translate each SliceInfo object into its Ruby equivalent. // int i = 0; for(vector::const_iterator p = slicedData->slices.begin(); p != slicedData->slices.end(); ++p) { volatile VALUE slice = callRuby(rb_class_new_instance, 0, static_cast(0), _sliceInfoType); RARRAY_PTR(slices)[i++] = slice; // // typeId // volatile VALUE typeId = createString((*p)->typeId); callRuby(rb_iv_set, slice, "@typeId", typeId); // // compactId // volatile VALUE compactId = INT2FIX((*p)->compactId); callRuby(rb_iv_set, slice, "@compactId", compactId); // // bytes // volatile VALUE bytes = callRuby(rb_str_new, reinterpret_cast(&(*p)->bytes[0]), (*p)->bytes.size()); callRuby(rb_iv_set, slice, "@bytes", bytes); // // objects // volatile VALUE objects = createArray((*p)->objects.size()); callRuby(rb_iv_set, slice, "@objects", objects); int j = 0; for(vector::iterator q = (*p)->objects.begin(); q != (*p)->objects.end(); ++q) { // // Each element in the objects list is an instance of ObjectReader that wraps a Ruby object. // assert(*q); ObjectReaderPtr r = ObjectReaderPtr::dynamicCast(*q); assert(r); VALUE o = r->getObject(); assert(o != Qnil); // Should be non-nil. RARRAY_PTR(objects)[j++] = o; } // // hasOptionalMembers // callRuby(rb_iv_set, slice, "@hasOptionalMembers", (*p)->hasOptionalMembers ? Qtrue : Qfalse); // // isLastSlice // callRuby(rb_iv_set, slice, "@isLastSlice", (*p)->isLastSlice ? Qtrue : Qfalse); } callRuby(rb_iv_set, obj, "@_ice_slicedData", sd); } // // Instances of preserved class and exception types may have a data member // named _ice_slicedData which is an instance of the Ruby class Ice::SlicedData. // Ice::SlicedDataPtr IceRuby::SlicedDataUtil::getMember(VALUE obj, ObjectMap* objectMap) { Ice::SlicedDataPtr slicedData; if(callRuby(rb_ivar_defined, obj, rb_intern("@_ice_slicedData")) == Qtrue) { volatile VALUE sd = callRuby(rb_iv_get, obj, "@_ice_slicedData"); if(sd != Qnil) { // // The "slices" member is an array of Ice::SliceInfo objects. // volatile VALUE sl = callRuby(rb_iv_get, sd, "@slices"); assert(TYPE(sl) == T_ARRAY); Ice::SliceInfoSeq slices; long sz = RARRAY_LEN(sl); for(long i = 0; i < sz; ++i) { volatile VALUE s = RARRAY_PTR(sl)[i]; Ice::SliceInfoPtr info = new Ice::SliceInfo; volatile VALUE typeId = callRuby(rb_iv_get, s, "@typeId"); info->typeId = getString(typeId); volatile VALUE compactId = callRuby(rb_iv_get, s, "@compactId"); info->compactId = static_cast(getInteger(compactId)); volatile VALUE bytes = callRuby(rb_iv_get, s, "@bytes"); assert(TYPE(bytes) == T_STRING); const char* str = RSTRING_PTR(bytes); const long len = RSTRING_LEN(bytes); if(str != 0 && len != 0) { vector vtmp(reinterpret_cast(str), reinterpret_cast(str + len)); info->bytes.swap(vtmp); } volatile VALUE objects = callRuby(rb_iv_get, s, "@objects"); assert(TYPE(objects) == T_ARRAY); long osz = RARRAY_LEN(objects); for(long j = 0; j < osz; ++j) { VALUE o = RARRAY_PTR(objects)[j]; Ice::ObjectPtr writer; ObjectMap::iterator i = objectMap->find(o); if(i == objectMap->end()) { writer = new ObjectWriter(o, objectMap); objectMap->insert(ObjectMap::value_type(o, writer)); } else { writer = i->second; } info->objects.push_back(writer); } volatile VALUE hasOptionalMembers = callRuby(rb_iv_get, s, "@hasOptionalMembers"); info->hasOptionalMembers = hasOptionalMembers == Qtrue; volatile VALUE isLastSlice = callRuby(rb_iv_get, s, "@isLastSlice"); info->isLastSlice = isLastSlice == Qtrue; slices.push_back(info); } slicedData = new Ice::SlicedData(slices); } } return slicedData; } // // UnmarshalCallback implementation. // IceRuby::UnmarshalCallback::~UnmarshalCallback() { } // // TypeInfo implementation. // IceRuby::TypeInfo::TypeInfo() { } bool IceRuby::TypeInfo::usesClasses() const { return false; } void IceRuby::TypeInfo::unmarshaled(VALUE, VALUE, void*) { assert(false); } void IceRuby::TypeInfo::destroy() { } // // PrimitiveInfo implementation. // IceRuby::PrimitiveInfo::PrimitiveInfo() { } IceRuby::PrimitiveInfo::PrimitiveInfo(Kind k) : kind(k) { } string IceRuby::PrimitiveInfo::getId() const { switch(kind) { case KindBool: return "bool"; case KindByte: return "byte"; case KindShort: return "short"; case KindInt: return "int"; case KindLong: return "long"; case KindFloat: return "float"; case KindDouble: return "double"; case KindString: return "string"; } assert(false); return string(); } bool IceRuby::PrimitiveInfo::validate(VALUE) { // // Ruby supports type coercion, such that it's technically possible for any // value to be coerced to a primitive type. It would be expensive to perform // this coercion twice, once to validate and again to marshal, so we skip // the validation here. // return true; } bool IceRuby::PrimitiveInfo::variableLength() const { return kind == KindString; } int IceRuby::PrimitiveInfo::wireSize() const { switch(kind) { case KindBool: case KindByte: return 1; case KindShort: return 2; case KindInt: return 4; case KindLong: return 8; case KindFloat: return 4; case KindDouble: return 8; case KindString: return 1; } assert(false); return 0; } Ice::OptionalFormat IceRuby::PrimitiveInfo::optionalFormat() const { switch(kind) { case KindBool: case KindByte: return Ice::OptionalFormatF1; case KindShort: return Ice::OptionalFormatF2; case KindInt: return Ice::OptionalFormatF4; case KindLong: return Ice::OptionalFormatF8; case KindFloat: return Ice::OptionalFormatF4; case KindDouble: return Ice::OptionalFormatF8; case KindString: return Ice::OptionalFormatVSize; } assert(false); return Ice::OptionalFormatF1; } void IceRuby::PrimitiveInfo::marshal(VALUE p, const Ice::OutputStreamPtr& os, ObjectMap*, bool) { switch(kind) { case PrimitiveInfo::KindBool: { os->write(static_cast(RTEST(p))); break; } case PrimitiveInfo::KindByte: { long i = getInteger(p); if(i >= 0 && i <= 255) { os->write(static_cast(i)); break; } throw RubyException(rb_eTypeError, "value is out of range for a byte"); } case PrimitiveInfo::KindShort: { long i = getInteger(p); if(i >= SHRT_MIN && i <= SHRT_MAX) { os->write(static_cast(i)); break; } throw RubyException(rb_eTypeError, "value is out of range for a short"); } case PrimitiveInfo::KindInt: { long i = getInteger(p); if(i >= INT_MIN && i <= INT_MAX) { os->write(static_cast(i)); break; } throw RubyException(rb_eTypeError, "value is out of range for an int"); } case PrimitiveInfo::KindLong: { os->write(getLong(p)); break; } case PrimitiveInfo::KindFloat: { volatile VALUE val = callRuby(rb_Float, p); if(NIL_P(val)) { throw RubyException(rb_eTypeError, "unable to convert value to a float"); } assert(TYPE(val) == T_FLOAT); os->write(static_cast(RFLOAT_VALUE(val))); break; } case PrimitiveInfo::KindDouble: { volatile VALUE val = callRuby(rb_Float, p); if(NIL_P(val)) { throw RubyException(rb_eTypeError, "unable to convert value to a double"); } assert(TYPE(val) == T_FLOAT); os->write(static_cast(RFLOAT_VALUE(val))); break; } case PrimitiveInfo::KindString: { string val = getString(p); os->write(val); break; } } } void IceRuby::PrimitiveInfo::unmarshal(const Ice::InputStreamPtr& is, const UnmarshalCallbackPtr& cb, VALUE target, void* closure, bool) { volatile VALUE val = Qnil; switch(kind) { case PrimitiveInfo::KindBool: { bool b; is->read(b); val = b ? Qtrue : Qfalse; break; } case PrimitiveInfo::KindByte: { Ice::Byte b; is->read(b); val = callRuby(rb_int2inum, b); break; } case PrimitiveInfo::KindShort: { Ice::Short sh; is->read(sh); val = callRuby(rb_int2inum, sh); break; } case PrimitiveInfo::KindInt: { Ice::Int i; is->read(i); val = callRuby(rb_int2inum, i); break; } case PrimitiveInfo::KindLong: { Ice::Long l; is->read(l); val = callRuby(rb_ll2inum, l); break; } case PrimitiveInfo::KindFloat: { Ice::Float f; is->read(f); val = callRuby(rb_float_new, f); break; } case PrimitiveInfo::KindDouble: { Ice::Double d; is->read(d); val = callRuby(rb_float_new, d); break; } case PrimitiveInfo::KindString: { string str; is->read(str); val = createString(str); break; } } cb->unmarshaled(val, target, closure); } void IceRuby::PrimitiveInfo::print(VALUE value, IceUtilInternal::Output& out, PrintObjectHistory*) { switch(kind) { case PrimitiveInfo::KindBool: { out << (RTEST(value) ? "true" : "false"); break; } case PrimitiveInfo::KindByte: case PrimitiveInfo::KindShort: case PrimitiveInfo::KindInt: { out << getInteger(value); break; } case PrimitiveInfo::KindLong: { Ice::Long l = getLong(value); out << IceUtilInternal::int64ToString(l); break; } case PrimitiveInfo::KindFloat: case PrimitiveInfo::KindDouble: { double d = toDouble(value); out << d; break; } case PrimitiveInfo::KindString: { out << "'" << getString(value) << "'"; break; } } } double IceRuby::PrimitiveInfo::toDouble(VALUE v) { volatile VALUE val = callRuby(rb_Float, v); if(NIL_P(val)) { throw RubyException(rb_eTypeError, "unable to convert value to a double"); } assert(TYPE(val) == T_FLOAT); return RFLOAT_VALUE(val); } // // EnumInfo implementation. // namespace { struct EnumDefinitionIterator : public IceRuby::HashIterator { EnumDefinitionIterator() : maxValue(0) { } virtual void element(VALUE key, VALUE value) { const Ice::Int v = static_cast(getInteger(key)); assert(enumerators.find(v) == enumerators.end()); enumerators[v] = value; if(v > maxValue) { maxValue = v; } } Ice::Int maxValue; IceRuby::EnumeratorMap enumerators; }; } IceRuby::EnumInfo::EnumInfo(VALUE ident, VALUE t, VALUE e) : rubyClass(t), maxValue(0) { const_cast(id) = getString(ident); EnumDefinitionIterator iter; hashIterate(e, iter); const_cast(maxValue) = iter.maxValue; const_cast(enumerators) = iter.enumerators; } string IceRuby::EnumInfo::getId() const { return id; } bool IceRuby::EnumInfo::validate(VALUE val) { return callRuby(rb_obj_is_instance_of, val, rubyClass) == Qtrue; } bool IceRuby::EnumInfo::variableLength() const { return true; } int IceRuby::EnumInfo::wireSize() const { return 1; } Ice::OptionalFormat IceRuby::EnumInfo::optionalFormat() const { return Ice::OptionalFormatSize; } void IceRuby::EnumInfo::marshal(VALUE p, const Ice::OutputStreamPtr& os, ObjectMap*, bool) { assert(callRuby(rb_obj_is_instance_of, p, rubyClass) == Qtrue); // validate() should have caught this. // // Validate value. // volatile VALUE val = callRuby(rb_iv_get, p, "@value"); const Ice::Int ival = static_cast(getInteger(val)); if(enumerators.find(ival) == enumerators.end()) { throw RubyException(rb_eRangeError, "invalid enumerator %ld for enum %s", ival, id.c_str()); } os->writeEnum(ival, maxValue); } void IceRuby::EnumInfo::unmarshal(const Ice::InputStreamPtr& is, const UnmarshalCallbackPtr& cb, VALUE target, void* closure, bool) { Ice::Int val = is->readEnum(maxValue); EnumeratorMap::const_iterator p = enumerators.find(val); if(p == enumerators.end()) { ostringstream ostr; ostr << "invalid enumerator " << val << " for enum " << id; throw Ice::MarshalException(__FILE__, __LINE__, ostr.str()); } cb->unmarshaled(p->second, target, closure); } void IceRuby::EnumInfo::print(VALUE value, IceUtilInternal::Output& out, PrintObjectHistory*) { if(!validate(value)) { out << ""; return; } volatile VALUE str = callRuby(rb_funcall, value, rb_intern("inspect"), 0); out << getString(str); } // // DataMember implementation. // void IceRuby::DataMember::unmarshaled(VALUE val, VALUE target, void*) { callRuby(rb_ivar_set, target, rubyID, val); } static void convertDataMembers(VALUE members, DataMemberList& reqMembers, DataMemberList& optMembers, bool allowOptional) { list optList; volatile VALUE arr = callRuby(rb_check_array_type, members); assert(!NIL_P(arr)); for(long i = 0; i < RARRAY_LEN(arr); ++i) { volatile VALUE m = callRuby(rb_check_array_type, RARRAY_PTR(arr)[i]); assert(!NIL_P(m)); assert(RARRAY_LEN(m) == allowOptional ? 4 : 2); DataMemberPtr member = new DataMember; member->name = getString(RARRAY_PTR(m)[0]); member->type = getType(RARRAY_PTR(m)[1]); string s = "@" + member->name; member->rubyID = rb_intern(s.c_str()); if(allowOptional) { member->optional = RTEST(RARRAY_PTR(m)[2]); member->tag = static_cast(getInteger(RARRAY_PTR(m)[3])); } else { member->optional = false; member->tag = 0; } if(member->optional) { optList.push_back(member); } else { reqMembers.push_back(member); } } if(allowOptional) { class SortFn { public: static bool compare(const DataMemberPtr& lhs, const DataMemberPtr& rhs) { return lhs->tag < rhs->tag; } }; optList.sort(SortFn::compare); copy(optList.begin(), optList.end(), back_inserter(optMembers)); } } // // StructInfo implementation. // IceRuby::StructInfo::StructInfo(VALUE ident, VALUE t, VALUE m) : rubyClass(t) { const_cast(id) = getString(ident); DataMemberList opt; convertDataMembers(m, const_cast(members), opt, false); assert(opt.empty()); _variableLength = false; _wireSize = 0; for(DataMemberList::const_iterator p = members.begin(); p != members.end(); ++p) { if(!_variableLength && (*p)->type->variableLength()) { _variableLength = true; } _wireSize += (*p)->type->wireSize(); } } string IceRuby::StructInfo::getId() const { return id; } bool IceRuby::StructInfo::validate(VALUE val) { return callRuby(rb_obj_is_kind_of, val, rubyClass) == Qtrue; } bool IceRuby::StructInfo::variableLength() const { return _variableLength; } int IceRuby::StructInfo::wireSize() const { return _wireSize; } Ice::OptionalFormat IceRuby::StructInfo::optionalFormat() const { return _variableLength ? Ice::OptionalFormatFSize : Ice::OptionalFormatVSize; } bool IceRuby::StructInfo::usesClasses() const { for(DataMemberList::const_iterator p = members.begin(); p != members.end(); ++p) { if((*p)->type->usesClasses()) { return true; } } return false; } void IceRuby::StructInfo::marshal(VALUE p, const Ice::OutputStreamPtr& os, ObjectMap* objectMap, bool optional) { assert(callRuby(rb_obj_is_kind_of, p, rubyClass) == Qtrue); // validate() should have caught this. if(optional) { if(_variableLength) { os->startSize(); } else { os->writeSize(_wireSize); } } for(DataMemberList::const_iterator q = members.begin(); q != members.end(); ++q) { DataMemberPtr member = *q; volatile VALUE val = callRuby(rb_ivar_get, p, member->rubyID); if(!member->type->validate(val)) { throw RubyException(rb_eTypeError, "invalid value for %s member `%s'", const_cast(id.c_str()), member->name.c_str()); } member->type->marshal(val, os, objectMap, false); } if(optional && _variableLength) { os->endSize(); } } void IceRuby::StructInfo::unmarshal(const Ice::InputStreamPtr& is, const UnmarshalCallbackPtr& cb, VALUE target, void* closure, bool optional) { volatile VALUE obj = callRuby(rb_class_new_instance, 0, static_cast(0), rubyClass); if(optional) { if(_variableLength) { is->skip(4); } else { is->skipSize(); } } for(DataMemberList::const_iterator q = members.begin(); q != members.end(); ++q) { DataMemberPtr member = *q; member->type->unmarshal(is, member, obj, 0, false); } cb->unmarshaled(obj, target, closure); } void IceRuby::StructInfo::print(VALUE value, IceUtilInternal::Output& out, PrintObjectHistory* history) { if(!validate(value)) { out << ""; return; } out.sb(); for(DataMemberList::const_iterator q = members.begin(); q != members.end(); ++q) { DataMemberPtr member = *q; out << nl << member->name << " = "; if(callRuby(rb_ivar_defined, value, member->rubyID) == Qfalse) { out << ""; } else { volatile VALUE val = callRuby(rb_ivar_get, value, member->rubyID); member->type->print(val, out, history); } } out.eb(); } void IceRuby::StructInfo::destroy() { for(DataMemberList::const_iterator p = members.begin(); p != members.end(); ++p) { (*p)->type->destroy(); } const_cast(members).clear(); } // // SequenceInfo implementation. // IceRuby::SequenceInfo::SequenceInfo(VALUE ident, VALUE t) { const_cast(id) = getString(ident); const_cast(elementType) = getType(t); } string IceRuby::SequenceInfo::getId() const { return id; } bool IceRuby::SequenceInfo::validate(VALUE val) { // // Accept nil, an array, a string (for sequence), or any object that responds to to_ary. // if(NIL_P(val) || TYPE(val) == T_ARRAY) { return true; } if(TYPE(val) == T_STRING) { PrimitiveInfoPtr pi = PrimitiveInfoPtr::dynamicCast(elementType); if(pi && pi->kind == PrimitiveInfo::KindByte) { return true; } } ID id = rb_intern("to_ary"); return callRuby(rb_respond_to, val, id) != 0; } bool IceRuby::SequenceInfo::variableLength() const { return true; } int IceRuby::SequenceInfo::wireSize() const { return 1; } Ice::OptionalFormat IceRuby::SequenceInfo::optionalFormat() const { return elementType->variableLength() ? Ice::OptionalFormatFSize : Ice::OptionalFormatVSize; } bool IceRuby::SequenceInfo::usesClasses() const { return elementType->usesClasses(); } void IceRuby::SequenceInfo::marshal(VALUE p, const Ice::OutputStreamPtr& os, ObjectMap* objectMap, bool optional) { PrimitiveInfoPtr pi = PrimitiveInfoPtr::dynamicCast(elementType); volatile VALUE arr = Qnil; if(optional) { if(elementType->variableLength()) { os->startSize(); } else if(elementType->wireSize() > 1) { // // Determine the sequence size. // int sz = 0; if(!NIL_P(p)) { if(TYPE(p) == T_ARRAY) { sz = static_cast(RARRAY_LEN(p)); } else { arr = callRuby(rb_Array, p); if(NIL_P(arr)) { throw RubyException(rb_eTypeError, "unable to convert value to an array"); } sz = static_cast(RARRAY_LEN(arr)); } } os->writeSize(sz == 0 ? 1 : sz * elementType->wireSize() + (sz > 254 ? 5 : 1)); } } if(NIL_P(p)) { os->writeSize(0); } else if(pi) { marshalPrimitiveSequence(pi, p, os); } else { if(NIL_P(arr)) { arr = callRuby(rb_Array, p); if(NIL_P(arr)) { throw RubyException(rb_eTypeError, "unable to convert value to an array"); } } long sz = RARRAY_LEN(arr); os->writeSize(static_cast(sz)); for(long i = 0; i < sz; ++i) { if(!elementType->validate(RARRAY_PTR(arr)[i])) { throw RubyException(rb_eTypeError, "invalid value for element %ld of `%s'", i, const_cast(id.c_str())); } elementType->marshal(RARRAY_PTR(arr)[i], os, objectMap, false); } } if(optional && elementType->variableLength()) { os->endSize(); } } void IceRuby::SequenceInfo::unmarshal(const Ice::InputStreamPtr& is, const UnmarshalCallbackPtr& cb, VALUE target, void* closure, bool optional) { if(optional) { if(elementType->variableLength()) { is->skip(4); } else if(elementType->wireSize() > 1) { is->skipSize(); } } PrimitiveInfoPtr pi = PrimitiveInfoPtr::dynamicCast(elementType); if(pi) { unmarshalPrimitiveSequence(pi, is, cb, target, closure); return; } Ice::Int sz = is->readSize(); volatile VALUE arr = createArray(sz); for(Ice::Int i = 0; i < sz; ++i) { void* cl = reinterpret_cast(i); elementType->unmarshal(is, this, arr, cl, false); } cb->unmarshaled(arr, target, closure); } void IceRuby::SequenceInfo::unmarshaled(VALUE val, VALUE target, void* closure) { long i = reinterpret_cast(closure); RARRAY_PTR(target)[i] = val; } void IceRuby::SequenceInfo::print(VALUE value, IceUtilInternal::Output& out, PrintObjectHistory* history) { if(!validate(value)) { out << ""; return; } if(NIL_P(value)) { out << "{}"; } else { if(TYPE(value) == T_STRING) { PrimitiveInfoPtr pi = PrimitiveInfoPtr::dynamicCast(elementType); if(pi && pi->kind == PrimitiveInfo::KindByte) { out << "'" << escapeString(getString(value)) << "'"; return; } } volatile VALUE arr = callRuby(rb_Array, value); if(NIL_P(arr)) { throw RubyException(rb_eTypeError, "unable to convert value to an array"); } long sz = RARRAY_LEN(arr); out.sb(); for(long i = 0; i < sz; ++i) { out << nl << '[' << i << "] = "; elementType->print(RARRAY_PTR(arr)[i], out, history); } out.eb(); } } void IceRuby::SequenceInfo::destroy() { if(elementType) { elementType->destroy(); const_cast(elementType) = 0; } } void IceRuby::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, VALUE p, const Ice::OutputStreamPtr& os) { volatile VALUE arr = Qnil; volatile VALUE str = Qnil; // // Accept a string or an array for sequence. // if(pi->kind == PrimitiveInfo::KindByte) { if(TYPE(p) == T_STRING) { str = p; } else { arr = callRuby(rb_Array, p); if(NIL_P(arr)) { throw RubyException(rb_eTypeError, "argument is not a string or an array"); } } } else { arr = callRuby(rb_Array, p); if(NIL_P(arr)) { throw RubyException(rb_eTypeError, "unable to convert value to an array"); } } switch(pi->kind) { case PrimitiveInfo::KindBool: { long sz = RARRAY_LEN(arr); Ice::BoolSeq seq(sz); for(long i = 0; i < sz; ++i) { seq[i] = RTEST(RARRAY_PTR(arr)[i]); } os->write(seq); break; } case PrimitiveInfo::KindByte: { if(!NIL_P(str)) { const char* s = RSTRING_PTR(str); const long len = RSTRING_LEN(str); if(s == 0 || len == 0) { os->writeSize(0); } else { os->write(reinterpret_cast(s), reinterpret_cast(s + len)); } } else { long sz = RARRAY_LEN(arr); Ice::ByteSeq seq(sz); for(long i = 0; i < sz; ++i) { long val = getInteger(RARRAY_PTR(arr)[i]); if(val < 0 || val > 255) { throw RubyException(rb_eTypeError, "invalid value for element %ld of sequence", i); } seq[i] = static_cast(val); } os->write(&seq[0], &seq[0] + seq.size()); } break; } case PrimitiveInfo::KindShort: { long sz = RARRAY_LEN(arr); Ice::ShortSeq seq(sz); for(long i = 0; i < sz; ++i) { long val = getInteger(RARRAY_PTR(arr)[i]); if(val < SHRT_MIN || val > SHRT_MAX) { throw RubyException(rb_eTypeError, "invalid value for element %ld of sequence", i); } seq[i] = static_cast(val); } os->write(&seq[0], &seq[0] + seq.size()); break; } case PrimitiveInfo::KindInt: { long sz = RARRAY_LEN(arr); Ice::IntSeq seq(sz); for(long i = 0; i < sz; ++i) { long val = getInteger(RARRAY_PTR(arr)[i]); if(val < INT_MIN || val > INT_MAX) { throw RubyException(rb_eTypeError, "invalid value for element %ld of sequence", i); } seq[i] = static_cast(val); } os->write(&seq[0], &seq[0] + seq.size()); break; } case PrimitiveInfo::KindLong: { long sz = RARRAY_LEN(arr); Ice::LongSeq seq(sz); for(long i = 0; i < sz; ++i) { seq[i] = getLong(RARRAY_PTR(arr)[i]); } os->write(&seq[0], &seq[0] + seq.size()); break; } case PrimitiveInfo::KindFloat: { long sz = RARRAY_LEN(arr); Ice::FloatSeq seq(sz); for(long i = 0; i < sz; ++i) { volatile VALUE v = callRuby(rb_Float, RARRAY_PTR(arr)[i]); if(NIL_P(v)) { throw RubyException(rb_eTypeError, "unable to convert array element %ld to a float", i); } assert(TYPE(v) == T_FLOAT); seq[i] = static_cast(RFLOAT_VALUE(v)); } os->write(&seq[0], &seq[0] + seq.size()); break; } case PrimitiveInfo::KindDouble: { long sz = RARRAY_LEN(arr); Ice::DoubleSeq seq(sz); for(long i = 0; i < sz; ++i) { volatile VALUE v = callRuby(rb_Float, RARRAY_PTR(arr)[i]); if(NIL_P(v)) { throw RubyException(rb_eTypeError, "unable to convert array element %ld to a double", i); } assert(TYPE(v) == T_FLOAT); seq[i] = RFLOAT_VALUE(v); } os->write(&seq[0], &seq[0] + seq.size()); break; } case PrimitiveInfo::KindString: { long sz = RARRAY_LEN(arr); Ice::StringSeq seq(sz); for(long i = 0; i < sz; ++i) { seq[i] = getString(RARRAY_PTR(arr)[i]); } os->write(seq, true); break; } } } void IceRuby::SequenceInfo::unmarshalPrimitiveSequence(const PrimitiveInfoPtr& pi, const Ice::InputStreamPtr& is, const UnmarshalCallbackPtr& cb, VALUE target, void* closure) { volatile VALUE result = Qnil; switch(pi->kind) { case PrimitiveInfo::KindBool: { pair p; IceUtil::ScopedArray sa; is->read(p, sa); long sz = static_cast(p.second - p.first); result = createArray(sz); if(sz > 0) { for(long i = 0; i < sz; ++i) { RARRAY_PTR(result)[i] = p.first[i] ? Qtrue : Qfalse; } } break; } case PrimitiveInfo::KindByte: { pair p; is->read(p); result = callRuby(rb_str_new, reinterpret_cast(p.first), static_cast(p.second - p.first)); break; } case PrimitiveInfo::KindShort: { pair p; IceUtil::ScopedArray sa; is->read(p, sa); long sz = static_cast(p.second - p.first); result = createArray(sz); if(sz > 0) { for(long i = 0; i < sz; ++i) { RARRAY_PTR(result)[i] = INT2FIX(p.first[i]); } } break; } case PrimitiveInfo::KindInt: { pair p; IceUtil::ScopedArray sa; is->read(p, sa); long sz = static_cast(p.second - p.first); result = createArray(sz); if(sz > 0) { for(long i = 0; i < sz; ++i) { RARRAY_PTR(result)[i] = INT2FIX(p.first[i]); } } break; } case PrimitiveInfo::KindLong: { pair p; IceUtil::ScopedArray sa; is->read(p, sa); long sz = static_cast(p.second - p.first); result = createArray(sz); if(sz > 0) { for(long i = 0; i < sz; ++i) { RARRAY_PTR(result)[i] = callRuby(rb_ll2inum, p.first[i]); } } break; } case PrimitiveInfo::KindFloat: { pair p; IceUtil::ScopedArray sa; is->read(p, sa); long sz = static_cast(p.second - p.first); result = createArray(sz); if(sz > 0) { for(long i = 0; i < sz; ++i) { RARRAY_PTR(result)[i] = callRuby(rb_float_new, p.first[i]); } } break; } case PrimitiveInfo::KindDouble: { pair p; IceUtil::ScopedArray sa; is->read(p, sa); long sz = static_cast(p.second - p.first); result = createArray(sz); if(sz > 0) { for(long i = 0; i < sz; ++i) { RARRAY_PTR(result)[i] = callRuby(rb_float_new, p.first[i]); } } break; } case PrimitiveInfo::KindString: { Ice::StringSeq seq; is->read(seq, true); long sz = static_cast(seq.size()); result = createArray(sz); if(sz > 0) { for(long i = 0; i < sz; ++i) { RARRAY_PTR(result)[i] = createString(seq[i]); } } break; } } cb->unmarshaled(result, target, closure); } // // DictionaryInfo implementation. // IceRuby::DictionaryInfo::DictionaryInfo(VALUE ident, VALUE kt, VALUE vt) { const_cast(id) = getString(ident); const_cast(keyType) = getType(kt); const_cast(valueType) = getType(vt); _variableLength = keyType->variableLength() || valueType->variableLength(); _wireSize = keyType->wireSize() + valueType->wireSize(); } string IceRuby::DictionaryInfo::getId() const { return id; } bool IceRuby::DictionaryInfo::validate(VALUE val) { // // Accept nil, a hash, or any object that responds to to_hash. // if(NIL_P(val) || TYPE(val) == T_HASH) { return true; } ID id = rb_intern("to_hash"); return callRuby(rb_respond_to, val, id) != 0; } bool IceRuby::DictionaryInfo::variableLength() const { return true; } int IceRuby::DictionaryInfo::wireSize() const { return 1; } Ice::OptionalFormat IceRuby::DictionaryInfo::optionalFormat() const { return _variableLength ? Ice::OptionalFormatFSize : Ice::OptionalFormatVSize; } bool IceRuby::DictionaryInfo::usesClasses() const { return valueType->usesClasses(); } namespace { struct DictionaryMarshalIterator : public IceRuby::HashIterator { DictionaryMarshalIterator(const IceRuby::DictionaryInfoPtr& d, const Ice::OutputStreamPtr o, IceRuby::ObjectMap* m) : dict(d), os(o), objectMap(m) { } virtual void element(VALUE key, VALUE value) { dict->marshalElement(key, value, os, objectMap); } IceRuby::DictionaryInfoPtr dict; Ice::OutputStreamPtr os; IceRuby::ObjectMap* objectMap; }; } void IceRuby::DictionaryInfo::marshal(VALUE p, const Ice::OutputStreamPtr& os, ObjectMap* objectMap, bool optional) { volatile VALUE hash = Qnil; if(!NIL_P(p)) { hash = callRuby(rb_convert_type, p, T_HASH, "Hash", "to_hash"); if(NIL_P(hash)) { throw RubyException(rb_eTypeError, "unable to convert value to a hash"); } } int sz = 0; if(!NIL_P(hash)) { sz = RHASH_SIZE(hash); } if(optional) { if(_variableLength) { os->startSize(); } else { os->writeSize(sz == 0 ? 1 : sz * _wireSize + (sz > 254 ? 5 : 1)); } } if(NIL_P(hash)) { os->writeSize(0); } else { os->writeSize(sz); if(sz > 0) { DictionaryMarshalIterator iter(this, os, objectMap); hashIterate(hash, iter); } } if(optional && _variableLength) { os->endSize(); } } void IceRuby::DictionaryInfo::marshalElement(VALUE key, VALUE value, const Ice::OutputStreamPtr& os, ObjectMap* objectMap) { if(!keyType->validate(key)) { throw RubyException(rb_eTypeError, "invalid key in `%s' element", const_cast(id.c_str())); } if(!valueType->validate(value)) { throw RubyException(rb_eTypeError, "invalid value in `%s' element", const_cast(id.c_str())); } keyType->marshal(key, os, objectMap, false); valueType->marshal(value, os, objectMap, false); } void IceRuby::DictionaryInfo::unmarshal(const Ice::InputStreamPtr& is, const UnmarshalCallbackPtr& cb, VALUE target, void* closure, bool optional) { if(optional) { if(_variableLength) { is->skip(4); } else { is->skipSize(); } } volatile VALUE hash = callRuby(rb_hash_new); KeyCallbackPtr keyCB = new KeyCallback; keyCB->key = Qnil; Ice::Int sz = is->readSize(); for(Ice::Int i = 0; i < sz; ++i) { // // A dictionary key cannot be a class (or contain one), so the key must be // available immediately. // keyType->unmarshal(is, keyCB, Qnil, 0, false); assert(!NIL_P(keyCB->key)); // // The callback will set the dictionary entry with the unmarshaled value, // so we pass it the key. // void* cl = reinterpret_cast(keyCB->key); valueType->unmarshal(is, this, hash, cl, false); } cb->unmarshaled(hash, target, closure); } void IceRuby::DictionaryInfo::unmarshaled(VALUE val, VALUE target, void* closure) { volatile VALUE key = reinterpret_cast(closure); callRuby(rb_hash_aset, target, key, val); } namespace { struct DictionaryPrintIterator : public IceRuby::HashIterator { DictionaryPrintIterator(const DictionaryInfoPtr& d, IceUtilInternal::Output& o, PrintObjectHistory* h) : dict(d), out(o), history(h) { } virtual void element(VALUE key, VALUE value) { dict->printElement(key, value, out, history); } IceRuby::DictionaryInfoPtr dict; IceUtilInternal::Output& out; IceRuby::PrintObjectHistory* history; }; } void IceRuby::DictionaryInfo::print(VALUE value, IceUtilInternal::Output& out, PrintObjectHistory* history) { if(!validate(value)) { out << ""; return; } if(NIL_P(value)) { out << "{}"; } else { volatile VALUE hash = callRuby(rb_convert_type, value, T_HASH, "Hash", "to_hash"); if(NIL_P(hash)) { throw RubyException(rb_eTypeError, "unable to convert value to a hash"); } if(RHASH_SIZE(hash) == 0) { out << "{}"; return; } out.sb(); DictionaryPrintIterator iter(this, out, history); hashIterate(hash, iter); out.eb(); } } void IceRuby::DictionaryInfo::printElement(VALUE key, VALUE value, IceUtilInternal::Output& out, PrintObjectHistory* history) { out << nl << "key = "; keyType->print(key, out, history); out << nl << "value = "; valueType->print(value, out, history); } void IceRuby::DictionaryInfo::KeyCallback::unmarshaled(VALUE val, VALUE, void*) { key = val; } void IceRuby::DictionaryInfo::destroy() { if(keyType) { keyType->destroy(); const_cast(keyType) = 0; } if(valueType) { valueType->destroy(); const_cast(valueType) = 0; } } // // ClassInfo implementation. // IceRuby::ClassInfo::ClassInfo(VALUE ident, bool loc) : compactId(-1), isBase(false), isLocal(loc), isAbstract(false), preserve(false), rubyClass(Qnil), typeObj(Qnil), defined(false) { const_cast(id) = getString(ident); if(isLocal) { const_cast(isBase) = id == "::Ice::LocalObject"; } else { const_cast(isBase) = id == Ice::Object::ice_staticId(); } const_cast(typeObj) = createType(this); } void IceRuby::ClassInfo::define(VALUE t, VALUE compact, VALUE abstr, VALUE pres, VALUE b, VALUE i, VALUE m) { if(!NIL_P(b)) { const_cast(base) = ClassInfoPtr::dynamicCast(getType(b)); assert(base); } const_cast(compactId) = static_cast(getInteger(compact)); const_cast(isAbstract) = RTEST(abstr); const_cast(preserve) = RTEST(pres); long n; volatile VALUE arr; arr = callRuby(rb_check_array_type, i); assert(!NIL_P(arr)); for(n = 0; n < RARRAY_LEN(arr); ++n) { ClassInfoPtr iface = ClassInfoPtr::dynamicCast(getType(RARRAY_PTR(arr)[n])); assert(iface); const_cast(interfaces).push_back(iface); } convertDataMembers(m, const_cast(members), const_cast(optionalMembers), true); const_cast(rubyClass) = t; const_cast(defined) = true; } string IceRuby::ClassInfo::getId() const { return id; } bool IceRuby::ClassInfo::validate(VALUE val) { if(NIL_P(val)) { return true; } // // We consider an object to be an instance of this class if its class contains // an ICE_TYPE constant that refers to this class, or a subclass of this class. // volatile VALUE cls = CLASS_OF(val); volatile VALUE type = Qnil; try { type = callRuby(rb_const_get, cls, rb_intern("ICE_TYPE")); } catch(const RubyException& ex) { if(callRuby(rb_obj_is_instance_of, ex.ex, rb_eNameError) == Qtrue) { // // The ICE_TYPE constant will be missing from an instance of LocalObject // if it does not implement a user-defined type. This means the user // could potentially pass any kind of object; there isn't much we can do // since LocalObject maps to the base object type. // return id == "::Ice::LocalObject"; } else { throw; } } assert(!NIL_P(type)); ClassInfoPtr info = ClassInfoPtr::dynamicCast(getType(type)); assert(info); return info->isA(this); } bool IceRuby::ClassInfo::variableLength() const { return true; } int IceRuby::ClassInfo::wireSize() const { return 1; } Ice::OptionalFormat IceRuby::ClassInfo::optionalFormat() const { return Ice::OptionalFormatClass; } bool IceRuby::ClassInfo::usesClasses() const { return true; } void IceRuby::ClassInfo::marshal(VALUE p, const Ice::OutputStreamPtr& os, ObjectMap* objectMap, bool) { if(!defined) { throw RubyException(rb_eRuntimeError, "class %s is declared but not defined", id.c_str()); } if(NIL_P(p)) { os->writeObject(0); return; } // // Ice::ObjectWriter is a subclass of Ice::Object that wraps a Ruby object for marshaling. // It is possible that this Ruby object has already been marshaled, therefore we first must // check the object map to see if this object is present. If so, we use the existing ObjectWriter, // otherwise we create a new one. // Ice::ObjectPtr writer; assert(objectMap); ObjectMap::iterator q = objectMap->find(p); if(q == objectMap->end()) { writer = new ObjectWriter(p, objectMap); objectMap->insert(ObjectMap::value_type(p, writer)); } else { writer = q->second; } // // Give the writer to the stream. The stream will eventually call write() on it. // os->writeObject(writer); } void IceRuby::ClassInfo::unmarshal(const Ice::InputStreamPtr& is, const UnmarshalCallbackPtr& cb, VALUE target, void* closure, bool) { if(!defined) { throw RubyException(rb_eRuntimeError, "class %s is declared but not defined", id.c_str()); } is->readObject(new ReadObjectCallback(this, cb, target, closure)); } void IceRuby::ClassInfo::print(VALUE value, IceUtilInternal::Output& out, PrintObjectHistory* history) { if(!validate(value)) { out << ""; return; } if(NIL_P(value)) { out << ""; } else { map::iterator q = history->objects.find(value); if(q != history->objects.end()) { out << "second << ">"; } else { volatile VALUE cls = CLASS_OF(value); volatile VALUE type = Qnil; ClassInfoPtr info; try { type = callRuby(rb_const_get, cls, rb_intern("ICE_TYPE")); info = ClassInfoPtr::dynamicCast(getType(type)); } catch(const RubyException& ex) { if(callRuby(rb_obj_is_instance_of, ex.ex, rb_eNameError) == Qtrue) { // // The ICE_TYPE constant will be missing from an instance of LocalObject // if it does not implement a user-defined type. This means the user // could potentially pass any kind of object; there isn't much we can do // since LocalObject maps to the base object type. // if(id == "::Ice::LocalObject") { info = this; } else { out << ""; return; } } else { throw; } } assert(info); out << "object #" << history->index << " (" << info->id << ')'; history->objects.insert(map::value_type(value, history->index)); ++history->index; out.sb(); info->printMembers(value, out, history); out.eb(); } } } void IceRuby::ClassInfo::destroy() { const_cast(base) = 0; const_cast(interfaces).clear(); if(!members.empty()) { DataMemberList ml = members; const_cast(members).clear(); for(DataMemberList::iterator p = ml.begin(); p != ml.end(); ++p) { (*p)->type->destroy(); } } } void IceRuby::ClassInfo::printMembers(VALUE value, IceUtilInternal::Output& out, PrintObjectHistory* history) { if(base) { base->printMembers(value, out, history); } DataMemberList::const_iterator q; for(q = members.begin(); q != members.end(); ++q) { DataMemberPtr member = *q; out << nl << member->name << " = "; if(callRuby(rb_ivar_defined, value, member->rubyID) == Qfalse) { out << ""; } else { volatile VALUE val = callRuby(rb_ivar_get, value, member->rubyID); member->type->print(val, out, history); } } for(q = optionalMembers.begin(); q != optionalMembers.end(); ++q) { DataMemberPtr member = *q; out << nl << member->name << " = "; if(callRuby(rb_ivar_defined, value, member->rubyID) == Qfalse) { out << ""; } else { volatile VALUE val = callRuby(rb_ivar_get, value, member->rubyID); if(val == Unset) { out << ""; } else { member->type->print(val, out, history); } } } } bool IceRuby::ClassInfo::isA(const ClassInfoPtr& info) { // // Return true if this class has an is-a relationship with info. // if(info->isBase && isLocal == info->isLocal) { return true; } else if(this == info.get()) { return true; } else if(base && base->isA(info)) { return true; } else if(!interfaces.empty()) { for(ClassInfoList::const_iterator p = interfaces.begin(); p != interfaces.end(); ++p) { if((*p)->isA(info)) { return true; } } } return false; } // // ProxyInfo implementation. // IceRuby::ProxyInfo::ProxyInfo(VALUE ident) : rubyClass(Qnil), typeObj(Qnil) { const_cast(id) = getString(ident); const_cast(typeObj) = createType(this); } void IceRuby::ProxyInfo::define(VALUE t, VALUE i) { const_cast(rubyClass) = t; const_cast(classInfo) = ClassInfoPtr::dynamicCast(getType(i)); assert(classInfo); } string IceRuby::ProxyInfo::getId() const { return id; } bool IceRuby::ProxyInfo::validate(VALUE val) { if(!NIL_P(val)) { if(!checkProxy(val)) { return false; } volatile VALUE cls = CLASS_OF(val); volatile VALUE type = callRuby(rb_const_get, cls, rb_intern("ICE_TYPE")); assert(!NIL_P(type)); ProxyInfoPtr info = ProxyInfoPtr::dynamicCast(getType(type)); assert(info); return info->classInfo->isA(classInfo); } return true; } bool IceRuby::ProxyInfo::variableLength() const { return true; } int IceRuby::ProxyInfo::wireSize() const { return 1; } Ice::OptionalFormat IceRuby::ProxyInfo::optionalFormat() const { return Ice::OptionalFormatFSize; } void IceRuby::ProxyInfo::marshal(VALUE p, const Ice::OutputStreamPtr& os, ObjectMap*, bool optional) { if(optional) { os->startSize(); } if(NIL_P(p)) { os->write(Ice::ObjectPrx()); } else { assert(checkProxy(p)); // validate() should have caught this. os->write(getProxy(p)); } if(optional) { os->endSize(); } } void IceRuby::ProxyInfo::unmarshal(const Ice::InputStreamPtr& is, const UnmarshalCallbackPtr& cb, VALUE target, void* closure, bool optional) { if(optional) { is->skip(4); } Ice::ObjectPrx proxy; is->read(proxy); if(!proxy) { cb->unmarshaled(Qnil, target, closure); return; } if(NIL_P(rubyClass)) { throw RubyException(rb_eRuntimeError, "class %s is declared but not defined", id.c_str()); } volatile VALUE p = createProxy(proxy, rubyClass); cb->unmarshaled(p, target, closure); } void IceRuby::ProxyInfo::print(VALUE value, IceUtilInternal::Output& out, PrintObjectHistory*) { if(!validate(value)) { out << ""; return; } if(NIL_P(value)) { out << ""; } else { out << getString(value); } } void IceRuby::ProxyInfo::destroy() { const_cast(classInfo) = 0; } // // ObjectWriter implementation. // IceRuby::ObjectWriter::ObjectWriter(VALUE object, ObjectMap* objectMap) : _object(object), _map(objectMap) { volatile VALUE cls = CLASS_OF(object); volatile VALUE type = callRuby(rb_const_get, cls, rb_intern("ICE_TYPE")); assert(!NIL_P(type)); _info = ClassInfoPtr::dynamicCast(getType(type)); assert(_info); } void IceRuby::ObjectWriter::ice_preMarshal() { ID id = rb_intern("ice_preMarshal"); if(callRuby(rb_respond_to, _object, id)) { callRuby(rb_funcall, _object, id, 0); } } void IceRuby::ObjectWriter::write(const Ice::OutputStreamPtr& os) const { Ice::SlicedDataPtr slicedData; if(_info->preserve) { // // Retrieve the SlicedData object that we stored as a hidden member of the Ruby object. // slicedData = SlicedDataUtil::getMember(_object, const_cast(_map)); } os->startObject(slicedData); if(_info->id != "::Ice::UnknownSlicedObject") { ClassInfoPtr info = _info; while(info) { os->startSlice(info->id, info->compactId, !info->base); writeMembers(os, info->members); writeMembers(os, info->optionalMembers); // The optional members have already been sorted by tag. os->endSlice(); info = info->base; } } os->endObject(); } void IceRuby::ObjectWriter::writeMembers(const Ice::OutputStreamPtr& os, const DataMemberList& members) const { for(DataMemberList::const_iterator q = members.begin(); q != members.end(); ++q) { DataMemberPtr member = *q; volatile VALUE val = callRuby(rb_ivar_get, _object, member->rubyID); if(member->optional && (val == Unset || !os->writeOptional(member->tag, member->type->optionalFormat()))) { continue; } if(!member->type->validate(val)) { throw RubyException(rb_eTypeError, "invalid value for %s member `%s'", _info->id.c_str(), member->name.c_str()); } member->type->marshal(val, os, _map, member->optional); } } // // ObjectReader implementation. // IceRuby::ObjectReader::ObjectReader(VALUE object, const ClassInfoPtr& info) : _object(object), _info(info) { } void IceRuby::ObjectReader::ice_postUnmarshal() { ID id = rb_intern("ice_postUnmarshal"); if(callRuby(rb_respond_to, _object, id)) { callRuby(rb_funcall, _object, id, 0); } } void IceRuby::ObjectReader::read(const Ice::InputStreamPtr& is) { is->startObject(); const bool unknown = _info->id == "::Ice::UnknownSlicedObject"; // // Unmarshal the slices of a user-defined class. // if(!unknown && _info->id != Ice::Object::ice_staticId()) { ClassInfoPtr info = _info; while(info) { is->startSlice(); DataMemberList::const_iterator p; for(p = info->members.begin(); p != info->members.end(); ++p) { DataMemberPtr member = *p; member->type->unmarshal(is, member, _object, 0, false); } // // The optional members have already been sorted by tag. // for(p = info->optionalMembers.begin(); p != info->optionalMembers.end(); ++p) { DataMemberPtr member = *p; if(is->readOptional(member->tag, member->type->optionalFormat())) { member->type->unmarshal(is, member, _object, 0, true); } else { callRuby(rb_ivar_set, _object, member->rubyID, Unset); } } is->endSlice(); info = info->base; } } _slicedData = is->endObject(_info->preserve); if(_slicedData) { SlicedDataUtil* util = reinterpret_cast(is->closure()); assert(util); util->add(this); // // Define the "unknownTypeId" member for an instance of UnknownSlicedObject. // if(unknown) { assert(!_slicedData->slices.empty()); volatile VALUE typeId = createString(_slicedData->slices[0]->typeId); callRuby(rb_iv_set, _object, "@unknownTypeId", typeId); } } } ClassInfoPtr IceRuby::ObjectReader::getInfo() const { return _info; } VALUE IceRuby::ObjectReader::getObject() const { return _object; } Ice::SlicedDataPtr IceRuby::ObjectReader::getSlicedData() const { return _slicedData; } // // InfoMapDestroyer implementation. // IceRuby::InfoMapDestroyer::~InfoMapDestroyer() { { for(ProxyInfoMap::iterator p = _proxyInfoMap.begin(); p != _proxyInfoMap.end(); ++p) { p->second->destroy(); } } { for(ClassInfoMap::iterator p = _classInfoMap.begin(); p != _classInfoMap.end(); ++p) { p->second->destroy(); } } _compactIdMap.clear(); _exceptionInfoMap.clear(); } // // ReadObjectCallback implementation. // IceRuby::ReadObjectCallback::ReadObjectCallback(const ClassInfoPtr& info, const UnmarshalCallbackPtr& cb, VALUE target, void* closure) : _info(info), _cb(cb), _target(target), _closure(closure) { } void IceRuby::ReadObjectCallback::invoke(const Ice::ObjectPtr& p) { if(p) { ObjectReaderPtr reader = ObjectReaderPtr::dynamicCast(p); assert(reader); // // Verify that the unmarshaled object is compatible with the formal type. // volatile VALUE obj = reader->getObject(); if(!_info->validate(obj)) { Ice::UnexpectedObjectException ex(__FILE__, __LINE__); ex.reason = "unmarshaled object is not an instance of " + _info->id; ex.type = reader->getInfo()->getId(); ex.expectedType = _info->id; throw ex; } _cb->unmarshaled(obj, _target, _closure); } else { _cb->unmarshaled(Qnil, _target, _closure); } } // // ExceptionInfo implementation. // VALUE IceRuby::ExceptionInfo::unmarshal(const Ice::InputStreamPtr& is) { volatile VALUE obj = callRuby(rb_class_new_instance, 0, static_cast(0), rubyClass); ExceptionInfoPtr info = this; while(info) { is->startSlice(); DataMemberList::iterator q; for(q = info->members.begin(); q != info->members.end(); ++q) { DataMemberPtr member = *q; member->type->unmarshal(is, member, obj, 0, false); } // // The optional members have already been sorted by tag. // for(q = info->optionalMembers.begin(); q != info->optionalMembers.end(); ++q) { DataMemberPtr member = *q; if(is->readOptional(member->tag, member->type->optionalFormat())) { member->type->unmarshal(is, member, obj, 0, true); } else { callRuby(rb_ivar_set, obj, member->rubyID, Unset); } } is->endSlice(); info = info->base; } return obj; } void IceRuby::ExceptionInfo::print(VALUE value, IceUtilInternal::Output& out) { if(callRuby(rb_obj_is_kind_of, value, rubyClass) == Qfalse) { out << ""; return; } PrintObjectHistory history; history.index = 0; out << "exception " << id; out.sb(); printMembers(value, out, &history); out.eb(); } void IceRuby::ExceptionInfo::printMembers(VALUE value, IceUtilInternal::Output& out, PrintObjectHistory* history) { if(base) { base->printMembers(value, out, history); } DataMemberList::const_iterator q; for(q = members.begin(); q != members.end(); ++q) { DataMemberPtr member = *q; out << nl << member->name << " = "; if(callRuby(rb_ivar_defined, value, member->rubyID) == Qfalse) { out << ""; } else { volatile VALUE val = callRuby(rb_ivar_get, value, member->rubyID); member->type->print(val, out, history); } } for(q = optionalMembers.begin(); q != optionalMembers.end(); ++q) { DataMemberPtr member = *q; out << nl << member->name << " = "; if(callRuby(rb_ivar_defined, value, member->rubyID) == Qfalse) { out << ""; } else { volatile VALUE val = callRuby(rb_ivar_get, value, member->rubyID); if(val == Unset) { out << ""; } else { member->type->print(val, out, history); } } } } // // ExceptionReader implementation. // IceRuby::ExceptionReader::ExceptionReader(const Ice::CommunicatorPtr& communicator, const ExceptionInfoPtr& info) : Ice::UserExceptionReader(communicator), _info(info) { } IceRuby::ExceptionReader::~ExceptionReader() throw() { } void IceRuby::ExceptionReader::read(const Ice::InputStreamPtr& is) const { is->startException(); const_cast(_ex) = _info->unmarshal(is); const_cast(_slicedData) = is->endException(_info->preserve); } bool IceRuby::ExceptionReader::usesClasses() const { return _info->usesClasses; } string IceRuby::ExceptionReader::ice_name() const { return _info->id; } Ice::UserException* IceRuby::ExceptionReader::ice_clone() const { assert(false); return 0; } void IceRuby::ExceptionReader::ice_throw() const { throw *this; } VALUE IceRuby::ExceptionReader::getException() const { return _ex; } Ice::SlicedDataPtr IceRuby::ExceptionReader::getSlicedData() const { return _slicedData; } // // IdResolver // string IceRuby::IdResolver::resolve(Ice::Int id) const { CompactIdMap::iterator p = _compactIdMap.find(id); if(p != _compactIdMap.end()) { return p->second->id; } return string(); } extern "C" VALUE IceRuby_defineEnum(VALUE /*self*/, VALUE id, VALUE type, VALUE enumerators) { ICE_RUBY_TRY { EnumInfoPtr info = new EnumInfo(id, type, enumerators); return createType(info); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_defineStruct(VALUE /*self*/, VALUE id, VALUE type, VALUE members) { ICE_RUBY_TRY { StructInfoPtr info = new StructInfo(id, type, members); return createType(info); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_defineSequence(VALUE /*self*/, VALUE id, VALUE elementType) { ICE_RUBY_TRY { SequenceInfoPtr info = new SequenceInfo(id, elementType); return createType(info); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_defineDictionary(VALUE /*self*/, VALUE id, VALUE keyType, VALUE valueType) { ICE_RUBY_TRY { DictionaryInfoPtr info = new DictionaryInfo(id, keyType, valueType); return createType(info); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_declareProxy(VALUE /*self*/, VALUE id) { ICE_RUBY_TRY { string proxyId = getString(id); proxyId += "Prx"; ProxyInfoPtr info = lookupProxyInfo(proxyId); if(!info) { info = new ProxyInfo(id); addProxyInfo(proxyId, info); } return info->typeObj; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_declareClass(VALUE /*self*/, VALUE id) { ICE_RUBY_TRY { string idstr = getString(id); ClassInfoPtr info = lookupClassInfo(idstr); if(!info) { info = new ClassInfo(id, false); addClassInfo(idstr, info); } return info->typeObj; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_declareLocalClass(VALUE /*self*/, VALUE id) { ICE_RUBY_TRY { string idstr = getString(id); ClassInfoPtr info = lookupClassInfo(idstr); if(!info) { info = new ClassInfo(id, true); addClassInfo(idstr, info); } return info->typeObj; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_defineException(VALUE /*self*/, VALUE id, VALUE type, VALUE preserve, VALUE base, VALUE members) { ICE_RUBY_TRY { ExceptionInfoPtr info = new ExceptionInfo; info->id = getString(id); info->preserve = preserve == Qtrue; if(!NIL_P(base)) { info->base = ExceptionInfoPtr::dynamicCast(getException(base)); assert(info->base); } convertDataMembers(members, info->members, info->optionalMembers, true); info->usesClasses = false; // // Only examine the required members to see if any use classes. // for(DataMemberList::iterator p = info->members.begin(); p != info->members.end(); ++p) { if(!info->usesClasses) { info->usesClasses = (*p)->type->usesClasses(); } } info->rubyClass = type; addExceptionInfo(info->id, info); return createException(info); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_TypeInfo_defineProxy(VALUE self, VALUE type, VALUE classInfo) { ICE_RUBY_TRY { ProxyInfoPtr info = ProxyInfoPtr::dynamicCast(getType(self)); assert(info); info->define(type, classInfo); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_TypeInfo_defineClass(VALUE self, VALUE type, VALUE compactId, VALUE isAbstract, VALUE preserve, VALUE base, VALUE interfaces, VALUE members) { ICE_RUBY_TRY { ClassInfoPtr info = ClassInfoPtr::dynamicCast(getType(self)); assert(info); info->define(type, compactId, isAbstract, preserve, base, interfaces, members); CompactIdMap::iterator q = _compactIdMap.find(info->compactId); if(q != _compactIdMap.end()) { _compactIdMap.erase(q); } _compactIdMap.insert(CompactIdMap::value_type(info->compactId, info)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_stringify(VALUE /*self*/, VALUE obj, VALUE type) { ICE_RUBY_TRY { TypeInfoPtr info = getType(type); ostringstream ostr; IceUtilInternal::Output out(ostr); PrintObjectHistory history; history.index = 0; info->print(obj, out, &history); string str = ostr.str(); return createString(str); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_stringifyException(VALUE /*self*/, VALUE ex) { ICE_RUBY_TRY { volatile VALUE cls = CLASS_OF(ex); volatile VALUE type = callRuby(rb_const_get, cls, rb_intern("ICE_TYPE")); ExceptionInfoPtr info = getException(type); ostringstream ostr; IceUtilInternal::Output out(ostr); info->print(ex, out); string str = ostr.str(); return createString(str); } ICE_RUBY_CATCH return Qnil; } // // lookupClassInfo() // IceRuby::ClassInfoPtr IceRuby::lookupClassInfo(const string& id) { ClassInfoMap::iterator p = _classInfoMap.find(id); if(p != _classInfoMap.end()) { return p->second; } return 0; } // // lookupExceptionInfo() // IceRuby::ExceptionInfoPtr IceRuby::lookupExceptionInfo(const string& id) { ExceptionInfoMap::iterator p = _exceptionInfoMap.find(id); if(p != _exceptionInfoMap.end()) { return p->second; } return 0; } bool IceRuby::initTypes(VALUE iceModule) { // // Define a class to represent TypeInfo, and another to represent ExceptionInfo. // _typeInfoClass = rb_define_class_under(iceModule, "Internal_TypeInfo", rb_cObject); _exceptionInfoClass = rb_define_class_under(iceModule, "Internal_ExceptionInfo", rb_cObject); rb_define_const(iceModule, "T_bool", createType(new PrimitiveInfo(PrimitiveInfo::KindBool))); rb_define_const(iceModule, "T_byte", createType(new PrimitiveInfo(PrimitiveInfo::KindByte))); rb_define_const(iceModule, "T_short", createType(new PrimitiveInfo(PrimitiveInfo::KindShort))); rb_define_const(iceModule, "T_int", createType(new PrimitiveInfo(PrimitiveInfo::KindInt))); rb_define_const(iceModule, "T_long", createType(new PrimitiveInfo(PrimitiveInfo::KindLong))); rb_define_const(iceModule, "T_float", createType(new PrimitiveInfo(PrimitiveInfo::KindFloat))); rb_define_const(iceModule, "T_double", createType(new PrimitiveInfo(PrimitiveInfo::KindDouble))); rb_define_const(iceModule, "T_string", createType(new PrimitiveInfo(PrimitiveInfo::KindString))); rb_define_module_function(iceModule, "__defineEnum", CAST_METHOD(IceRuby_defineEnum), 3); rb_define_module_function(iceModule, "__defineStruct", CAST_METHOD(IceRuby_defineStruct), 3); rb_define_module_function(iceModule, "__defineSequence", CAST_METHOD(IceRuby_defineSequence), 2); rb_define_module_function(iceModule, "__defineDictionary", CAST_METHOD(IceRuby_defineDictionary), 3); rb_define_module_function(iceModule, "__declareProxy", CAST_METHOD(IceRuby_declareProxy), 1); rb_define_module_function(iceModule, "__declareClass", CAST_METHOD(IceRuby_declareClass), 1); rb_define_module_function(iceModule, "__declareLocalClass", CAST_METHOD(IceRuby_declareLocalClass), 1); rb_define_module_function(iceModule, "__defineException", CAST_METHOD(IceRuby_defineException), 5); rb_define_method(_typeInfoClass, "defineClass", CAST_METHOD(IceRuby_TypeInfo_defineClass), 7); rb_define_method(_typeInfoClass, "defineProxy", CAST_METHOD(IceRuby_TypeInfo_defineProxy), 2); rb_define_module_function(iceModule, "__stringify", CAST_METHOD(IceRuby_stringify), 2); rb_define_module_function(iceModule, "__stringifyException", CAST_METHOD(IceRuby_stringifyException), 1); _unsetTypeClass = rb_define_class_under(iceModule, "Internal_UnsetType", rb_cObject); Unset = callRuby(rb_class_new_instance, 0, static_cast(0), _unsetTypeClass); rb_define_const(iceModule, "Unset", Unset); return true; } IceRuby::TypeInfoPtr IceRuby::getType(VALUE obj) { assert(TYPE(obj) == T_DATA); assert(rb_obj_is_instance_of(obj, _typeInfoClass) == Qtrue); TypeInfoPtr* p = reinterpret_cast(DATA_PTR(obj)); return *p; } extern "C" void IceRuby_TypeInfo_free(TypeInfoPtr* p) { delete p; } VALUE IceRuby::createType(const TypeInfoPtr& info) { return Data_Wrap_Struct(_typeInfoClass, 0, IceRuby_TypeInfo_free, new TypeInfoPtr(info)); } IceRuby::ExceptionInfoPtr IceRuby::getException(VALUE obj) { assert(TYPE(obj) == T_DATA); assert(rb_obj_is_instance_of(obj, _exceptionInfoClass) == Qtrue); ExceptionInfoPtr* p = reinterpret_cast(DATA_PTR(obj)); return *p; } extern "C" void IceRuby_ExceptionInfo_free(ExceptionInfoPtr* p) { delete p; } VALUE IceRuby::createException(const ExceptionInfoPtr& info) { return Data_Wrap_Struct(_exceptionInfoClass, 0, IceRuby_ExceptionInfo_free, new ExceptionInfoPtr(info)); } Ice-3.5.1/rb/src/IceRuby/ImplicitContext.cpp0000644000076400007640000000722612223561477016761 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace IceRuby; static VALUE _implicitContextClass; extern "C" void IceRuby_ImplicitContext_free(Ice::ImplicitContextPtr* p) { assert(p); delete p; } extern "C" VALUE IceRuby_ImplicitContext_getContext(VALUE self) { ICE_RUBY_TRY { Ice::ImplicitContextPtr p = getImplicitContext(self); return contextToHash(p->getContext()); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ImplicitContext_setContext(VALUE self, VALUE context) { ICE_RUBY_TRY { Ice::Context ctx; if(!hashToContext(context, ctx)) { throw RubyException(rb_eTypeError, "argument must be a hash"); } Ice::ImplicitContextPtr p = getImplicitContext(self); p->setContext(ctx); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ImplicitContext_containsKey(VALUE self, VALUE key) { ICE_RUBY_TRY { Ice::ImplicitContextPtr p = getImplicitContext(self); string k = getString(key); if(p->containsKey(k)) { return Qtrue; } else { return Qfalse; } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ImplicitContext_get(VALUE self, VALUE key) { ICE_RUBY_TRY { Ice::ImplicitContextPtr p = getImplicitContext(self); string k = getString(key); string v = p->get(k); return createString(v); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ImplicitContext_put(VALUE self, VALUE key, VALUE value) { ICE_RUBY_TRY { Ice::ImplicitContextPtr p = getImplicitContext(self); string k = getString(key); string v = getString(value); return createString(p->put(k, v)); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_ImplicitContext_remove(VALUE self, VALUE key) { ICE_RUBY_TRY { Ice::ImplicitContextPtr p = getImplicitContext(self); string k = getString(key); return createString(p->remove(k)); } ICE_RUBY_CATCH return Qnil; } void IceRuby::initImplicitContext(VALUE iceModule) { _implicitContextClass = rb_define_class_under(iceModule, "ImplicitContextI", rb_cObject); rb_define_method(_implicitContextClass, "getContext", CAST_METHOD(IceRuby_ImplicitContext_getContext), 0); rb_define_method(_implicitContextClass, "setContext", CAST_METHOD(IceRuby_ImplicitContext_setContext), 1); rb_define_method(_implicitContextClass, "containsKey", CAST_METHOD(IceRuby_ImplicitContext_containsKey), 1); rb_define_method(_implicitContextClass, "get", CAST_METHOD(IceRuby_ImplicitContext_get), 1); rb_define_method(_implicitContextClass, "put", CAST_METHOD(IceRuby_ImplicitContext_put), 2); rb_define_method(_implicitContextClass, "remove", CAST_METHOD(IceRuby_ImplicitContext_remove), 1); } Ice::ImplicitContextPtr IceRuby::getImplicitContext(VALUE v) { Ice::ImplicitContextPtr* p = reinterpret_cast(DATA_PTR(v)); assert(p); return *p; } VALUE IceRuby::createImplicitContext(const Ice::ImplicitContextPtr& p) { return Data_Wrap_Struct(_implicitContextClass, 0, IceRuby_ImplicitContext_free, new Ice::ImplicitContextPtr(p)); } Ice-3.5.1/rb/src/IceRuby/Makefile0000644000076400007640000000260212223561477014567 0ustar mesmes# ********************************************************************** # # 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 mkrblibfilename,IceRuby,$(VERSION)) SONAME = $(call mkrbsoname,IceRuby,$(SOVERSION)) LIBNAME = $(call mkrblibname,IceRuby) TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME)) OBJS = Connection.o \ Communicator.o \ Endpoint.o \ Init.o \ ImplicitContext.o \ Logger.o \ ObjectFactory.o \ Operation.o \ Properties.o \ Proxy.o \ Slice.o \ Types.o \ Util.o SRCS = $(OBJS:.o=.cpp) include $(top_srcdir)/config/Make.rules CPPFLAGS := -I. -I.. $(CPPFLAGS) $(ICE_FLAGS) $(RUBY_FLAGS) LINKWITH := -L"$(libdir)" $(ICE_LIBS) $(RUBY_LIBS) $(CXXLIBS) $(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) $@ install:: all $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME)) #include .depend Ice-3.5.1/rb/src/IceRuby/Slice.cpp0000644000076400007640000001243212223561477014674 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace IceRuby; using namespace Slice; using namespace Slice::Ruby; extern "C" VALUE IceRuby_loadSlice(int argc, VALUE* argv, VALUE self) { ICE_RUBY_TRY { if(argc < 1 || argc > 2) { throw RubyException(rb_eArgError, "wrong number of arguments"); } string cmd = getString(argv[0]); vector argSeq; try { argSeq = IceUtilInternal::Options::split(cmd); } catch(const IceUtilInternal::BadOptException& ex) { throw RubyException(rb_eArgError, "error in Slice options: %s", ex.reason.c_str()); } catch(const IceUtilInternal::APIException& ex) { throw RubyException(rb_eArgError, "error in Slice options: %s", ex.reason.c_str()); } if(argc > 1) { if(!arrayToStringSeq(argv[1], argSeq)) { throw RubyException(rb_eTypeError, "argument 2 is not an array"); } } IceUtilInternal::Options opts; opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("I", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("d", "debug"); opts.addOpt("", "ice"); opts.addOpt("", "underscore"); opts.addOpt("", "checksum"); opts.addOpt("", "all"); vector files; try { argSeq.insert(argSeq.begin(), ""); // dummy argv[0] files = opts.parse(argSeq); if(files.empty()) { throw RubyException(rb_eArgError, "no Slice files specified in `%s'", cmd.c_str()); } } catch(const IceUtilInternal::BadOptException& ex) { throw RubyException(rb_eArgError, "error in Slice options: %s", ex.reason.c_str()); } catch(const IceUtilInternal::APIException& ex) { throw RubyException(rb_eArgError, "error in Slice options: %s", ex.reason.c_str()); } vector cppArgs; vector includePaths; bool debug = false; bool ice = true; // This must be true so that we can create Ice::Identity when necessary. bool underscore = opts.isSet("underscore"); bool all = false; bool checksum = false; if(opts.isSet("D")) { vector optargs = opts.argVec("D"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { cppArgs.push_back("-D" + *i); } } if(opts.isSet("U")) { vector optargs = opts.argVec("U"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { cppArgs.push_back("-U" + *i); } } if(opts.isSet("I")) { includePaths = opts.argVec("I"); for(vector::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i) { cppArgs.push_back("-I" + *i); } } debug = opts.isSet("d") || opts.isSet("debug"); all = opts.isSet("all"); checksum = opts.isSet("checksum"); bool ignoreRedefs = false; for(vector::const_iterator p = files.begin(); p != files.end(); ++p) { string file = *p; Slice::PreprocessorPtr icecpp = Slice::Preprocessor::create("icecpp", file, cppArgs); FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2RB__"); if(cppHandle == 0) { throw RubyException(rb_eArgError, "Slice preprocessing failed for `%s'", cmd.c_str()); } UnitPtr u = Slice::Unit::createUnit(ignoreRedefs, all, ice, underscore); int parseStatus = u->parse(file, cppHandle, debug); if(!icecpp->close() || parseStatus == EXIT_FAILURE) { u->destroy(); throw RubyException(rb_eArgError, "Slice parsing failed for `%s'", cmd.c_str()); } // // Generate the Ruby code into a string stream. // ostringstream codeStream; IceUtilInternal::Output out(codeStream); out.setUseTab(false); generate(u, all, checksum, includePaths, out); u->destroy(); string code = codeStream.str(); callRuby(rb_eval_string, code.c_str()); } } ICE_RUBY_CATCH return Qnil; } void IceRuby::initSlice(VALUE iceModule) { rb_define_module_function(iceModule, "loadSlice", CAST_METHOD(IceRuby_loadSlice), -1); } Ice-3.5.1/rb/src/IceRuby/Types.h0000644000076400007640000003222212223561477014405 0ustar mesmes// ********************************************************************** // // 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 ICE_RUBY_TYPES_H #define ICE_RUBY_TYPES_H #include #include #include #include namespace IceRuby { class ExceptionInfo; typedef IceUtil::Handle ExceptionInfoPtr; typedef std::vector ExceptionInfoList; class ClassInfo; typedef IceUtil::Handle ClassInfoPtr; typedef std::vector ClassInfoList; // // This class is raised as an exception when object marshaling needs to be aborted. // // TODO: Need an equivalent Ruby exception. // class AbortMarshaling { }; typedef std::map ObjectMap; class ObjectReader; typedef IceUtil::Handle ObjectReaderPtr; // // This class keeps track of Ruby objects (instances of Slice classes // and exceptions) that have preserved slices. // class SlicedDataUtil { public: SlicedDataUtil(); ~SlicedDataUtil(); void add(const ObjectReaderPtr&); void update(); static void setMember(VALUE, const Ice::SlicedDataPtr&); static Ice::SlicedDataPtr getMember(VALUE, ObjectMap*); private: std::set _readers; static VALUE _slicedDataType; static VALUE _sliceInfoType; }; struct PrintObjectHistory { int index; std::map objects; }; // // The delayed nature of class unmarshaling in the Ice protocol requires us to // handle unmarshaling using a callback strategy. An instance of UnmarshalCallback // is supplied to each type's unmarshal() member function. For all types except // classes, the callback is invoked with the unmarshaled value before unmarshal() // returns. For class instances, however, the callback may not be invoked until // the stream's finished() function is called. // class UnmarshalCallback : public IceUtil::Shared { public: virtual ~UnmarshalCallback(); // // The unmarshaled() member function receives the unmarshaled value. The // last two arguments are the values passed to unmarshal() for use by // UnmarshalCallback implementations. // virtual void unmarshaled(VALUE, VALUE, void*) = 0; }; typedef IceUtil::Handle UnmarshalCallbackPtr; // // Base class for type information. // class TypeInfo : public UnmarshalCallback { public: virtual std::string getId() const = 0; virtual bool validate(VALUE) = 0; virtual bool variableLength() const = 0; virtual int wireSize() const = 0; virtual Ice::OptionalFormat optionalFormat() const = 0; virtual bool usesClasses() const; // Default implementation returns false. virtual void unmarshaled(VALUE, VALUE, void*); // Default implementation is assert(false). virtual void destroy(); protected: TypeInfo(); public: // // The marshal and unmarshal functions can raise Ice exceptions, and may raise // AbortMarshaling if an error occurs. // virtual void marshal(VALUE, const Ice::OutputStreamPtr&, ObjectMap*, bool) = 0; virtual void unmarshal(const Ice::InputStreamPtr&, const UnmarshalCallbackPtr&, VALUE, void*, bool) = 0; virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*) = 0; }; typedef IceUtil::Handle TypeInfoPtr; // // Primitive type information. // class PrimitiveInfo : public TypeInfo { public: enum Kind { KindBool, KindByte, KindShort, KindInt, KindLong, KindFloat, KindDouble, KindString }; PrimitiveInfo(); PrimitiveInfo(Kind); virtual std::string getId() const; virtual bool validate(VALUE); virtual bool variableLength() const; virtual int wireSize() const; virtual Ice::OptionalFormat optionalFormat() const; virtual void marshal(VALUE, const Ice::OutputStreamPtr&, ObjectMap*, bool); virtual void unmarshal(const Ice::InputStreamPtr&, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); static double toDouble(VALUE); Kind kind; }; typedef IceUtil::Handle PrimitiveInfoPtr; // // Enum information. // typedef std::map EnumeratorMap; class EnumInfo : public TypeInfo { public: EnumInfo(VALUE, VALUE, VALUE); virtual std::string getId() const; virtual bool validate(VALUE); virtual bool variableLength() const; virtual int wireSize() const; virtual Ice::OptionalFormat optionalFormat() const; virtual void marshal(VALUE, const Ice::OutputStreamPtr&, ObjectMap*, bool); virtual void unmarshal(const Ice::InputStreamPtr&, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); const std::string id; const VALUE rubyClass; const Ice::Int maxValue; const EnumeratorMap enumerators; }; typedef IceUtil::Handle EnumInfoPtr; class DataMember : public UnmarshalCallback { public: virtual void unmarshaled(VALUE, VALUE, void*); std::string name; TypeInfoPtr type; ID rubyID; bool optional; int tag; }; typedef IceUtil::Handle DataMemberPtr; typedef std::vector DataMemberList; // // Struct information. // class StructInfo : public TypeInfo { public: StructInfo(VALUE, VALUE, VALUE); virtual std::string getId() const; virtual bool validate(VALUE); virtual bool variableLength() const; virtual int wireSize() const; virtual Ice::OptionalFormat optionalFormat() const; virtual bool usesClasses() const; // Default implementation returns false. virtual void marshal(VALUE, const Ice::OutputStreamPtr&, ObjectMap*, bool); virtual void unmarshal(const Ice::InputStreamPtr&, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); virtual void destroy(); const std::string id; const DataMemberList members; const VALUE rubyClass; private: bool _variableLength; int _wireSize; }; typedef IceUtil::Handle StructInfoPtr; // // Sequence information. // class SequenceInfo : public TypeInfo { public: SequenceInfo(VALUE, VALUE); virtual std::string getId() const; virtual bool validate(VALUE); virtual bool variableLength() const; virtual int wireSize() const; virtual Ice::OptionalFormat optionalFormat() const; virtual bool usesClasses() const; // Default implementation returns false. virtual void marshal(VALUE, const Ice::OutputStreamPtr&, ObjectMap*, bool); virtual void unmarshal(const Ice::InputStreamPtr&, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void unmarshaled(VALUE, VALUE, void*); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); virtual void destroy(); const std::string id; const TypeInfoPtr elementType; private: void marshalPrimitiveSequence(const PrimitiveInfoPtr&, VALUE, const Ice::OutputStreamPtr&); void unmarshalPrimitiveSequence(const PrimitiveInfoPtr&, const Ice::InputStreamPtr&, const UnmarshalCallbackPtr&, VALUE, void*); }; typedef IceUtil::Handle SequenceInfoPtr; // // Dictionary information. // class DictionaryInfo : public TypeInfo { public: DictionaryInfo(VALUE, VALUE, VALUE); virtual std::string getId() const; virtual bool validate(VALUE); virtual bool variableLength() const; virtual int wireSize() const; virtual Ice::OptionalFormat optionalFormat() const; virtual bool usesClasses() const; // Default implementation returns false. virtual void marshal(VALUE, const Ice::OutputStreamPtr&, ObjectMap*, bool); virtual void unmarshal(const Ice::InputStreamPtr&, const UnmarshalCallbackPtr&, VALUE, void*, bool); void marshalElement(VALUE, VALUE, const Ice::OutputStreamPtr&, ObjectMap*); virtual void unmarshaled(VALUE, VALUE, void*); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); void printElement(VALUE, VALUE, IceUtilInternal::Output&, PrintObjectHistory*); virtual void destroy(); class KeyCallback : public UnmarshalCallback { public: virtual void unmarshaled(VALUE, VALUE, void*); VALUE key; }; typedef IceUtil::Handle KeyCallbackPtr; const std::string id; const TypeInfoPtr keyType; const TypeInfoPtr valueType; private: bool _variableLength; int _wireSize; }; typedef IceUtil::Handle DictionaryInfoPtr; typedef std::vector TypeInfoList; class ClassInfo : public TypeInfo { public: ClassInfo(VALUE, bool); void define(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); virtual std::string getId() const; virtual bool validate(VALUE); virtual bool variableLength() const; virtual int wireSize() const; virtual Ice::OptionalFormat optionalFormat() const; virtual bool usesClasses() const; // Default implementation returns false. virtual void marshal(VALUE, const Ice::OutputStreamPtr&, ObjectMap*, bool); virtual void unmarshal(const Ice::InputStreamPtr&, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); virtual void destroy(); void printMembers(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); bool isA(const ClassInfoPtr&); const std::string id; const Ice::Int compactId; const bool isBase; // Is this the ClassInfo for Ice::Object or Ice::LocalObject? const bool isLocal; const bool isAbstract; const bool preserve; const ClassInfoPtr base; const ClassInfoList interfaces; const DataMemberList members; const DataMemberList optionalMembers; const VALUE rubyClass; const VALUE typeObj; const bool defined; }; // // Proxy information. // class ProxyInfo : public TypeInfo { public: ProxyInfo(VALUE); void define(VALUE, VALUE); virtual std::string getId() const; virtual bool validate(VALUE); virtual bool variableLength() const; virtual int wireSize() const; virtual Ice::OptionalFormat optionalFormat() const; virtual void marshal(VALUE, const Ice::OutputStreamPtr&, ObjectMap*, bool); virtual void unmarshal(const Ice::InputStreamPtr&, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); virtual void destroy(); const std::string id; const VALUE rubyClass; const ClassInfoPtr classInfo; const VALUE typeObj; }; typedef IceUtil::Handle ProxyInfoPtr; // // Exception information. // class ExceptionInfo : public IceUtil::Shared { public: VALUE unmarshal(const Ice::InputStreamPtr&); void print(VALUE, IceUtilInternal::Output&); void printMembers(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); std::string id; bool preserve; ExceptionInfoPtr base; DataMemberList members; DataMemberList optionalMembers; bool usesClasses; VALUE rubyClass; }; // // ObjectWriter wraps a Ruby object for marshaling. // class ObjectWriter : public Ice::ObjectWriter { public: ObjectWriter(VALUE, ObjectMap*); virtual void ice_preMarshal(); virtual void write(const Ice::OutputStreamPtr&) const; private: void writeMembers(const Ice::OutputStreamPtr&, const DataMemberList&) const; VALUE _object; ObjectMap* _map; ClassInfoPtr _info; }; // // ObjectReader unmarshals the state of an Ice object. // class ObjectReader : public Ice::ObjectReader { public: ObjectReader(VALUE, const ClassInfoPtr&); virtual void ice_postUnmarshal(); virtual void read(const Ice::InputStreamPtr&); virtual ClassInfoPtr getInfo() const; VALUE getObject() const; // Borrowed reference. Ice::SlicedDataPtr getSlicedData() const; private: VALUE _object; ClassInfoPtr _info; Ice::SlicedDataPtr _slicedData; }; // // ExceptionReader creates a Ruby user exception and unmarshals it. // class ExceptionReader : public Ice::UserExceptionReader { public: ExceptionReader(const Ice::CommunicatorPtr&, const ExceptionInfoPtr&); ~ExceptionReader() throw(); virtual void read(const Ice::InputStreamPtr&) const; virtual bool usesClasses() const; virtual std::string ice_name() const; virtual Ice::UserException* ice_clone() const; virtual void ice_throw() const; VALUE getException() const; Ice::SlicedDataPtr getSlicedData() const; private: ExceptionInfoPtr _info; VALUE _ex; Ice::SlicedDataPtr _slicedData; }; class IdResolver : public Ice::CompactIdResolver { public: virtual ::std::string resolve(Ice::Int) const; }; ClassInfoPtr lookupClassInfo(const std::string&); ExceptionInfoPtr lookupExceptionInfo(const std::string&); extern VALUE Unset; bool initTypes(VALUE); VALUE createType(const TypeInfoPtr&); TypeInfoPtr getType(VALUE); VALUE createException(const ExceptionInfoPtr&); ExceptionInfoPtr getException(VALUE); } #endif Ice-3.5.1/rb/src/IceRuby/Communicator.cpp0000644000076400007640000004007012223561477016274 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace IceRuby; static VALUE _communicatorClass; typedef map CommunicatorMap; static CommunicatorMap _communicatorMap; extern "C" void IceRuby_Communicator_mark(Ice::CommunicatorPtr* p) { assert(p); try { ObjectFactoryPtr pof = ObjectFactoryPtr::dynamicCast((*p)->findObjectFactory("")); assert(pof); pof->mark(); } catch(const Ice::CommunicatorDestroyedException&) { // Ignore. This is expected. } } extern "C" void IceRuby_Communicator_free(Ice::CommunicatorPtr* p) { assert(p); delete p; } extern "C" VALUE IceRuby_initialize(int argc, VALUE* argv, VALUE self) { ICE_RUBY_TRY { volatile VALUE initDataCls = callRuby(rb_path2class, "Ice::InitializationData"); volatile VALUE args = Qnil, initData = Qnil; if(argc == 1) { if(isArray(argv[0])) { args = argv[0]; } else if(callRuby(rb_obj_is_instance_of, argv[0], initDataCls) == Qtrue) { initData = argv[0]; } else { throw RubyException(rb_eTypeError, "invalid argument to Ice::initialize"); } } else if(argc == 2) { if(!isArray(argv[0]) || callRuby(rb_obj_is_instance_of, argv[1], initDataCls) == Qfalse) { throw RubyException(rb_eTypeError, "invalid argument to Ice::initialize"); } args = argv[0]; initData = argv[1]; } else if(argc > 0) { throw RubyException(rb_eArgError, "invalid number of arguments to Ice::initialize"); } Ice::StringSeq seq; if(!NIL_P(args) && !arrayToStringSeq(args, seq)) { throw RubyException(rb_eTypeError, "invalid array argument to Ice::initialize"); } // // Use the with-args or the without-args version of initialize()? // bool hasArgs = !NIL_P(args); Ice::InitializationData data; if(!NIL_P(initData)) { volatile VALUE properties = callRuby(rb_iv_get, initData, "@properties"); volatile VALUE logger = callRuby(rb_iv_get, initData, "@logger"); if(!NIL_P(properties)) { data.properties = getProperties(properties); } if(!NIL_P(logger)) { throw RubyException(rb_eArgError, "custom logger is not supported"); } } // // Insert the program name (stored in the Ruby global variable $0) as the first // element of the sequence. // volatile VALUE progName = callRuby(rb_gv_get, "$0"); seq.insert(seq.begin(), getString(progName)); data.compactIdResolver = new IdResolver; if(hasArgs) { data.properties = Ice::createProperties(seq, data.properties); } else if(!data.properties) { data.properties = Ice::createProperties(); } // // Disable collocation optimization, otherwise an invocation on a // collocated servant results in a CollocationOptimizationException // (because Ruby uses the blobject API). // // TODO: Enable if a server mapping is added. // //data.properties->setProperty("Ice.Default.CollocationOptimization", "0"); // // Remaining command line options are passed to the communicator // as an argument vector in case they contain plugin properties. // int ac = static_cast(seq.size()); char** av = new char*[ac + 1]; int i = 0; for(Ice::StringSeq::const_iterator s = seq.begin(); s != seq.end(); ++s, ++i) { av[i] = strdup(s->c_str()); } av[ac] = 0; Ice::CommunicatorPtr communicator; try { if(hasArgs) { communicator = Ice::initialize(ac, av, data); } else { communicator = Ice::initialize(data); } } catch(...) { for(i = 0; i < ac + 1; ++i) { free(av[i]); } delete[] av; throw; } // // Replace the contents of the given argument list with the filtered arguments. // if(!NIL_P(args)) { callRuby(rb_ary_clear, args); // // We start at index 1 in order to skip the element that we inserted earlier. // for(i = 1; i < ac; ++i) { volatile VALUE str = createString(av[i]); callRuby(rb_ary_push, args, str); } } for(i = 0; i < ac + 1; ++i) { free(av[i]); } delete[] av; ObjectFactoryPtr factory = new ObjectFactory; communicator->addObjectFactory(factory, ""); VALUE result = Data_Wrap_Struct(_communicatorClass, IceRuby_Communicator_mark, IceRuby_Communicator_free, new Ice::CommunicatorPtr(communicator)); CommunicatorMap::iterator p = _communicatorMap.find(communicator); if(p != _communicatorMap.end()) { _communicatorMap.erase(p); } _communicatorMap.insert(CommunicatorMap::value_type(communicator, reinterpret_cast(result))); return result; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_destroy(VALUE self) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); p->destroy(); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_shutdown(VALUE self) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); p->shutdown(); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_isShutdown(VALUE self) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); return p->isShutdown() ? Qtrue : Qfalse; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_stringToProxy(VALUE self, VALUE str) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); string s = getString(str); Ice::ObjectPrx proxy = p->stringToProxy(s); if(proxy) { return createProxy(proxy); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_proxyToString(VALUE self, VALUE proxy) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); Ice::ObjectPrx prx; if(!NIL_P(proxy)) { if(!checkProxy(proxy)) { throw RubyException(rb_eTypeError, "argument must be a proxy"); } prx = getProxy(proxy); } string str = p->proxyToString(prx); return createString(str); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_propertyToProxy(VALUE self, VALUE str) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); string s = getString(str); Ice::ObjectPrx proxy = p->propertyToProxy(s); if(proxy) { return createProxy(proxy); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_proxyToProperty(VALUE self, VALUE obj, VALUE str) { ICE_RUBY_TRY { if(!checkProxy(obj)) { throw RubyException(rb_eTypeError, "argument must be a proxy"); } Ice::CommunicatorPtr p = getCommunicator(self); Ice::ObjectPrx o = getProxy(obj); string s = getString(str); Ice::PropertyDict dict = p->proxyToProperty(o, s); volatile VALUE result = callRuby(rb_hash_new); for(Ice::PropertyDict::const_iterator q = dict.begin(); q != dict.end(); ++q) { volatile VALUE key = createString(q->first); volatile VALUE value = createString(q->second); callRuby(rb_hash_aset, result, key, value); } return result; } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_stringToIdentity(VALUE self, VALUE str) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); string s = getString(str); Ice::Identity ident = p->stringToIdentity(s); return createIdentity(ident); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_identityToString(VALUE self, VALUE id) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); Ice::Identity ident = getIdentity(id); string str = p->identityToString(ident); return createString(str); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_addObjectFactory(VALUE self, VALUE factory, VALUE id) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); ObjectFactoryPtr pof = ObjectFactoryPtr::dynamicCast(p->findObjectFactory("")); assert(pof); string idstr = getString(id); pof->add(factory, idstr); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_findObjectFactory(VALUE self, VALUE id) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); ObjectFactoryPtr pof = ObjectFactoryPtr::dynamicCast(p->findObjectFactory("")); assert(pof); string idstr = getString(id); return pof->find(idstr); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_getImplicitContext(VALUE self) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); Ice::ImplicitContextPtr implicitContext = p->getImplicitContext(); return createImplicitContext(implicitContext); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_getProperties(VALUE self) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); Ice::PropertiesPtr props = p->getProperties(); return createProperties(props); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_getLogger(VALUE self) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); Ice::LoggerPtr logger = p->getLogger(); return createLogger(logger); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_getDefaultRouter(VALUE self) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); Ice::RouterPrx router = p->getDefaultRouter(); if(router) { volatile VALUE cls = callRuby(rb_path2class, "Ice::RouterPrx"); assert(!NIL_P(cls)); return createProxy(router, cls); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_setDefaultRouter(VALUE self, VALUE router) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); Ice::RouterPrx proxy; if(!NIL_P(router)) { if(!checkProxy(router)) { throw RubyException(rb_eTypeError, "argument must be a proxy"); } proxy = Ice::RouterPrx::uncheckedCast(getProxy(router)); } p->setDefaultRouter(proxy); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_getDefaultLocator(VALUE self) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); Ice::LocatorPrx locator = p->getDefaultLocator(); if(locator) { volatile VALUE cls = callRuby(rb_path2class, "Ice::LocatorPrx"); assert(!NIL_P(cls)); return createProxy(locator, cls); } } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_setDefaultLocator(VALUE self, VALUE locator) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); Ice::LocatorPrx proxy; if(!NIL_P(locator)) { if(!checkProxy(locator)) { throw RubyException(rb_eTypeError, "argument must be a proxy"); } proxy = Ice::LocatorPrx::uncheckedCast(getProxy(locator)); } p->setDefaultLocator(proxy); } ICE_RUBY_CATCH return Qnil; } extern "C" VALUE IceRuby_Communicator_flushBatchRequests(VALUE self) { ICE_RUBY_TRY { Ice::CommunicatorPtr p = getCommunicator(self); p->flushBatchRequests(); } ICE_RUBY_CATCH return Qnil; } void IceRuby::initCommunicator(VALUE iceModule) { rb_define_module_function(iceModule, "initialize", CAST_METHOD(IceRuby_initialize), -1); _communicatorClass = rb_define_class_under(iceModule, "CommunicatorI", rb_cObject); rb_define_method(_communicatorClass, "destroy", CAST_METHOD(IceRuby_Communicator_destroy), 0); rb_define_method(_communicatorClass, "shutdown", CAST_METHOD(IceRuby_Communicator_shutdown), 0); rb_define_method(_communicatorClass, "isShutdown", CAST_METHOD(IceRuby_Communicator_isShutdown), 0); rb_define_method(_communicatorClass, "stringToProxy", CAST_METHOD(IceRuby_Communicator_stringToProxy), 1); rb_define_method(_communicatorClass, "proxyToString", CAST_METHOD(IceRuby_Communicator_proxyToString), 1); rb_define_method(_communicatorClass, "propertyToProxy", CAST_METHOD(IceRuby_Communicator_propertyToProxy), 1); rb_define_method(_communicatorClass, "proxyToProperty", CAST_METHOD(IceRuby_Communicator_proxyToProperty), 2); rb_define_method(_communicatorClass, "stringToIdentity", CAST_METHOD(IceRuby_Communicator_stringToIdentity), 1); rb_define_method(_communicatorClass, "identityToString", CAST_METHOD(IceRuby_Communicator_identityToString), 1); rb_define_method(_communicatorClass, "addObjectFactory", CAST_METHOD(IceRuby_Communicator_addObjectFactory), 2); rb_define_method(_communicatorClass, "findObjectFactory", CAST_METHOD(IceRuby_Communicator_findObjectFactory), 1); rb_define_method(_communicatorClass, "getImplicitContext", CAST_METHOD(IceRuby_Communicator_getImplicitContext), 0); rb_define_method(_communicatorClass, "getProperties", CAST_METHOD(IceRuby_Communicator_getProperties), 0); rb_define_method(_communicatorClass, "getLogger", CAST_METHOD(IceRuby_Communicator_getLogger), 0); rb_define_method(_communicatorClass, "getDefaultRouter", CAST_METHOD(IceRuby_Communicator_getDefaultRouter), 0); rb_define_method(_communicatorClass, "setDefaultRouter", CAST_METHOD(IceRuby_Communicator_setDefaultRouter), 1); rb_define_method(_communicatorClass, "getDefaultLocator", CAST_METHOD(IceRuby_Communicator_getDefaultLocator), 0); rb_define_method(_communicatorClass, "setDefaultLocator", CAST_METHOD(IceRuby_Communicator_setDefaultLocator), 1); rb_define_method(_communicatorClass, "flushBatchRequests", CAST_METHOD(IceRuby_Communicator_flushBatchRequests), 0); } Ice::CommunicatorPtr IceRuby::getCommunicator(VALUE v) { Ice::CommunicatorPtr* p = reinterpret_cast(DATA_PTR(v)); assert(p); return *p; } VALUE IceRuby::lookupCommunicator(const Ice::CommunicatorPtr& p) { CommunicatorMap::iterator q = _communicatorMap.find(p.get()); if(q != _communicatorMap.end()) { return q->second; } return Qnil; } Ice-3.5.1/rb/src/Makefile0000644000076400007640000000113012223561477013220 0ustar mesmes# ********************************************************************** # # 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 = .. include $(top_srcdir)/config/Make.rules SUBDIRS = IceRuby $(EVERYTHING):: @for subdir in $(SUBDIRS); \ do \ if test -d $$subdir ; \ then \ echo "making $@ in $$subdir"; \ ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ fi; \ done Ice-3.5.1/rb/CHANGES0000644000076400007640000001505012223561477011772 0ustar mesmesNOTE: This file is no longer being updated. See the CHANGES file in the top-level directory. Changes since version 3.2.0 --------------------------- - Fixed bug where ObjectPrx.ice_getCachedConnection() would never return a valid connection object. - Fixed bug with the ObjectPrx == method where on some platforms comparison to a nil object would be incorrect. - Added the methods Ice::proxyIdentityCompare and Ice::proxyIdentityAndFacetCompare. - Implemented <=> in proxies. - Added support for protected class data members using the new metadata tag ["protected"]. The tag can be applied to a Slice class or to individual data members. - Changed the throughput demo to better support cross-language testing. - Added timeout, proxy and binding tests. - Ice::ObjectPrx::ice_getEndpointSelection now returns the correct endpoint enumeration value. - Trailing characters past the adapter id in a stringified proxy will now raise a ProxyParseException. - All local methods on a proxy that return the "same" proxy with a different attribute (such as ice_oneway and ice_secure) now return a proxy of the same class as the original. As a result, once you have downcast a proxy, it will rarely be necessary to downcast it again. For example, you can rewrite the following statements twoway = Demo::HelloPrx::checkedCast(...) oneway = Demo::HelloPrx::uncheckedCast(twoway.ice_oneway()) as simply twoway = Demo::HelloPrx::checkedCast(...) oneway = twoway.ice_oneway() The local methods ice_facet and ice_identity still return a proxy of the base class Ice::ObjectPrx, since a change to the proxy's facet or identity typically refers to an object with a different Slice type and therefore requires a new downcast. This change does not affect the behavior of existing code. However, code that depends on these new semantics will not run correctly using prior versions of Ice. - Fixed bugs in stringToProxy and propertyToProxy that reported a "NullHandleException". Changes since version 3.1.1 --------------------------- - Ice for Ruby is now compatible with ruby 1.8.1. - Fixed a bug in Application::holdInterrupt. - Fixed a bug that would cause the extension to abort if a GC occurred after the communicator was destroyed. - Fixed a code-generation bug that occurred when the name of a data member begins with an uppercase letter. - Changed the mapping of sequence for performance reasons: - A string is now accepted as a legal value when sequence is expected. An array of integers is also accepted, but the Ice run time validates every element of the array to ensure it is in the proper range, therefore using an array is much slower than using a string. - A sequence value is now always received as a string. - Added the property Ice.Default.EndpointSelection. If not defined, the default value is "Random". - Proxies can now be configured to use thread-per-connection. - Added Communicator::isShutdown() to allow applications to determine whether a communicator has been shutdown. - Added a per-process logger and two methods to get/set the logger, Ice.Util.getProcessLogger() and Ice.Util.setProcessLogger(). Calling getProcessLogger() creates a default logger if setProcessLogger() has not been called. The process logger is also used as the default logger for all communicators that do not have a logger explicitly set. - Added support for a user-defined signal handler in Ice::Application. A subclass must override the interruptCallback method and invoke callbackOnInterrupt to activate it. - Message batches are now automatically flushed when the total size of the batch reaches the message size maximum. This feature can be controlled using the Ice.BatchAutoFlush property, which is on by default. - Added Communicator::propertyToProxy() which creates a proxy from a set of properties. This operation allows you to set various local proxy settings, such as the locator cache timeout, which cannot be set using stringToProxy(). - The propertyToProxy() operation prints warnings if unknown properties are found during creation of the proxy. These warnings can be disabled by setting Ice.Warn.UnknownProperties=0. - The Ice.Logger.Timestamp property has been removed. Timestamps are now always printed. - Added the property Ice.Default.PreferSecure, which if set to 1 causes secure endpoints to be preferred over non-secure endpoints. By default this property is set to 0. Also added functions to control this behavior on a per-proxy rather than global basis: ice_isPreferSecure() and ice_preferSecure(). - If a proxy does not specify a hostname (via -h HOST), the client only attempts to connect to the loopback interface (127.0.0.1). - Attempts to change the attributes of a fixed proxy now result in a FixedProxyException rather than just ignoring the change request and returning the same proxy. Also, attempts to marshal a fixed proxy now result in a FixedProxyException rather than a MarshalException. - Added support for implicit request contexts. When you invoke an operation on a proxy and don't pass an explicit context, Ice uses the "implicit context" combined with the per-proxy context (if any). You can obtain the implicit context using the new communicator operation getImplicitContext(). Three implementations of implicit context are available; you select one by setting the property Ice.ImplicitContext to one of the following values: * None: No implicit context at all (default). * PerThread: The implementation maintains a context per thread. * Shared: The implementation maintains a single thread-safe context that is shared by all threads. - Removed defaultContext from InitializationData. - Communicator::setDefaultContext(), Communicator::getDefaultContext() and Proxy::ice_defaultContext() have been deprecated. - Added Ice.Override.Secure which forces a client to only use secure connections. - Added UnexpectedObjectException. This exception is raised if you use Slice classes and client and server are compiled with mismatched Slice definitions. Alternatively, this exception is raised if you use dynamic invocation and pass a class of the wrong type as an operation parameter. - New Slice metadata for operations: - ["nonmutating"] provides backward compatibility for idempotent operations that were previously declared using the deprecated 'nonmutating' keyword. You can replace the 'nonmutating' keyword with '["nonmutating"] idempotent' to maintain compatibility with objects implemented using Ice 3.0 or 3.1. Ice-3.5.1/rb/allTests.py0000755000076400007640000000311412223561477013145 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys, re, getopt path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil # # List of all basic tests. # tests = [ ("Slice/keyword", ["once"]), ("Slice/structure", ["once"]), ("Slice/macros", ["once"]), ("Ice/binding", ["core"]), ("Ice/checksum", ["core"]), ("Ice/exceptions", ["core"]), ("Ice/facets", ["core"]), ("Ice/info", ["core", "noipv6", "nocompress"]), ("Ice/inheritance", ["core"]), ("Ice/location", ["core"]), ("Ice/objects", ["core"]), ("Ice/proxy", ["core"]), ("Ice/properties", ["once", "nowin32"]), ("Ice/operations", ["core"]), ("Ice/retry", ["core"]), ("Ice/timeout", ["core"]), ("Ice/slicing/exceptions", ["core"]), ("Ice/slicing/objects", ["core"]), ("Ice/defaultValue", ["core"]), ("Ice/optional", ["core"]), ("Ice/enums", ["core"]) ] if __name__ == "__main__": TestUtil.run(tests) Ice-3.5.1/rb/demo/0000755000076400007640000000000012223561477011722 5ustar mesmesIce-3.5.1/rb/demo/Ice/0000755000076400007640000000000012223561477012422 5ustar mesmesIce-3.5.1/rb/demo/Ice/README0000644000076400007640000000166312223561477013310 0ustar mesmesDemos in this directory: - hello This demo illustrates how to invoke ordinary (twoway) operations, as well as how to invoke oneway operations, use datagrams, secure invocations, and how to use batched invocations. - latency A simple latency test that measures the basic call dispatch delay of Ice. - minimal This demo illustrates a minimal Ice application. - session This demo shows how to use sessions to clean up client-specific resources in a server after the client shuts down or crashes. - throughput A simple throughput demo that allows you to send sequences of various types between client and server and to measure the maximum bandwidth that can be achieved using serialized synchronous requests. - value This demo shows how to use classes, class factories, and the difference between local and remote invocations of class operations. - optional This demo shows the use of the optional keyword. Ice-3.5.1/rb/demo/Ice/latency/0000755000076400007640000000000012223561477014061 5ustar mesmesIce-3.5.1/rb/demo/Ice/latency/config.client0000644000076400007640000000106612223561477016531 0ustar mesmes# # The client reads this property to create the reference to the "Ping" # object in the server. # Ping.Proxy=ping:default -p 10000 -h localhost # # Disable client-side ACM. # Ice.ACM.Client=0 # # SSL Configuration # Ice.Plugin.IceSSL=IceSSL:createIceSSL IceSSL.DefaultDir=../../../../certs IceSSL.CertAuthFile=cacert.pem IceSSL.CertFile=c_rsa1024_pub.pem IceSSL.KeyFile=c_rsa1024_priv.pem # # IceMX configuration. # #Ice.Admin.Endpoints=tcp -h localhost -p 10003 Ice.Admin.InstanceName=client IceMX.Metrics.Debug.GroupBy=id IceMX.Metrics.ByParent.GroupBy=parent Ice-3.5.1/rb/demo/Ice/latency/README0000644000076400007640000000043512223561477014743 0ustar mesmesA simple latency test that measures the basic call dispatch delay of Ice. The Ice extension for Ruby currently supports only client-side functionality, therefore you must use a server from any other language mapping. After starting the server, run the Ruby client: $ ruby Client.rb Ice-3.5.1/rb/demo/Ice/latency/Client.rb0000755000076400007640000000250012223561477015624 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice('Latency.ice') class Client < Ice::Application def run(args) if args.length > 0 puts $0 + ": too many argumnets" return 1 end ping = Demo::PingPrx::checkedCast(Ice::Application::communicator().propertyToProxy('Ping.Proxy')) if not ping puts "invalid proxy" return 1 end # Initial ping to setup the connection. ping.ice_ping() repetitions = 100000 puts "pinging server " + repetitions.to_s + " times (this may take a while)" tsec = Time.now i = repetitions while i >= 0 ping.ice_ping() i = i - 1 end tsec = Time.now - tsec tmsec = tsec * 1000.0 printf "time for %d pings: %.3fms\n", repetitions, tmsec printf "time per ping: %.3fms\n", tmsec / repetitions return 0 end end app = Client.new exit(app.main(ARGV, "config.client")) Ice-3.5.1/rb/demo/Ice/latency/Latency.ice0000644000076400007640000000060612223561477016144 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Demo { class Ping { }; }; Ice-3.5.1/rb/demo/Ice/minimal/0000755000076400007640000000000012223561477014050 5ustar mesmesIce-3.5.1/rb/demo/Ice/minimal/README0000644000076400007640000000075312223561477014735 0ustar mesmesThis demo is a minimal Ice "hello world" application. Each time the client is run a "sayHello" invocation is sent to the server. The Ice extension for Ruby currently supports only client-side functionality, therefore you must use a server from any other language mapping. After starting the server, run the Ruby client: $ ruby Client.rb Note that this demo hardwires port 10000. If port 10000 is not available on your machine, you need to edit both client and server to use a free port. Ice-3.5.1/rb/demo/Ice/minimal/Client.rb0000755000076400007640000000123512223561477015617 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice('Hello.ice') begin communicator = Ice::initialize(ARGV) hello = Demo::HelloPrx::checkedCast(communicator.stringToProxy("hello:tcp -h localhost -p 10000")) hello.sayHello() communicator.destroy() rescue => ex puts $! puts ex.backtrace.join("\n") exit(1) end Ice-3.5.1/rb/demo/Ice/minimal/Hello.ice0000644000076400007640000000064012223561477015575 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Demo { interface Hello { void sayHello(); }; }; Ice-3.5.1/rb/demo/Ice/optional/0000755000076400007640000000000012223561477014247 5ustar mesmesIce-3.5.1/rb/demo/Ice/optional/config.client0000644000076400007640000000033712223561477016717 0ustar mesmes# # The client reads this property to create the reference to the # "ContactDB" object in the server. # ContactDB.Proxy=contactdb:default -p 10000 -h localhost # # Warn about connection exceptions # Ice.Warn.Connections=1 Ice-3.5.1/rb/demo/Ice/optional/README0000644000076400007640000000043312223561477015127 0ustar mesmesThis demo illustrates the use of optional class members and parameters. The Ice extension for Ruby currently supports only client-side functionality, therefore you must use a server from any other language mapping. After starting the server, run the Ruby client: $ ruby Client.rb Ice-3.5.1/rb/demo/Ice/optional/Contact.ice0000644000076400007640000000175112223561477016330 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Demo { enum NumberType { HOME, OFFICE, CELL }; class Contact { string name; optional(1) NumberType type = HOME; optional(2) string number; optional(3) int dialGroup; }; interface ContactDB { void addContact(string name, optional(1) NumberType type, optional(2) string number, optional(3) int dialGroup); void updateContact(string name, optional(1) NumberType type, optional(2) string number, optional(3) int dialGroup); Contact query(string name); optional(1) string queryNumber(string name); void queryDialgroup(string name, out optional(1) int dialGroup); void shutdown(); }; }; Ice-3.5.1/rb/demo/Ice/optional/config.server0000644000076400007640000000037312223561477016747 0ustar mesmes# # The server creates one single object adapter with the name # "ContactDB". The following line sets the endpoints for this # adapter. # ContactDB.Endpoints=default -p 10000 -h localhost # # Warn about connection exceptions # Ice.Warn.Connections=1 Ice-3.5.1/rb/demo/Ice/optional/Client.rb0000644000076400007640000001313312223561477016013 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice('Contact.ice') class ContactClient < Ice::Application def run(args) if args.length > 0 puts $0 + ": too many argumnets" return 1 end contactdb = Demo::ContactDBPrx::checkedCast(Ice::Application::communicator().propertyToProxy('ContactDB.Proxy')) if not contactdb puts "invalid proxy" return 1 end # # Add a contact for "john". All parameters are provided. # johnNumber = "123-456-7890" contactdb.addContact("john", Demo::NumberType::HOME, johnNumber, 0) print "Checking john... " STDOUT.flush() # # Find the phone number for "john" # number = contactdb.queryNumber("john") if number != johnNumber print "number is incorrect " STDOUT.flush() end dialgroup = contactdb.queryDialgroup("john") if dialgroup != 0 print "dialgroup is incorrect " STDOUT.flush() end info = contactdb.query("john") # # All of the info parameters should be set. # if info.type != Demo::NumberType::HOME or info.number != johnNumber or info.dialGroup != 0 print "info is incorrect " STDOUT.flush() end puts("ok") # # Add a contact for "steve". The behavior of the server is to # default construct the Contact, and then assign all set parameters. # Since the default value of NumberType in the slice definition # is HOME and in this case the NumberType is unset it will take # the default value. # steveNumber = "234-567-8901" contactdb.addContact("steve", Ice::Unset, steveNumber, 1) print "Checking steve... " STDOUT.flush() number = contactdb.queryNumber("steve") if number != steveNumber print "number is incorrect " STDOUT.flush() end info = contactdb.query("steve") # # Check the value for the NumberType. # if info.type != Demo::NumberType::HOME print "info is incorrect " STDOUT.flush() end if info.number != steveNumber or info.dialGroup != 1 print "info is incorrect " STDOUT.flush() end dialgroup = contactdb.queryDialgroup("steve") if dialgroup != 1 print "dialgroup is incorrect " STDOUT.flush() end puts("ok") # # Add a contact from "frank". Here the dialGroup field isn't set. # frankNumber = "345-678-9012" contactdb.addContact("frank", Demo::NumberType::CELL, frankNumber, Ice::Unset) print "Checking frank... " STDOUT.flush() number = contactdb.queryNumber("frank") if number != frankNumber print "number is incorrect " STDOUT.flush() end info = contactdb.query("frank") # # The dial group field should be unset. # if info.dialGroup != Ice::Unset print "info is incorrect " STDOUT.flush() end if info.type != Demo::NumberType::CELL or info.number != frankNumber print "info is incorrect " STDOUT.flush() end dialgroup = contactdb.queryDialgroup("frank") if dialgroup != Ice::Unset print "dialgroup is incorrect " STDOUT.flush() end puts("ok") # # Add a contact from "anne". The number field isn't set. # contactdb.addContact("anne", Demo::NumberType::OFFICE, Ice::Unset, 2) print "Checking anne... " STDOUT.flush() number = contactdb.queryNumber("anne") if number != Ice::Unset print "number is incorrect " STDOUT.flush() end info = contactdb.query("anne") # # The number field should be unset. # if info.number != Ice::Unset print "info is incorrect " STDOUT.flush() end if info.type != Demo::NumberType::OFFICE or info.dialGroup != 2 print "info is incorrect " STDOUT.flush() end dialgroup = contactdb.queryDialgroup("anne") if dialgroup != 2 print "dialgroup is incorrect " STDOUT.flush() end # # The optional fields can be used to determine what fields to # update on the contact. Here we update only the number for anne, # the remainder of the fields are unchanged. # anneNumber = "456-789-0123" contactdb.updateContact("anne", Ice::Unset, anneNumber, Ice::Unset) number = contactdb.queryNumber("anne") if number != anneNumber print "number is incorrect " STDOUT.flush() end info = contactdb.query("anne") if info.number != anneNumber or info.type != Demo::NumberType::OFFICE or info.dialGroup != 2 print "info is incorrect " STDOUT.flush() end puts("ok") contactdb.shutdown() return 0 end end app = ContactClient.new exit(app.main(ARGV, "config.client")) Ice-3.5.1/rb/demo/Ice/value/0000755000076400007640000000000012223561477013536 5ustar mesmesIce-3.5.1/rb/demo/Ice/value/Value.ice0000644000076400007640000000202412223561477015272 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Demo { class Simple { string message; }; ["preserve-slice"] class Printer { string message; void printBackwards(); }; ["cpp:virtual"]class DerivedPrinter extends Printer { string derivedMessage; void printUppercase(); }; ["cpp:virtual"]class ClientPrinter extends Printer { }; exception DerivedPrinterException { DerivedPrinter derived; }; interface Initial { Simple getSimple(); void getPrinter(out Printer impl, out Printer* proxy); ["format:sliced"] Printer getDerivedPrinter(); ["format:sliced"] Printer updatePrinterMessage(Printer impl); void throwDerivedPrinter() throws DerivedPrinterException; void shutdown(); }; }; Ice-3.5.1/rb/demo/Ice/value/config.client0000644000076400007640000000033112223561477016200 0ustar mesmes# # The client reads this property to create the reference to the # "Initial" object in the server. # Initial.Proxy=initial:default -h localhost -p 10000 # # Warn about connection exceptions # Ice.Warn.Connections=1 Ice-3.5.1/rb/demo/Ice/value/README0000644000076400007640000000052512223561477014420 0ustar mesmesThis demo shows how to use classes, class factories, and the difference between local and remote invocations of class operations. The Ice extension for Ruby currently supports only client-side functionality, therefore you must use a server from any other language mapping. After starting the server, run the Ruby client: $ ruby Client.rb Ice-3.5.1/rb/demo/Ice/value/Client.rb0000755000076400007640000001446412223561477015315 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice('Value.ice') # # Reopen Demo::Printer (generated 'on the fly' by loadSlice above) # and define printBackwards # class Demo::Printer def printBackwards() puts message.reverse end end # # We can also use derivation (and register a factory) to implement # local operations # class DerivedPrinterI < Demo::DerivedPrinter def printUppercase(current=nil) puts derivedMessage.upcase end end class ClientPrinterI < Demo::ClientPrinter end class ObjectFactory def create(type) if type == Demo::DerivedPrinter::ice_staticId() return DerivedPrinterI.new end if type == Demo::ClientPrinter::ice_staticId() return ClientPrinterI.new end fail "unknown type" end end # # Redefine a number of methods in Ice::Application # class Ice::Application def interruptCallback(sig) begin Ice::Application::communicator.destroy rescue => ex puts ex end exit(0) end def run(args) if args.length > 0 puts $0 + ": too many argumnets" return 1 end # # Since this is an interactive demo we want the custom interrupt # callback to be called when the process is interrupted. # Ice::Application::callbackOnInterrupt initial = Demo::InitialPrx::checkedCast(Ice::Application::communicator().propertyToProxy('Initial.Proxy')) if not initial puts $0 + ": invalid proxy" return 1 end puts "\n"\ "Let's first transfer a simple object, for a class without\n"\ "operations, and print its contents. No factory is ever required\n"\ "for this.\n"\ "[press enter]" STDOUT.flush STDIN.readline simple = initial.getSimple() puts "==> " + simple.message puts "\n"\ "Yes, this worked. Now let's try to transfer an object for a class\n"\ "with operations as type ::Demo::Printer.\n"\ "[press enter]" STDOUT.flush STDIN.readline printer, printerProxy = initial.getPrinter() puts "==> " + printer.message puts "\n"\ "Cool, it worked! Let's try calling the printBackwards() method\n"\ "on the object we just received locally.\n"\ "[press enter]" STDOUT.flush STDIN.readline print "==> " printer.printBackwards() puts "\n"\ "Now we call the same method, but on the remote object. Watch the\n"\ "server's output.\n"\ "[press enter]" STDOUT.flush STDIN.readline printerProxy.printBackwards() puts "\n"\ "Next, we transfer a derived object from the server.\n"\ "With Ice for Ruby, installing an object factory is optional,\n"\ "and since we compiled the Slice definition for DerivedPrinter, the object\n"\ "is not sliced.\n"\ "[press enter]" STDOUT.flush STDIN.readline derived = initial.getDerivedPrinter() puts "==> The type ID of the received object is \"" + derived.ice_id() + "\"" fail unless derived.ice_id() == "::Demo::DerivedPrinter" puts "\n"\ "However since we did not implement Demo::DerivedPrinter::printUppercase.\n"\ "calling printUppercase on this object does not work.\n"\ "[press enter]" STDOUT.flush STDIN.readline begin derived.printUpperCase puts $0 + ": Did not get the expected NoMethodError!" exit(false) rescue NoMethodError => ex print "==> ", ex, "\n" end puts "\n"\ "Now we install a factory for the derived class, and try again.\n"\ "[press enter]" STDOUT.flush STDIN.readline Ice::Application::communicator().addObjectFactory(ObjectFactory.new, Demo::DerivedPrinter::ice_staticId()) derived = initial.getDerivedPrinter() puts "==> The type ID of the received object is \"" + derived.ice_id() + "\"" puts "\n"\ "Let's print the message contained in the derived object, and\n"\ "call the operation printUppercase() on the derived object\n"\ "locally.\n"\ "[press enter]" STDOUT.flush STDIN.readline puts "==> " + derived.derivedMessage print "==> " derived.printUppercase() puts "\n"\ "Now let's make sure that slice is preserved with [\"preserve-slice\"]\n"\ "metadata. We create a derived type on the client and pass it to the\n"\ "server, which does not have a factory for the derived type.\n"\ "[press enter]\n" STDOUT.flush STDIN.readline clientp = ClientPrinterI.new clientp.message = "a message 4 u" Ice::Application::communicator().addObjectFactory(ObjectFactory.new, Demo::ClientPrinter::ice_staticId()) derivedAsBase = initial.updatePrinterMessage(clientp) fail unless derivedAsBase.ice_id() == "::Demo::ClientPrinter" puts "==> " + derivedAsBase.message puts "\n"\ "Finally, we try the same again, but instead of returning the\n"\ "derived object, we throw an exception containing the derived\n"\ "object.\n"\ "[press enter]" STDOUT.flush STDIN.readline begin initial.throwDerivedPrinter() puts $0 + "Did not get the expected DerivedPrinterException!" exit(false) rescue Demo::DerivedPrinterException => ex derived = ex.derived fail unless derived end puts "==> " + derived.derivedMessage print "==> " derived.printUppercase() puts "\n"\ "That's it for this demo. Have fun with Ice!" initial.shutdown() return 0 end end app = Ice::Application.new exit(app.main(ARGV, "config.client")) Ice-3.5.1/rb/demo/Ice/session/0000755000076400007640000000000012223561477014105 5ustar mesmesIce-3.5.1/rb/demo/Ice/session/config.client0000644000076400007640000000035612223561477016556 0ustar mesmes# # The client reads this property to create the reference to the # "SessionFactory" object in the server. # SessionFactory.Proxy=SessionFactory:default -h localhost -p 10000 # # Warn about connection exceptions # Ice.Warn.Connections=1 Ice-3.5.1/rb/demo/Ice/session/README0000644000076400007640000000130412223561477014763 0ustar mesmesThis example demonstrates how to clean up per-client objects through the use of sessions. When the client starts, a session object is created through which all per-client objects are created. The session object's timestamp must be refreshed by the client on a periodic basis otherwise it will be destroyed. Once the session is destroyed, whether by the client destroying the session upon termination or due to a timeout, all per-client objects are automatically cleaned up by the session object. The Ice extension for Ruby currently supports only client-side functionality, therefore you must use a server from any other language mapping. After starting the server, run the Ruby client: $ ruby Client.rb Ice-3.5.1/rb/demo/Ice/session/Session.ice0000644000076400007640000000251712223561477016217 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Demo { interface Hello { idempotent void sayHello(); }; // // The session object. This is used to create per-session objects on // behalf of the client. If the session is not refreshed on a periodic // basis, it will be automatically destroyed. // interface Session { // // Create a new per-session hello object. The created object will // be automatically destroyed when the session is destroyed. // Hello* createHello(); // // Refresh a session. If a session is not refreshed on a regular // basis by the client, it will be automatically destroyed. // idempotent void refresh(); idempotent string getName(); // // Destroy the session explicitly. // void destroy(); }; interface SessionFactory { // // Create a session with the given name. Note that the name is // only used for diagnostic purposes. It is not used as unique // session id. // Session* create(string name); void shutdown(); }; }; Ice-3.5.1/rb/demo/Ice/session/Client.rb0000755000076400007640000001307112223561477015655 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' require 'thread' require 'timeout' Ice::loadSlice('Session.ice') class SessionRefreshThread def initialize(logger, timeout, session) @_logger = logger @_session = session @_timeout = timeout @_terminated = false @_cond = ConditionVariable.new @_mutex = Mutex.new end def run @_mutex.synchronize { while not @_terminated begin Timeout::timeout(@_timeout) do @_cond.wait(@_mutex) end rescue Timeout::Error end if not @_terminated begin @_session.refresh() rescue Ice::LocalException => ex @_logger.warning("SessionRefreshThread: " + ex) @_terminated = true end end end } end def terminate @_mutex.synchronize { @_terminated = true @_cond.signal } end end class Client < Ice::Application def initialize @mutex = Mutex.new @session = nil @refresh = nil @refreshThread = nil end def interruptCallback(sig) cleanup(true) begin Ice::Application::communicator.destroy rescue => ex puts ex end exit(0) end def run(args) if args.length > 0 puts $0 + ": too many argumnets" return 1 end # # Since this is an interactive demo we want the custom interrupt # callback to be called when the process is interrupted. # Ice::Application::callbackOnInterrupt while true print "Please enter your name ==> " STDOUT.flush name = STDIN.readline.chomp if name.length > 0 break end end base = Ice::Application::communicator().propertyToProxy('SessionFactory.Proxy') factory = Demo::SessionFactoryPrx::checkedCast(base) if not factory puts $0 + ": invalid proxy" return 1 end @mutex.synchronize { @session = factory.create(name) @refresh = SessionRefreshThread.new(Ice::Application::communicator().getLogger(), 5, @session) @refreshThread = Thread.new { @refresh.run } } begin hellos = [] menu() destroy = true shutdown = false while true begin print "==> " STDOUT.flush c = STDIN.readline.chomp if c =~ /^[0-9]+$/ index = c.to_i if index < hellos.length hello = hellos[index] hello.sayHello() else puts "Index is too high. " + hellos.length.to_s + " hello objects exist so far.\n" +\ "Use `c' to create a new hello object." end elsif c == 'c' hellos.push(@session.createHello()) puts "Created hello object " + (hellos.length - 1).to_s elsif c == 's' destroy = false shutdown = true break elsif c == 'x' break elsif c == 't' destroy = false break elsif c == '?' menu() else puts "unknown command `" + c + "'" menu() end rescue EOFError break end end # # The refresher thread must be terminated before destroy is # called, otherwise it might get ObjectNotExistException. refresh # is set to 0 so that if session->destroy() raises an exception # the thread will not be re-terminated and re-joined. # cleanup(destroy) if shutdown factory.shutdown() end rescue # # The refresher thread must be terminated in the event of a # failure. # begin cleanup(true) rescue end end return 0 end def cleanup(destroy) @mutex.synchronize { if @refresh @refresh.terminate @refreshThread.join @refresh = nil end if destroy && @session @session.destroy end @session = nil } end def menu print < ByteSeq; const int ByteSeqSize = 500000; sequence StringSeq; const int StringSeqSize = 50000; struct StringDouble { string s; double d; }; sequence StringDoubleSeq; const int StringDoubleSeqSize = 50000; struct Fixed { int i; int j; double d; }; sequence FixedSeq; const int FixedSeqSize = 50000; interface Throughput { bool needsWarmup(); void startWarmup(); void endWarmup(); void sendByteSeq(ByteSeq seq); ByteSeq recvByteSeq(); ByteSeq echoByteSeq(ByteSeq seq); void sendStringSeq(StringSeq seq); StringSeq recvStringSeq(); StringSeq echoStringSeq(StringSeq seq); void sendStructSeq(StringDoubleSeq seq); StringDoubleSeq recvStructSeq(); StringDoubleSeq echoStructSeq(StringDoubleSeq seq); void sendFixedSeq(FixedSeq seq); FixedSeq recvFixedSeq(); FixedSeq echoFixedSeq(FixedSeq seq); void shutdown(); }; }; Ice-3.5.1/rb/demo/Ice/throughput/Client.rb0000755000076400007640000002175512223561477016413 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice('Throughput.ice') def menu print < ex puts ex end exit(0) end def run(args) if args.length > 0 puts $0 + ": too many argumnets" return 1 end # # Since this is an interactive demo we want the custom interrupt # callback to be called when the process is interrupted. # Ice::Application::callbackOnInterrupt throughput = Demo::ThroughputPrx::checkedCast( Ice::Application::communicator().propertyToProxy('Throughput.Proxy')) if not throughput puts $0 + ": invalid proxy" return 1 end throughputOneway = Demo::ThroughputPrx::uncheckedCast(throughput.ice_oneway()) byteSeq = "\0" * Demo::ByteSeqSize stringSeq = Array.new(Demo::StringSeqSize, "hello") stringDouble = Demo::StringDouble.new stringDouble.s = "hello" stringDouble.d = 3.14 structSeq = Array.new(Demo::StringDoubleSeqSize, stringDouble) fixed = Demo::Fixed.new fixed.i = 0 fixed.j = 0 fixed.d = 0.0 fixedSeq = Array.new(Demo::FixedSeqSize, fixed) # # To allow cross-language tests we may need to "warm up" the # server. The warm up is to ensure that any JIT compiler will # have converted any hotspots to native code. This ensures an # accurate throughput measurement. # if throughput.needsWarmup() throughput.startWarmup() emptyBytes = "\x00" emptyStrings = Array.new(1, "hello") emptyStructs = Array.new(1, Demo::StringDouble.new) emptyFixed = Array.new(1, Demo::Fixed.new) print "warming up the server..." STDOUT.flush for i in (0..10000) throughput.sendByteSeq(emptyBytes) throughput.sendStringSeq(emptyStrings) throughput.sendStructSeq(emptyStructs) throughput.sendFixedSeq(emptyFixed) throughput.recvByteSeq() throughput.recvStringSeq() throughput.recvStructSeq() throughput.recvFixedSeq() throughput.echoByteSeq(emptyBytes) throughput.echoStringSeq(emptyStrings) throughput.echoStructSeq(emptyStructs) throughput.echoFixedSeq(emptyFixed) end throughput.endWarmup() print " ok\n" else throughput.ice_ping() # Initial ping to setup the connection. end menu() currentType = '1' seqSize = Demo::ByteSeqSize c = nil while c != 'x' begin print "==> " STDOUT.flush c = STDIN.readline.chomp repetitions = 100 if c == '1' or c == '2' or c == '3' or c == '4' currentType = c if c == '1' puts "using byte sequences" seqSize = Demo::ByteSeqSize elsif c == '2' puts "using string sequences" seqSize = Demo::StringSeqSize elsif c == '3' puts "using variable-length struct sequences" seqSize = Demo::StringDoubleSeqSize elsif c == '4' puts "using fixed-length struct sequences" seqSize = Demo::FixedSeqSize end elsif c == 't' or c == 'o' or c == 'r' or c == 'e' if c == 't' or c == 'o' print "sending " elsif c == 'r' print "receiving " elsif c == 'e' print "sending and receiving " end print repetitions.to_s + " " if currentType == '1' print "byte " elsif currentType == '2' print "string " elsif currentType == '3' print "variable-length struct " elsif currentType == '4' print "fixed-length struct " end if c == 'o' printf "sequences of size %d as oneway...\n", seqSize else printf "sequences of size %d...\n", seqSize end tsec = Time.now for i in (0..repetitions) if currentType == '1' if c == 't' throughput.sendByteSeq(byteSeq) elsif c == 'o' throughputOneway.sendByteSeq(byteSeq) elsif c == 'r' throughput.recvByteSeq() elsif c == 'e' throughput.echoByteSeq(byteSeq) end elsif currentType == '2' if c == 't' throughput.sendStringSeq(stringSeq) elsif c == 'o' throughputOneway.sendStringSeq(stringSeq) elsif c == 'r' throughput.recvStringSeq() elsif c == 'e' throughput.echoStringSeq(stringSeq) end elsif currentType == '3' if c == 't' throughput.sendStructSeq(structSeq) elsif c == 'o' throughputOneway.sendStructSeq(structSeq) elsif c == 'r' throughput.recvStructSeq() elsif c == 'e' throughput.echoStructSeq(structSeq) end elsif currentType == '4' if c == 't' throughput.sendFixedSeq(fixedSeq) elsif c == 'o' throughputOneway.sendFixedSeq(fixedSeq) elsif c == 'r' throughput.recvFixedSeq() elsif c == 'e' throughput.echoFixedSeq(fixedSeq) end end end tsec = Time.now - tsec tmsec = tsec * 1000.0 printf "time for %d sequences: %.3fms\n", repetitions, tmsec printf "time per sequence: %.3fms\n", tmsec / repetitions wireSize = 0 if currentType == '1' wireSize = 1 elsif currentType == '2' wireSize = stringSeq[0].length elsif currentType == '3' wireSize = structSeq[0].s.length wireSize += 8 elsif currentType == '4' wireSize = 16 end mbit = repetitions * seqSize * wireSize * 8.0 / tsec / 1000000.0 if c == 'e' mbit = mbit * 2 end printf "throughput: %.3fMbps\n", mbit elsif c == 's' throughput.shutdown() elsif c == 'x' # Nothing to do elsif c == '?' menu() else puts "unknown command `" + c + "'" menu() end rescue EOFError break end end return 0 end end app = Client.new exit(app.main(ARGV, "config.client")) Ice-3.5.1/rb/demo/Ice/hello/0000755000076400007640000000000012223561477013525 5ustar mesmesIce-3.5.1/rb/demo/Ice/hello/config.client0000644000076400007640000000200412223561477016166 0ustar mesmes# # The client reads this property to create the reference to the # "hello" object in the server. # Hello.Proxy=hello:tcp -h localhost -p 10000:udp -h localhost -p 10000:ssl -h localhost -p 10001 # # Warn about connection exceptions # Ice.Warn.Connections=1 # # Network Tracing # # 0 = no network tracing # 1 = trace connection establishment and closure # 2 = like 1, but more detailed # 3 = like 2, but also trace data transfer # #Ice.Trace.Network=1 # # Protocol Tracing # # 0 = no protocol tracing # 1 = trace protocol messages # #Ice.Trace.Protocol=1 # # Security Tracing # # 0 = no security tracing # 1 = trace messages # #IceSSL.Trace.Security=1 # # SSL Configuration # Ice.Plugin.IceSSL=IceSSL:createIceSSL IceSSL.DefaultDir=../../../../certs IceSSL.CertAuthFile=cacert.pem IceSSL.CertFile=c_rsa1024_pub.pem IceSSL.KeyFile=c_rsa1024_priv.pem # # IceMX configuration. # #Ice.Admin.Endpoints=tcp -h localhost -p 10003 Ice.Admin.InstanceName=client IceMX.Metrics.Debug.GroupBy=id IceMX.Metrics.ByParent.GroupBy=parent Ice-3.5.1/rb/demo/Ice/hello/README0000644000076400007640000000142712223561477014411 0ustar mesmesThis demo illustrates how to invoke ordinary (twoway) operations, as well as how to make oneway, datagram, secure, and batched invocations. The Ice extension for Ruby currently supports only client-side functionality, therefore you must use a server from any other language mapping. After starting the server, run the Ruby client: $ ruby Client.rb To test timeouts you can use 'T' to set a timeout on the client proxy and 'P' to set a delayed response in the server to cause a timeout. You will notice that two "Hello World!" messages will be printed by the server in this case. This is because the sayHello method is marked as idempotent in the slice, meaning that Ice does not need to follow the at-most-once retry semantics. See the manual for more information about retry behavior. Ice-3.5.1/rb/demo/Ice/hello/Client.rb0000755000076400007640000001136012223561477015274 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice('Hello.ice') def menu print < ex puts ex end exit(0) end def run(args) if args.length > 0 puts $0 + ": too many argumnets" return 1 end # # Since this is an interactive demo we want the custom interrupt # callback to be called when the process is interrupted. # Ice::Application::callbackOnInterrupt twoway = Demo::HelloPrx::checkedCast( Ice::Application::communicator().propertyToProxy('Hello.Proxy'). ice_twoway().ice_timeout(-1).ice_secure(false)) if not twoway puts $0 + ": invalid proxy" return 1 end oneway = twoway.ice_oneway() batchOneway = twoway.ice_batchOneway() datagram = twoway.ice_datagram() batchDatagram = twoway.ice_batchDatagram() secure = false timeout = -1 delay = 0 menu() c = nil while c != 'x' begin print "==> " STDOUT.flush line = STDIN.readline c = line[0..0] if c == 't' twoway.sayHello(delay) elsif c == 'o' oneway.sayHello(delay) elsif c == 'O' batchOneway.sayHello(delay) elsif c == 'd' if secure puts "secure datagrams are not supported" else datagram.sayHello(delay) end elsif c == 'D' if secure puts "secure datagrams are not supported" else batchDatagram.sayHello(delay) end elsif c == 'f' Ice::Application::communicator().flushBatchRequests() elsif c == 'T' if timeout == -1 timeout = 2000 else timeout = -1 end twoway = twoway.ice_timeout(timeout) oneway = oneway.ice_timeout(timeout) batchOneway = batchOneway.ice_timeout(timeout) if timeout == -1 puts "timeout is now switched off" else puts "timeout is now set to 2000ms" end elsif c == 'P' if delay == 0 delay = 2500 else delay = 0 end if delay == 0 puts "server delay is now deactivated" else puts "server delay is now set to 2500ms" end elsif c == 'S' secure = !secure twoway = twoway.ice_secure(secure) oneway = oneway.ice_secure(secure) batchOneway = batchOneway.ice_secure(secure) datagram = datagram.ice_secure(secure) batchDatagram = batchDatagram.ice_secure(secure) if secure puts "secure mode is now on" else puts "secure mode is now off" end elsif c == 's' twoway.shutdown() elsif c == 'x' # Nothing to do elsif c == '?' menu() else puts "unknown command `" + c + "'" menu() end rescue Ice::Exception => ex puts ex rescue EOFError break end end return 0 end end app = Client.new() exit(app.main(ARGV, "config.client")) Ice-3.5.1/rb/demo/Ice/hello/Hello.ice0000644000076400007640000000071112223561477015251 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Demo { interface Hello { idempotent void sayHello(int delay); void shutdown(); }; }; Ice-3.5.1/rb/demo/README0000644000076400007640000000054412223561477012605 0ustar mesmesThis directory contains demos for various Ice components. The demos are provided to get you started on how to use a particular feature or coding technique. See the README file in each subdirectory for details on the demos. For examples of the features of the Ice services (Glacier2, IceGrid, IceStorm) please see the demos in the Ice for C++ distibution. Ice-3.5.1/rb/demo/book/0000755000076400007640000000000012223561477012654 5ustar mesmesIce-3.5.1/rb/demo/book/README0000644000076400007640000000036512223561477013540 0ustar mesmesDemos in this directory: - printer An implementation of the simple printer example at the beginning of the book. - simple_filesystem An implementation of the simple (non-persistent, non-life-cycle) version of the filesystem example. Ice-3.5.1/rb/demo/book/printer/0000755000076400007640000000000012223561477014337 5ustar mesmesIce-3.5.1/rb/demo/book/printer/Printer.ice0000644000076400007640000000067512223561477016454 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Demo { interface Printer { void printString(string s); }; }; Ice-3.5.1/rb/demo/book/printer/README0000644000076400007640000000033012223561477015213 0ustar mesmesThis demo implements the printer example in chapter 3 of the documentation. You will need to start a server from one of the other supported language mappings. In a separate window, run the client: $ ruby Client.rb Ice-3.5.1/rb/demo/book/printer/Client.rb0000755000076400007640000000161712223561477016112 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice('Printer.ice') status = 0 ic = nil begin ic = Ice::initialize(ARGV) base = ic.stringToProxy("SimplePrinter:default -h localhost -p 10000") printer = Demo::PrinterPrx::checkedCast(base) if not printer raise "Invalid proxy" end printer.printString("Hello World!") rescue puts $! puts $!.backtrace.join("\n") status = 1 end if ic # Clean up begin ic.destroy() rescue puts $! puts $!.backtrace.join("\n") status = 1 end end exit(status) Ice-3.5.1/rb/demo/book/simple_filesystem/0000755000076400007640000000000012223561477016411 5ustar mesmesIce-3.5.1/rb/demo/book/simple_filesystem/README0000644000076400007640000000037612223561477017277 0ustar mesmesThis demo implements the simple filesystem application shown at the end of the Ruby client-side mapping chapter. You will need to start a server from one of the other supported language mappings. In a separate window, run the client: $ ruby Client.rb Ice-3.5.1/rb/demo/book/simple_filesystem/Filesystem.ice0000644000076400007640000000143312223561477021220 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Filesystem { exception GenericError { string reason; }; interface Node { idempotent string name(); }; sequence Lines; interface File extends Node { idempotent Lines read(); idempotent void write(Lines text) throws GenericError; }; sequence NodeSeq; interface Directory extends Node { idempotent NodeSeq list(); }; }; Ice-3.5.1/rb/demo/book/simple_filesystem/Client.rb0000755000076400007640000000355512223561477020167 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice('Filesystem.ice') # Recursively print the contents of directory "dir" # in tree fashion. For files, show the contents of # each file. The "depth" parameter is the current # nesting level (for indentation). def listRecursive(dir, depth) indent = '' depth = depth + 1 for i in (0...depth) indent += "\t" end contents = dir.list() for node in contents subdir = Filesystem::DirectoryPrx::checkedCast(node) file = Filesystem::FilePrx::uncheckedCast(node) print indent + node.name() if subdir puts "(directory):" listRecursive(subdir, depth) else puts "(file):" text = file.read() for line in text puts indent + "\t" + line end end end end status = 0 ic = nil begin # Create a communicator # ic = Ice::initialize(ARGV) # Create a proxy for the root directory # obj = ic.stringToProxy("RootDir:default -h localhost -p 10000") # Down-cast the proxy to a Directory proxy # rootDir = Filesystem::DirectoryPrx::checkedCast(obj) # Recursively list the contents of the root directory # puts "Contents of root directory:" listRecursive(rootDir, 0) rescue => ex puts ex print ex.backtrace.join("\n") status = 1 end if ic # Clean up # begin ic.destroy() rescue => ex puts ex print ex.backtrace.join("\n") status = 1 end end exit(status) Ice-3.5.1/rb/config/0000755000076400007640000000000012223561477012243 5ustar mesmesIce-3.5.1/rb/config/Make.rules.MINGW0000644000076400007640000000155512223561477015062 0ustar mesmes# ********************************************************************** # # 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 C++ Make.rules.MINGW # include $(top_srcdir)/../cpp/config/Make.rules.MINGW mkrblibfilename = $(1).so # # Define the following names so the rule to build $(libdir)/$(LIBFILENAME) # is not override by $(libdir)/$(SONAME) and $(libdir)/$(LIBNAME) # targets. # mkrbsoname = $(if $(2),lib$(1).xxx.$(2),lib$(1).xxx) mkrblibname = $(1).xxx libdir = $(top_srcdir)/ruby ifdef ice_src_dist ifeq ($(ice_cpp_dir), $(ice_dir)/cpp) SLICEPARSERLIB = $(ice_cpp_dir)/bin/$(call mklibfilename,Slice,$(VERSION)) endif endifIce-3.5.1/rb/config/Make.rules0000644000076400007640000001620312223561477014176 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** # # Select an installation base directory. The directory will be created # if it does not exist. # prefix ?= /opt/Ice-$(VERSION) # # The "root directory" for runpath embedded in executables. Can be unset # to avoid adding a runpath to Ice executables. # embedded_runpath_prefix ?= /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR) # # Define OPTIMIZE as yes if you want to build with optimization. # Otherwise the Ice extension is built with debug information. # #OPTIMIZE = yes # # Define LP64 as yes if you want to build in 64 bit mode on a platform # that supports both 32 and 64 bit. # #LP64 := yes # # If you have not built Ice for C++ from the cpp subdirectory or if # you have installed the Ice @ver@ for C++ development kit in a # non-standard location, set the ICE_HOME to the installation directory. # #ICE_HOME = C:\Program Files\ZeroC\Ice-$(VERSION) # # If the Ruby interpreter is in your PATH, the settings below will # work properly in most cases. If you want to use a particular # installation of Ruby, set RUBY_HOME with the installation directory. # ifneq ($(RUBY_HOME),) RUBY = $(RUBY_HOME)/bin/ruby else RUBY = ruby endif ifeq ($(RUBY18), yes) RUBY_MAJOR_VERSION = $(shell $(RUBY) -e 'require "rbconfig"; puts Config::expand("$$(MAJOR)")') RUBY_MINOR_VERSION = $(shell $(RUBY) -e 'require "rbconfig"; puts Config::expand("$$(MINOR)")') ifeq ("$(RUBY_MAJOR_VERSION).$(RUBY_MINOR_VERSION)", "1.8") RUBY_FLAGS = -I$(shell $(RUBY) -e 'require "rbconfig"; puts Config::expand("$$(archdir)")') else RUBY_FLAGS = -I$(shell $(RUBY) -e 'require "rbconfig"; puts Config::expand("$$(rubyhdrdir)")') \ -I$(shell $(RUBY) -e 'require "rbconfig"; puts Config::expand("$$(rubyhdrdir)/$$(arch)")') endif LIB_DIR = $(shell $(RUBY) -e 'require "rbconfig"; puts Config::expand("$$(libdir)")') RUBY_SHARED = $(shell $(RUBY) -e 'require "rbconfig"; puts Config::MAKEFILE_CONFIG["ENABLE_SHARED"]') ifeq ("$(RUBY_SHARED)","yes") RUBY_LIB = $(shell $(RUBY) -e 'require "rbconfig"; puts Config::expand("-l$$(RUBY_SO_NAME)")') else RUBY_LIB = $(shell $(RUBY) -e 'require "rbconfig"; puts Config::expand("-l$$(RUBY_SO_NAME)-static")') endif else RUBY_MAJOR_VERSION = $(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::expand("$$(MAJOR)")') RUBY_MINOR_VERSION = $(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::expand("$$(MINOR)")') RUBY_LIB_DIR = $(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::expand("$$(rubylibdir)")') RUBY_ARCH = $(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::expand("$$(arch)")') ifeq ("$(RUBY_MAJOR_VERSION).$(RUBY_MINOR_VERSION)", "1.8") RUBY_FLAGS = -I$(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::expand("$$(archdir)")') else RUBY_FLAGS = -I$(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::expand("$$(rubyhdrdir)")') \ -I$(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::expand("$$(rubyhdrdir)/$$(arch)")') endif LIB_DIR = $(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::expand("$$(libdir)")') RUBY_SHARED = $(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::MAKEFILE_CONFIG["ENABLE_SHARED"]') ifeq ("$(RUBY_SHARED)","yes") RUBY_LIB = $(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::expand("-l$$(RUBY_SO_NAME)")') else RUBY_LIB = $(shell $(RUBY) -e 'require "rbconfig"; puts RbConfig::expand("-l$$(RUBY_SO_NAME)-static")') endif endif RUBY_LIBS = -L$(LIB_DIR) $(RUBY_LIB) # # The build architectures for gcc based builds. The format of these # build flags are OS dependent. For example, under OS X to build # binaries which support both i386 and x86_64 you would use "-arch # i386 -arch x86_64". The default is OS version dependent. Be aware # that this value may conflict with the setting of LP64 above. # #CXXARCHFLAGS = -arch i386 -arch x86_64 # ---------------------------------------------------------------------- # Don't change anything below this line! # ---------------------------------------------------------------------- # # Common definitions # ice_language = rb ice_require_cpp = yes slice_translator = slice2rb ifeq ($(shell test -f $(top_srcdir)/config/Make.common.rules && echo 0),0) include $(top_srcdir)/config/Make.common.rules else include $(top_srcdir)/../config/Make.common.rules endif libdir = $(top_srcdir)/ruby ifneq ($(prefix), /usr) install_rubydir = $(prefix)/ruby install_libdir = $(prefix)/ruby else install_rubydir = $(RUBY_LIB_DIR) install_libdir = $(RUBY_LIB_DIR)/$(RUBY_ARCH) endif install_bindir = $(prefix)/$(binsubdir) # # Platform specific definitions # ifeq ($(shell test -f $(top_srcdir)/config/Make.rules.$(UNAME) && echo 0),0) configdir = $(top_srcdir)/config else configdir = $(top_srcdir)/../cpp/config endif include $(configdir)/Make.rules.$(UNAME) ifdef ice_src_dist ifeq ($(ice_cpp_dir), $(ice_dir)/cpp) ICE_LIB_DIR = -L$(ice_cpp_dir)/lib else ICE_LIB_DIR = -L$(ice_cpp_dir)/$(libsubdir) endif ICE_FLAGS = -I$(ice_cpp_dir)/include endif ifdef ice_bin_dist ICE_LIB_DIR = -L$(ice_dir)/$(libsubdir) ICE_FLAGS = -I$(ice_dir)/include endif ICE_LIBS = $(ICE_LIB_DIR) -lIce -lSlice -lIceUtil ifneq ($(embedded_runpath_prefix),) runpath_libdir := $(embedded_runpath_prefix)/$(libsubdir) endif CPPFLAGS = ICECPPFLAGS = -I$(slicedir) SLICE2RBFLAGS = $(ICECPPFLAGS) LDFLAGS = $(LDPLATFORMFLAGS) $(CXXFLAGS) -L$(libdir) ifdef ice_src_dist ifeq ($(ice_cpp_dir), $(ice_dir)/cpp) ifeq ($(SLICEPARSERLIB),) SLICEPARSERLIB = $(ice_cpp_dir)/lib/$(call mklibfilename,Slice,$(VERSION)) endif SLICE2RB = $(ice_cpp_dir)/bin/$(slice_translator) else SLICEPARSERLIB = $(ice_cpp_dir)/$(libsubdir)/$(call mklibfilename,Slice,$(VERSION)) SLICE2RB = $(ice_cpp_dir)/$(binsubdir)/$(slice_translator) endif else SLICEPARSERLIB = $(ice_dir)/$(libsubdir)/$(call mklibfilename,Slice,$(VERSION)) SLICE2CPP = $(ice_dir)/$(binsubdir)/$(slice_translator) endif # # A Ruby extension library cannot have a "lib" prefix, so Ruby-specific # functions are defined that strip "lib" from the regular library name. # ifeq ($(mkrblibfilename),) mkrblibfilename = $(subst lib,,$(call mklibfilename,$(1),$(2))) endif ifeq ($(mkrbsoname),) mkrbsoname = $(subst lib,,$(call mksoname,$(1),$(2))) endif ifeq ($(mkrblibname),) mkrblibname = $(subst lib,,$(call mklibname,$(1))) endif EVERYTHING = all depend clean install .SUFFIXES: .SUFFIXES: .cpp .o .rb all:: $(SRCS) %.rb: $(SDIR)/%.ice rm -f $(*F).rb $(SLICE2RB) $(SLICE2RBFLAGS) $< .cpp.o: $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< clean:: -rm -f $(TARGETS) -rm -f core *.o *.bak all:: $(SRCS) $(TARGETS) ifneq ($(SRCS),) depend:: $(SRCS) -rm -f .depend .depend.mak if test -n "$(SRCS)" ; then \ $(CXX) -DMAKEDEPEND -M $(CXXFLAGS) $(CPPFLAGS) $(SRCS) | $(ice_dir)/config/makedepend.py; \ fi endif ifneq ($(TEMPLATE_REPOSITORY),) clean:: rm -fr $(TEMPLATE_REPOSITORY) endif install:: Ice-3.5.1/rb/Makefile0000644000076400007640000000161412223561477012440 0ustar mesmes# ********************************************************************** # # 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 = . include $(top_srcdir)/config/Make.rules SUBDIRS = src ruby INSTALL_SUBDIRS = $(install_rubydir) $(install_libdir) install:: install-common @for subdir in $(INSTALL_SUBDIRS); \ do \ if test ! -d $(DESTDIR)$$subdir ; \ then \ echo "Creating $(DESTDIR)$$subdir..." ; \ mkdir -p $(DESTDIR)$$subdir ; \ chmod a+rx $(DESTDIR)$$subdir ; \ fi ; \ done $(EVERYTHING):: @for subdir in $(SUBDIRS); \ do \ echo "making $@ in $$subdir"; \ ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ done test:: @python $(top_srcdir)/allTests.py Ice-3.5.1/rb/test/0000755000076400007640000000000012223561477011755 5ustar mesmesIce-3.5.1/rb/test/Ice/0000755000076400007640000000000012223561477012455 5ustar mesmesIce-3.5.1/rb/test/Ice/properties/0000755000076400007640000000000012223561477014651 5ustar mesmesIce-3.5.1/rb/test/Ice/properties/config/0000755000076400007640000000000012223561477016116 5ustar mesmesIce-3.5.1/rb/test/Ice/properties/config/config.10000644000076400007640000000001712223561477017443 0ustar mesmesConfig1=Config1Ice-3.5.1/rb/test/Ice/properties/config/config.20000644000076400007640000000001712223561477017444 0ustar mesmesConfig2=Config2Ice-3.5.1/rb/test/Ice/properties/config/config.30000644000076400007640000000001712223561477017445 0ustar mesmesConfig3=Config3Ice-3.5.1/rb/test/Ice/properties/Client.rb0000644000076400007640000000363412223561477016422 0ustar mesmes#!/usr/bin/env ruby # encoding: UTF-8 # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' def test(b) if !b raise RuntimeError, 'test assertion failed' end end class Client < Ice::Application def run(args) print "testing load properties from UTF-8 path using Ice::Application... " properties = Ice::Application::communicator().getProperties() test(properties.getProperty("Ice.Trace.Network") == "1") test(properties.getProperty("Ice.Trace.Protocol") == "1") test(properties.getProperty("Config.Path").eql? "./config/中国_client.config") test(properties.getProperty("Ice.ProgramName") == "PropertiesClient") test(Ice::Application::appName() == properties.getProperty("Ice.ProgramName")) puts "ok" return true end end print "testing load properties from UTF-8 path... " properties = Ice.createProperties(ARGV) properties.load("./config/中国_client.config") test(properties.getProperty("Ice.Trace.Network") == "1") test(properties.getProperty("Ice.Trace.Protocol") == "1") test(properties.getProperty("Config.Path").eql? "./config/中国_client.config") test(properties.getProperty("Ice.ProgramName") == "PropertiesClient") puts "ok" app = Client.new() app.main(ARGV, "./config/中国_client.config") print "testing using Ice.Config with multiple config files... " properties = Ice.createProperties(["--Ice.Config=config/config.1, config/config.2, config/config.3"]); test(properties.getProperty("Config1") == "Config1"); test(properties.getProperty("Config2") == "Config2"); test(properties.getProperty("Config3") == "Config3"); puts "ok" exit(0) Ice-3.5.1/rb/test/Ice/properties/run.py0000755000076400007640000000257612223561477016044 0ustar mesmes#!/usr/bin/env python # -*- coding: utf-8 -*- # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil # # Write config # if sys.version_info[0] == 2: configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config" else: configPath = "./config/\u4e2d\u56fd_client.config" TestUtil.createConfig(configPath, ["# Automatically generated by Ice test driver.", "Ice.Trace.Protocol=1", "Ice.Trace.Network=1", "Ice.ProgramName=PropertiesClient", "Config.Path=" + configPath], "utf-8") TestUtil.simpleTest() if os.path.exists(configPath): os.remove(configPath) Ice-3.5.1/rb/test/Ice/binding/0000755000076400007640000000000012223561477014067 5ustar mesmesIce-3.5.1/rb/test/Ice/binding/AllTests.rb0000644000076400007640000003256512223561477016162 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def test(b) if !b raise RuntimeError, 'test assertion failed' end end def createTestIntfPrx(adapters) endpoints = [] test = nil for p in adapters test = p.getTestIntf() edpts = test.ice_getEndpoints() endpoints.concat(edpts) end return Test::TestIntfPrx::uncheckedCast(test.ice_endpoints(endpoints)) end def deactivate(com, adapters) for p in adapters com.deactivateObjectAdapter(p) end end def allTests(communicator) ref = "communicator:default -p 12010" com = Test::RemoteCommunicatorPrx::uncheckedCast(communicator.stringToProxy(ref)) print "testing binding with single endpoint... " STDOUT.flush adapter = com.createObjectAdapter("Adapter", "default") test1 = adapter.getTestIntf() test2 = adapter.getTestIntf() test(test1.ice_getConnection() == test2.ice_getConnection()) test1.ice_ping() test2.ice_ping() com.deactivateObjectAdapter(adapter) test3 = Test::TestIntfPrx::uncheckedCast(test1) test(test3.ice_getConnection() == test1.ice_getConnection()) test(test3.ice_getConnection() == test2.ice_getConnection()) begin test3.ice_ping() test(false) rescue Ice::ConnectionRefusedException # Expected end puts "ok" print "testing binding with multiple endpoints... " STDOUT.flush adapters = [] adapters.push(com.createObjectAdapter("Adapter11", "default")) adapters.push(com.createObjectAdapter("Adapter12", "default")) adapters.push(com.createObjectAdapter("Adapter13", "default")) # # Ensure that when a connection is opened it's reused for new # proxies and that all endpoints are eventually tried. # names = ["Adapter11", "Adapter12", "Adapter13"] while names.length > 0 adpts = adapters.clone test1 = createTestIntfPrx(adpts) adpts = adpts.sort_by { rand } test2 = createTestIntfPrx(adpts) adpts = adpts.sort_by { rand } test3 = createTestIntfPrx(adpts) test(test1.ice_getConnection() == test2.ice_getConnection()) test(test2.ice_getConnection() == test3.ice_getConnection()) name = test1.getAdapterName() if names.include?(name) names.delete(name) end test1.ice_getConnection().close(false) end # # Ensure that the proxy correctly caches the connection (we # always send the request over the same connection.) # for a in adapters a.getTestIntf().ice_ping() end t = createTestIntfPrx(adapters) name = t.getAdapterName() i = 0 nRetry = 5 while i < nRetry and t.getAdapterName() == name i = i + 1 end test(i == nRetry) for a in adapters a.getTestIntf().ice_getConnection().close(false) end # # Deactivate an adapter and ensure that we can still # establish the connection to the remaining adapters. # com.deactivateObjectAdapter(adapters[0]) names.push("Adapter12") names.push("Adapter13") while names.length > 0 adpts = adapters.clone test1 = createTestIntfPrx(adpts) adpts = adpts.sort_by { rand } test2 = createTestIntfPrx(adpts) adpts = adpts.sort_by { rand } test3 = createTestIntfPrx(adpts) test(test1.ice_getConnection() == test2.ice_getConnection()) test(test2.ice_getConnection() == test3.ice_getConnection()) name = test1.getAdapterName() if names.include?(name) names.delete(name) end test1.ice_getConnection().close(false) end # # Deactivate an adapter and ensure that we can still # establish the connection to the remaining adapters. # com.deactivateObjectAdapter(adapters[2]) t = createTestIntfPrx(adapters) test(t.getAdapterName() == "Adapter12") deactivate(com, adapters) puts "ok" print "testing random endpoint selection... " STDOUT.flush adapters = [] adapters.push(com.createObjectAdapter("Adapter21", "default")) adapters.push(com.createObjectAdapter("Adapter22", "default")) adapters.push(com.createObjectAdapter("Adapter23", "default")) t = createTestIntfPrx(adapters) test(t.ice_getEndpointSelection() == Ice::EndpointSelectionType::Random) names = ["Adapter21", "Adapter22", "Adapter23"] while names.length > 0 name = t.getAdapterName() if names.include?(name) names.delete(name) end t.ice_getConnection().close(false) end t = Test::TestIntfPrx::uncheckedCast(t.ice_endpointSelection(Ice::EndpointSelectionType::Random)) test(t.ice_getEndpointSelection() == Ice::EndpointSelectionType::Random) names.push("Adapter21") names.push("Adapter22") names.push("Adapter23") while names.length > 0 name = t.getAdapterName() if names.include?(name) names.delete(name) end t.ice_getConnection().close(false) end deactivate(com, adapters) puts "ok" print "testing ordered endpoint selection... " STDOUT.flush adapters = [] adapters.push(com.createObjectAdapter("Adapter31", "default")) adapters.push(com.createObjectAdapter("Adapter32", "default")) adapters.push(com.createObjectAdapter("Adapter33", "default")) t = createTestIntfPrx(adapters) t = Test::TestIntfPrx::uncheckedCast(t.ice_endpointSelection(Ice::EndpointSelectionType::Ordered)) test(t.ice_getEndpointSelection() == Ice::EndpointSelectionType::Ordered) nRetry = 5 # # Ensure that endpoints are tried in order by deactivating the adapters # one after the other. # i = 0 while i < nRetry and t.getAdapterName() == "Adapter31" i = i + 1 end test(i == nRetry) com.deactivateObjectAdapter(adapters[0]) i = 0 while i < nRetry and t.getAdapterName() == "Adapter32" i = i + 1 end test(i == nRetry) com.deactivateObjectAdapter(adapters[1]) i = 0 while i < nRetry and t.getAdapterName() == "Adapter33" i = i + 1 end test(i == nRetry) com.deactivateObjectAdapter(adapters[2]) begin t.getAdapterName() rescue Ice::ConnectionRefusedException # Expected end endpoints = t.ice_getEndpoints() adapters = [] # # Now, re-activate the adapters with the same endpoints in the opposite # order. # adapters.push(com.createObjectAdapter("Adapter36", endpoints[2].toString())) i = 0 while i < nRetry and t.getAdapterName() == "Adapter36" i = i + 1 end test(i == nRetry) t.ice_getConnection().close(false) adapters.push(com.createObjectAdapter("Adapter35", endpoints[1].toString())) i = 0 while i < nRetry and t.getAdapterName() == "Adapter35" i = i + 1 end test(i == nRetry) t.ice_getConnection().close(false) adapters.push(com.createObjectAdapter("Adapter34", endpoints[0].toString())) i = 0 while i < nRetry and t.getAdapterName() == "Adapter34" i = i + 1 end test(i == nRetry) deactivate(com, adapters) puts "ok" print "testing per request binding with single endpoint... " STDOUT.flush adapter = com.createObjectAdapter("Adapter41", "default") test1 = Test::TestIntfPrx::uncheckedCast(adapter.getTestIntf().ice_connectionCached(false)) test2 = Test::TestIntfPrx::uncheckedCast(adapter.getTestIntf().ice_connectionCached(false)) test(!test1.ice_isConnectionCached()) test(!test2.ice_isConnectionCached()) test(test1.ice_getConnection() == test2.ice_getConnection()) test1.ice_ping() com.deactivateObjectAdapter(adapter) test3 = Test::TestIntfPrx::uncheckedCast(test1) begin test(test3.ice_getConnection() == test1.ice_getConnection()) test(false) rescue Ice::ConnectionRefusedException # Expected end puts "ok" print "testing per request binding with multiple endpoints... " STDOUT.flush adapters = [] adapters.push(com.createObjectAdapter("Adapter51", "default")) adapters.push(com.createObjectAdapter("Adapter52", "default")) adapters.push(com.createObjectAdapter("Adapter53", "default")) t = Test::TestIntfPrx::uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)) test(!t.ice_isConnectionCached()) names = ["Adapter51", "Adapter52", "Adapter53"] while names.length > 0 name = t.getAdapterName() if names.include?(name) names.delete(name) end end com.deactivateObjectAdapter(adapters[0]) names.push("Adapter52") names.push("Adapter53") while names.length > 0 name = t.getAdapterName() if names.include?(name) names.delete(name) end end com.deactivateObjectAdapter(adapters[2]) test(t.getAdapterName() == "Adapter52") deactivate(com, adapters) puts "ok" print "testing per request binding and ordered endpoint selection... " STDOUT.flush adapters = [] adapters.push(com.createObjectAdapter("Adapter61", "default")) adapters.push(com.createObjectAdapter("Adapter62", "default")) adapters.push(com.createObjectAdapter("Adapter63", "default")) t = createTestIntfPrx(adapters) t = Test::TestIntfPrx::uncheckedCast(t.ice_endpointSelection(Ice::EndpointSelectionType::Ordered)) test(t.ice_getEndpointSelection() == Ice::EndpointSelectionType::Ordered) t = Test::TestIntfPrx::uncheckedCast(t.ice_connectionCached(false)) test(!t.ice_isConnectionCached()) nRetry = 5 # # Ensure that endpoints are tried in order by deactiving the adapters # one after the other. # i = 0 while i < nRetry and t.getAdapterName() == "Adapter61" i = i + 1 end test(i == nRetry) com.deactivateObjectAdapter(adapters[0]) i = 0 while i < nRetry and t.getAdapterName() == "Adapter62" i = i + 1 end test(i == nRetry) com.deactivateObjectAdapter(adapters[1]) i = 0 while i < nRetry and t.getAdapterName() == "Adapter63" i = i + 1 end test(i == nRetry) com.deactivateObjectAdapter(adapters[2]) begin t.getAdapterName() rescue Ice::ConnectionRefusedException # Expected end endpoints = t.ice_getEndpoints() adapters = [] # # Now, re-activate the adapters with the same endpoints in the opposite # order. # adapters.push(com.createObjectAdapter("Adapter66", endpoints[2].toString())) i = 0 while i < nRetry and t.getAdapterName() == "Adapter66" i = i + 1 end test(i == nRetry) adapters.push(com.createObjectAdapter("Adapter65", endpoints[1].toString())) i = 0 while i < nRetry and t.getAdapterName() == "Adapter65" i = i + 1 end test(i == nRetry) adapters.push(com.createObjectAdapter("Adapter64", endpoints[0].toString())) i = 0 while i < nRetry and t.getAdapterName() == "Adapter64" i = i + 1 end test(i == nRetry) deactivate(com, adapters) puts "ok" print "testing endpoint mode filtering... " STDOUT.flush adapters = [] adapters.push(com.createObjectAdapter("Adapter71", "default")) adapters.push(com.createObjectAdapter("Adapter72", "udp")) t = createTestIntfPrx(adapters) test(t.getAdapterName() == "Adapter71") testUDP = Test::TestIntfPrx::uncheckedCast(t.ice_datagram()) test(t.ice_getConnection() != testUDP.ice_getConnection()) begin testUDP.getAdapterName() rescue Ice::TwowayOnlyException # Expected end puts "ok" if communicator.getProperties().getProperty("Ice.Plugin.IceSSL").length > 0 print "testing unsecure vs. secure endpoints... " STDOUT.flush adapters = [] adapters.push(com.createObjectAdapter("Adapter81", "ssl")) adapters.push(com.createObjectAdapter("Adapter82", "tcp")) t = createTestIntfPrx(adapters) for i in 0...5 test(t.getAdapterName() == "Adapter82") t.ice_getConnection().close(false) end testSecure = Test::TestIntfPrx::uncheckedCast(t.ice_secure(true)) test(testSecure.ice_isSecure()) testSecure = Test::TestIntfPrx::uncheckedCast(t.ice_secure(false)) test(!testSecure.ice_isSecure()) testSecure = Test::TestIntfPrx::uncheckedCast(t.ice_secure(true)) test(testSecure.ice_isSecure()) test(t.ice_getConnection() != testSecure.ice_getConnection()) com.deactivateObjectAdapter(adapters[1]) for i in 0...5 test(t.getAdapterName() == "Adapter81") t.ice_getConnection().close(false) end com.createObjectAdapter("Adapter83", (t.ice_getEndpoints()[1]).toString()) # Reactive tcp OA. for i in 0...5 test(t.getAdapterName() == "Adapter83") t.ice_getConnection().close(false) end com.deactivateObjectAdapter(adapters[0]) begin testSecure.ice_ping() test(false) rescue Ice::ConnectionRefusedException # Expected end deactivate(com, adapters) puts "ok" end com.shutdown() end Ice-3.5.1/rb/test/Ice/binding/Client.rb0000755000076400007640000000154012223561477015635 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' Ice::loadSlice('Test.ice') require './AllTests' def run(args, communicator) allTests(communicator) return true end begin communicator = Ice::initialize(ARGV) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/binding/run.py0000755000076400007640000000144712223561477015256 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.clientServerTest() Ice-3.5.1/rb/test/Ice/binding/Test.ice0000644000076400007640000000132712223561477015473 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { interface TestIntf { ["ami"] string getAdapterName(); }; interface RemoteObjectAdapter { TestIntf* getTestIntf(); void deactivate(); }; interface RemoteCommunicator { RemoteObjectAdapter* createObjectAdapter(string name, string endpoints); void deactivateObjectAdapter(RemoteObjectAdapter* adapter); void shutdown(); }; }; Ice-3.5.1/rb/test/Ice/facets/0000755000076400007640000000000012223561477013722 5ustar mesmesIce-3.5.1/rb/test/Ice/facets/AllTests.rb0000644000076400007640000000632412223561477016007 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator) print "testing Ice.Admin.Facets property... " STDOUT.flush test(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets").length == 0) communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar"); facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.length == 1 && facetFilter[0] == "foobar"); communicator.getProperties().setProperty("Ice.Admin.Facets", "foo\\'bar"); facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.length == 1 && facetFilter[0] == "foo'bar"); communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar' toto 'titi'"); facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.length == 3 && facetFilter[0] == "foo bar" && facetFilter[1] == "toto" && facetFilter[2] == "titi"); communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar\\' toto' 'titi'"); facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.length == 2 && facetFilter[0] == "foo bar' toto" && facetFilter[1] == "titi"); # communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar' 'toto titi"); # facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); # test(facetFilter.length == 0); communicator.getProperties().setProperty("Ice.Admin.Facets", ""); puts "ok" print "testing stringToProxy... " STDOUT.flush ref = "d:default -p 12010" db = communicator.stringToProxy(ref) test(db) puts "ok" print "testing checked cast... " STDOUT.flush d = Test::DPrx::checkedCast(db) test(d) test(d == db) test(Test::DPrx::checkedCast(d, "bogus") == nil) puts "ok" print "testing non-facets A, B, C, and D... " STDOUT.flush test(d.callA() == "A") test(d.callB() == "B") test(d.callC() == "C") test(d.callD() == "D") puts "ok" print "testing facets A, B, C, and D... " STDOUT.flush df = Test::DPrx::checkedCast(d, "facetABCD") test(df) test(df.callA() == "A") test(df.callB() == "B") test(df.callC() == "C") test(df.callD() == "D") puts "ok" print "testing facets E and F... " STDOUT.flush ff = Test::FPrx::checkedCast(d, "facetEF") test(ff) test(ff.callE() == "E") test(ff.callF() == "F") puts "ok" print "testing facet G... " STDOUT.flush gf = Test::GPrx::checkedCast(ff, "facetGH") test(gf) test(gf.callG() == "G") puts "ok" print "testing whether casting preserves the facet... " STDOUT.flush hf = Test::HPrx::checkedCast(gf) test(hf) test(hf.callG() == "G") test(hf.callH() == "H") puts "ok" return gf end Ice-3.5.1/rb/test/Ice/facets/Client.rb0000755000076400007640000000156412223561477015476 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' Ice::loadSlice('Test.ice') require './AllTests' def run(args, communicator) g = allTests(communicator) g.shutdown() return true end begin communicator = Ice::initialize(ARGV) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/facets/run.py0000755000076400007640000000144712223561477015111 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.clientServerTest() Ice-3.5.1/rb/test/Ice/facets/Test.ice0000644000076400007640000000140512223561477015323 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { interface Empty { }; interface A { string callA(); }; interface B extends A { string callB(); }; interface C extends A { string callC(); }; interface D extends B, C { string callD(); }; interface E { string callE(); }; interface F extends E { string callF(); }; interface G { void shutdown(); string callG(); }; interface H extends G { string callH(); }; }; Ice-3.5.1/rb/test/Ice/location/0000755000076400007640000000000012223561477014265 5ustar mesmesIce-3.5.1/rb/test/Ice/location/AllTests.rb0000644000076400007640000001540512223561477016352 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator, ref) manager = Test::ServerManagerPrx::checkedCast(communicator.stringToProxy(ref)) locator = communicator.getDefaultLocator() test(manager) print "testing stringToProxy... " STDOUT.flush base = communicator.stringToProxy("test @ TestAdapter") base2 = communicator.stringToProxy("test @ TestAdapter") base3 = communicator.stringToProxy("test") base4 = communicator.stringToProxy("ServerManager") base5 = communicator.stringToProxy("test2") puts "ok" print "testing ice_locator and ice_getLocator... " STDOUT.flush test(Ice::proxyIdentityEqual(base.ice_getLocator(), communicator.getDefaultLocator())) anotherLocator = Ice::LocatorPrx::uncheckedCast(communicator.stringToProxy("anotherLocator")) base = base.ice_locator(anotherLocator) test(Ice::proxyIdentityEqual(base.ice_getLocator(), anotherLocator)) communicator.setDefaultLocator(nil) base = communicator.stringToProxy("test @ TestAdapter") test(!base.ice_getLocator()) base = base.ice_locator(anotherLocator) test(Ice::proxyIdentityEqual(base.ice_getLocator(), anotherLocator)) communicator.setDefaultLocator(locator) base = communicator.stringToProxy("test @ TestAdapter") test(Ice::proxyIdentityEqual(base.ice_getLocator(), communicator.getDefaultLocator())); # # We also test ice_router/ice_getRouter (perhaps we should add a # test/Ice/router test?) # test(!base.ice_getRouter()) anotherRouter = Ice::RouterPrx::uncheckedCast(communicator.stringToProxy("anotherRouter")) base = base.ice_router(anotherRouter) test(Ice::proxyIdentityEqual(base.ice_getRouter(), anotherRouter)) router = Ice::RouterPrx::uncheckedCast(communicator.stringToProxy("dummyrouter")) communicator.setDefaultRouter(router) base = communicator.stringToProxy("test @ TestAdapter") test(Ice::proxyIdentityEqual(base.ice_getRouter(), communicator.getDefaultRouter())) communicator.setDefaultRouter(nil) base = communicator.stringToProxy("test @ TestAdapter") test(!base.ice_getRouter()) puts "ok" print "starting server... " STDOUT.flush manager.startServer() puts "ok" print "testing checked cast... " STDOUT.flush obj = Test::TestIntfPrx::checkedCast(base) obj = Test::TestIntfPrx::checkedCast(communicator.stringToProxy("test@TestAdapter")) obj = Test::TestIntfPrx::checkedCast(communicator.stringToProxy("test @TestAdapter")) obj = Test::TestIntfPrx::checkedCast(communicator.stringToProxy("test@ TestAdapter")) test(obj) obj2 = Test::TestIntfPrx::checkedCast(base2) test(obj2) obj3 = Test::TestIntfPrx::checkedCast(base3) test(obj3) obj4 = Test::ServerManagerPrx::checkedCast(base4) test(obj4) obj5 = Test::TestIntfPrx::checkedCast(base5) test(obj5) puts "ok" print "testing id@AdapterId indirect proxy... " STDOUT.flush obj.shutdown() manager.startServer() begin obj2 = Test::TestIntfPrx::checkedCast(base2) obj2.ice_ping() rescue Ice::LocalException test(false) end puts "ok" print "testing identity indirect proxy... " STDOUT.flush obj.shutdown() manager.startServer() begin obj3 = Test::TestIntfPrx::checkedCast(base3) obj3.ice_ping() rescue Ice::LocalException test(false) end begin obj2 = Test::TestIntfPrx::checkedCast(base2) obj2.ice_ping() rescue Ice::LocalException test(false) end obj.shutdown() manager.startServer() begin obj2 = Test::TestIntfPrx::checkedCast(base2) obj2.ice_ping() rescue Ice::LocalException test(false) end begin obj3 = Test::TestIntfPrx::checkedCast(base3) obj3.ice_ping() rescue Ice::LocalException test(false) end obj.shutdown() manager.startServer() begin obj2 = Test::TestIntfPrx::checkedCast(base2) obj2.ice_ping() rescue Ice::LocalException test(false) end obj.shutdown() manager.startServer() begin obj3 = Test::TestIntfPrx::checkedCast(base3) obj3.ice_ping() rescue Ice::LocalException test(false) end obj.shutdown() manager.startServer() begin obj2 = Test::TestIntfPrx::checkedCast(base2) obj2.ice_ping() rescue Ice::LocalException test(false) end obj.shutdown() manager.startServer() begin obj5 = Test::TestIntfPrx::checkedCast(base5) obj5.ice_ping() rescue Ice::LocalException test(false) end puts "ok" print "testing reference with unknown identity... " STDOUT.flush begin base = communicator.stringToProxy("unknown/unknown") base.ice_ping() test(false) rescue Ice::NotRegisteredException => ex test(ex.kindOfObject == "object") test(ex.id == "unknown/unknown") end puts "ok" print "testing reference with unknown adapter... " STDOUT.flush begin base = communicator.stringToProxy("test @ TestAdapterUnknown") base.ice_ping() test(false) rescue Ice::NotRegisteredException => ex test(ex.kindOfObject == "object adapter") test(ex.id == "TestAdapterUnknown") end puts "ok" print "testing object reference from server... " STDOUT.flush hello = obj.getHello() hello.sayHello() puts "ok" print "testing object reference from server after shutdown... " STDOUT.flush obj.shutdown() manager.startServer() hello.sayHello() puts "ok" print "testing object migration... " STDOUT.flush hello = Test::HelloPrx::checkedCast(communicator.stringToProxy("hello")) obj.migrateHello() hello.sayHello() obj.migrateHello() hello.sayHello() obj.migrateHello() hello.sayHello() puts "ok" print "shutdown server... " STDOUT.flush obj.shutdown() puts "ok" print "testing whether server is gone... " STDOUT.flush begin obj2.ice_ping() test(false) rescue Ice::LocalException end begin obj3.ice_ping() test(false) rescue Ice::LocalException end begin obj5.ice_ping() test(false) rescue Ice::LocalException end puts "ok" print "shutdown server manager... " STDOUT.flush manager.shutdown() puts "ok" end Ice-3.5.1/rb/test/Ice/location/Client.rb0000755000076400007640000000224412223561477016035 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' slice_dir = Ice.getSliceDir if slice_dir.empty? fail "Slice directory not found" end Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require './AllTests' def run(args, communicator) allTests(communicator, "ServerManager:default -p 12010") return true end begin data = Ice::InitializationData.new data.properties = Ice::createProperties(ARGV) data.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010") communicator = Ice::initialize(ARGV, data) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/location/run.py0000755000076400007640000000144712223561477015454 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.clientServerTest() Ice-3.5.1/rb/test/Ice/location/Test.ice0000644000076400007640000000143212223561477015666 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once #include module Test { interface TestLocatorRegistry extends ::Ice::LocatorRegistry { // // Allow remote addition of objects to the locator registry. // void addObject(Object* obj); }; interface ServerManager { void startServer(); void shutdown(); }; interface Hello { void sayHello(); }; interface TestIntf { void shutdown(); Hello* getHello(); void migrateHello(); }; }; Ice-3.5.1/rb/test/Ice/timeout/0000755000076400007640000000000012223561477014143 5ustar mesmesIce-3.5.1/rb/test/Ice/timeout/AllTests.rb0000644000076400007640000001034612223561477016227 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def allTests(communicator) sref = "timeout:default -p 12010" obj = communicator.stringToProxy(sref) test(obj) timeout = Test::TimeoutPrx::checkedCast(obj) test(timeout) print "testing connect timeout... " STDOUT.flush # # Expect ConnectTimeoutException. # to = Test::TimeoutPrx::uncheckedCast(obj.ice_timeout(500)) to.holdAdapter(750) to.ice_getConnection().close(true) # Force a reconnect. begin to.op() test(false) rescue Ice::ConnectTimeoutException # Expected. end # # Expect success. # timeout.op() # Ensure adapter is active. to = Test::TimeoutPrx::uncheckedCast(obj.ice_timeout(1000)) to.holdAdapter(500) to.ice_getConnection().close(true) # Force a reconnect. begin to.op() rescue Ice::ConnectTimeoutException test(false) end puts "ok" print "testing read timeout... " STDOUT.flush # # Expect TimeoutException. # to = Test::TimeoutPrx::uncheckedCast(obj.ice_timeout(500)) begin to.sleep(750) test(false) rescue Ice::TimeoutException # Expected. end # # Expect success. # timeout.op() # Ensure adapter is active. to = Test::TimeoutPrx::uncheckedCast(obj.ice_timeout(1000)) begin to.sleep(500) rescue Ice::TimeoutException test(false) end puts "ok" print "testing write timeout... " STDOUT.flush # # Expect TimeoutException. # to = Test::TimeoutPrx::uncheckedCast(obj.ice_timeout(500)) to.holdAdapter(2000) seq = "\0" * 100000 # 100,000 entries begin to.sendData(seq) test(false) rescue Ice::TimeoutException # Expected. end # # Expect success. # timeout.op() # Ensure adapter is active. to = Test::TimeoutPrx::uncheckedCast(obj.ice_timeout(1000)) to.holdAdapter(500) begin to.sendData(seq) rescue Ice::TimeoutException test(false) end puts "ok" print "testing timeout overrides... " STDOUT.flush # # Test Ice.Override.Timeout. This property overrides all # endpoint timeouts. # initData = Ice::InitializationData.new initData.properties = communicator.getProperties().clone() initData.properties.setProperty("Ice.Override.Timeout", "500") comm = Ice.initialize(initData) to = Test::TimeoutPrx::checkedCast(comm.stringToProxy(sref)) begin to.sleep(750) test(false) rescue Ice::TimeoutException # expected end # # Calling ice_timeout() should have no effect. # timeout.op() # Ensure adapter is active. to = Test::TimeoutPrx::checkedCast(to.ice_timeout(1000)) begin to.sleep(750) test(false) rescue Ice::TimeoutException # Expected. end comm.destroy() # # Test Ice.Override.ConnectTimeout. # initData = Ice::InitializationData.new initData.properties = communicator.getProperties().clone() initData.properties.setProperty("Ice.Override.ConnectTimeout", "750") comm = Ice.initialize(initData) timeout.holdAdapter(1000) to = Test::TimeoutPrx::uncheckedCast(comm.stringToProxy(sref)) begin to.op() test(false) rescue Ice::ConnectTimeoutException # expected end # # Calling ice_timeout() should have no effect on the connect timeout. # timeout.op() # Ensure adapter is active. timeout.holdAdapter(1000) to = Test::TimeoutPrx::uncheckedCast(to.ice_timeout(1250)) begin to.op() test(false) rescue Ice::ConnectTimeoutException # expected end # # Verify that timeout set via ice_timeout() is still used for requests. # to.op() # Force connection. begin to.sleep(2000) test(false) rescue Ice::TimeoutException # Expected. end comm.destroy() puts "ok" return timeout end Ice-3.5.1/rb/test/Ice/timeout/Client.rb0000755000076400007640000000305612223561477015715 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' slice_dir = Ice.getSliceDir if slice_dir.empty? fail "Slice directory not found" end Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require './AllTests' def test(b) if !b raise RuntimeError, 'test assertion failed' end end def run(args, communicator) myClass = allTests(communicator) myClass.shutdown() return true end begin # # In this test, we need at least two threads in the # client side thread pool for nested AMI. # initData = Ice::InitializationData.new initData.properties = Ice.createProperties(ARGV) # # For this test, we want to disable retries. # initData.properties.setProperty('Ice.RetryIntervals', '-1') # # This test kills connections, so we don't want warnings. # initData.properties.setProperty('Ice.Warn.Connections', '0') communicator = Ice.initialize(ARGV, initData) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/timeout/run.py0000755000076400007640000000151312223561477015324 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("tests with regular server.") TestUtil.clientServerTest() Ice-3.5.1/rb/test/Ice/timeout/Test.ice0000644000076400007640000000107212223561477015544 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { sequence ByteSeq; interface Timeout { ["ami"] void op(); ["ami"] void sendData(ByteSeq seq); ["ami"] void sleep(int to); void holdAdapter(int to); void shutdown(); }; }; Ice-3.5.1/rb/test/Ice/inheritance/0000755000076400007640000000000012223561477014746 5ustar mesmesIce-3.5.1/rb/test/Ice/inheritance/AllTests.rb0000644000076400007640000001100012223561477017016 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator) print "testing stringToProxy... " STDOUT.flush ref = "initial:default -p 12010" base = communicator.stringToProxy(ref) test(base) puts "ok" print "testing checked cast... " STDOUT.flush initial = Test::InitialPrx::checkedCast(base) test(initial) test(initial == base) puts "ok" print "getting proxies for class hierarchy... " STDOUT.flush ca = initial.caop() cb = initial.cbop() cc = initial.ccop() cd = initial.cdop() test(ca != cb) test(ca != cc) test(ca != cd) test(cb != cc) test(cb != cd) test(cc != cd) puts "ok" print "getting proxies for interface hierarchy... " STDOUT.flush ia = initial.iaop() ib1 = initial.ib1op() ib2 = initial.ib2op() ic = initial.icop() test(ia != ib1) test(ia != ib2) test(ia != ic) test(ib1 != ic) test(ib2 != ic) puts "ok" print "invoking proxy operations on class hierarchy... " STDOUT.flush cao = ca.caop(ca) test(cao == ca) cao = ca.caop(cb) test(cao == cb) cao = ca.caop(cc) test(cao == cc) cao = cb.caop(ca) test(cao == ca) cao = cb.caop(cb) test(cao == cb) cao = cb.caop(cc) test(cao == cc) cao = cc.caop(ca) test(cao == ca) cao = cc.caop(cb) test(cao == cb) cao = cc.caop(cc) test(cao == cc) cao = cb.cbop(cb) test(cao == cb) cbo = cb.cbop(cb) test(cbo == cb) cao = cb.cbop(cc) test(cao == cc) cbo = cb.cbop(cc) test(cbo == cc) cao = cc.cbop(cb) test(cao == cb) cbo = cc.cbop(cb) test(cbo == cb) cao = cc.cbop(cc) test(cao == cc) cbo = cc.cbop(cc) test(cbo == cc) cao = cc.ccop(cc) test(cao == cc) cbo = cc.ccop(cc) test(cbo == cc) cco = cc.ccop(cc) test(cco == cc) puts "ok" print "ditto, but for interface hierarchy... " STDOUT.flush iao = ia.iaop(ia) test(iao == ia) iao = ia.iaop(ib1) test(iao == ib1) iao = ia.iaop(ib2) test(iao == ib2) iao = ia.iaop(ic) test(iao == ic) iao = ib1.iaop(ia) test(iao == ia) iao = ib1.iaop(ib1) test(iao == ib1) iao = ib1.iaop(ib2) test(iao == ib2) iao = ib1.iaop(ic) test(iao == ic) iao = ib2.iaop(ia) test(iao == ia) iao = ib2.iaop(ib1) test(iao == ib1) iao = ib2.iaop(ib2) test(iao == ib2) iao = ib2.iaop(ic) test(iao == ic) iao = ic.iaop(ia) test(iao == ia) iao = ic.iaop(ib1) test(iao == ib1) iao = ic.iaop(ib2) test(iao == ib2) iao = ic.iaop(ic) test(iao == ic) iao = ib1.ib1op(ib1) test(iao == ib1) ib1o = ib1.ib1op(ib1) test(ib1o == ib1) iao = ib1.ib1op(ic) test(iao == ic) ib1o = ib1.ib1op(ic) test(ib1o == ic) iao = ic.ib1op(ib1) test(iao == ib1) ib1o = ic.ib1op(ib1) test(ib1o == ib1) iao = ic.ib1op(ic) test(iao == ic) ib1o = ic.ib1op(ic) test(ib1o == ic) iao = ib2.ib2op(ib2) test(iao == ib2) ib2o = ib2.ib2op(ib2) test(ib2o == ib2) iao = ib2.ib2op(ic) test(iao == ic) ib2o = ib2.ib2op(ic) test(ib2o == ic) iao = ic.ib2op(ib2) test(iao == ib2) ib2o = ic.ib2op(ib2) test(ib2o == ib2) iao = ic.ib2op(ic) test(iao == ic) ib2o = ic.ib2op(ic) test(ib2o == ic) iao = ic.icop(ic) test(iao == ic) ib1o = ic.icop(ic) test(ib1o == ic) ib2o = ic.icop(ic) test(ib2o == ic) ico = ic.icop(ic) test(ico == ic) puts "ok" print "ditto, but for class implementing interfaces... " STDOUT.flush cao = cd.caop(cd) test(cao == cd) cbo = cd.cbop(cd) test(cbo == cd) cco = cd.ccop(cd) test(cco == cd) iao = cd.iaop(cd) test(iao == cd) ib1o = cd.ib1op(cd) test(ib1o == cd) ib2o = cd.ib2op(cd) test(ib2o == cd) cao = cd.cdop(cd) test(cao == cd) cbo = cd.cdop(cd) test(cbo == cd) cco = cd.cdop(cd) test(cco == cd) iao = cd.cdop(cd) test(iao == cd) ib1o = cd.cdop(cd) test(ib1o == cd) ib2o = cd.cdop(cd) test(ib2o == cd) puts "ok" return initial end Ice-3.5.1/rb/test/Ice/inheritance/Client.rb0000755000076400007640000000157712223561477016526 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' Ice::loadSlice('Test.ice') require './AllTests' def run(args, communicator) initial = allTests(communicator) initial.shutdown() return true end begin communicator = Ice.initialize(ARGV) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/inheritance/run.py0000755000076400007640000000144712223561477016135 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.clientServerTest() Ice-3.5.1/rb/test/Ice/inheritance/Test.ice0000644000076400007640000000205512223561477016351 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { module MA { interface IA { IA* iaop(IA* p); }; class CA { CA* caop(CA* p); }; }; module MB { interface IB1 extends MA::IA { IB1* ib1op(IB1* p); }; interface IB2 extends MA::IA { IB2* ib2op(IB2* p); }; class CB extends MA::CA { CB* cbop(CB* p); }; }; module MA { interface IC extends MB::IB1, MB::IB2 { IC* icop(IC* p); }; class CC extends MB::CB { CC* ccop(CC* p); }; class CD extends CC implements MB::IB1, MB::IB2 { CD* cdop(CD* p); }; }; interface Initial { void shutdown(); MA::CA* caop(); MB::CB* cbop(); MA::CC* ccop(); MA::CD* cdop(); MA::IA* iaop(); MB::IB1* ib1op(); MB::IB2* ib2op(); MA::IC* icop(); }; }; Ice-3.5.1/rb/test/Ice/info/0000755000076400007640000000000012223561477013410 5ustar mesmesIce-3.5.1/rb/test/Ice/info/AllTests.rb0000644000076400007640000000640512223561477015475 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def allTests(communicator) print "testing proxy endpoint information..." STDOUT.flush p1 = communicator.stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" + \ "udp -h udphost -p 10001 --interface eth0 --ttl 5:" + \ "opaque -e 1.8 -t 100 -v ABCD") endps = p1.ice_getEndpoints() ipEndpoint = endps[0].getInfo() test(ipEndpoint.is_a?(Ice::IPEndpointInfo)); test(ipEndpoint.host == "tcphost") test(ipEndpoint.port == 10000) test(ipEndpoint.timeout == 1200) test(ipEndpoint.compress) test(!ipEndpoint.datagram()) test((ipEndpoint.type() == Ice::TCPEndpointType && !ipEndpoint.secure()) || (ipEndpoint.type() == 2 && ipEndpoint.secure())) test((ipEndpoint.type() == Ice::TCPEndpointType && ipEndpoint.is_a?(Ice::TCPEndpointInfo)) || (ipEndpoint.type() == 2)) udpEndpoint = endps[1].getInfo() test(udpEndpoint.is_a?(Ice::UDPEndpointInfo)); test(udpEndpoint.host == "udphost") test(udpEndpoint.port == 10001) test(udpEndpoint.mcastInterface == "eth0") test(udpEndpoint.mcastTtl == 5) test(udpEndpoint.timeout == -1) test(!udpEndpoint.compress) test(!udpEndpoint.secure()) test(udpEndpoint.datagram()) test(udpEndpoint.type() == Ice::UDPEndpointType) opaqueEndpoint = endps[2].getInfo() test(opaqueEndpoint.is_a?(Ice::OpaqueEndpointInfo)); test(opaqueEndpoint.rawEncoding == Ice::EncodingVersion.new(1, 8)) puts "ok" defaultHost = communicator.getProperties().getProperty("Ice.Default.Host") base = communicator.stringToProxy("test:default -p 12010:udp -p 12010") testIntf = Test::TestIntfPrx::checkedCast(base) print "test connection endpoint information..." STDOUT.flush ipinfo = base.ice_getConnection().getEndpoint().getInfo() test(ipinfo.port == 12010) test(!ipinfo.compress) test(ipinfo.host == defaultHost) ctx = testIntf.getEndpointInfoAsContext() test(ctx["host"] == ipinfo.host) test(ctx["compress"] == "false") port = Integer(ctx["port"]) test(port > 0) udp = base.ice_datagram().ice_getConnection().getEndpoint().getInfo() test(udp.port == 12010) test(udp.host == defaultHost) puts "ok" print "testing connection information..." STDOUT.flush info = base.ice_getConnection().getInfo() test(!info.incoming) test(info.adapterName.length == 0) test(info.remotePort == 12010) test(info.remoteAddress == defaultHost) test(info.localAddress == defaultHost) ctx = testIntf.getConnectionInfoAsContext() test(ctx["incoming"] == "true") test(ctx["adapterName"] == "TestAdapter") test(ctx["remoteAddress"] == info.localAddress) test(ctx["localAddress"] == info.remoteAddress) test(ctx["remotePort"] == info.localPort.to_s()) test(ctx["localPort"] == info.remotePort.to_s()) puts "ok" testIntf.shutdown() communicator.shutdown() end Ice-3.5.1/rb/test/Ice/info/Client.rb0000755000076400007640000000221712223561477015160 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' slice_dir = Ice.getSliceDir if slice_dir.empty? fail "Slice directory not found" end Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require './AllTests' def test(b) if !b raise RuntimeError, 'test assertion failed' end end def run(args, communicator) allTests(communicator) return true end begin initData = Ice::InitializationData.new initData.properties = Ice.createProperties(ARGV) communicator = Ice.initialize(ARGV, initData) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/info/run.py0000755000076400007640000000144612223561477014576 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.clientServerTest() Ice-3.5.1/rb/test/Ice/info/Test.ice0000644000076400007640000000103512223561477015010 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once #include module Test { interface TestIntf { void shutdown(); Ice::Context getEndpointInfoAsContext(); Ice::Context getConnectionInfoAsContext(); }; }; Ice-3.5.1/rb/test/Ice/operations/0000755000076400007640000000000012223561477014640 5ustar mesmesIce-3.5.1/rb/test/Ice/operations/AllTests.rb0000644000076400007640000000157412223561477016727 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** require './Twoways' require './BatchOneways' def allTests(communicator) ref = "test:default -p 12010" base = communicator.stringToProxy(ref) cl = Test::MyClassPrx::checkedCast(base) derived = Test::MyDerivedClassPrx::checkedCast(cl) print "testing twoway operations... " STDOUT.flush twoways(communicator, cl) twoways(communicator, derived) derived.opDerived() puts "ok" print "testing batch oneway operations... " STDOUT.flush batchOneways(cl) batchOneways(derived) puts "ok" return cl end Ice-3.5.1/rb/test/Ice/operations/Twoways.rb0000644000076400007640000003221012223561477016640 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def twoways(communicator, p) # # ice_ping # p.ice_ping # # ice_isA # test(p.ice_isA(Test::MyClass::ice_staticId())) # # ice_ids # ids = p.ice_ids test(ids.length == 3) test(ids[0] == "::Ice::Object") test(ids[1] == "::Test::MyClass") test(ids[2] == "::Test::MyDerivedClass") # # ice_id # test(p.ice_id == Test::MyDerivedClass::ice_staticId()) # # opVoid # p.opVoid() # # opByte # r, b = p.opByte(0xff, 0x0f) test(b == 0xf0) test(r == 0xff) # # opBool # r, b = p.opBool(true, false) test(b) test(!r) # # opShortIntLong # r, s, i, l = p.opShortIntLong(10, 11, 12) test(s == 10) test(i == 11) test(l == 12) test(r == 12) r, s, i, l = p.opShortIntLong(-32768, -2147483648, -9223372036854775808) test(s == -32768) test(i == -2147483648) test(l == -9223372036854775808) test(r == -9223372036854775808) r, s, i, l = p.opShortIntLong(32767, 2147483647, 9223372036854775807) test(s == 32767) test(i == 2147483647) test(l == 9223372036854775807) test(r == 9223372036854775807) # # opFloatDouble # r, f, d = p.opFloatDouble(3.14, 1.1E10) test(f - 3.14 < 0.001) test(d == 1.1E10) test(r == 1.1E10) # # opString # r, s = p.opString("hello", "world") test(s == "world hello") test(r == "hello world") # # opMyEnum # r, e = p.opMyEnum(Test::MyEnum::Enum2) test(e == Test::MyEnum::Enum2) test(r == Test::MyEnum::Enum3) # # opMyClass # r, c1, c2 = p.opMyClass(p) test(Ice::proxyIdentityAndFacetEqual(c1, p)) test(!Ice::proxyIdentityAndFacetEqual(c2, p)) test(Ice::proxyIdentityAndFacetEqual(r, p)) test(c1.ice_getIdentity() == communicator.stringToIdentity("test")) test(c2.ice_getIdentity() == communicator.stringToIdentity("noSuchIdentity")) test(r.ice_getIdentity() == communicator.stringToIdentity("test")) r.opVoid() c1.opVoid() begin c2.opVoid() test(false) rescue Ice::ObjectNotExistException end r, c1, c2 = p.opMyClass(nil) test(!c1) test(c2) test(Ice::proxyIdentityAndFacetEqual(r, p)) r.opVoid() # # opStruct # si1 = Test::Structure.new si1.p = p si1.e = Test::MyEnum::Enum3 si1.s = Test::AnotherStruct.new si1.s.s = "abc" si2 = Test::Structure.new si2.p = nil si2.e = Test::MyEnum::Enum2 si2.s = Test::AnotherStruct.new si2.s.s = "def" rso, so = p.opStruct(si1, si2) test(!rso.p) test(rso.e == Test::MyEnum::Enum2) test(rso.s.s == "def") test(so.p == p) test(so.e == Test::MyEnum::Enum3) test(so.s.s == "a new string") so.p.opVoid() # # opByteS # bsi1 = [0x01, 0x11, 0x12, 0x22] bsi2 = [0xf1, 0xf2, 0xf3, 0xf4] rso, bso = p.opByteS(bsi1, bsi2) test(bso.length == 4) test(bso == "\x22\x12\x11\x01") test(rso.length == 8) test(rso == "\x01\x11\x12\x22\xf1\xf2\xf3\xf4") # # opBoolS # bsi1 = [true, true, false] bsi2 = [false] rso, bso = p.opBoolS(bsi1, bsi2) test(bso.length == 4) test(bso[0]) test(bso[1]) test(!bso[2]) test(!bso[3]) test(rso.length == 3) test(!rso[0]) test(rso[1]) test(rso[2]) # # opShortIntLongS # ssi = [1, 2, 3] isi = [5, 6, 7, 8] lsi = [10, 30, 20] rso, sso, iso, lso = p.opShortIntLongS(ssi, isi, lsi) test(sso.length == 3) test(sso[0] == 1) test(sso[1] == 2) test(sso[2] == 3) test(iso.length == 4) test(iso[0] == 8) test(iso[1] == 7) test(iso[2] == 6) test(iso[3] == 5) test(lso.length == 6) test(lso[0] == 10) test(lso[1] == 30) test(lso[2] == 20) test(lso[3] == 10) test(lso[4] == 30) test(lso[5] == 20) test(rso.length == 3) test(rso[0] == 10) test(rso[1] == 30) test(rso[2] == 20) # # opFloatDoubleS # fsi = [3.14, 1.11] dsi = [1.1E10, 1.2E10, 1.3E10] rso, fso, dso = p.opFloatDoubleS(fsi, dsi) test(fso.length == 2) test(fso[0] - 3.14 < 0.001) test(fso[1] - 1.11 < 0.001) test(dso.length == 3) test(dso[0] == 1.3E10) test(dso[1] == 1.2E10) test(dso[2] == 1.1E10) test(rso.length == 5) test(rso[0] == 1.1E10) test(rso[1] == 1.2E10) test(rso[2] == 1.3E10) test(rso[3] - 3.14 < 0.001) test(rso[4] - 1.11 < 0.001) # # opStringS # ssi1 = ['abc', 'de', 'fghi'] ssi2 = ['xyz'] rso, sso = p.opStringS(ssi1, ssi2) test(sso.length == 4) test(sso[0] == "abc") test(sso[1] == "de") test(sso[2] == "fghi") test(sso[3] == "xyz") test(rso.length == 3) test(rso[0] == "fghi") test(rso[1] == "de") test(rso[2] == "abc") # # opByteSS # bsi1 = [[0x01, 0x11, 0x12], [0xff]] bsi2 = [[0x0e], [0xf2, 0xf1]] rso, bso = p.opByteSS(bsi1, bsi2) test(bso.length == 2) test(bso[0].length == 1) test(bso[0] == "\xff") test(bso[1].length == 3) test(bso[1] == "\x01\x11\x12") test(rso.length == 4) test(rso[0].length == 3) test(rso[0] == "\x01\x11\x12") test(rso[1].length == 1) test(rso[1] == "\xff") test(rso[2].length == 1) test(rso[2] == "\x0e") test(rso[3].length == 2) test(rso[3] == "\xf2\xf1") # # opFloatDoubleSS # fsi = [[3.14], [1.11], []] dsi = [[1.1E10, 1.2E10, 1.3E10]] rso, fso, dso = p.opFloatDoubleSS(fsi, dsi) test(fso.length == 3) test(fso[0].length == 1) test(fso[0][0] - 3.14 < 0.001) test(fso[1].length == 1) test(fso[1][0] - 1.11 < 0.001) test(fso[2].length == 0) test(dso.length == 1) test(dso[0].length == 3) test(dso[0][0] == 1.1E10) test(dso[0][1] == 1.2E10) test(dso[0][2] == 1.3E10) test(rso.length == 2) test(rso[0].length == 3) test(rso[0][0] == 1.1E10) test(rso[0][1] == 1.2E10) test(rso[0][2] == 1.3E10) test(rso[1].length == 3) test(rso[1][0] == 1.1E10) test(rso[1][1] == 1.2E10) test(rso[1][2] == 1.3E10) # # opStringSS # ssi1 = [['abc'], ['de', 'fghi']] ssi2 = [[], [], ['xyz']] rso, sso = p.opStringSS(ssi1, ssi2) test(sso.length == 5) test(sso[0].length == 1) test(sso[0][0] == "abc") test(sso[1].length == 2) test(sso[1][0] == "de") test(sso[1][1] == "fghi") test(sso[2].length == 0) test(sso[3].length == 0) test(sso[4].length == 1) test(sso[4][0] == "xyz") test(rso.length == 3) test(rso[0].length == 1) test(rso[0][0] == "xyz") test(rso[1].length == 0) test(rso[2].length == 0) # # opStringSSS # sssi1 = [[['abc', 'de'], ['xyz']], [['hello']]] sssi2 = [[['', ''], ['abcd']], [['']], []] rsso, ssso = p.opStringSSS(sssi1, sssi2) test(ssso.length == 5) test(ssso[0].length == 2) test(ssso[0][0].length == 2) test(ssso[0][1].length == 1) test(ssso[1].length == 1) test(ssso[1][0].length == 1) test(ssso[2].length == 2) test(ssso[2][0].length == 2) test(ssso[2][1].length == 1) test(ssso[3].length == 1) test(ssso[3][0].length == 1) test(ssso[4].length == 0) test(ssso[0][0][0] == "abc") test(ssso[0][0][1] == "de") test(ssso[0][1][0] == "xyz") test(ssso[1][0][0] == "hello") test(ssso[2][0][0] == "") test(ssso[2][0][1] == "") test(ssso[2][1][0] == "abcd") test(ssso[3][0][0] == "") test(rsso.length == 3) test(rsso[0].length == 0) test(rsso[1].length == 1) test(rsso[1][0].length == 1) test(rsso[2].length == 2) test(rsso[2][0].length == 2) test(rsso[2][1].length == 1) test(rsso[1][0][0] == "") test(rsso[2][0][0] == "") test(rsso[2][0][1] == "") test(rsso[2][1][0] == "abcd") # # opByteBoolD # di1 = {10=>true, 100=>false} di2 = {10=>true, 11=>false, 101=>true} ro, d = p.opByteBoolD(di1, di2) test(d == di1) test(ro.length == 4) test(ro[10]) test(!ro[11]) test(!ro[100]) test(ro[101]) # # opShortIntD # di1 = {110=>-1, 1100=>123123} di2 = {110=>-1, 111=>-100, 1101=>0} ro, d = p.opShortIntD(di1, di2) test(d == di1) test(ro.length == 4) test(ro[110] == -1) test(ro[111] == -100) test(ro[1100] == 123123) test(ro[1101] == 0) # # opLongFloatD # di1 = {999999110=>-1.1, 999999111=>123123.2} di2 = {999999110=>-1.1, 999999120=>-100.4, 999999130=>0.5} ro, d = p.opLongFloatD(di1, di2) for k in d.keys test((d[k] - di1[k]).abs < 0.01) end test(ro.length == 4) test(ro[999999110] - -1.1 < 0.01) test(ro[999999120] - -100.4 < 0.01) test(ro[999999111] - 123123.2 < 0.01) test(ro[999999130] - 0.5 < 0.01) # # opStringStringD # di1 = {'foo'=>'abc -1.1', 'bar'=>'abc 123123.2'} di2 = {'foo'=>'abc -1.1', 'FOO'=>'abc -100.4', 'BAR'=>'abc 0.5'} ro, d = p.opStringStringD(di1, di2) test(d == di1) test(ro.length == 4) test(ro["foo"] == "abc -1.1") test(ro["FOO"] == "abc -100.4") test(ro["bar"] == "abc 123123.2") test(ro["BAR"] == "abc 0.5") # # opStringMyEnumD # di1 = {'abc'=>Test::MyEnum::Enum1, ''=>Test::MyEnum::Enum2} di2 = {'abc'=>Test::MyEnum::Enum1, 'qwerty'=>Test::MyEnum::Enum3, 'Hello!!'=>Test::MyEnum::Enum2} ro, d = p.opStringMyEnumD(di1, di2) test(d == di1) test(ro.length == 4) test(ro["abc"] == Test::MyEnum::Enum1) test(ro["qwerty"] == Test::MyEnum::Enum3) test(ro[""] == Test::MyEnum::Enum2) test(ro["Hello!!"] == Test::MyEnum::Enum2) # # opMyEnumStringD # di1 = {Test::MyEnum::Enum1=>'abc'} di2 = {Test::MyEnum::Enum2=>'Hello!!', Test::MyEnum::Enum3=>'qwerty'} ro, d = p.opMyEnumStringD(di1, di2) test(d == di1) test(ro.length == 3) test(ro[Test::MyEnum::Enum1] == "abc") test(ro[Test::MyEnum::Enum2] == "Hello!!") test(ro[Test::MyEnum::Enum3] == "qwerty") # # opMyStructMyEnumD # s11 = Test::MyStruct.new s11.i = 1 s11.j = 1 s12 = Test::MyStruct.new s12.i = 1 s12.j = 2 s22 = Test::MyStruct.new s22.i = 2 s22.j = 2 s23 = Test::MyStruct.new s23.i = 2 s23.j = 3 di1 = {s11=>Test::MyEnum::Enum1, s12=>Test::MyEnum::Enum2} di2 = {s11=>Test::MyEnum::Enum1, s22=>Test::MyEnum::Enum3, s23=>Test::MyEnum::Enum2} ro, d = p.opMyStructMyEnumD(di1, di2) test(d == di1) test(ro.length == 4) test(ro[s11] == Test::MyEnum::Enum1) test(ro[s12] == Test::MyEnum::Enum2) test(ro[s22] == Test::MyEnum::Enum3) test(ro[s23] == Test::MyEnum::Enum2) # # opIntS # lengths = [ 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 ] for l in lengths s = [] for i in (0...l) s.push(i) end r = p.opIntS(s) test(r.length == l) for j in (0...r.length) test(r[j] == -j) end end # # opContext # ctx = {'one'=>'ONE', 'two'=>'TWO', 'three'=>'THREE'} r = p.opContext() test(p.ice_getContext().length == 0) test(r != ctx) r = p.opContext(ctx) test(p.ice_getContext().length == 0) test(r == ctx) p2 = Test::MyClassPrx::checkedCast(p.ice_context(ctx)) test(p2.ice_getContext() == ctx) r = p2.opContext() test(r == ctx) r = p2.opContext(ctx) test(r == ctx) # # opIdempotent # p.opIdempotent # # opNonmutating # p.opNonmutating # # Test implicit context propagation # impls = [ 'Shared', 'PerThread' ] for i in impls initData = Ice::InitializationData.new initData.properties = communicator.getProperties().clone() initData.properties.setProperty('Ice.ImplicitContext', i) ic = Ice::initialize(initData) ctx = {'one'=>'ONE', 'two'=>'TWO', 'three'=>'THREE'} p = Test::MyClassPrx::uncheckedCast(ic.stringToProxy('test:default -p 12010')) ic.getImplicitContext().setContext(ctx) test(ic.getImplicitContext().getContext() == ctx) test(p.opContext() == ctx) test(ic.getImplicitContext().containsKey('zero') == false); r = ic.getImplicitContext().put('zero', 'ZERO'); test(r == ''); test(ic.getImplicitContext().containsKey('zero') == true); test(ic.getImplicitContext().get('zero') == 'ZERO'); ctx = ic.getImplicitContext().getContext() test(p.opContext() == ctx) prxContext = {'one'=>'UN', 'four'=>'QUATRE'} combined = ctx.clone() combined.update(prxContext) test(combined['one'] == 'UN') p = Test::MyClassPrx::uncheckedCast(p.ice_context(prxContext)) ic.getImplicitContext().setContext({}) test(p.opContext() == prxContext) ic.getImplicitContext().setContext(ctx) test(p.opContext() == combined) test(ic.getImplicitContext().remove('one') == 'ONE'); ic.destroy() end end Ice-3.5.1/rb/test/Ice/operations/Client.rb0000755000076400007640000000335212223561477016411 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' slice_dir = Ice.getSliceDir Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require './AllTests' def test(b) if !b raise RuntimeError, 'test assertion failed' end end def run(args, communicator) myClass = allTests(communicator) print "testing server shutdown... " STDOUT.flush myClass.shutdown() begin myClass.opVoid() test(false) rescue Ice::LocalException puts "ok" end return true end begin initData = Ice::InitializationData.new initData.properties = Ice.createProperties(ARGV) # # This is not necessary since we don't have AMI support (yet). # #initData.properties.setProperty('Ice.ThreadPool.Client.Size', '2') #initData.properties.setProperty('Ice.ThreadPool.Client.SizeWarn', '0') # # We must set MessageSizeMax to an explicit values, because # we run tests to check whether Ice.MemoryLimitException is # raised as expected. # initData.properties.setProperty("Ice.MessageSizeMax", "100") communicator = Ice.initialize(ARGV, initData) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/operations/run.py0000755000076400007640000000163112223561477016022 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("tests with regular server.") TestUtil.clientServerTest() print("tests with AMD server.") TestUtil.clientServerTest(server="serveramd") Ice-3.5.1/rb/test/Ice/operations/Test.ice0000644000076400007640000001041112223561477016236 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once #include module Test { enum MyEnum { enum1, enum2, enum3 }; class MyClass; struct AnotherStruct { string s; }; struct Structure { MyClass* p; MyEnum e; AnotherStruct s; }; sequence ByteS; sequence BoolS; sequence ShortS; sequence IntS; sequence LongS; sequence FloatS; sequence DoubleS; sequence StringS; sequence MyEnumS; sequence MyClassS; sequence ByteSS; sequence BoolSS; sequence ShortSS; sequence IntSS; sequence LongSS; sequence FloatSS; sequence DoubleSS; sequence StringSS; sequence MyEnumSS; sequence MyClassSS; sequence StringSSS; struct MyStruct { int i; int j; }; dictionary ByteBoolD; dictionary ShortIntD; dictionary LongFloatD; dictionary StringStringD; dictionary StringMyEnumD; dictionary MyEnumStringD; dictionary MyStructMyEnumD; ["ami"] class MyClass { void shutdown(); void opVoid(); byte opByte(byte p1, byte p2, out byte p3); bool opBool(bool p1, bool p2, out bool p3); long opShortIntLong(short p1, int p2, long p3, out short p4, out int p5, out long p6); double opFloatDouble(float p1, double p2, out float p3, out double p4); string opString(string p1, string p2, out string p3); MyEnum opMyEnum(MyEnum p1, out MyEnum p2); MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3); Structure opStruct(Structure p1, Structure p2, out Structure p3); ByteS opByteS(ByteS p1, ByteS p2, out ByteS p3); BoolS opBoolS(BoolS p1, BoolS p2, out BoolS p3); LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3, out ::Test::ShortS p4, out IntS p5, out LongS p6); DoubleS opFloatDoubleS(FloatS p1, DoubleS p2, out FloatS p3, out DoubleS p4); StringS opStringS(StringS p1, StringS p2, out StringS p3); ByteSS opByteSS(ByteSS p1, ByteSS p2, out ByteSS p3); BoolSS opBoolSS(BoolSS p1, BoolSS p2, out BoolSS p3); LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3, out ShortSS p4, out IntSS p5, out LongSS p6); DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2, out FloatSS p3, out DoubleSS p4); StringSS opStringSS(StringSS p1, StringSS p2, out StringSS p3); StringSSS opStringSSS(StringSSS p1, StringSSS p2, out StringSSS p3); ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2, out ByteBoolD p3); ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2, out ShortIntD p3); LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2, out LongFloatD p3); StringStringD opStringStringD(StringStringD p1, StringStringD p2, out StringStringD p3); StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, out StringMyEnumD p3); MyEnumStringD opMyEnumStringD(MyEnumStringD p1, MyEnumStringD p2, out MyEnumStringD p3); MyStructMyEnumD opMyStructMyEnumD(MyStructMyEnumD p1, MyStructMyEnumD p2, out MyStructMyEnumD p3); IntS opIntS(IntS s); void opByteSOneway(ByteS s); Ice::Context opContext(); idempotent void opIdempotent(); ["nonmutating"] idempotent void opNonmutating(); }; ["ami"] class MyDerivedClass extends MyClass { void opDerived(); }; }; Ice-3.5.1/rb/test/Ice/operations/BatchOneways.rb0000644000076400007640000000372112223561477017557 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def batchOneways(p) bs1 = "\0" * (10 * 1024); bs2 = "\0" * (99 * 1024); bs3 = "\0" * (100 * 1024); begin p.opByteSOneway(bs1) rescue Ice::MemoryLimitException test(false) end begin p.opByteSOneway(bs2) rescue Ice::MemoryLimitException test(false) end begin p.opByteSOneway(bs3) test(false) rescue Ice::MemoryLimitException end batch = Test::MyClassPrx::uncheckedCast(p.ice_batchOneway()) for i in (0...30) begin batch.opByteSOneway(bs1) rescue Ice::MemoryLimitException test(false) end end batch.ice_getConnection().flushBatchRequests() batch2 = Test::MyClassPrx::uncheckedCast(p.ice_batchOneway()) batch.ice_ping() batch2.ice_ping() batch.ice_flushBatchRequests() batch.ice_getConnection().close(false) batch.ice_ping() batch2.ice_ping() batch.ice_getConnection() batch2.ice_getConnection() batch.ice_ping() batch.ice_getConnection().close(false) begin batch.ice_ping() test(false) rescue Ice::CloseConnectionException end begin batch2.ice_ping() test(false) rescue Ice::CloseConnectionException end batch.ice_ping() batch2.ice_ping() identity = Ice::Identity.new() identity.name = "invalid"; batch3 = batch.ice_identity(identity) batch3.ice_ping() batch3.ice_flushBatchRequests() # Make sure that a bogus batch request doesn't cause troubles to other ones. batch3.ice_ping() batch.ice_ping() batch.ice_flushBatchRequests() batch.ice_ping() end Ice-3.5.1/rb/test/Ice/optional/0000755000076400007640000000000012223561477014302 5ustar mesmesIce-3.5.1/rb/test/Ice/optional/AllTests.rb0000644000076400007640000004766212223561477016401 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator) print "testing stringToProxy... " STDOUT.flush ref = "initial:default -p 12010" base = communicator.stringToProxy(ref) test(base) puts "ok" print "testing checked cast... " STDOUT.flush initial = Test::InitialPrx::checkedCast(base) test(initial) test(initial == base) puts "ok" print "testing optional data members... " STDOUT.flush oo1 = Test::OneOptional.new test(oo1.a == Ice::Unset) oo1.a = 15 oo2 = Test::OneOptional.new(16) test(oo2.a == 16) mo1 = Test::MultiOptional.new() test(mo1.a == Ice::Unset) test(mo1.b == Ice::Unset) test(mo1.c == Ice::Unset) test(mo1.d == Ice::Unset) test(mo1.e == Ice::Unset) test(mo1.f == Ice::Unset) test(mo1.g == Ice::Unset) test(mo1.h == Ice::Unset) test(mo1.i == Ice::Unset) test(mo1.j == Ice::Unset) test(mo1.k == Ice::Unset) test(mo1.bs == Ice::Unset) test(mo1.ss == Ice::Unset) test(mo1.iid == Ice::Unset) test(mo1.sid == Ice::Unset) test(mo1.fs == Ice::Unset) test(mo1.vs == Ice::Unset) test(mo1.shs == Ice::Unset) test(mo1.es == Ice::Unset) test(mo1.fss == Ice::Unset) test(mo1.vss == Ice::Unset) test(mo1.oos == Ice::Unset) test(mo1.oops == Ice::Unset) test(mo1.ied == Ice::Unset) test(mo1.ifsd == Ice::Unset) test(mo1.ivsd == Ice::Unset) test(mo1.iood == Ice::Unset) test(mo1.ioopd == Ice::Unset) test(mo1.bos == Ice::Unset) fs = Test::FixedStruct.new(78) vs = Test::VarStruct.new("hello") mo1 = Test::MultiOptional.new(15, true, 19, 78, 99, 5.5, 1.0, "test", Test::MyEnum::MyEnumMember, \ Test::MultiOptionalPrx::uncheckedCast(communicator.stringToProxy("test")), \ nil, [5], ["test", "test2"], {4=>3}, {"test"=>10}, fs, vs, [1], \ [Test::MyEnum::MyEnumMember, Test::MyEnum::MyEnumMember], \ [ fs ], [ vs ], [ oo1 ], \ [ Test::OneOptionalPrx::uncheckedCast(communicator.stringToProxy("test")) ], \ {4=>Test::MyEnum::MyEnumMember}, {4=>fs}, {5=>vs}, {5=>Test::OneOptional.new(15)}, \ {5=>Test::OneOptionalPrx::uncheckedCast(communicator.stringToProxy("test"))}, \ [false, true, false]) test(mo1.a == 15) test(mo1.b == true) test(mo1.c == 19) test(mo1.d == 78) test(mo1.e == 99) test(mo1.f == 5.5) test(mo1.g == 1.0) test(mo1.h == "test") test(mo1.i == Test::MyEnum::MyEnumMember) test(mo1.j == Test::MultiOptionalPrx::uncheckedCast(communicator.stringToProxy("test"))) test(mo1.k == nil) test(mo1.bs == [5]) test(mo1.ss == ["test", "test2"]) test(mo1.iid[4] == 3) test(mo1.sid["test"] == 10) test(mo1.fs == Test::FixedStruct.new(78)) test(mo1.vs == Test::VarStruct.new("hello")) test(mo1.shs[0] == 1) test(mo1.es[0] == Test::MyEnum::MyEnumMember && mo1.es[1] == Test::MyEnum::MyEnumMember) test(mo1.fss[0] == Test::FixedStruct.new(78)) test(mo1.vss[0] == Test::VarStruct.new("hello")) test(mo1.oos[0] == oo1) test(mo1.oops[0] == Test::OneOptionalPrx::uncheckedCast(communicator.stringToProxy("test"))) test(mo1.ied[4] == Test::MyEnum::MyEnumMember) test(mo1.ifsd[4] == Test::FixedStruct.new(78)) test(mo1.ivsd[5] == Test::VarStruct.new("hello")) test(mo1.iood[5].a == 15) test(mo1.ioopd[5] == Test::OneOptionalPrx::uncheckedCast(communicator.stringToProxy("test"))) test(mo1.bos == [false, true, false]) puts "ok" print "testing marshaling... " STDOUT.flush oo4 = initial.pingPong(Test::OneOptional.new) test(oo4.a == Ice::Unset) oo5 = initial.pingPong(oo1) test(oo1.a == oo5.a) mo4 = initial.pingPong(Test::MultiOptional.new) test(mo4.a == Ice::Unset) test(mo4.b == Ice::Unset) test(mo4.c == Ice::Unset) test(mo4.d == Ice::Unset) test(mo4.e == Ice::Unset) test(mo4.f == Ice::Unset) test(mo4.g == Ice::Unset) test(mo4.h == Ice::Unset) test(mo4.i == Ice::Unset) test(mo4.j == Ice::Unset) test(mo4.k == Ice::Unset) test(mo4.bs == Ice::Unset) test(mo4.ss == Ice::Unset) test(mo4.iid == Ice::Unset) test(mo4.sid == Ice::Unset) test(mo4.fs == Ice::Unset) test(mo4.vs == Ice::Unset) test(mo4.shs == Ice::Unset) test(mo4.es == Ice::Unset) test(mo4.fss == Ice::Unset) test(mo4.vss == Ice::Unset) test(mo4.oos == Ice::Unset) test(mo4.oops == Ice::Unset) test(mo4.ied == Ice::Unset) test(mo4.ifsd == Ice::Unset) test(mo4.ivsd == Ice::Unset) test(mo4.iood == Ice::Unset) test(mo4.ioopd == Ice::Unset) test(mo4.bos == Ice::Unset) mo5 = initial.pingPong(mo1) test(mo5.a == mo1.a) test(mo5.b == mo1.b) test(mo5.c == mo1.c) test(mo5.d == mo1.d) test(mo5.e == mo1.e) test(mo5.f == mo1.f) test(mo5.g == mo1.g) test(mo5.h == mo1.h) test(mo5.i == mo1.i) test(mo5.j == mo1.j) test(mo5.k == nil) test(mo5.bs == "\x05") test(mo5.ss == mo1.ss) test(mo5.iid[4] == 3) test(mo5.sid["test"] == 10) test(mo5.fs == mo1.fs) test(mo5.vs == mo1.vs) test(mo5.shs == mo1.shs) test(mo5.es[0] == Test::MyEnum::MyEnumMember && mo1.es[1] == Test::MyEnum::MyEnumMember) test(mo5.fss[0] == Test::FixedStruct.new(78)) test(mo5.vss[0] == Test::VarStruct.new("hello")) test(mo5.oos[0].a == 15) test(mo5.oops[0] == Test::OneOptionalPrx::uncheckedCast(communicator.stringToProxy("test"))) test(mo5.ied[4] == Test::MyEnum::MyEnumMember) test(mo5.ifsd[4] == Test::FixedStruct.new(78)) test(mo5.ivsd[5] == Test::VarStruct.new("hello")) test(mo5.iood[5].a == 15) test(mo5.ioopd[5] == Test::OneOptionalPrx::uncheckedCast(communicator.stringToProxy("test"))) test(mo5.bos == mo1.bos) # Clear the first half of the optional members mo6 = Test::MultiOptional.new mo6.b = mo5.b mo6.d = mo5.d mo6.f = mo5.f mo6.h = mo5.h mo6.j = mo5.j mo6.bs = mo5.bs mo6.iid = mo5.iid mo6.fs = mo5.fs mo6.shs = mo5.shs mo6.fss = mo5.fss mo6.oos = mo5.oos mo6.ifsd = mo5.ifsd mo6.iood = mo5.iood mo6.bos = mo5.bos mo7 = initial.pingPong(mo6) test(mo7.a == Ice::Unset) test(mo7.b == mo1.b) test(mo7.c == Ice::Unset) test(mo7.d == mo1.d) test(mo7.e == Ice::Unset) test(mo7.f == mo1.f) test(mo7.g == Ice::Unset) test(mo7.h == mo1.h) test(mo7.i == Ice::Unset) test(mo7.j == mo1.j) test(mo7.k == Ice::Unset) test(mo7.bs == "\x05") test(mo7.ss == Ice::Unset) test(mo7.iid[4] == 3) test(mo7.sid == Ice::Unset) test(mo7.fs == mo1.fs) test(mo7.vs == Ice::Unset) test(mo7.shs == mo1.shs) test(mo7.es == Ice::Unset) test(mo7.fss[0] == Test::FixedStruct.new(78)) test(mo7.vss == Ice::Unset) test(mo7.oos[0].a == 15) test(mo7.oops == Ice::Unset) test(mo7.ied == Ice::Unset) test(mo7.ifsd[4] == Test::FixedStruct.new(78)) test(mo7.ivsd == Ice::Unset) test(mo7.iood[5].a == 15) test(mo7.ioopd == Ice::Unset) test(mo7.bos == [false, true, false]) # Clear the second half of the optional members mo8 = Test::MultiOptional.new mo8.a = mo5.a mo8.c = mo5.c mo8.e = mo5.e mo8.g = mo5.g mo8.i = mo5.i mo8.k = mo8 mo8.ss = mo5.ss mo8.sid = mo5.sid mo8.vs = mo5.vs mo8.es = mo5.es mo8.vss = mo5.vss mo8.oops = mo5.oops mo8.ied = mo5.ied mo8.ivsd = mo5.ivsd mo8.ioopd = mo5.ioopd mo9 = initial.pingPong(mo8) test(mo9.a == mo1.a) test(mo9.b == Ice::Unset) test(mo9.c == mo1.c) test(mo9.d == Ice::Unset) test(mo9.e == mo1.e) test(mo9.f == Ice::Unset) test(mo9.g == mo1.g) test(mo9.h == Ice::Unset) test(mo9.i == mo1.i) test(mo9.j == Ice::Unset) test(mo9.k == mo9) test(mo9.bs == Ice::Unset) test(mo9.ss == mo1.ss) test(mo9.iid == Ice::Unset) test(mo9.sid["test"] == 10) test(mo9.fs == Ice::Unset) test(mo9.vs == mo1.vs) test(mo9.shs == Ice::Unset) test(mo9.es[0] == Test::MyEnum::MyEnumMember && mo1.es[1] == Test::MyEnum::MyEnumMember) test(mo9.fss == Ice::Unset) test(mo9.vss[0] == Test::VarStruct.new("hello")) test(mo9.oos == Ice::Unset) test(mo9.oops[0] == Test::OneOptionalPrx::uncheckedCast(communicator.stringToProxy("test"))) test(mo9.ied[4] == Test::MyEnum::MyEnumMember) test(mo9.ifsd == Ice::Unset) test(mo9.ivsd[5] == Test::VarStruct.new("hello")) test(mo9.iood == Ice::Unset) test(mo9.ioopd[5] == Test::OneOptionalPrx::uncheckedCast(communicator.stringToProxy("test"))) test(mo9.bos == Ice::Unset) # # Use the 1.0 encoding with operations whose only class parameters are optional. # initial.sendOptionalClass(true, Test::OneOptional.new(53)) initial.ice_encodingVersion(Ice::Encoding_1_0).sendOptionalClass(true, Test::OneOptional.new(53)) r = initial.returnOptionalClass(true) test(r != Ice::Unset) r = initial.ice_encodingVersion(Ice::Encoding_1_0).returnOptionalClass(true) test(r == Ice::Unset) puts "ok" print "testing marshaling of large containers with fixed size elements... " STDOUT.flush mc = Test::MultiOptional.new mc.bs = [] for i in (0...1000) mc.bs.push(0) end mc.shs = [] for i in (0...300) mc.shs.push(0) end mc.fss = [] for i in (0...300) mc.fss.push(Test::FixedStruct.new) end mc.ifsd = {} for i in (0...300) mc.ifsd[i] = Test::FixedStruct.new end mc = initial.pingPong(mc) test(mc.bs.length == 1000) test(mc.shs.length == 300) test(mc.fss.length == 300) test(mc.ifsd.length == 300) puts "ok" print "testing tag marshaling... " STDOUT.flush b = Test::B.new b2 = initial.pingPong(b) test(b2.ma == Ice::Unset) test(b2.mb == Ice::Unset) test(b2.mc == Ice::Unset) b.ma = 10 b.mb = 11 b.mc = 12 b.md = 13 b2 = initial.pingPong(b) test(b2.ma == 10) test(b2.mb == 11) test(b2.mc == 12) test(b2.md == 13) puts "ok" print "testing marshalling of objects with optional objects..." STDOUT.flush f = Test::F.new f.af = Test::A.new f.ae = f.af rf = initial.pingPong(f) test(rf.ae == rf.af) puts "ok" print "testing optional with default values... " STDOUT.flush wd = initial.pingPong(Test::WD.new) test(wd.a == 5) test(wd.s == "test") wd.a = Ice::Unset wd.s = Ice::Unset wd = initial.pingPong(wd) test(wd.a == Ice::Unset) test(wd.s == Ice::Unset) puts "ok" if communicator.getProperties().getPropertyAsInt("Ice.Default.SlicedFormat") > 0 print "testing marshaling with unknown class slices... " STDOUT.flush c = Test::C.new c.ss = "test" c.ms = "testms" c = initial.pingPong(c) test(c.ma == Ice::Unset) test(c.mb == Ice::Unset) test(c.mc == Ice::Unset) test(c.md == Ice::Unset) test(c.ss == "test") test(c.ms == "testms") puts "ok" print "testing optionals with unknown classes... " STDOUT.flush initial2 = Test::Initial2Prx::uncheckedCast(base) d = Test::D.new d.ds = "test" d.seq = ["test1", "test2", "test3", "test4"] d.ao = Test::A.new(18) d.requiredB = 14; d.requiredA = 14; initial2.opClassAndUnknownOptional(Test::A.new, d) puts "ok" end print "testing optional parameters... " STDOUT.flush p2, p3 = initial.opByte(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p2, p3 = initial.opByte(56) test(p2 == 56 && p3 == 56) p2, p3 = initial.opBool(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p2, p3 = initial.opBool(true) test(p2 == true && p3 == true) p2, p3 = initial.opShort(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p2, p3 = initial.opShort(56) test(p2 == 56 && p3 == 56) p2, p3 = initial.opInt(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p2, p3 = initial.opInt(56) test(p2 == 56 && p3 == 56) p2, p3 = initial.opLong(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p2, p3 = initial.opLong(56) test(p2 == 56 && p3 == 56) p2, p3 = initial.opFloat(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p2, p3 = initial.opFloat(1.0) test(p2 == 1.0 && p3 == 1.0) p2, p3 = initial.opDouble(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p2, p3 = initial.opDouble(1.0) test(p2 == 1.0 && p3 == 1.0) p2, p3 = initial.opString(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p2, p3 = initial.opString("test") test(p2 == "test" && p3 == "test") p2, p3 = initial.opMyEnum(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p2, p3 = initial.opMyEnum(Test::MyEnum::MyEnumMember) test(p2 == Test::MyEnum::MyEnumMember && p3 == Test::MyEnum::MyEnumMember) p2, p3 = initial.opSmallStruct(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = Test::SmallStruct.new(56) p2, p3 = initial.opSmallStruct(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opFixedStruct(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = Test::FixedStruct.new(56) p2, p3 = initial.opFixedStruct(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opVarStruct(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = Test::VarStruct.new("test") p2, p3 = initial.opVarStruct(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opOneOptional(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = Test::OneOptional.new(58) p2, p3 = initial.opOneOptional(p1) test(p2.a == p1.a && p3.a == p1.a) p2, p3 = initial.opOneOptionalProxy(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = Test::OneOptionalPrx::uncheckedCast(communicator.stringToProxy("test")) p2, p3 = initial.opOneOptionalProxy(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opByteSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...100) p1.push(56) end p2, p3 = initial.opByteSeq(p1) test(p2.length == p1.length && p3.length == p1.length) test(p2[0] == "\x38" || p2[0] == 0x38) test(p3[0] == "\x38" || p3[0] == 0x38) p2, p3 = initial.opBoolSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...100) p1.push(true) end p2, p3 = initial.opBoolSeq(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opShortSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...100) p1.push(56) end p2, p3 = initial.opShortSeq(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opIntSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...100) p1.push(56) end p2, p3 = initial.opIntSeq(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opLongSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...100) p1.push(56) end p2, p3 = initial.opLongSeq(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opFloatSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...100) p1.push(1.0) end p2, p3 = initial.opFloatSeq(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opDoubleSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...100) p1.push(1.0) end p2, p3 = initial.opDoubleSeq(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opStringSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...100) p1.push("test1") end p2, p3 = initial.opStringSeq(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opSmallStructSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...10) p1.push(Test::SmallStruct.new(1)) end p2, p3 = initial.opSmallStructSeq(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opSmallStructList(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...10) p1.push(Test::SmallStruct.new(1)) end p2, p3 = initial.opSmallStructList(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opFixedStructSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...10) p1.push(Test::FixedStruct.new(1)) end p2, p3 = initial.opFixedStructSeq(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opFixedStructList(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...10) p1.push(Test::FixedStruct.new(1)) end p2, p3 = initial.opFixedStructList(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opVarStructSeq(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = [] for x in (0...10) p1.push(Test::VarStruct.new("test")) end p2, p3 = initial.opVarStructSeq(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opIntIntDict(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = {1=>2, 2=>3} p2, p3 = initial.opIntIntDict(p1) test(p2 == p1 && p3 == p1) p2, p3 = initial.opStringIntDict(Ice::Unset) test(p2 == Ice::Unset && p3 == Ice::Unset) p1 = {"1"=>2, "2"=>3} p2, p3 = initial.opStringIntDict(p1) test(p2 == p1 && p3 == p1) puts "ok" print "testing exception optionals... " STDOUT.flush begin initial.opOptionalException(Ice::Unset, Ice::Unset, Ice::Unset) rescue Test::OptionalException => ex test(ex.a == Ice::Unset) test(ex.b == Ice::Unset) test(ex.o == Ice::Unset) end begin initial.opOptionalException(30, "test", Test::OneOptional.new(53)) rescue Test::OptionalException => ex test(ex.a == 30) test(ex.b == "test") test(ex.o.a == 53) end begin # # Use the 1.0 encoding with an exception whose only class members are optional. # initial.ice_encodingVersion(Ice::Encoding_1_0).opOptionalException(30, "test", Test::OneOptional.new(53)) rescue Test::OptionalException => ex test(ex.a == Ice::Unset) test(ex.b == Ice::Unset) test(ex.o == Ice::Unset) end begin initial.opDerivedException(Ice::Unset, Ice::Unset, Ice::Unset) rescue Test::DerivedException => ex test(ex.a == Ice::Unset) test(ex.b == Ice::Unset) test(ex.o == Ice::Unset) test(ex.ss == Ice::Unset) test(ex.o2 == Ice::Unset) end begin initial.opDerivedException(30, "test", Test::OneOptional.new(53)) rescue Test::DerivedException => ex test(ex.a == 30) test(ex.b == "test") test(ex.o.a == 53) test(ex.ss == "test") test(ex.o2 == ex.o) end begin initial.opRequiredException(Ice::Unset, Ice::Unset, Ice::Unset) rescue Test::RequiredException => ex test(ex.a == Ice::Unset) test(ex.b == Ice::Unset) test(ex.o == Ice::Unset) test(ex.ss != Ice::Unset) test(ex.o2 != Ice::Unset) end begin initial.opRequiredException(30, "test", Test::OneOptional.new(53)) rescue Test::RequiredException => ex test(ex.a == 30) test(ex.b == "test") test(ex.o.a == 53) test(ex.ss == "test") test(ex.o2 == ex.o) end puts "ok" return initial end Ice-3.5.1/rb/test/Ice/optional/ClientPrivate.ice0000644000076400007640000000153012223561477017534 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once #include module Test { // // The server doesn't know this class. // class D extends B { string ds; optional(990) StringSeq seq; optional(1000) A ao; }; // // This class is a hack that allows us to invoke the opClassAndUnknownOptional operation // on the server and pass an optional argument. This isn't necessary in other language // mappings where the public stream API is available. // class Initial2 { void opClassAndUnknownOptional(A p, optional(1) Object o); }; }; Ice-3.5.1/rb/test/Ice/optional/Client.rb0000755000076400007640000000172712223561477016057 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice("--all -I. ClientPrivate.ice") require './AllTests' def test(b) if !b raise RuntimeError, 'test assertion failed' end end def run(args, communicator) initial = allTests(communicator) initial.shutdown() return true end begin communicator = Ice.initialize(ARGV) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/optional/run.py0000755000076400007640000000201312223561477015457 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("Running test with compact (default) format.") TestUtil.clientServerTest() print("Running test with sliced format.") TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") Ice-3.5.1/rb/test/Ice/optional/Test.ice0000644000076400007640000001552512223561477015713 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { class OneOptional { optional(1) int a; }; enum MyEnum { MyEnumMember }; struct SmallStruct { byte m; }; struct FixedStruct { int m; }; struct VarStruct { string m; }; struct ClassVarStruct { int a; }; sequence ByteSeq; sequence BoolSeq; sequence ShortSeq; sequence IntSeq; sequence LongSeq; sequence FloatSeq; sequence DoubleSeq; sequence StringSeq; sequence MyEnumSeq; sequence SmallStructSeq; sequence SmallStructList; sequence FixedStructSeq; sequence FixedStructList; sequence VarStructSeq; sequence OneOptionalSeq; sequence OneOptionalPrxSeq; sequence Serializable; dictionary IntIntDict; dictionary StringIntDict; dictionary IntEnumDict; dictionary IntFixedStructDict; dictionary IntVarStructDict; dictionary IntOneOptionalDict; dictionary IntOneOptionalPrxDict; class MultiOptional { optional(1) byte a; optional(2) bool b; optional(3) short c; optional(4) int d; optional(5) long e; optional(6) float f; optional(7) double g; optional(8) string h; optional(9) MyEnum i; optional(10) MultiOptional* j; optional(11) MultiOptional k; optional(12) ByteSeq bs; optional(13) StringSeq ss; optional(14) IntIntDict iid; optional(15) StringIntDict sid; optional(16) FixedStruct fs; optional(17) VarStruct vs; optional(18) ShortSeq shs; optional(19) MyEnumSeq es; optional(20) FixedStructSeq fss; optional(21) VarStructSeq vss; optional(22) OneOptionalSeq oos; optional(23) OneOptionalPrxSeq oops; optional(24) IntEnumDict ied; optional(25) IntFixedStructDict ifsd; optional(26) IntVarStructDict ivsd; optional(27) IntOneOptionalDict iood; optional(28) IntOneOptionalPrxDict ioopd; optional(29) BoolSeq bos; optional(30) Serializable ser; }; class A { int requiredA; optional(1) int ma; optional(50) int mb; optional(500) int mc; }; ["preserve-slice"] class B extends A { int requiredB; optional(10) int md; }; class C extends B { string ss; optional(890) string ms; }; class WD { optional(1) int a = 5; optional(2) string s = "test"; }; exception OptionalException { bool req = false; optional(1) int a = 5; optional(2) string b; optional(50) OneOptional o; }; exception DerivedException extends OptionalException { optional(600) string ss = "test"; optional(601) OneOptional o2; }; exception RequiredException extends OptionalException { string ss = "test"; OneOptional o2; }; class OptionalWithCustom { optional(1) SmallStructList l; ["protected"] optional(2) SmallStructList lp; optional(3) ClassVarStruct s; }; class E { A ae; }; class F extends E { optional(1) A af; }; ["ami"] class Initial { void shutdown(); Object pingPong(Object o); void opOptionalException(optional(1) int a, optional(2) string b, optional(3) OneOptional o) throws OptionalException; void opDerivedException(optional(1) int a, optional(2) string b, optional(3) OneOptional o) throws OptionalException; void opRequiredException(optional(1) int a, optional(2) string b, optional(3) OneOptional o) throws OptionalException; optional(1) byte opByte(optional(2) byte p1, out optional(3) byte p3); optional(1) bool opBool(optional(2) bool p1, out optional(3) bool p3); optional(1) short opShort(optional(2) short p1, out optional(3) short p3); optional(1) int opInt(optional(2) int p1, out optional(3) int p3); optional(3) long opLong(optional(1) long p1, out optional(2) long p3); optional(1) float opFloat(optional(2) float p1, out optional(3) float p3); optional(1) double opDouble(optional(2) double p1, out optional(3) double p3); optional(1) string opString(optional(2) string p1, out optional(3) string p3); optional(1) MyEnum opMyEnum(optional(2) MyEnum p1, out optional(3) MyEnum p3); optional(1) SmallStruct opSmallStruct(optional(2) SmallStruct p1, out optional(3) SmallStruct p3); optional(1) FixedStruct opFixedStruct(optional(2) FixedStruct p1, out optional(3) FixedStruct p3); optional(1) VarStruct opVarStruct(optional(2) VarStruct p1, out optional(3) VarStruct p3); optional(1) OneOptional opOneOptional(optional(2) OneOptional p1, out optional(3) OneOptional p3); optional(1) OneOptional* opOneOptionalProxy(optional(2) OneOptional* p1, out optional(3) OneOptional* p3); optional(1) ByteSeq opByteSeq(optional(2) ByteSeq p1, out optional(3) ByteSeq p3); optional(1) BoolSeq opBoolSeq(optional(2) BoolSeq p1, out optional(3) BoolSeq p3); optional(1) ShortSeq opShortSeq(optional(2) ShortSeq p1, out optional(3) ShortSeq p3); optional(1) IntSeq opIntSeq(optional(2) IntSeq p1, out optional(3) IntSeq p3); optional(1) LongSeq opLongSeq(optional(2) LongSeq p1, out optional(3) LongSeq p3); optional(1) FloatSeq opFloatSeq(optional(2) FloatSeq p1, out optional(3) FloatSeq p3); optional(1) DoubleSeq opDoubleSeq(optional(2) DoubleSeq p1, out optional(3) DoubleSeq p3); optional(1) StringSeq opStringSeq(optional(2) StringSeq p1, out optional(3) StringSeq p3); optional(1) SmallStructSeq opSmallStructSeq(optional(2) SmallStructSeq p1, out optional(3) SmallStructSeq p3); optional(1) SmallStructList opSmallStructList(optional(2) SmallStructList p1, out optional(3) SmallStructList p3); optional(1) FixedStructSeq opFixedStructSeq(optional(2) FixedStructSeq p1, out optional(3) FixedStructSeq p3); optional(1) FixedStructList opFixedStructList(optional(2) FixedStructList p1, out optional(3) FixedStructList p3); optional(1) VarStructSeq opVarStructSeq(optional(2) VarStructSeq p1, out optional(3) VarStructSeq p3); optional(1) Serializable opSerializable(optional(2) Serializable p1, out optional(3) Serializable p3); optional(1) IntIntDict opIntIntDict(optional(2) IntIntDict p1, out optional(3) IntIntDict p3); optional(1) StringIntDict opStringIntDict(optional(2) StringIntDict p1, out optional(3) StringIntDict p3); void opClassAndUnknownOptional(A p); void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); bool supportsRequiredParams(); bool supportsJavaSerializable(); bool supportsCsharpSerializable(); }; }; Ice-3.5.1/rb/test/Ice/application/0000755000076400007640000000000012223561477014760 5ustar mesmesIce-3.5.1/rb/test/Ice/application/Client.rb0000755000076400007640000000236112223561477016530 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' class Client < Ice::Application def interruptCallback(sig) puts "handling signal " + sig end def run(args) Ice::Application::ignoreInterrupt puts "Ignore CTRL+C and the like for 5 seconds (try it!)" sleep(5) Ice::Application::callbackOnInterrupt Ice::Application::holdInterrupt puts "Hold CTRL+C and the like for 5 seconds (try it!)" sleep(5) Ice::Application::releaseInterrupt puts "Release CTRL+C (any held signals should be released)" sleep(5) Ice::Application::holdInterrupt puts "Hold CTRL+C and the like for 5 seconds (try it!)" sleep(5) Ice::Application::callbackOnInterrupt puts "Release CTRL+C (any held signals should be released)" sleep(5) puts "ok" return true end end app = Client.new() exit(app.main(ARGV)) Ice-3.5.1/rb/test/Ice/defaultValue/0000755000076400007640000000000012223561477015076 5ustar mesmesIce-3.5.1/rb/test/Ice/defaultValue/AllTests.rb0000644000076400007640000001013112223561477017152 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def allTests() print "testing default values... " STDOUT.flush v = Test::Struct1.new test(!v.boolFalse) test(v.boolTrue) test(v.b == 254) test(v.s == 16000) test(v.i == 3) test(v.l == 4) test(v.f == 5.1) test(v.d == 6.2) test(v.str == "foo \\ \"bar\n \r\n\t\v\f\a\b? \007 \x07") test(v.c1 == Test::Color::Red) test(v.c2 == Test::Color::Green) test(v.c3 == Test::Color::Blue) test(v.nc1 == Test::Nested::Color::Red) test(v.nc2 == Test::Nested::Color::Green) test(v.nc3 == Test::Nested::Color::Blue) test(v.noDefault == '') test(v.zeroI == 0) test(v.zeroL == 0) test(v.zeroF == 0) test(v.zeroDotF == 0) test(v.zeroD == 0) test(v.zeroDotD == 0) v = Test::Struct2.new test(v.boolTrue == Test::ConstBool) test(v.b == Test::ConstByte) test(v.s == Test::ConstShort) test(v.i == Test::ConstInt) test(v.l == Test::ConstLong) test(v.f == Test::ConstFloat) test(v.d == Test::ConstDouble) test(v.str == Test::ConstString) test(v.c1 == Test::ConstColor1) test(v.c2 == Test::ConstColor2) test(v.c3 == Test::ConstColor3) test(v.nc1 == Test::ConstNestedColor1) test(v.nc2 == Test::ConstNestedColor2) test(v.nc3 == Test::ConstNestedColor3) test(v.zeroI == Test::ConstZeroI) test(v.zeroL == Test::ConstZeroL) test(v.zeroF == Test::ConstZeroF) test(v.zeroDotF == Test::ConstZeroDotF) test(v.zeroD == Test::ConstZeroD) test(v.zeroDotD == Test::ConstZeroDotD) v = Test::Base.new test(!v.boolFalse) test(v.boolTrue) test(v.b == 1) test(v.s == 2) test(v.i == 3) test(v.l == 4) test(v.f == 5.1) test(v.d == 6.2) test(v.str == "foo \\ \"bar\n \r\n\t\v\f\a\b? \007 \x07") test(v.noDefault == '') test(v.noDefault == '') test(v.zeroI == 0) test(v.zeroL == 0) test(v.zeroF == 0) test(v.zeroDotF == 0) test(v.zeroD == 0) test(v.zeroDotD == 0) v = Test::Derived.new test(!v.boolFalse) test(v.boolTrue) test(v.b == 1) test(v.s == 2) test(v.i == 3) test(v.l == 4) test(v.f == 5.1) test(v.d == 6.2) test(v.str == "foo \\ \"bar\n \r\n\t\v\f\a\b? \007 \x07") test(v.c1 == Test::Color::Red) test(v.c2 == Test::Color::Green) test(v.c3 == Test::Color::Blue) test(v.nc1 == Test::Nested::Color::Red) test(v.nc2 == Test::Nested::Color::Green) test(v.nc3 == Test::Nested::Color::Blue) test(v.noDefault == '') test(v.noDefault == '') test(v.zeroI == 0) test(v.zeroL == 0) test(v.zeroF == 0) test(v.zeroDotF == 0) test(v.zeroD == 0) test(v.zeroDotD == 0) v = Test::BaseEx.new test(!v.boolFalse) test(v.boolTrue) test(v.b == 1) test(v.s == 2) test(v.i == 3) test(v.l == 4) test(v.f == 5.1) test(v.d == 6.2) test(v.str == "foo \\ \"bar\n \r\n\t\v\f\a\b? \007 \x07") test(v.noDefault == '') test(v.noDefault == '') test(v.zeroI == 0) test(v.zeroL == 0) test(v.zeroF == 0) test(v.zeroDotF == 0) test(v.zeroD == 0) test(v.zeroDotD == 0) v = Test::DerivedEx.new test(!v.boolFalse) test(v.boolTrue) test(v.b == 1) test(v.s == 2) test(v.i == 3) test(v.l == 4) test(v.f == 5.1) test(v.d == 6.2) test(v.str == "foo \\ \"bar\n \r\n\t\v\f\a\b? \007 \x07") test(v.noDefault == '') test(v.c1 == Test::Color::Red) test(v.c2 == Test::Color::Green) test(v.c3 == Test::Color::Blue) test(v.nc1 == Test::Nested::Color::Red) test(v.nc2 == Test::Nested::Color::Green) test(v.nc3 == Test::Nested::Color::Blue) test(v.noDefault == '') test(v.zeroI == 0) test(v.zeroL == 0) test(v.zeroF == 0) test(v.zeroDotF == 0) test(v.zeroD == 0) test(v.zeroDotD == 0) puts "ok" end Ice-3.5.1/rb/test/Ice/defaultValue/Client.rb0000755000076400007640000000130212223561477016640 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' Ice::loadSlice('Test.ice') require './AllTests' def test(b) if !b raise RuntimeError, 'test assertion failed' end end def run(args) allTests() return true end begin status = run(ARGV) rescue => ex puts $! print ex.backtrace.join("\n") status = false end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/defaultValue/run.py0000755000076400007640000000171312223561477016261 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil sys.stdout.write("starting client... ") sys.stdout.flush() clientProc = TestUtil.startClient("Client.rb", startReader = False) print("ok") clientProc.startReader() clientProc.waitTestSuccess() Ice-3.5.1/rb/test/Ice/defaultValue/Test.ice0000644000076400007640000000717312223561477016507 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { enum Color { red, green, blue }; module Nested { enum Color { red, green, blue }; }; struct Struct1 { bool boolFalse = false; bool boolTrue = true; byte b = 254; short s = 16000; int i = 3; long l = 4; float f = 5.1; double d = 6.2; string str = "foo \\ \"bar\n \r\n\t\v\f\a\b\? \007 \x07"; Color c1 = ::Test::red; Color c2 = Test::green; Color c3 = blue; Nested::Color nc1 = ::Test::Nested::red; Nested::Color nc2 = Nested::green; Nested::Color nc3 = Nested::blue; string noDefault; int zeroI = 0; long zeroL = 0; float zeroF = 0; float zeroDotF = 0.0; double zeroD = 0; double zeroDotD = 0; }; const bool ConstBool = true; const byte ConstByte = 254; const short ConstShort = 16000; const int ConstInt = 3; const long ConstLong = 4; const float ConstFloat = 5.1; const double ConstDouble = 6.2; const string ConstString = "foo \\ \"bar\n \r\n\t\v\f\a\b\? \007 \x07"; const Color ConstColor1 = ::Test::red; const Color ConstColor2 = Test::green; const Color ConstColor3 = blue; const Nested::Color ConstNestedColor1 = ::Test::Nested::red; const Nested::Color ConstNestedColor2 = Test::Nested::green; const Nested::Color ConstNestedColor3 = Nested::blue; const int ConstZeroI = 0; const long ConstZeroL = 0; const float ConstZeroF = 0; const float ConstZeroDotF = 0.0; const double ConstZeroD = 0; const double ConstZeroDotD = 0; struct Struct2 { bool boolTrue = ConstBool; byte b = ConstByte; short s = ConstShort; int i = ConstInt; long l = ConstLong; float f = ConstFloat; double d = ConstDouble; string str = ConstString; Color c1 = ConstColor1; Color c2 = ConstColor2; Color c3 = ConstColor3; Nested::Color nc1 = ConstNestedColor1; Nested::Color nc2 = ConstNestedColor2; Nested::Color nc3 = ConstNestedColor3; int zeroI = ConstZeroI; long zeroL = ConstZeroL; float zeroF = ConstZeroF; float zeroDotF = ConstZeroDotF; double zeroD = ConstZeroD; double zeroDotD = ConstZeroDotD; }; class Base { bool boolFalse = false; bool boolTrue = true; byte b = 1; short s = 2; int i = 3; long l = 4; float f = 5.1; double d = 6.2; string str = "foo \\ \"bar\n \r\n\t\v\f\a\b\? \007 \x07"; string noDefault; int zeroI = 0; long zeroL = 0; float zeroF = 0; float zeroDotF = 0.0; double zeroD = 0; double zeroDotD = 0; }; class Derived extends Base { Color c1 = ::Test::red; Color c2 = Test::green; Color c3 = blue; Nested::Color nc1 = ::Test::Nested::red; Nested::Color nc2 = Nested::green; Nested::Color nc3 = Nested::blue; }; exception BaseEx { bool boolFalse = false; bool boolTrue = true; byte b = 1; short s = 2; int i = 3; long l = 4; float f = 5.1; double d = 6.2; string str = "foo \\ \"bar\n \r\n\t\v\f\a\b\? \007 \x07"; string noDefault; int zeroI = 0; long zeroL = 0; float zeroF = 0; float zeroDotF = 0.0; double zeroD = 0; double zeroDotD = 0; }; exception DerivedEx extends BaseEx { Color c1 = ConstColor1; Color c2 = ConstColor2; Color c3 = ConstColor3; Nested::Color nc1 = ConstNestedColor1; Nested::Color nc2 = ConstNestedColor2; Nested::Color nc3 = ConstNestedColor3; }; }; Ice-3.5.1/rb/test/Ice/objects/0000755000076400007640000000000012223561477014106 5ustar mesmesIce-3.5.1/rb/test/Ice/objects/AllTests.rb0000644000076400007640000001364512223561477016177 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** require './TestI.rb' # # Ice for Ruby behaves differently than Ice for C++, because # collocated invocations are still sent "over the wire". Therefore # we always need to install the factories, even for the collocated # case. # class MyObjectFactory def create(type) if type == '::Test::B' return BI.new elsif type == '::Test::C' return CI.new # # We do not specialize D, instead we just re-open it to define # its methods. # #elsif type == '::Test::D' # return DI.new elsif type == '::Test::E' return EI.new elsif type == '::Test::F' return FI.new end fail "unknown type" end def destroy # Nothing to do end end def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator) factory = MyObjectFactory.new communicator.addObjectFactory(factory, '::Test::B') communicator.addObjectFactory(factory, '::Test::C') #communicator.addObjectFactory(factory, '::Test::D') communicator.addObjectFactory(factory, '::Test::E') communicator.addObjectFactory(factory, '::Test::F') print "testing stringToProxy... " STDOUT.flush ref = "initial:default -p 12010" base = communicator.stringToProxy(ref) test(base) puts "ok" print "testing checked cast... " STDOUT.flush initial = Test::InitialPrx::checkedCast(base) test(initial) test(initial == base) puts "ok" print "getting B1... " STDOUT.flush b1 = initial.getB1() test(b1) puts "ok" print "getting B2... " STDOUT.flush b2 = initial.getB2() test(b2) puts "ok" print "getting C... " STDOUT.flush c = initial.getC() test(c) puts "ok" print "getting D... " STDOUT.flush d = initial.getD() test(d) puts "ok" print "checking consistency... " STDOUT.flush test(b1 != b2) test(b1 != c) test(b1 != d) test(b2 != c) test(b2 != d) test(c != d) test(b1.theB == b1) test(b1.theC == nil) test(b1.theA.is_a?(Test::B)) test(b1.theA.theA == b1.theA) test(b1.theA.theB == b1) test(b1.theA.theC) test(b1.theA.theC.theB == b1.theA) test(b1.preMarshalInvoked) test(b1.postUnmarshalInvoked()) test(b1.theA.preMarshalInvoked) test(b1.theA.postUnmarshalInvoked()) test(b1.theA.theC.preMarshalInvoked) test(b1.theA.theC.postUnmarshalInvoked()) # More tests possible for b2 and d, but I think this is already sufficient. test(b2.theA == b2) test(d.theC == nil) puts "ok" print "getting B1, B2, C, and D all at once... " STDOUT.flush b1, b2, c, d = initial.getAll() test(b1) test(b2) test(c) test(d) puts "ok" print "checking consistency... " STDOUT.flush test(b1 != b2) test(b1 != c) test(b1 != d) test(b2 != c) test(b2 != d) test(c != d) test(b1.theA == b2) test(b1.theB == b1) test(b1.theC == nil) test(b2.theA == b2) test(b2.theB == b1) test(b2.theC == c) test(c.theB == b2) test(d.theA == b1) test(d.theB == b2) test(d.theC == nil) test(d.preMarshalInvoked) test(d.postUnmarshalInvoked()) test(d.theA.preMarshalInvoked) test(d.theA.postUnmarshalInvoked()) test(d.theB.preMarshalInvoked) test(d.theB.postUnmarshalInvoked()) test(d.theB.theC.preMarshalInvoked) test(d.theB.theC.postUnmarshalInvoked()) puts "ok" print "testing protected members... " STDOUT.flush e = initial.getE() test(e.checkValues()) begin e.i # Test that i is not accessible test(false) rescue NoMethodError # Expected end begin e.s # Test that s is not accessible test(false) rescue NoMethodError # Expected end f = initial.getF() test(f.checkValues()) test(f.e2.checkValues()) begin f.e1 # Test that e1 is not accessible test(false) rescue NoMethodError # Expected end puts "ok" print "getting I, J, H... " STDOUT.flush i = initial.getI() test(i) j = initial.getJ() test(i) h = initial.getH() test(i) puts "ok" print "setting I... " STDOUT.flush initial.setI(i) initial.setI(j) initial.setI(h) puts "ok" print "testing sequences... " STDOUT.flush initial.opBaseSeq([]) retS, outS = initial.opBaseSeq([Test::Base.new]) test(retS.length == 1 && outS.length == 1) puts "ok" print "testing compact ID... " STDOUT.flush begin r = initial.getCompact() test(r != nil) rescue Ice::OperationNotExistException end puts "ok" print "testing UnexpectedObjectException... " STDOUT.flush ref = "uoet:default -p 12010" base = communicator.stringToProxy(ref) test(base) uoet = Test::UnexpectedObjectExceptionTestPrx::uncheckedCast(base) test(uoet) begin uoet.op() test(false) rescue Ice::UnexpectedObjectException => ex test(ex.type == "::Test::AlsoEmpty") test(ex.expectedType == "::Test::Empty") rescue Ice::UnmarshalOutOfBoundsException => ex # This test raises Ice::UnmarshalOutOfBoundsException on Windows when the # server is compiled with VC6. test(RUBY_PLATFORM =~ /(win|w)32$/) rescue Ice::Exception => ex puts $! print ex.backtrace.join("\n") test(false) rescue => ex puts $! print ex.backtrace.join("\n") test(false) end puts "ok" return initial end Ice-3.5.1/rb/test/Ice/objects/ClientPrivate.ice0000644000076400007640000000162512223561477017345 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { class Empty { }; class AlsoEmpty { }; interface UnexpectedObjectExceptionTest { Empty op(); }; // // Remaining definitions are here to ensure that the generated code compiles. // class COneMember { Empty e; }; class CTwoMembers { Empty e1; Empty e2; }; exception EOneMember { Empty e; }; exception ETwoMembers { Empty e1; Empty e2; }; struct SOneMember { Empty e; }; struct STwoMembers { Empty e1; Empty e2; }; dictionary DOneMember; dictionary DTwoMembers; }; Ice-3.5.1/rb/test/Ice/objects/TestI.rb0000644000076400007640000000332612223561477015467 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** class BI < Test::B def initialize @preMarshalInvoked = false @_postUnmarshalInvoked = false end def postUnmarshalInvoked(current=nil) return @_postUnmarshalInvoked end def ice_preMarshal @preMarshalInvoked = true end def ice_postUnmarshal @_postUnmarshalInvoked = true end end class CI < Test::C def initialize @preMarshalInvoked = false @_postUnmarshalInvoked = false end def postUnmarshalInvoked(current=nil) return @_postUnmarshalInvoked end def ice_preMarshal @preMarshalInvoked = true end def ice_postUnmarshal @_postUnmarshalInvoked = true end end # # Re-open Test::D instead of specializing it. # class Test::D def initialize @preMarshalInvoked = false @_postUnmarshalInvoked = false end def postUnmarshalInvoked(current=nil) return @_postUnmarshalInvoked end def ice_preMarshal @preMarshalInvoked = true end def ice_postUnmarshal @_postUnmarshalInvoked = true end end class EI < Test::E def initialize super(1, "hello") end def checkValues(current=nil) return i == 1 && s == "hello" end end class FI < Test::F def initialize(e=nil) super(e, e) end def checkValues(current=nil) return e1 != nil && e1 == e2 end end Ice-3.5.1/rb/test/Ice/objects/Client.rb0000755000076400007640000000164312223561477015660 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' Ice::loadSlice('Test.ice') Ice::loadSlice('ClientPrivate.ice') require './AllTests' def run(args, communicator) initial = allTests(communicator) initial.shutdown() return true end begin communicator = Ice.initialize(ARGV) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/objects/run.py0000755000076400007640000000240012223561477015263 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("Running test with compact (default) format.") TestUtil.clientServerTest() print("Running test with sliced format.") TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") print("Running test with 1.0 encoding.") TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") Ice-3.5.1/rb/test/Ice/objects/Test.ice0000644000076400007640000000305212223561477015507 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { struct S { string str; }; class Base { S theS; string str; }; class AbstractBase extends Base { void op(); }; class B; class C; class A { B theB; C theC; bool preMarshalInvoked; bool postUnmarshalInvoked(); }; class B extends A { A theA; }; class C { B theB; bool preMarshalInvoked; bool postUnmarshalInvoked(); }; class D { A theA; B theB; C theC; bool preMarshalInvoked; bool postUnmarshalInvoked(); }; ["protected"] class E { int i; string s; bool checkValues(); }; class F { ["protected"] E e1; E e2; bool checkValues(); }; interface I { }; interface J extends I { }; class H implements I { }; sequence BaseSeq; class CompactExt; class Compact(1) { }; const int CompactExtId = 789; class CompactExt(CompactExtId) extends Compact { }; class Initial { void shutdown(); B getB1(); B getB2(); C getC(); D getD(); E getE(); F getF(); void getAll(out B b1, out B b2, out C theC, out D theD); I getI(); I getJ(); I getH(); void setI(I theI); BaseSeq opBaseSeq(BaseSeq inSeq, out BaseSeq outSeq); Compact getCompact(); }; }; Ice-3.5.1/rb/test/Ice/exceptions/0000755000076400007640000000000012223561477014636 5ustar mesmesIce-3.5.1/rb/test/Ice/exceptions/AllTests.rb0000644000076400007640000002107612223561477016724 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def test(b) if !b raise RuntimeError, 'test assertion failed' end end class ObjectFactoryI def create(id) return nil end def destroy() end end def allTests(communicator) platformInfo = RUBY_PLATFORM.split("-") isWin32 = false if platformInfo.length >= 2 && platformInfo[1] == "mswin32" isWin32 = true end print "testing object factory registration exception... " STDOUT.flush of = ObjectFactoryI.new communicator.addObjectFactory(of, "x") begin communicator.addObjectFactory(of, "x") test(false) rescue Ice::AlreadyRegisteredException end puts "ok" print "testing stringToProxy... " STDOUT.flush ref = "thrower:default -p 12010" base = communicator.stringToProxy(ref) test(base) puts "ok" print "testing checked cast... " STDOUT.flush thrower = Test::ThrowerPrx::checkedCast(base) test(thrower) test(thrower == base) puts "ok" print "catching exact types... " STDOUT.flush begin thrower.throwAasA(1) test(false) rescue Test::A => ex test(ex.aMem == 1) rescue print $!.backtrace.join("\n") test(false) end begin thrower.throwAorDasAorD(1) test(false) rescue Test::A => ex test(ex.aMem == 1) rescue print $!.backtrace.join("\n") test(false) end begin thrower.throwAorDasAorD(-1) test(false) rescue Test::D => ex test(ex.dMem == -1) rescue print $!.backtrace.join("\n") test(false) end begin thrower.throwBasB(1, 2) test(false) rescue Test::B => ex test(ex.aMem == 1) test(ex.bMem == 2) rescue print $!.backtrace.join("\n") test(false) end begin thrower.throwCasC(1, 2, 3) test(false) rescue Test::C => ex test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) rescue print $!.backtrace.join("\n") test(false) end # # We cannot invoke throwModA if the server was built with VC6. # if !isWin32 begin thrower.throwModA(1, 2) test(false) rescue Test::Mod::A => ex test(ex.aMem == 1) test(ex.a2Mem == 2) rescue Ice::OperationNotExistException # # This operation is not supported in Java. # rescue print $! print $!.backtrace.join("\n") test(false) end end puts "ok" print "catching base types... " STDOUT.flush begin thrower.throwBasB(1, 2) test(false) rescue Test::A => ex test(ex.aMem == 1) rescue print $!.backtrace.join("\n") test(false) end begin thrower.throwCasC(1, 2, 3) test(false) rescue Test::B => ex test(ex.aMem == 1) test(ex.bMem == 2) rescue print $!.backtrace.join("\n") test(false) end # # We cannot invoke throwModA if the server was built with VC6. # if !isWin32 begin thrower.throwModA(1, 2) test(false) rescue Test::A => ex test(ex.aMem == 1) rescue Ice::OperationNotExistException # # This operation is not supported in Java. # rescue print $!.backtrace.join("\n") test(false) end end puts "ok" print "catching derived types... " STDOUT.flush begin thrower.throwBasA(1, 2) test(false) rescue Test::B => ex test(ex.aMem == 1) test(ex.bMem == 2) rescue print $!.backtrace.join("\n") test(false) end begin thrower.throwCasA(1, 2, 3) test(false) rescue Test::C => ex test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) rescue print $!.backtrace.join("\n") test(false) end begin thrower.throwCasB(1, 2, 3) test(false) rescue Test::C => ex test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) rescue print $!.backtrace.join("\n") test(false) end puts "ok" if thrower.supportsUndeclaredExceptions() print "catching unknown user exception... " STDOUT.flush begin thrower.throwUndeclaredA(1) test(false) rescue Ice::UnknownUserException # # We get an unknown user exception without collocation # optimization. # rescue print $!.backtrace.join("\n") test(false) end begin thrower.throwUndeclaredB(1, 2) test(false) rescue Ice::UnknownUserException # # We get an unknown user exception without collocation # optimization. # rescue print $!.backtrace.join("\n") test(false) end begin thrower.throwUndeclaredC(1, 2, 3) test(false) rescue Ice::UnknownUserException # # We get an unknown user exception without collocation # optimization. # rescue print $!.backtrace.join("\n") test(false) end puts "ok" end print "testing memory limit marshal exception..." STDOUT.flush begin thrower.throwMemoryLimitException(Array.new(1, 0x00)); test(false) rescue Ice::UnknownLocalException # Expected rescue test(false) end begin thrower.throwMemoryLimitException(Array.new(20 * 1024, 0x00)) # 20KB test(false) rescue Ice::MemoryLimitException # Expected rescue print $!.backtrace.join("\n") test(false) end puts "ok" print "catching object not exist exception... " STDOUT.flush id = communicator.stringToIdentity("does not exist") begin thrower2 = Test::ThrowerPrx::uncheckedCast(thrower.ice_identity(id)) thrower2.throwAasA(1) # thrower2.ice_ping() test(false) rescue Ice::ObjectNotExistException => ex test(ex.id == id) rescue print $!.backtrace.join("\n") test(false) end puts "ok" print "catching facet not exist exception... " STDOUT.flush begin thrower2 = Test::ThrowerPrx::uncheckedCast(thrower, "no such facet") begin thrower2.ice_ping() test(false) rescue Ice::FacetNotExistException => ex test(ex.facet == "no such facet") end rescue print $!.backtrace.join("\n") test(false) end puts "ok" print "catching operation not exist exception... " STDOUT.flush begin thrower2 = Test::WrongOperationPrx::uncheckedCast(thrower) thrower2.noSuchOperation() test(false) rescue Ice::OperationNotExistException => ex test(ex.operation == "noSuchOperation") rescue print $!.backtrace.join("\n") test(false) end puts "ok" print "catching unknown local exception... " STDOUT.flush begin thrower.throwLocalException() test(false) rescue Ice::UnknownLocalException # # We get an unknown local exception without collocation # optimization. # rescue print $!.backtrace.join("\n") test(false) end begin thrower.throwLocalExceptionIdempotent() test(false) rescue Ice::UnknownLocalException # # We get an unknown local exception without collocation # optimization. # rescue Ice::OperationNotExistException rescue print $!.backtrace.join("\n") test(false) end puts "ok" print "catching unknown non-Ice exception... " STDOUT.flush begin thrower.throwNonIceException() test(false) rescue Ice::UnknownException # # We get an unknown exception without collocation # optimization. # rescue print $!.backtrace.join("\n") test(false) end puts "ok" return thrower end Ice-3.5.1/rb/test/Ice/exceptions/Client.rb0000755000076400007640000000213412223561477016404 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' slice_dir = Ice.getSliceDir Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require './AllTests' def run(args, communicator) thrower = allTests(communicator) thrower.shutdown() return true end begin initData = Ice::InitializationData.new initData.properties = Ice.createProperties(ARGV) initData.properties.setProperty("Ice.MessageSizeMax", "10") communicator = Ice.initialize(ARGV, initData) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/exceptions/run.py0000755000076400007640000000362312223561477016023 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("Running test with compact (default) format.") TestUtil.clientServerTest() print("Running test with sliced format.") TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") print("Running test with 1.0 encoding.") TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") print("Running test with compact (default) format and AMD server.") TestUtil.clientServerTest(server="serveramd") print("Running test with sliced format and AMD server.") TestUtil.clientServerTest(server="serveramd", additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") print("Running test with 1.0 encoding and AMD server.") TestUtil.clientServerTest(server="serveramd", additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") Ice-3.5.1/rb/test/Ice/exceptions/Test.ice0000644000076400007640000000306312223561477016241 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once #include module Test { interface Empty { }; interface Thrower; exception A { int aMem; }; exception B extends A { int bMem; }; exception C extends B { int cMem; }; exception D { int dMem; }; module Mod { exception A extends ::Test::A { int a2Mem; }; }; ["ami"] interface Thrower { void shutdown(); bool supportsUndeclaredExceptions(); bool supportsAssertException(); void throwAasA(int a) throws A; void throwAorDasAorD(int a) throws A, D; void throwBasA(int a, int b) throws A; void throwCasA(int a, int b, int c) throws A; void throwBasB(int a, int b) throws B; void throwCasB(int a, int b, int c) throws B; void throwCasC(int a, int b, int c) throws C; void throwModA(int a, int a2) throws Mod::A; void throwUndeclaredA(int a); void throwUndeclaredB(int a, int b); void throwUndeclaredC(int a, int b, int c); void throwLocalException(); void throwNonIceException(); void throwAssertException(); Ice::ByteSeq throwMemoryLimitException(Ice::ByteSeq seq); idempotent void throwLocalExceptionIdempotent(); }; ["ami"] interface WrongOperation { void noSuchOperation(); }; }; Ice-3.5.1/rb/test/Ice/proxy/0000755000076400007640000000000012223561477013636 5ustar mesmesIce-3.5.1/rb/test/Ice/proxy/AllTests.rb0000644000076400007640000007376112223561477015734 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def allTests(communicator) print "testing stringToProxy... " STDOUT.flush ref = "test:default -p 12010" base = communicator.stringToProxy(ref) test(base) b1 = communicator.stringToProxy("test") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getAdapterId().empty? && b1.ice_getFacet().empty?) b1 = communicator.stringToProxy("test ") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet().empty?) b1 = communicator.stringToProxy(" test ") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet().empty?) b1 = communicator.stringToProxy(" test") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet().empty?) b1 = communicator.stringToProxy("'test -f facet'") test(b1.ice_getIdentity().name == "test -f facet" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet().empty?) begin b1 = communicator.stringToProxy("\"test -f facet'") test(false) rescue Ice::ProxyParseException end b1 = communicator.stringToProxy("\"test -f facet\"") test(b1.ice_getIdentity().name == "test -f facet" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet().empty?) b1 = communicator.stringToProxy("\"test -f facet@test\"") test(b1.ice_getIdentity().name == "test -f facet@test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet().empty?) b1 = communicator.stringToProxy("\"test -f facet@test @test\"") test(b1.ice_getIdentity().name == "test -f facet@test @test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet().empty?) begin b1 = communicator.stringToProxy("test test") test(false) rescue Ice::ProxyParseException end b1 = communicator.stringToProxy("test\\040test") test(b1.ice_getIdentity().name == "test test" && b1.ice_getIdentity().category.empty?) begin b1 = communicator.stringToProxy("test\\777") test(false) rescue Ice::IdentityParseException end b1 = communicator.stringToProxy("test\\40test") test(b1.ice_getIdentity().name == "test test") # Test some octal && hex corner cases. b1 = communicator.stringToProxy("test\\4test") test(b1.ice_getIdentity().name == "test\4test") b1 = communicator.stringToProxy("test\\04test") test(b1.ice_getIdentity().name == "test\4test") b1 = communicator.stringToProxy("test\\004test") test(b1.ice_getIdentity().name == "test\4test") b1 = communicator.stringToProxy("test\\1114test") test(b1.ice_getIdentity().name == "test\1114test") b1 = communicator.stringToProxy("test\\b\\f\\n\\r\\t\\'\\\"\\\\test") test(b1.ice_getIdentity().name == "test\b\f\n\r\t\'\"\\test" && b1.ice_getIdentity().category.empty?) b1 = communicator.stringToProxy("category/test") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category == "category" && \ b1.ice_getAdapterId().empty?) b1 = communicator.stringToProxy("test@adapter") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getAdapterId() == "adapter") begin b1 = communicator.stringToProxy("id@adapter test") test(false) rescue Ice::ProxyParseException end b1 = communicator.stringToProxy("category/test@adapter") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category == "category" && \ b1.ice_getAdapterId() == "adapter") b1 = communicator.stringToProxy("category/test@adapter:tcp") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category == "category" && \ b1.ice_getAdapterId() == "adapter:tcp") b1 = communicator.stringToProxy("'category 1/test'@adapter") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category == "category 1" && \ b1.ice_getAdapterId() == "adapter") b1 = communicator.stringToProxy("'category/test 1'@adapter") test(b1.ice_getIdentity().name == "test 1" && b1.ice_getIdentity().category == "category" && \ b1.ice_getAdapterId() == "adapter") b1 = communicator.stringToProxy("'category/test'@'adapter 1'") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category == "category" && \ b1.ice_getAdapterId() == "adapter 1") b1 = communicator.stringToProxy("\"category \\/test@foo/test\"@adapter") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category == "category /test@foo" && \ b1.ice_getAdapterId() == "adapter") b1 = communicator.stringToProxy("\"category \\/test@foo/test\"@\"adapter:tcp\"") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category == "category /test@foo" && \ b1.ice_getAdapterId() == "adapter:tcp") b1 = communicator.stringToProxy("id -f facet") test(b1.ice_getIdentity().name == "id" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet() == "facet") b1 = communicator.stringToProxy("id -f 'facet x'") test(b1.ice_getIdentity().name == "id" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet() == "facet x") b1 = communicator.stringToProxy("id -f \"facet x\"") test(b1.ice_getIdentity().name == "id" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet() == "facet x") begin b1 = communicator.stringToProxy("id -f \"facet x") test(false) rescue Ice::ProxyParseException end begin b1 = communicator.stringToProxy("id -f \'facet x") test(false) rescue Ice::ProxyParseException end b1 = communicator.stringToProxy("test -f facet:tcp") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet() == "facet" && b1.ice_getAdapterId().empty?) b1 = communicator.stringToProxy("test -f \"facet:tcp\"") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet() == "facet:tcp" && b1.ice_getAdapterId().empty?) b1 = communicator.stringToProxy("test -f facet@test") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet() == "facet" && b1.ice_getAdapterId() == "test") b1 = communicator.stringToProxy("test -f 'facet@test'") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet() == "facet@test" && b1.ice_getAdapterId().empty?) b1 = communicator.stringToProxy("test -f 'facet@test'@test") test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getFacet() == "facet@test" && b1.ice_getAdapterId() == "test") begin b1 = communicator.stringToProxy("test -f facet@test @test") test(false) rescue Ice::ProxyParseException end b1 = communicator.stringToProxy("test") test(b1.ice_isTwoway()) b1 = communicator.stringToProxy("test -t") test(b1.ice_isTwoway()) b1 = communicator.stringToProxy("test -o") test(b1.ice_isOneway()) b1 = communicator.stringToProxy("test -O") test(b1.ice_isBatchOneway()) b1 = communicator.stringToProxy("test -d") test(b1.ice_isDatagram()) b1 = communicator.stringToProxy("test -D") test(b1.ice_isBatchDatagram()) b1 = communicator.stringToProxy("test") test(!b1.ice_isSecure()) b1 = communicator.stringToProxy("test -s") test(b1.ice_isSecure()) test(b1.ice_getEncodingVersion() == Ice::currentEncoding()); b1 = communicator.stringToProxy("test -e 1.0"); test(b1.ice_getEncodingVersion().major == 1 && b1.ice_getEncodingVersion().minor == 0); b1 = communicator.stringToProxy("test -e 6.5"); test(b1.ice_getEncodingVersion().major == 6 && b1.ice_getEncodingVersion().minor == 5); begin b1 = communicator.stringToProxy("test:tcp@adapterId") test(false) rescue Ice::EndpointParseException end # This is an unknown endpoint warning, not a parse rescueion. # #begin # b1 = communicator.stringToProxy("test -f the:facet:tcp") # test(false) #rescue Ice::EndpointParseException #end begin b1 = communicator.stringToProxy("test::tcp") test(false) rescue Ice::EndpointParseException end puts "ok" print "testing propertyToProxy... " STDOUT.flush prop = communicator.getProperties() propertyPrefix = "Foo.Proxy" prop.setProperty(propertyPrefix, "test:default -p 12010") b1 = communicator.propertyToProxy(propertyPrefix) test(b1.ice_getIdentity().name == "test" && b1.ice_getIdentity().category.empty? && \ b1.ice_getAdapterId().empty? && b1.ice_getFacet().empty?) property = propertyPrefix + ".Locator" test(!b1.ice_getLocator()) prop.setProperty(property, "locator:default -p 10000") b1 = communicator.propertyToProxy(propertyPrefix) test(b1.ice_getLocator() && b1.ice_getLocator().ice_getIdentity().name == "locator") prop.setProperty(property, "") property = propertyPrefix + ".LocatorCacheTimeout" test(b1.ice_getLocatorCacheTimeout() == -1) prop.setProperty(property, "1") b1 = communicator.propertyToProxy(propertyPrefix) test(b1.ice_getLocatorCacheTimeout() == 1) prop.setProperty(property, "") # Now retest with an indirect proxy. prop.setProperty(propertyPrefix, "test") property = propertyPrefix + ".Locator" prop.setProperty(property, "locator:default -p 10000") b1 = communicator.propertyToProxy(propertyPrefix) test(b1.ice_getLocator() && b1.ice_getLocator().ice_getIdentity().name == "locator") prop.setProperty(property, "") property = propertyPrefix + ".LocatorCacheTimeout" test(b1.ice_getLocatorCacheTimeout() == -1) prop.setProperty(property, "1") b1 = communicator.propertyToProxy(propertyPrefix) test(b1.ice_getLocatorCacheTimeout() == 1) prop.setProperty(property, "") # This cannot be tested so easily because the property is cached # on communicator initialization. # #prop.setProperty("Ice::Default.LocatorCacheTimeout", "60") #b1 = communicator.propertyToProxy(propertyPrefix) #test(b1.ice_getLocatorCacheTimeout() == 60) #prop.setProperty("Ice::Default.LocatorCacheTimeout", "") prop.setProperty(propertyPrefix, "test:default -p 12010") property = propertyPrefix + ".Router" test(!b1.ice_getRouter()) prop.setProperty(property, "router:default -p 10000") b1 = communicator.propertyToProxy(propertyPrefix) test(b1.ice_getRouter() && b1.ice_getRouter().ice_getIdentity().name == "router") prop.setProperty(property, "") property = propertyPrefix + ".PreferSecure" test(!b1.ice_isPreferSecure()) prop.setProperty(property, "1") b1 = communicator.propertyToProxy(propertyPrefix) test(b1.ice_isPreferSecure()) prop.setProperty(property, "") property = propertyPrefix + ".ConnectionCached" test(b1.ice_isConnectionCached()) prop.setProperty(property, "0") b1 = communicator.propertyToProxy(propertyPrefix) test(!b1.ice_isConnectionCached()) prop.setProperty(property, "") property = propertyPrefix + ".EndpointSelection" test(b1.ice_getEndpointSelection() == Ice::EndpointSelectionType::Random) prop.setProperty(property, "Random") b1 = communicator.propertyToProxy(propertyPrefix) test(b1.ice_getEndpointSelection() == Ice::EndpointSelectionType::Random) prop.setProperty(property, "Ordered") b1 = communicator.propertyToProxy(propertyPrefix) test(b1.ice_getEndpointSelection() == Ice::EndpointSelectionType::Ordered) prop.setProperty(property, "") # # isCollocationOptimized is not implemented because the # collocation optimization is permanently disabled with IcePy. # #property = propertyPrefix + ".CollocationOptimized" #test(b1.ice_isCollocationOptimized()) #prop.setProperty(property, "0") #b1 = communicator.propertyToProxy(propertyPrefix) #test(!b1.ice_isCollocationOptimized()) #prop.setProperty(property, "") puts "ok" print "testing proxyToProperty... " STDOUT.flush b1 = communicator.stringToProxy("test") #b1 = b1.ice_collocationOptimized(true) b1 = b1.ice_connectionCached(true) b1 = b1.ice_preferSecure(false) b1 = b1.ice_endpointSelection(Ice::EndpointSelectionType::Ordered) b1 = b1.ice_locatorCacheTimeout(100) b1 = b1.ice_encodingVersion(Ice::EncodingVersion.new(1, 0)) router = communicator.stringToProxy("router") #router = router.ice_collocationOptimized(false) router = router.ice_connectionCached(true) router = router.ice_preferSecure(true) router = router.ice_endpointSelection(Ice::EndpointSelectionType::Random) router = router.ice_locatorCacheTimeout(200) locator = communicator.stringToProxy("locator") #locator = locator.ice_collocationOptimized(true) locator = locator.ice_connectionCached(false) locator = locator.ice_preferSecure(true) locator = locator.ice_endpointSelection(Ice::EndpointSelectionType::Random) locator = locator.ice_locatorCacheTimeout(300) locator = locator.ice_router(Ice::RouterPrx::uncheckedCast(router)) b1 = b1.ice_locator(Ice::LocatorPrx::uncheckedCast(locator)) proxyProps = communicator.proxyToProperty(b1, "Test") test(proxyProps.length() == 18) test(proxyProps["Test"] == "test -t -e 1.0") #test(proxyProps["Test.CollocationOptimized"] == "1") test(proxyProps["Test.ConnectionCached"] == "1") test(proxyProps["Test.PreferSecure"] == "0") test(proxyProps["Test.EndpointSelection"] == "Ordered") test(proxyProps["Test.LocatorCacheTimeout"] == "100") test(proxyProps["Test.Locator"] == "locator -t -e " + Ice::encodingVersionToString(Ice::currentEncoding())) #test(proxyProps["Test.Locator.CollocationOptimized"] == "1") test(proxyProps["Test.Locator.ConnectionCached"] == "0") test(proxyProps["Test.Locator.PreferSecure"] == "1") test(proxyProps["Test.Locator.EndpointSelection"] == "Random") test(proxyProps["Test.Locator.LocatorCacheTimeout"] == "300") test(proxyProps["Test.Locator.Router"] == "router -t -e " + Ice::encodingVersionToString(Ice::currentEncoding())); #test(proxyProps["Test.Locator.Router.CollocationOptimized"] == "0") test(proxyProps["Test.Locator.Router.ConnectionCached"] == "1") test(proxyProps["Test.Locator.Router.PreferSecure"] == "1") test(proxyProps["Test.Locator.Router.EndpointSelection"] == "Random") test(proxyProps["Test.Locator.Router.LocatorCacheTimeout"] == "200") puts "ok" print "testing ice_getCommunicator... " STDOUT.flush test(base.ice_getCommunicator() == communicator) puts "ok" print "testing proxy methods... " STDOUT.flush test(communicator.identityToString(base.ice_identity(communicator.stringToIdentity("other")).ice_getIdentity()) == "other") test(base.ice_facet("facet").ice_getFacet() == "facet") test(base.ice_adapterId("id").ice_getAdapterId() == "id") test(base.ice_twoway().ice_isTwoway()) test(base.ice_oneway().ice_isOneway()) test(base.ice_batchOneway().ice_isBatchOneway()) test(base.ice_datagram().ice_isDatagram()) test(base.ice_batchDatagram().ice_isBatchDatagram()) test(base.ice_secure(true).ice_isSecure()) test(!base.ice_secure(false).ice_isSecure()) test(base.ice_preferSecure(true).ice_isPreferSecure()) test(!base.ice_preferSecure(false).ice_isPreferSecure()) test(base.ice_encodingVersion(Ice::Encoding_1_0).ice_getEncodingVersion() == Ice::Encoding_1_0) test(base.ice_encodingVersion(Ice::Encoding_1_1).ice_getEncodingVersion() == Ice::Encoding_1_1) test(base.ice_encodingVersion(Ice::Encoding_1_0).ice_getEncodingVersion() != Ice::Encoding_1_1) puts "ok" print "testing proxy comparison... " STDOUT.flush test(communicator.stringToProxy("foo") == communicator.stringToProxy("foo")) test(communicator.stringToProxy("foo") != communicator.stringToProxy("foo2")) #test(communicator.stringToProxy("foo") < communicator.stringToProxy("foo2")) #test(!(communicator.stringToProxy("foo2") < communicator.stringToProxy("foo"))) compObj = communicator.stringToProxy("foo") test(compObj.ice_facet("facet") == compObj.ice_facet("facet")) test(compObj.ice_facet("facet") != compObj.ice_facet("facet1")) #test(compObj.ice_facet("facet") < compObj.ice_facet("facet1")) #test(!(compObj.ice_facet("facet") < compObj.ice_facet("facet"))) test(compObj.ice_oneway() == compObj.ice_oneway()) test(compObj.ice_oneway() != compObj.ice_twoway()) #test(compObj.ice_twoway() < compObj.ice_oneway()) #test(!(compObj.ice_oneway() < compObj.ice_twoway())) test(compObj.ice_secure(true) == compObj.ice_secure(true)) test(compObj.ice_secure(false) != compObj.ice_secure(true)) #test(compObj.ice_secure(false) < compObj.ice_secure(true)) #test(!(compObj.ice_secure(true) < compObj.ice_secure(false))) #test(compObj.ice_collocationOptimized(true) == compObj.ice_collocationOptimized(true)) #test(compObj.ice_collocationOptimized(false) != compObj.ice_collocationOptimized(true)) #test(compObj.ice_collocationOptimized(false) < compObj.ice_collocationOptimized(true)) #test(!(compObj.ice_collocationOptimized(true) < compObj.ice_collocationOptimized(false))) test(compObj.ice_connectionCached(true) == compObj.ice_connectionCached(true)) test(compObj.ice_connectionCached(false) != compObj.ice_connectionCached(true)) #test(compObj.ice_connectionCached(false) < compObj.ice_connectionCached(true)) #test(!(compObj.ice_connectionCached(true) < compObj.ice_connectionCached(false))) test(compObj.ice_endpointSelection(Ice::EndpointSelectionType::Random) == \ compObj.ice_endpointSelection(Ice::EndpointSelectionType::Random)) test(compObj.ice_endpointSelection(Ice::EndpointSelectionType::Random) != \ compObj.ice_endpointSelection(Ice::EndpointSelectionType::Ordered)) #test(compObj.ice_endpointSelection(Ice::EndpointSelectionType::Random) < \ # compObj.ice_endpointSelection(Ice::EndpointSelectionType::Ordered)) #test(!(compObj.ice_endpointSelection(Ice::EndpointSelectionType::Ordered) < \ # compObj.ice_endpointSelection(Ice::EndpointSelectionType::Random))) test(compObj.ice_connectionId("id2") == compObj.ice_connectionId("id2")) test(compObj.ice_connectionId("id1") != compObj.ice_connectionId("id2")) test(compObj.ice_connectionId("id1").ice_getConnectionId() == "id1") test(compObj.ice_connectionId("id2").ice_getConnectionId() == "id2") #test(compObj.ice_connectionId("id1") < compObj.ice_connectionId("id2")) #test(!(compObj.ice_connectionId("id2") < compObj.ice_connectionId("id1"))) test(compObj.ice_compress(true) == compObj.ice_compress(true)) test(compObj.ice_compress(false) != compObj.ice_compress(true)) #test(compObj.ice_compress(false) < compObj.ice_compress(true)) #test(!(compObj.ice_compress(true) < compObj.ice_compress(false))) test(compObj.ice_timeout(20) == compObj.ice_timeout(20)) test(compObj.ice_timeout(10) != compObj.ice_timeout(20)) #test(compObj.ice_timeout(10) < compObj.ice_timeout(20)) #test(!(compObj.ice_timeout(20) < compObj.ice_timeout(10))) loc1 = Ice::LocatorPrx::uncheckedCast(communicator.stringToProxy("loc1:default -p 10000")) loc2 = Ice::LocatorPrx::uncheckedCast(communicator.stringToProxy("loc2:default -p 10000")) test(compObj.ice_locator(nil) == compObj.ice_locator(nil)) test(compObj.ice_locator(loc1) == compObj.ice_locator(loc1)) test(compObj.ice_locator(loc1) != compObj.ice_locator(nil)) test(compObj.ice_locator(nil) != compObj.ice_locator(loc2)) test(compObj.ice_locator(loc1) != compObj.ice_locator(loc2)) #test(compObj.ice_locator(nil) < compObj.ice_locator(loc1)) #test(!(compObj.ice_locator(loc1) < compObj.ice_locator(nil))) #test(compObj.ice_locator(loc1) < compObj.ice_locator(loc2)) #test(!(compObj.ice_locator(loc2) < compObj.ice_locator(loc1))) rtr1 = Ice::RouterPrx::uncheckedCast(communicator.stringToProxy("rtr1:default -p 10000")) rtr2 = Ice::RouterPrx::uncheckedCast(communicator.stringToProxy("rtr2:default -p 10000")) test(compObj.ice_router(nil) == compObj.ice_router(nil)) test(compObj.ice_router(rtr1) == compObj.ice_router(rtr1)) test(compObj.ice_router(rtr1) != compObj.ice_router(nil)) test(compObj.ice_router(nil) != compObj.ice_router(rtr2)) test(compObj.ice_router(rtr1) != compObj.ice_router(rtr2)) #test(compObj.ice_router(nil) < compObj.ice_router(rtr1)) #test(!(compObj.ice_router(rtr1) < compObj.ice_router(nil))) #test(compObj.ice_router(rtr1) < compObj.ice_router(rtr2)) #test(!(compObj.ice_router(rtr2) < compObj.ice_router(rtr1))) ctx1 = { } ctx1["ctx1"] = "v1" ctx2 = { } ctx2["ctx2"] = "v2" test(compObj.ice_context({ }) == compObj.ice_context({ })) test(compObj.ice_context(ctx1) == compObj.ice_context(ctx1)) test(compObj.ice_context(ctx1) != compObj.ice_context({ })) test(compObj.ice_context({ }) != compObj.ice_context(ctx2)) test(compObj.ice_context(ctx1) != compObj.ice_context(ctx2)) #test(compObj.ice_context(ctx1) < compObj.ice_context(ctx2)) #test(!(compObj.ice_context(ctx2) < compObj.ice_context(ctx1))) test(compObj.ice_preferSecure(true) == compObj.ice_preferSecure(true)) test(compObj.ice_preferSecure(true) != compObj.ice_preferSecure(false)) #test(compObj.ice_preferSecure(false) < compObj.ice_preferSecure(true)) #test(!(compObj.ice_preferSecure(true) < compObj.ice_preferSecure(false))) compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000") compObj2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001") test(compObj1 != compObj2) #test(compObj1 < compObj2) #test(!(compObj2 < compObj1)) compObj1 = communicator.stringToProxy("foo@MyAdapter1") compObj2 = communicator.stringToProxy("foo@MyAdapter2") test(compObj1 != compObj2) #test(compObj1 < compObj2) #test(!(compObj2 < compObj1)) test(compObj1.ice_locatorCacheTimeout(20) == compObj1.ice_locatorCacheTimeout(20)) test(compObj1.ice_locatorCacheTimeout(10) != compObj1.ice_locatorCacheTimeout(20)) #test(compObj1.ice_locatorCacheTimeout(10) < compObj1.ice_locatorCacheTimeout(20)) #test(!(compObj1.ice_locatorCacheTimeout(20) < compObj1.ice_locatorCacheTimeout(10))) compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 1000") compObj2 = communicator.stringToProxy("foo@MyAdapter1") test(compObj1 != compObj2) #test(compObj1 < compObj2) #test(!(compObj2 < compObj1)) endpts1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000").ice_getEndpoints() endpts2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001").ice_getEndpoints() test(endpts1 != endpts2) #test(endpts1 < endpts2) #test(!(endpts2 < endpts1)) test(endpts1 == communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000").ice_getEndpoints()) test(compObj1.ice_encodingVersion(Ice::Encoding_1_0) == compObj1.ice_encodingVersion(Ice::Encoding_1_0)) test(compObj1.ice_encodingVersion(Ice::Encoding_1_0) != compObj1.ice_encodingVersion(Ice::Encoding_1_1)) #test(compObj.ice_encodingVersion(Ice::Encoding_1_0) < compObj.ice_encodingVersion(Ice::Encoding_1_1)) #test(! (compObj.ice_encodingVersion(Ice::Encoding_1_1) < compObj.ice_encodingVersion(Ice::Encoding_1_0))) # # TODO: Ideally we should also test comparison of fixed proxies. # puts "ok" print "testing checked cast... " STDOUT.flush cl = Test::MyClassPrx::checkedCast(base) test(cl) derived = Test::MyDerivedClassPrx::checkedCast(cl) test(derived) test(cl == base) test(derived == base) test(cl == derived) loc = Ice::LocatorPrx::checkedCast(base) test(loc == nil) # # Upcasting # cl2 = Test::MyClassPrx::checkedCast(derived) obj = Ice::ObjectPrx::checkedCast(derived) test(cl2) test(obj) test(cl2 == obj) test(cl2 == derived) puts "ok" print "testing checked cast with context... " STDOUT.flush tccp = Test::MyClassPrx::checkedCast(base) c = tccp.getContext() test(c == nil || c.length == 0) c = { } c["one"] = "hello" c["two"] = "world" tccp = Test::MyClassPrx::checkedCast(base, c) c2 = tccp.getContext() test(c == c2) puts "ok" print "testing encoding versioning... " STDOUT.flush ref20 = "test -e 2.0:default -p 12010"; cl20 = Test::MyClassPrx::uncheckedCast(communicator.stringToProxy(ref20)); begin cl20.ice_ping(); test(false); rescue Ice::UnsupportedEncodingException # Server 2.0 endpoint doesn't support 1.1 version. end ref10 = "test -e 1.0:default -p 12010" cl10 = Test::MyClassPrx::uncheckedCast(communicator.stringToProxy(ref10)) cl10.ice_ping() cl10.ice_encodingVersion(Ice::Encoding_1_0).ice_ping() cl.ice_encodingVersion(Ice::Encoding_1_0).ice_ping() # 1.3 isn't supported but since a 1.3 proxy supports 1.1, the # call will use the 1.1 encoding ref13 = "test -e 1.3:default -p 12010" cl13 = Test::MyClassPrx::uncheckedCast(communicator.stringToProxy(ref13)) cl13.ice_ping() puts "ok" print "testing opaque endpoints... " STDOUT.flush begin # Invalid -x option p = communicator.stringToProxy("id:opaque -t 99 -v abc -x abc") test(false) rescue Ice::EndpointParseException end begin # Missing -t and -v p = communicator.stringToProxy("id:opaque") test(false) rescue Ice::EndpointParseException end begin # Repeated -t p = communicator.stringToProxy("id:opaque -t 1 -t 1 -v abc") test(false) rescue Ice::EndpointParseException end begin # Repeated -v p = communicator.stringToProxy("id:opaque -t 1 -v abc -v abc") test(false) rescue Ice::EndpointParseException end begin # Missing -t p = communicator.stringToProxy("id:opaque -v abc") test(false) rescue Ice::EndpointParseException end begin # Missing -v p = communicator.stringToProxy("id:opaque -t 1") test(false) rescue Ice::EndpointParseException end begin # Missing arg for -t p = communicator.stringToProxy("id:opaque -t -v abc") test(false) rescue Ice::EndpointParseException end begin # Missing arg for -v p = communicator.stringToProxy("id:opaque -t 1 -v") test(false) rescue Ice::EndpointParseException end begin # Not a number for -t p = communicator.stringToProxy("id:opaque -t x -v abc") test(false) rescue Ice::EndpointParseException end begin # < 0 for -t p = communicator.stringToProxy("id:opaque -t -1 -v abc") test(false) rescue Ice::EndpointParseException end begin # Invalid char for -v p = communicator.stringToProxy("id:opaque -t 99 -v x?c") test(false) rescue Ice::EndpointParseException end # Legal TCP endpoint expressed as opaque endpoint. p1 = communicator.stringToProxy("test -e 1.1:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==") pstr = communicator.proxyToString(p1) test(pstr == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000") # Opaque endpoint encoded with 1.1 encoding. p2 = communicator.stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==") test(communicator.proxyToString(p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000") # Working? if communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0 ssl = communicator.getProperties().getProperty("Ice.Default.Protocol") == "ssl" if !ssl p1.ice_encodingVersion(Ice::Encoding_1_0).ice_ping() end # Two legal TCP endpoints expressed as opaque endpoints p1 = communicator.stringToProxy("test -e 1.0:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA==") pstr = communicator.proxyToString(p1) test(pstr == "test -t -e 1.0:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000") # # Test that an SSL endpoint and a nonsense endpoint get written # back out as an opaque endpoint. # p1 = communicator.stringToProxy("test -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") pstr = communicator.proxyToString(p1) if !ssl test(pstr == "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") else test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch") end # # Try to invoke on the SSL endpoint to verify that we get a # NoEndpointException (or ConnectionRefusedException when # running with SSL). # begin p1.ice_encodingVersion(Ice::Encoding_1_0).ice_ping() test(false) rescue Ice::NoEndpointException test(!ssl) rescue Ice::ConnectionRefusedException test(ssl) end # # Test that the proxy with an SSL endpoint and a nonsense # endpoint (which the server doesn't understand either) can be # sent over the wire and returned by the server without losing # the opaque endpoints. # p2 = derived.echo(p1) pstr = communicator.proxyToString(p2) if !ssl test(pstr == "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") else test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch") end end puts "ok" return cl end Ice-3.5.1/rb/test/Ice/proxy/Client.rb0000755000076400007640000000226112223561477015405 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' slice_dir = Ice.getSliceDir if slice_dir.empty? fail "Slice directory not found" end Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require './AllTests' def test(b) if !b raise RuntimeError, 'test assertion failed' end end def run(args, communicator) myClass = allTests(communicator) myClass.shutdown() return true end begin initData = Ice::InitializationData.new initData.properties = Ice.createProperties(ARGV) communicator = Ice.initialize(ARGV, initData) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/proxy/run.py0000755000076400007640000000164512223561477015025 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("tests with regular server.") TestUtil.clientServerTest() print("tests with AMD server.") TestUtil.clientServerTest(server="serveramd") sys.exit(0) Ice-3.5.1/rb/test/Ice/proxy/Test.ice0000644000076400007640000000104412223561477015236 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once #include module Test { class MyClass { void shutdown(); Ice::Context getContext(); }; class MyDerivedClass extends MyClass { Object* echo(Object* obj); }; }; Ice-3.5.1/rb/test/Ice/retry/0000755000076400007640000000000012223561477013622 5ustar mesmesIce-3.5.1/rb/test/Ice/retry/AllTests.rb0000644000076400007640000000257012223561477015706 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator) print "testing stringToProxy... " STDOUT.flush ref = "retry:default -p 12010 -t 10000" base1 = communicator.stringToProxy(ref) test(base1) base2 = communicator.stringToProxy(ref) test(base2) puts "ok" print "testing checked cast... " STDOUT.flush retry1 = Test::RetryPrx::checkedCast(base1) test(retry1) test(retry1 == base1) retry2 = Test::RetryPrx::checkedCast(base2) test(retry2 != nil) test(retry2 == base2) puts "ok" print "calling regular operation with first proxy... " STDOUT.flush retry1.op(false) puts "ok" print "calling operation to kill connection with second proxy... " STDOUT.flush begin retry2.op(true) test(false) rescue Ice::ConnectionLostException puts "ok" end print "calling regular operation with first proxy again... " STDOUT.flush retry1.op(false) puts "ok" return retry1 end Ice-3.5.1/rb/test/Ice/retry/Client.rb0000755000076400007640000000232112223561477015366 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' slice_dir = Ice.getSliceDir if slice_dir.empty? fail "Slice directory not found" end Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require './AllTests' def run(args, communicator) ret = allTests(communicator) ret.shutdown return true end begin initData = Ice::InitializationData.new initData.properties = Ice.createProperties(ARGV) initData.properties.setProperty('Ice.RetryIntervals', '-1') initData.properties.setProperty('Ice.Warn.Connections', '0') communicator = Ice.initialize(ARGV, initData) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/retry/run.py0000755000076400007640000000144712223561477015011 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.clientServerTest() Ice-3.5.1/rb/test/Ice/retry/Test.ice0000644000076400007640000000070012223561477015220 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { interface Retry { ["ami"] void op(bool kill); void shutdown(); }; }; Ice-3.5.1/rb/test/Ice/checksum/0000755000076400007640000000000012223561477014257 5ustar mesmesIce-3.5.1/rb/test/Ice/checksum/AllTests.rb0000644000076400007640000000277312223561477016350 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator) ref = "test:default -p 12010" base = communicator.stringToProxy(ref) test(base) checksum = Test::ChecksumPrx::checkedCast(base) test(checksum) # # Verify that no checksums are present for local types. # print "testing checksums... " STDOUT.flush test(Ice::SliceChecksums.length > 0) for i in Ice::SliceChecksums.keys test(!i.include?("Local")) end # # Get server's Slice checksums. # d = checksum.getSliceChecksums() # # Compare the checksums. For a type FooN whose name ends in an integer N, # we assume that the server's type does not change for N = 1, and does # change for N > 1. # patt = Regexp.new("\\d+") for i in d.keys n = 0 m = patt.match(i) if m n = i[m.begin(0)...i.length].to_i end test(Ice::SliceChecksums.has_key?(i)) if n <= 1 test(Ice::SliceChecksums[i] == d[i]) else test(Ice::SliceChecksums[i] != d[i]) end end puts "ok" return checksum end Ice-3.5.1/rb/test/Ice/checksum/CTypes.ice0000644000076400007640000002100212223561477016143 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { // // TEST: Same // const int IntConst1 = 100; // // TEST: Value changed // const int IntConst2 = 100; // // TEST: Type changed // const int IntConst3 = 100; // // TEST: Same // enum Enum1 { Enum11, Enum12, Enum13 }; // // TEST: Add enumerator // enum Enum2 { Enum21, Enum22, Enum23 }; // // TEST: Remove enumerator // enum Enum3 { Enum31, Enum32, Enum33 }; // // TEST: Change to a different type // enum Enum4 { Enum41, Enum42, Enum43 }; // // TEST: Enum with explicit values. // enum EnumExplicit0 { EnumExplicit01 = 1, EnumExplicit02 = 2, EnumExplicit03 = 3 }; // // TEST: Enum with same explicit values, different order. // enum EnumExplicit1 { EnumExplicit11 = 1, EnumExplicit12 = 2, EnumExplicit13 = 3 }; // // TEST: Enum with different explicit values. // enum EnumExplicit2 { EnumExplicit21 = 1, EnumExplicit22 = 2, EnumExplicit23 = 3}; // // TEST: Enum with explicit values, removed enumerator. // enum EnumExplicit3 { EnumExplicit31 = 1, EnumExplicit32 = 2, EnumExplicit33 = 3}; // // TEST: Same // sequence Sequence1; // // TEST: Change sequence type // sequence Sequence2; // // TEST: Change to a different type // sequence Sequence3; // // TEST: Same // dictionary Dictionary1; // // TEST: Change key type // dictionary Dictionary2; // // TEST: Change value type // dictionary Dictionary3; // // TEST: Change to a different type // dictionary Dictionary4; // // TEST: Same // struct Struct1 { string str; bool b; }; // // TEST: Add member // struct Struct2 { string str; bool b; }; // // TEST: Change member type // struct Struct3 { string str; bool b; }; // // TEST: Remove member // struct Struct4 { string str; bool b; }; // // TEST: Change to a different type // struct Struct5 { string str; bool b; }; // // TEST: Same // interface Interface1 { }; // // TEST: Change interface to class // interface Interface2 { }; // // TEST: Add base interface // interface Interface3 { }; // // TEST: Add operation // interface Interface4 { }; // // TEST: Same // class EmptyClass1 { }; // // TEST: Add data member // class EmptyClass2 { }; // // TEST: Add operation // class EmptyClass3 { }; // // TEST: Add base class // class EmptyClass4 { }; // // TEST: Add interface // class EmptyClass5 { }; // // TEST: Same // class SimpleClass1 { string str; float f; }; // // TEST: Add operation // class SimpleClass2 { string str; float f; }; // // TEST: Rename member // class SimpleClass3 { string str; float f; }; // // TEST: Add member // class SimpleClass4 { string str; float f; }; // // TEST: Remove member // class SimpleClass5 { string str; float f; }; // // TEST: Reorder members // class SimpleClass6 { string str; float f; }; // // TEST: Change member type // class SimpleClass7 { string str; float f; }; // // TEST: Same // exception Exception1 { string str; bool b; }; // // TEST: Add member // exception Exception2 { string str; bool b; }; // // TEST: Change member type // exception Exception3 { string str; bool b; }; // // TEST: Remove member // exception Exception4 { string str; bool b; }; // // TEST: Add base exception // exception Exception5 { }; // // TEST: Change to a different type // exception Exception6 { string str; bool b; }; // // TEST: Exception with optional members. // exception OptionalEx0 { string firstName; optional(1) string secondName; optional(2) string emailAddress; }; // // TEST: Exception with optional members, different order, same tags. // exception OptionalEx1 { string firstName; optional(1) string secondName; optional(2) string emailAddress; }; // // TEST: Exception with different optional members. // exception OptionalEx2 { string firstName; string secondName; optional(1) string emailAddress; }; // // TEST: Exception with different optional members. // exception OptionalEx3 { string firstName; optional(1) string secondName; optional(2) string emailAddress; }; // // TEST: Exception with optional members using different tags. // exception OptionalEx4 { string firstName; optional(1) string secondName; optional(2) string emailAddress; }; // // TEST: Same // class BaseClass1 { void baseOp1(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Change return type // class BaseClass2 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Add parameter // class BaseClass3 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Add exception // class BaseClass4 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Change out parameter to in parameter // class BaseClass5 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Remove parameter // class BaseClass6 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Remove exception // class BaseClass7 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Remove operation // class BaseClass8 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Add base class // class BaseClass9 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Add interface // class BaseClass10 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Add base class and interface // class BaseClass11 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Class with compact id // class Compact1(1) { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Derived from class with compact id // class Derived1 extends Compact1 { }; // // TEST: Same class names but different compact id // class Compact2(2) { void baseOp(); void baseOp2(int i, out string s) throws Exception1; }; // // TEST: Class with optional members. // class Optional0 { string firstName; optional(1) string secondName; optional(2) string emailAddress; }; // // TEST: Class with optional members, different order, same tags. // class Optional1 { string firstName; optional(1) string secondName; optional(2) string emailAddress; }; // // TEST: Class with different optional members. // class Optional2 { string firstName; string secondName; optional(1) string emailAddress; }; // // TEST: Class with different optional members. // class Optional3 { string firstName; optional(1) string secondName; optional(2) string emailAddress; }; // // TEST: Class with optional members using different tags. // class Optional4 { string firstName; optional(1) string secondName; optional(2) string emailAddress; }; // // TEST: Class with optional parameters. // class OptionalParameters0 { void op1(string firstName, optional(1) string secondName, optional(2) string emailAddress); }; // // TEST: Class with optional parameters, different order. // class OptionalParameters1 { void op1(string firstName, optional(1) string secondName, optional(2) string emailAddress); }; // // TEST: Class with optional parameters, different tags. // class OptionalParameters2 { void op1(string firstName, optional(1) string emailAddress, optional(2) string secondName); }; // // TEST: Class with different optional parameters. // class OptionalParameters3 { void op1(string firstName, optional(1) string emailAddress, string secondName); }; // // TEST: Class with optional return type. // class OptionalReturn0 { optional(1) int op(); }; // // TEST: Class that changes optional return type. // class OptionalReturn2 { optional(1) int op(); }; // // TEST: Local // local enum LocalEnum { LocalEnum1, LocalEnum2, LocalEnum3 }; // // TEST: Local // local sequence LocalSequence; // // TEST: Local // local dictionary LocalDictionary; // // TEST: Local // local struct LocalStruct { string str; }; // // TEST: Local // local class LocalClass { }; }; Ice-3.5.1/rb/test/Ice/checksum/Client.rb0000755000076400007640000000201012223561477016016 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' slice_dir = Ice.getSliceDir if slice_dir.empty? fail "Slice directory not found" end Ice::loadSlice("'-I" + slice_dir + "' --checksum Test.ice CTypes.ice") require './AllTests' def run(args, communicator) checksum = allTests(communicator) checksum.shutdown() return true end begin communicator = Ice.initialize(ARGV) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/checksum/run.py0000755000076400007640000000147512223561477015447 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.clientServerTest(server='server/server') Ice-3.5.1/rb/test/Ice/checksum/Test.ice0000644000076400007640000000101112223561477015651 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once #include module Test { interface Checksum { idempotent Ice::SliceChecksumDict getSliceChecksums(); void shutdown(); }; }; Ice-3.5.1/rb/test/Ice/slicing/0000755000076400007640000000000012223561477014105 5ustar mesmesIce-3.5.1/rb/test/Ice/slicing/objects/0000755000076400007640000000000012223561477015536 5ustar mesmesIce-3.5.1/rb/test/Ice/slicing/objects/AllTests.rb0000644000076400007640000005026712223561477017630 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice('-I. --all Forward.ice ClientPrivate.ice') def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator) obj = communicator.stringToProxy("Test:default -p 12010") t = Test::TestIntfPrx::checkedCast(obj) print "base as Object... " STDOUT.flush o = nil begin o = t.SBaseAsObject() test(o) test(o.ice_id() == "::Test::SBase") rescue Ice::Exception puts $!.inspect test(false) end sb = o test(sb.is_a?(Test::SBase)) test(sb) test(sb.sb == "SBase.sb") puts "ok" print "base as base... " STDOUT.flush begin sb = t.SBaseAsSBase() test(sb.sb == "SBase.sb") rescue Ice::Exception test(false) end puts "ok" print "base with known derived as base... " STDOUT.flush begin sb = t.SBSKnownDerivedAsSBase() test(sb.sb == "SBSKnownDerived.sb") rescue Ice::Exception test(false) end sbskd = sb test(sbskd.is_a?(Test::SBSKnownDerived)) test(sbskd) test(sbskd.sbskd == "SBSKnownDerived.sbskd") puts "ok" print "base with known derived as known derived... " STDOUT.flush begin sbskd = t.SBSKnownDerivedAsSBSKnownDerived() test(sbskd.sbskd == "SBSKnownDerived.sbskd") rescue Ice::Exception test(false) end puts "ok" print "base with unknown derived as base... " STDOUT.flush begin sb = t.SBSUnknownDerivedAsSBase() test(sb.sb == "SBSUnknownDerived.sb") rescue Ice::Exception test(false) end if t.ice_getEncodingVersion() == Ice::Encoding_1_0 begin # # This test succeeds for the 1.0 encoding. # sb = t.SBSUnknownDerivedAsSBaseCompact() test(sb.sb == "SBSUnknownDerived.sb") rescue test(false) end else begin # # This test fails when using the compact format because the instance cannot # be sliced to a known type. # sb = t.SBSUnknownDerivedAsSBaseCompact() test(false) rescue Ice::NoObjectFactoryException # Expected. rescue test(false) end end puts "ok" print "unknown with Object as Object... " STDOUT.flush begin o = t.SUnknownAsObject() test(t.ice_getEncodingVersion() != Ice::Encoding_1_0) test(o.is_a?(Ice::UnknownSlicedObject)) test(o.unknownTypeId == "::Test::SUnknown") test(o._ice_slicedData != nil) t.checkSUnknown(o) rescue Ice::NoObjectFactoryException test(t.ice_getEncodingVersion() == Ice::Encoding_1_0) rescue Ice::Exception test(false) end puts "ok" print "one-element cycle... " STDOUT.flush begin b = t.oneElementCycle() test(b) test(b.ice_id() == "::Test::B") test(b.sb == "B1.sb") test(b.pb == b) rescue Ice::Exception test(false) end puts "ok" print "two-element cycle... " STDOUT.flush begin b1 = t.twoElementCycle() test(b1) test(b1.ice_id() == "::Test::B") test(b1.sb == "B1.sb") b2 = b1.pb test(b2) test(b2.ice_id() == "::Test::B") test(b2.sb == "B2.sb") test(b2.pb == b1) rescue Ice::Exception test(false) end puts "ok" print "known derived pointer slicing as base... " STDOUT.flush begin b1 = t.D1AsB() test(b1) test(b1.ice_id() == "::Test::D1") test(b1.sb == "D1.sb") test(b1.pb) test(b1.pb != b1) d1 = b1 test(d1.is_a?(Test::D1)) test(d1.sd1 == "D1.sd1") test(d1.pd1) test(d1.pd1 != b1) test(b1.pb == d1.pd1) b2 = b1.pb test(b2) test(b2.pb == b1) test(b2.sb == "D2.sb") test(b2.ice_id() == "::Test::B") rescue Ice::Exception test(false) end puts "ok" print "known derived pointer slicing as derived... " STDOUT.flush begin d1 = t.D1AsD1() test(d1) test(d1.ice_id() == "::Test::D1") test(d1.sb == "D1.sb") test(d1.pb) test(d1.pb != d1) b2 = d1.pb test(b2) test(b2.ice_id() == "::Test::B") test(b2.sb == "D2.sb") test(b2.pb == d1) rescue Ice::Exception test(false) end puts "ok" print "unknown derived pointer slicing as base... " STDOUT.flush begin b2 = t.D2AsB() test(b2) test(b2.ice_id() == "::Test::B") test(b2.sb == "D2.sb") test(b2.pb) test(b2.pb != b2) b1 = b2.pb test(b1) test(b1.ice_id() == "::Test::D1") test(b1.sb == "D1.sb") test(b1.pb == b2) d1 = b1 test(d1.is_a?(Test::D1)) test(d1.sd1 == "D1.sd1") test(d1.pd1 == b2) rescue Ice::Exception test(false) end puts "ok" print "param ptr slicing with known first... " STDOUT.flush begin b1, b2 = t.paramTest1() test(b1) test(b1.ice_id() == "::Test::D1") test(b1.sb == "D1.sb") test(b1.pb == b2) d1 = b1 test(d1.is_a?(Test::D1)) test(d1.sd1 == "D1.sd1") test(d1.pd1 == b2) test(b2) test(b2.ice_id() == "::Test::B") # No factory, must be sliced test(b2.sb == "D2.sb") test(b2.pb == b1) rescue Ice::Exception test(false) end puts "ok" print "param ptr slicing with unknown first... " STDOUT.flush begin b2, b1 = t.paramTest2() test(b1) test(b1.ice_id() == "::Test::D1") test(b1.sb == "D1.sb") test(b1.pb == b2) d1 = b1 test(d1.is_a?(Test::D1)) test(d1.sd1 == "D1.sd1") test(d1.pd1 == b2) test(b2) test(b2.ice_id() == "::Test::B") # No factory, must be sliced test(b2.sb == "D2.sb") test(b2.pb == b1) rescue Ice::Exception test(false) end puts "ok" print "return value identity with known first... " STDOUT.flush begin r, p1, p2 = t.returnTest1() test(r == p1) rescue Ice::Exception test(false) end puts "ok" print "return value identity with unknown first... " STDOUT.flush begin r, p1, p2 = t.returnTest2() test(r == p1) rescue Ice::Exception test(false) end puts "ok" print "return value identity for input params known first... " STDOUT.flush begin d1 = Test::D1.new d1.sb = "D1.sb" d1.sd1 = "D1.sd1" d3 = Test::D3.new d3.pb = d1 d3.sb = "D3.sb" d3.sd3 = "D3.sd3" d3.pd3 = d1 d1.pb = d3 d1.pd1 = d3 b1 = t.returnTest3(d1, d3) test(b1) test(b1.sb == "D1.sb") test(b1.ice_id() == "::Test::D1") p1 = b1 test(p1.is_a?(Test::D1)) test(p1.sd1 == "D1.sd1") test(p1.pd1 == b1.pb) b2 = b1.pb test(b2) test(b2.sb == "D3.sb") test(b2.ice_id() == "::Test::B") # Sliced by server test(b2.pb == b1) p3 = b2 test(!p3.is_a?(Test::D3)) test(b1 != d1) test(b1 != d3) test(b2 != d1) test(b2 != d3) rescue Ice::Exception test(false) end puts "ok" print "return value identity for input params unknown first... " STDOUT.flush begin d1 = Test::D1.new d1.sb = "D1.sb" d1.sd1 = "D1.sd1" d3 = Test::D3.new d3.pb = d1 d3.sb = "D3.sb" d3.sd3 = "D3.sd3" d3.pd3 = d1 d1.pb = d3 d1.pd1 = d3 b1 = t.returnTest3(d3, d1) test(b1) test(b1.sb == "D3.sb") test(b1.ice_id() == "::Test::B") # Sliced by server p1 = b1 test(!p1.is_a?(Test::D3)) b2 = b1.pb test(b2) test(b2.sb == "D1.sb") test(b2.ice_id() == "::Test::D1") test(b2.pb == b1) p3 = b2 test(p3.is_a?(Test::D1)) test(p3.sd1 == "D1.sd1") test(p3.pd1 == b1) test(b1 != d1) test(b1 != d3) test(b2 != d1) test(b2 != d3) rescue Ice::Exception test(false) end puts "ok" print "remainder unmarshaling (3 instances)... " STDOUT.flush begin ret, p1, p2 = t.paramTest3() test(p1) test(p1.sb == "D2.sb (p1 1)") test(p1.pb == nil) test(p1.ice_id() == "::Test::B") test(p2) test(p2.sb == "D2.sb (p2 1)") test(p2.pb == nil) test(p2.ice_id() == "::Test::B") test(ret) test(ret.sb == "D1.sb (p2 2)") test(ret.pb == nil) test(ret.ice_id() == "::Test::D1") rescue Ice::Exception test(false) end puts "ok" print "remainder unmarshaling (4 instances)... " STDOUT.flush begin ret, b = t.paramTest4() test(b) test(b.sb == "D4.sb (1)") test(b.pb == nil) test(b.ice_id() == "::Test::B") test(ret) test(ret.sb == "B.sb (2)") test(ret.pb == nil) test(ret.ice_id() == "::Test::B") rescue Ice::Exception test(false) end puts "ok" print "param ptr slicing, instance marshaled in unknown derived as base... " STDOUT.flush begin b1 = Test::B.new b1.sb = "B.sb(1)" b1.pb = b1 d3 = Test::D3.new d3.sb = "D3.sb" d3.pb = d3 d3.sd3 = "D3.sd3" d3.pd3 = b1 b2 = Test::B.new b2.sb = "B.sb(2)" b2.pb = b1 r = t.returnTest3(d3, b2) test(r) test(r.ice_id() == "::Test::B") test(r.sb == "D3.sb") test(r.pb == r) rescue Ice::Exception test(false) end puts "ok" print "param ptr slicing, instance marshaled in unknown derived as derived... " STDOUT.flush begin d11 = Test::D1.new d11.sb = "D1.sb(1)" d11.pb = d11 d11.sd1 = "D1.sd1(1)" d11.pd1 = nil d3 = Test::D3.new d3.sb = "D3.sb" d3.pb = d3 d3.sd3 = "D3.sd3" d3.pd3 = d11 d12 = Test::D1.new d12.sb = "D1.sb(2)" d12.pb = d12 d12.sd1 = "D1.sd1(2)" d12.pd1 = d11 r = t.returnTest3(d3, d12) test(r) test(r.ice_id() == "::Test::B") test(r.sb == "D3.sb") test(r.pb == r) rescue Ice::Exception test(false) end puts "ok" print "sequence slicing... " STDOUT.flush begin ss = Test::SS3.new ss1b = Test::B.new ss1b.sb = "B.sb" ss1b.pb = ss1b ss1d1 = Test::D1.new ss1d1.sb = "D1.sb" ss1d1.sd1 = "D1.sd1" ss1d1.pb = ss1b ss1d3 = Test::D3.new ss1d3.sb = "D3.sb" ss1d3.sd3 = "D3.sd3" ss1d3.pb = ss1b ss2b = Test::B.new ss2b.sb = "B.sb" ss2b.pb = ss1b ss2d1 = Test::D1.new ss2d1.sb = "D1.sb" ss2d1.sd1 = "D1.sd1" ss2d1.pb = ss2b ss2d3 = Test::D3.new ss2d3.sb = "D3.sb" ss2d3.sd3 = "D3.sd3" ss2d3.pb = ss2b ss1d1.pd1 = ss2b ss1d3.pd3 = ss2d1 ss2d1.pd1 = ss1d3 ss2d3.pd3 = ss1d1 ss1 = Test::SS1.new ss1.s = [ss1b, ss1d1, ss1d3] ss2 = Test::SS2.new ss2.s = [ss2b, ss2d1, ss2d3] ss = t.sequenceTest(ss1, ss2) test(ss.c1) ss1b = ss.c1.s[0] ss1d1 = ss.c1.s[1] test(ss.c2) ss1d3 = ss.c1.s[2] test(ss.c2) ss2b = ss.c2.s[0] ss2d1 = ss.c2.s[1] ss2d3 = ss.c2.s[2] test(ss1b.pb == ss1b) test(ss1d1.pb == ss1b) test(ss1d3.pb == ss1b) test(ss2b.pb == ss1b) test(ss2d1.pb == ss2b) test(ss2d3.pb == ss2b) test(ss1b.ice_id() == "::Test::B") test(ss1d1.ice_id() == "::Test::D1") test(ss1d3.ice_id() == "::Test::B") test(ss2b.ice_id() == "::Test::B") test(ss2d1.ice_id() == "::Test::D1") test(ss2d3.ice_id() == "::Test::B") rescue Ice::Exception test(false) end puts "ok" print "dictionary slicing... " STDOUT.flush begin bin = {} for i in (0...10) d1 = Test::D1.new s = "D1." + i.to_s d1.sb = s d1.pb = d1 d1.sd1 = s d1.pd1 = nil bin[i] = d1 end r, bout = t.dictionaryTest(bin) test(bout.length == 10) for i in (0...10) b = bout[i * 10] test(b) s = "D1." + i.to_s test(b.sb == s) test(b.pb) test(b.pb != b) test(b.pb.sb == s) test(b.pb.pb == b.pb) end test(r.length == 10) for i in (0...10) b = r[i * 20] test(b) s = "D1." + (i * 20).to_s test(b.sb == s) if i == 0 test(b.pb == nil) else test(b.pb == r[(i - 1) * 20]) end d1 = b test(d1.is_a?(Test::D1)) test(d1.sd1 == s) test(d1.pd1 == d1) end rescue Ice::Exception test(false) end puts "ok" print "base exception thrown as base exception... " STDOUT.flush begin t.throwBaseAsBase() test(false) rescue Test::BaseException => e test(e.ice_name() == "Test::BaseException") test(e.sbe == "sbe") test(e.pb) test(e.pb.sb == "sb") test(e.pb.pb == e.pb) rescue Ice::Exception test(false) end puts "ok" print "derived exception thrown as base exception... " STDOUT.flush begin t.throwDerivedAsBase() test(false) rescue Test::DerivedException => e test(e.ice_name() == "Test::DerivedException") test(e.sbe == "sbe") test(e.pb) test(e.pb.sb == "sb1") test(e.pb.pb == e.pb) test(e.sde == "sde1") test(e.pd1) test(e.pd1.sb == "sb2") test(e.pd1.pb == e.pd1) test(e.pd1.sd1 == "sd2") test(e.pd1.pd1 == e.pd1) rescue Ice::Exception test(false) end puts "ok" print "derived exception thrown as derived exception... " STDOUT.flush begin t.throwDerivedAsDerived() test(false) rescue Test::DerivedException => e test(e.ice_name() == "Test::DerivedException") test(e.sbe == "sbe") test(e.pb) test(e.pb.sb == "sb1") test(e.pb.pb == e.pb) test(e.sde == "sde1") test(e.pd1) test(e.pd1.sb == "sb2") test(e.pd1.pb == e.pd1) test(e.pd1.sd1 == "sd2") test(e.pd1.pd1 == e.pd1) rescue Ice::Exception test(false) end puts "ok" print "unknown derived exception thrown as base exception... " STDOUT.flush begin t.throwUnknownDerivedAsBase() test(false) rescue Test::BaseException => e test(e.ice_name() == "Test::BaseException") test(e.sbe == "sbe") test(e.pb) test(e.pb.sb == "sb d2") test(e.pb.pb == e.pb) rescue Ice::Exception test(false) end puts "ok" print "forward-declared class... " STDOUT.flush begin f = t.useForward() test(f) rescue Ice::Exception test(false) end puts "ok" print "preserved classes... " STDOUT.flush # # Server knows the most-derived class PDerived. # pd = Test::PDerived.new() pd.pi = 3 pd.ps = "preserved" pd.pb = pd r = t.exchangePBase(pd) test(r.is_a?(Test::PDerived)) test(r.pi == 3) test(r.ps == "preserved") test(r.pb == r) # # Server only knows the base (non-preserved) type, so the object is sliced. # pu = Test::PCUnknown.new() pu.pi = 3 pu.pu = "preserved" r = t.exchangePBase(pu) test(!r.is_a?(Test::PCUnknown)) test(r.pi == 3) # # Server only knows the intermediate type Preserved. The object will be sliced to # Preserved for the 1.0 encoding; otherwise it should be returned intact. # pcd = Test::PCDerived.new() pcd.pi = 3 pcd.pbs = [ pcd ] r = t.exchangePBase(pcd) if t.ice_getEncodingVersion() == Ice::Encoding_1_0 test(!r.is_a?(Test::PCDerived)) test(r.pi == 3) else test(r.is_a?(Test::PCDerived)) test(r.pi == 3) test(r.pbs[0] == r) end # # Server only knows the intermediate type CompactPDerived. The object will be sliced to # CompactPDerived for the 1.0 encoding; otherwise it should be returned intact. # pcd = Test::CompactPCDerived.new() pcd.pi = 3 pcd.pbs = [ pcd ] r = t.exchangePBase(pcd) if t.ice_getEncodingVersion() == Ice::Encoding_1_0 test(!r.is_a?(Test::CompactPCDerived)) test(r.pi == 3) else test(r.is_a?(Test::CompactPCDerived)) test(r.pi == 3) test(r.pbs[0] == r) end # # Send an object that will have multiple preserved slices in the server. # The object will be sliced to PDerived for the 1.0 encoding. # pcd = Test::PCDerived3.new() pcd.pi = 3 # # Sending more than 254 objects exercises the encoding for object ids. # pcd.pbs = [] for i in (0...300) p2 = Test::PCDerived2.new() p2.pi = i p2.pbs = [ nil ] # Nil reference. This slice should not have an indirection table. p2.pcd2 = i pcd.pbs.push(p2) end pcd.pcd2 = pcd.pi pcd.pcd3 = pcd.pbs[10] r = t.exchangePBase(pcd) if t.ice_getEncodingVersion() == Ice::Encoding_1_0 test(!r.is_a?(Test::PCDerived3)) test(r.is_a?(Test::PDerived)) test(r.pi == 3) else test(r.is_a?(Test::PCDerived3)) test(r.pi == 3) for i in (0...300) p2 = r.pbs[i] test(p2.is_a?(Test::PCDerived2)) test(p2.pi == i) test(p2.pbs.length == 1) test(!p2.pbs[0]) test(p2.pcd2 == i) end test(r.pcd2 == r.pi) test(r.pcd3 == r.pbs[10]) end # # Obtain an object with preserved slices and send it back to the server. # The preserved slices should be excluded for the 1.0 encoding, otherwise # they should be included. # p = t.PBSUnknownAsPreserved() t.checkPBSUnknown(p) if t.ice_getEncodingVersion() != Ice::Encoding_1_0 t.ice_encodingVersion(Ice::Encoding_1_0).checkPBSUnknown(p) end # # Relay a graph through the server. This test uses a preserved class # with a class member. # c = Test::PNode.new() c._next = Test::PNode.new() c._next._next = Test::PNode.new() c._next._next._next = c # Create a cyclic graph. n = t.exchangePNode(c) test(n._next != nil) test(n._next != n._next._next) test(n._next._next != n._next._next._next) test(n._next._next._next == n) n = nil # Release reference. # # Obtain a preserved object from the server where the most-derived # type is unknown. The preserved slice refers to a graph of PNode # objects. # p = t.PBSUnknownAsPreservedWithGraph() test(p) t.checkPBSUnknownWithGraph(p) p = nil # Release reference. # # Obtain a preserved object from the server where the most-derived # type is unknown. A data member in the preserved slice refers to the # outer object, so the chain of references looks like this: # # outer->slicedData->outer # p = t.PBSUnknown2AsPreservedWithGraph() test(p != nil) if t.ice_getEncodingVersion() != Ice::Encoding_1_0 test(p._ice_slicedData != nil) end t.checkPBSUnknown2WithGraph(p) p._ice_slicedData = nil # Break the cycle. p = nil # Release reference. puts "ok" return t end Ice-3.5.1/rb/test/Ice/slicing/objects/ClientPrivate.ice0000644000076400007640000000137212223561477020774 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once #include module Test { class D3 extends B { string sd3; B pd3; }; ["preserve-slice"] class PCUnknown extends PBase { string pu; }; class PCDerived extends PDerived { PBaseSeq pbs; }; class PCDerived2 extends PCDerived { int pcd2; }; class PCDerived3 extends PCDerived2 { Object pcd3; }; class CompactPCDerived(57) extends CompactPDerived { PBaseSeq pbs; }; }; Ice-3.5.1/rb/test/Ice/slicing/objects/Forward.ice0000644000076400007640000000071112223561477017623 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { class Forward; class Hidden { Forward f; }; class Forward { Hidden h; }; }; Ice-3.5.1/rb/test/Ice/slicing/objects/Client.rb0000755000076400007640000000151212223561477017303 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require './AllTests' def run(args, communicator) t = allTests(communicator) t.shutdown() return true end begin communicator = Ice.initialize(ARGV) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/slicing/objects/run.py0000755000076400007640000000207312223561477016721 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("Running test with sliced format.") TestUtil.clientServerTest() print("Running test with 1.0 encoding.") TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") Ice-3.5.1/rb/test/Ice/slicing/objects/Test.ice0000644000076400007640000000550012223561477017137 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { class SBase { string sb; }; class SBSKnownDerived extends SBase { string sbskd; }; class B { string sb; B pb; }; class D1 extends B { string sd1; B pd1; }; sequence BSeq; class SS1 { BSeq s; }; class SS2 { BSeq s; }; struct SS3 { SS1 c1; SS2 c2; }; dictionary BDict; exception BaseException { string sbe; B pb; }; exception DerivedException extends BaseException { string sde; D1 pd1; }; class Forward; /* Forward-declared class defined in another compilation unit */ class PBase { int pi; }; sequence PBaseSeq; ["preserve-slice"] class Preserved extends PBase { string ps; }; class PDerived extends Preserved { PBase pb; }; class CompactPDerived(56) extends Preserved { PBase pb; }; ["preserve-slice"] class PNode { PNode next; }; ["preserve-slice"] exception PreservedException { }; ["format:sliced"] interface TestIntf { Object SBaseAsObject(); SBase SBaseAsSBase(); SBase SBSKnownDerivedAsSBase(); SBSKnownDerived SBSKnownDerivedAsSBSKnownDerived(); SBase SBSUnknownDerivedAsSBase(); ["format:compact"] SBase SBSUnknownDerivedAsSBaseCompact(); Object SUnknownAsObject(); void checkSUnknown(Object o); B oneElementCycle(); B twoElementCycle(); B D1AsB(); D1 D1AsD1(); B D2AsB(); void paramTest1(out B p1, out B p2); void paramTest2(out B p2, out B p1); B paramTest3(out B p1, out B p2); B paramTest4(out B p); B returnTest1(out B p1, out B p2); B returnTest2(out B p2, out B p1); B returnTest3(B p1, B p2); SS3 sequenceTest(SS1 p1, SS2 p2); BDict dictionaryTest(BDict bin, out BDict bout); PBase exchangePBase(PBase pb); Preserved PBSUnknownAsPreserved(); void checkPBSUnknown(Preserved p); ["amd"] Preserved PBSUnknownAsPreservedWithGraph(); void checkPBSUnknownWithGraph(Preserved p); ["amd"] Preserved PBSUnknown2AsPreservedWithGraph(); void checkPBSUnknown2WithGraph(Preserved p); PNode exchangePNode(PNode pn); void throwBaseAsBase() throws BaseException; void throwDerivedAsBase() throws BaseException; void throwDerivedAsDerived() throws DerivedException; void throwUnknownDerivedAsBase() throws BaseException; ["amd"] void throwPreservedException() throws PreservedException; void useForward(out Forward f); /* Use of forward-declared class to verify that code is generated correctly. */ void shutdown(); }; }; Ice-3.5.1/rb/test/Ice/slicing/exceptions/0000755000076400007640000000000012223561477016266 5ustar mesmesIce-3.5.1/rb/test/Ice/slicing/exceptions/AllTests.rb0000644000076400007640000001577612223561477020366 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** Ice::loadSlice('Test.ice') def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator) obj = communicator.stringToProxy("Test:default -p 12010") t = Test::TestIntfPrx::checkedCast(obj) print "base... " STDOUT.flush begin t.baseAsBase() test(false) rescue Test::Base => b test(b.b == "Base.b") test(b.ice_name() == "Test::Base") rescue test(false) end puts "ok" print "slicing of unknown derived... " STDOUT.flush begin t.unknownDerivedAsBase() test(false) rescue Test::Base => b test(b.b == "UnknownDerived.b") test(b.ice_name() == "Test::Base") rescue test(false) end puts "ok" print "non-slicing of known derived as base... " STDOUT.flush begin t.knownDerivedAsBase() test(false) rescue Test::KnownDerived => k test(k.b == "KnownDerived.b") test(k.kd == "KnownDerived.kd") test(k.ice_name() == "Test::KnownDerived") rescue test(false) end puts "ok" print "non-slicing of known derived as derived... " STDOUT.flush begin t.knownDerivedAsKnownDerived() test(false) rescue Test::KnownDerived => k test(k.b == "KnownDerived.b") test(k.kd == "KnownDerived.kd") test(k.ice_name() == "Test::KnownDerived") rescue test(false) end puts "ok" print "slicing of unknown intermediate as base... " STDOUT.flush begin t.unknownIntermediateAsBase() test(false) rescue Test::Base => b test(b.b == "UnknownIntermediate.b") test(b.ice_name() == "Test::Base") rescue test(false) end puts "ok" print "slicing of known intermediate as base... " STDOUT.flush begin t.knownIntermediateAsBase() test(false) rescue Test::KnownIntermediate => ki test(ki.b == "KnownIntermediate.b") test(ki.ki == "KnownIntermediate.ki") test(ki.ice_name() == "Test::KnownIntermediate") rescue test(false) end puts "ok" print "slicing of known most derived as base... " STDOUT.flush begin t.knownMostDerivedAsBase() test(false) rescue Test::KnownMostDerived => kmd test(kmd.b == "KnownMostDerived.b") test(kmd.ki == "KnownMostDerived.ki") test(kmd.kmd == "KnownMostDerived.kmd") test(kmd.ice_name() == "Test::KnownMostDerived") rescue test(false) end puts "ok" print "non-slicing of known intermediate as intermediate... " STDOUT.flush begin t.knownIntermediateAsKnownIntermediate() test(false) rescue Test::KnownIntermediate => ki test(ki.b == "KnownIntermediate.b") test(ki.ki == "KnownIntermediate.ki") test(ki.ice_name() == "Test::KnownIntermediate") rescue test(false) end puts "ok" print "non-slicing of known most derived exception as intermediate... " STDOUT.flush begin t.knownMostDerivedAsKnownIntermediate() test(false) rescue Test::KnownMostDerived => kmd test(kmd.b == "KnownMostDerived.b") test(kmd.ki == "KnownMostDerived.ki") test(kmd.kmd == "KnownMostDerived.kmd") test(kmd.ice_name() == "Test::KnownMostDerived") rescue test(false) end puts "ok" print "non-slicing of known most derived as most derived... " STDOUT.flush begin t.knownMostDerivedAsKnownMostDerived() test(false) rescue Test::KnownMostDerived => kmd test(kmd.b == "KnownMostDerived.b") test(kmd.ki == "KnownMostDerived.ki") test(kmd.kmd == "KnownMostDerived.kmd") test(kmd.ice_name() == "Test::KnownMostDerived") rescue test(false) end puts "ok" print "slicing of unknown most derived, known intermediate as base... " STDOUT.flush begin t.unknownMostDerived1AsBase() test(false) rescue Test::KnownIntermediate => ki test(ki.b == "UnknownMostDerived1.b") test(ki.ki == "UnknownMostDerived1.ki") test(ki.ice_name() == "Test::KnownIntermediate") rescue test(false) end puts "ok" print "slicing of unknown most derived, known intermediate as intermediate... " STDOUT.flush begin t.unknownMostDerived1AsKnownIntermediate() test(false) rescue Test::KnownIntermediate => ki test(ki.b == "UnknownMostDerived1.b") test(ki.ki == "UnknownMostDerived1.ki") test(ki.ice_name() == "Test::KnownIntermediate") rescue test(false) end puts "ok" print "slicing of unknown most derived, unknown intermediate as base... " STDOUT.flush begin t.unknownMostDerived2AsBase() test(false) rescue Test::Base => b test(b.b == "UnknownMostDerived2.b") test(b.ice_name() == "Test::Base") rescue test(false) end puts "ok" print "unknown most derived in compact format... " STDOUT.flush begin t.unknownMostDerived2AsBaseCompact() test(false) rescue Test::Base # # For the 1.0 encoding, the unknown exception is sliced to Base. # test(t.ice_getEncodingVersion() == Ice::Encoding_1_0) rescue Ice::UnknownUserException # # An UnkonwnUserException is raised for the compact format because the # most-derived type is unknown and the exception cannot be sliced. # test(t.ice_getEncodingVersion() != Ice::Encoding_1_0) rescue test(false) end puts "ok" print "preserved exceptions... " STDOUT.flush begin t.knownPreservedAsBase() test(false) rescue Test::KnownPreservedDerived => ex test(ex.b == "base") test(ex.kp == "preserved") test(ex.kpd == "derived") rescue test(false) end begin t.knownPreservedAsKnownPreserved() test(false) rescue Test::KnownPreservedDerived => ex test(ex.b == "base") test(ex.kp == "preserved") test(ex.kpd == "derived") rescue test(false) end begin t.unknownPreservedAsBase() test(false) rescue Test::KnownPreservedDerived => ex test(ex.b == "base") test(ex.kp == "preserved") test(ex.kpd == "derived") rescue test(false) end begin t.unknownPreservedAsKnownPreserved() test(false) rescue Test::KnownPreservedDerived => ex test(ex.b == "base") test(ex.kp == "preserved") test(ex.kpd == "derived") rescue test(false) end puts "ok" return t end Ice-3.5.1/rb/test/Ice/slicing/exceptions/Client.rb0000755000076400007640000000156312223561477020041 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' require 'Ice' Ice::loadSlice('Test.ice') require './AllTests' def run(args, communicator) t = allTests(communicator) t.shutdown() return true end begin communicator = Ice.initialize(ARGV) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/slicing/exceptions/run.py0000755000076400007640000000207312223561477017451 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("Running test with sliced format.") TestUtil.clientServerTest() print("Running test with 1.0 encoding.") TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") Ice-3.5.1/rb/test/Ice/slicing/exceptions/Test.ice0000644000076400007640000000461712223561477017677 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { exception Base { string b; }; exception KnownDerived extends Base { string kd; }; exception KnownIntermediate extends Base { string ki; }; exception KnownMostDerived extends KnownIntermediate { string kmd; }; ["preserve-slice"] exception KnownPreserved extends Base { string kp; }; exception KnownPreservedDerived extends KnownPreserved { string kpd; }; ["preserve-slice"] class BaseClass { string bc; }; ["format:sliced"] interface Relay { void knownPreservedAsBase() throws Base; void knownPreservedAsKnownPreserved() throws KnownPreserved; void unknownPreservedAsBase() throws Base; void unknownPreservedAsKnownPreserved() throws KnownPreserved; }; ["format:sliced"] interface TestIntf { void baseAsBase() throws Base; void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; void unknownIntermediateAsBase() throws Base; void knownIntermediateAsBase() throws Base; void knownMostDerivedAsBase() throws Base; void knownIntermediateAsKnownIntermediate() throws KnownIntermediate; void knownMostDerivedAsKnownIntermediate() throws KnownIntermediate; void knownMostDerivedAsKnownMostDerived() throws KnownMostDerived; void unknownMostDerived1AsBase() throws Base; void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; void knownPreservedAsBase() throws Base; void knownPreservedAsKnownPreserved() throws KnownPreserved; void relayKnownPreservedAsBase(Relay* r) throws Base; void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; void unknownPreservedAsBase() throws Base; void unknownPreservedAsKnownPreserved() throws KnownPreserved; void relayUnknownPreservedAsBase(Relay* r) throws Base; void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; void shutdown(); }; }; Ice-3.5.1/rb/test/Ice/enums/0000755000076400007640000000000012223561477013604 5ustar mesmesIce-3.5.1/rb/test/Ice/enums/AllTests.rb0000644000076400007640000001466412223561477015677 0ustar mesmes# ********************************************************************** # # 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. # # ********************************************************************** def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator) ref = "test:default -p 12010" base = communicator.stringToProxy(ref) test(base) proxy = Test::TestIntfPrx::checkedCast(base) test(proxy) print "testing enum values... " STDOUT.flush test(Test::ByteEnum::Benum1.to_i == 0); test(Test::ByteEnum::Benum2.to_i == 1); test(Test::ByteEnum::Benum3.to_i == Test::ByteConst1); test(Test::ByteEnum::Benum4.to_i == Test::ByteConst1 + 1); test(Test::ByteEnum::Benum5.to_i == Test::ShortConst1); test(Test::ByteEnum::Benum6.to_i == Test::ShortConst1 + 1); test(Test::ByteEnum::Benum7.to_i == Test::IntConst1); test(Test::ByteEnum::Benum8.to_i == Test::IntConst1 + 1); test(Test::ByteEnum::Benum9.to_i == Test::LongConst1); test(Test::ByteEnum::Benum10.to_i == Test::LongConst1 + 1); test(Test::ByteEnum::Benum11.to_i == Test::ByteConst2); test(Test::ByteEnum::from_int(0) == Test::ByteEnum::Benum1); test(Test::ByteEnum::from_int(1) == Test::ByteEnum::Benum2); test(Test::ByteEnum::from_int(Test::ByteConst1) == Test::ByteEnum::Benum3); test(Test::ByteEnum::from_int(Test::ByteConst1 + 1) == Test::ByteEnum::Benum4); test(Test::ByteEnum::from_int(Test::ShortConst1) == Test::ByteEnum::Benum5); test(Test::ByteEnum::from_int(Test::ShortConst1 + 1) == Test::ByteEnum::Benum6); test(Test::ByteEnum::from_int(Test::IntConst1) == Test::ByteEnum::Benum7); test(Test::ByteEnum::from_int(Test::IntConst1 + 1) == Test::ByteEnum::Benum8); test(Test::ByteEnum::from_int(Test::LongConst1) == Test::ByteEnum::Benum9); test(Test::ByteEnum::from_int(Test::LongConst1 + 1) == Test::ByteEnum::Benum10); test(Test::ByteEnum::from_int(Test::ByteConst2) == Test::ByteEnum::Benum11); test(Test::ShortEnum::Senum1.to_i == 3); test(Test::ShortEnum::Senum2.to_i == 4); test(Test::ShortEnum::Senum3.to_i == Test::ByteConst1); test(Test::ShortEnum::Senum4.to_i == Test::ByteConst1 + 1); test(Test::ShortEnum::Senum5.to_i == Test::ShortConst1); test(Test::ShortEnum::Senum6.to_i == Test::ShortConst1 + 1); test(Test::ShortEnum::Senum7.to_i == Test::IntConst1); test(Test::ShortEnum::Senum8.to_i == Test::IntConst1 + 1); test(Test::ShortEnum::Senum9.to_i == Test::LongConst1); test(Test::ShortEnum::Senum10.to_i == Test::LongConst1 + 1); test(Test::ShortEnum::Senum11.to_i == Test::ShortConst2); test(Test::ShortEnum::from_int(3) == Test::ShortEnum::Senum1); test(Test::ShortEnum::from_int(4) == Test::ShortEnum::Senum2); test(Test::ShortEnum::from_int(Test::ByteConst1) == Test::ShortEnum::Senum3); test(Test::ShortEnum::from_int(Test::ByteConst1 + 1) == Test::ShortEnum::Senum4); test(Test::ShortEnum::from_int(Test::ShortConst1) == Test::ShortEnum::Senum5); test(Test::ShortEnum::from_int(Test::ShortConst1 + 1) == Test::ShortEnum::Senum6); test(Test::ShortEnum::from_int(Test::IntConst1) == Test::ShortEnum::Senum7); test(Test::ShortEnum::from_int(Test::IntConst1 + 1) == Test::ShortEnum::Senum8); test(Test::ShortEnum::from_int(Test::LongConst1) == Test::ShortEnum::Senum9); test(Test::ShortEnum::from_int(Test::LongConst1 + 1) == Test::ShortEnum::Senum10); test(Test::ShortEnum::from_int(Test::ShortConst2) == Test::ShortEnum::Senum11); test(Test::IntEnum::Ienum1.to_i == 0); test(Test::IntEnum::Ienum2.to_i == 1); test(Test::IntEnum::Ienum3.to_i == Test::ByteConst1); test(Test::IntEnum::Ienum4.to_i == Test::ByteConst1 + 1); test(Test::IntEnum::Ienum5.to_i == Test::ShortConst1); test(Test::IntEnum::Ienum6.to_i == Test::ShortConst1 + 1); test(Test::IntEnum::Ienum7.to_i == Test::IntConst1); test(Test::IntEnum::Ienum8.to_i == Test::IntConst1 + 1); test(Test::IntEnum::Ienum9.to_i == Test::LongConst1); test(Test::IntEnum::Ienum10.to_i == Test::LongConst1 + 1); test(Test::IntEnum::Ienum11.to_i == Test::IntConst2); test(Test::IntEnum::Ienum12.to_i == Test::LongConst2); test(Test::IntEnum::from_int(0) == Test::IntEnum::Ienum1); test(Test::IntEnum::from_int(1) == Test::IntEnum::Ienum2); test(Test::IntEnum::from_int(Test::ByteConst1) == Test::IntEnum::Ienum3); test(Test::IntEnum::from_int(Test::ByteConst1 + 1) == Test::IntEnum::Ienum4); test(Test::IntEnum::from_int(Test::ShortConst1) == Test::IntEnum::Ienum5); test(Test::IntEnum::from_int(Test::ShortConst1 + 1) == Test::IntEnum::Ienum6); test(Test::IntEnum::from_int(Test::IntConst1) == Test::IntEnum::Ienum7); test(Test::IntEnum::from_int(Test::IntConst1 + 1) == Test::IntEnum::Ienum8); test(Test::IntEnum::from_int(Test::LongConst1) == Test::IntEnum::Ienum9); test(Test::IntEnum::from_int(Test::LongConst1 + 1) == Test::IntEnum::Ienum10); test(Test::IntEnum::from_int(Test::IntConst2) == Test::IntEnum::Ienum11); test(Test::IntEnum::from_int(Test::LongConst2) == Test::IntEnum::Ienum12); test(Test::SimpleEnum::Red.to_i == 0); test(Test::SimpleEnum::Green.to_i == 1); test(Test::SimpleEnum::Blue.to_i == 2); test(Test::SimpleEnum::from_int(0) == Test::SimpleEnum::Red); test(Test::SimpleEnum::from_int(1) == Test::SimpleEnum::Green); test(Test::SimpleEnum::from_int(2) == Test::SimpleEnum::Blue); puts "ok" print "testing enum operations... " STDOUT.flush test(proxy.opByte(Test::ByteEnum::Benum1) == [Test::ByteEnum::Benum1, Test::ByteEnum::Benum1]); test(proxy.opByte(Test::ByteEnum::Benum11) == [Test::ByteEnum::Benum11, Test::ByteEnum::Benum11]); test(proxy.opShort(Test::ShortEnum::Senum1) == [Test::ShortEnum::Senum1, Test::ShortEnum::Senum1]); test(proxy.opShort(Test::ShortEnum::Senum11) == [Test::ShortEnum::Senum11, Test::ShortEnum::Senum11]); test(proxy.opInt(Test::IntEnum::Ienum1) == [Test::IntEnum::Ienum1, Test::IntEnum::Ienum1]); test(proxy.opInt(Test::IntEnum::Ienum11) == [Test::IntEnum::Ienum11, Test::IntEnum::Ienum11]); test(proxy.opInt(Test::IntEnum::Ienum12) == [Test::IntEnum::Ienum12, Test::IntEnum::Ienum12]); test(proxy.opSimple(Test::SimpleEnum::Green) == [Test::SimpleEnum::Green, Test::SimpleEnum::Green]); puts "ok" return proxy end Ice-3.5.1/rb/test/Ice/enums/Client.rb0000755000076400007640000000155112223561477015354 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'Ice' Ice::loadSlice("Test.ice") require './AllTests' def run(args, communicator) proxy = allTests(communicator) proxy.shutdown() return true end begin communicator = Ice.initialize(ARGV) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Ice/enums/run.py0000755000076400007640000000205012223561477014762 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("Running test with 1.0 encoding.") TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") print("Running test with 1.1 encoding.") TestUtil.clientServerTest() Ice-3.5.1/rb/test/Ice/enums/Test.ice0000644000076400007640000000311512223561477015205 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #pragma once module Test { const byte ByteConst1 = 10; const short ShortConst1 = 20; const int IntConst1 = 30; const long LongConst1 = 40; const byte ByteConst2 = 126; const short ShortConst2 = 32766; const int IntConst2 = 2147483647; const long LongConst2 = 2147483646; enum ByteEnum { benum1, benum2, benum3 = ByteConst1, benum4, benum5 = ShortConst1, benum6, benum7 = IntConst1, benum8, benum9 = LongConst1, benum10, benum11 = ByteConst2 }; enum ShortEnum { senum1 = 3, senum2, senum3 = ByteConst1, senum4, senum5 = ShortConst1, senum6, senum7 = IntConst1, senum8, senum9 = LongConst1, senum10, senum11 = ShortConst2 }; enum IntEnum { ienum1, ienum2, ienum3 = ByteConst1, ienum4, ienum5 = ShortConst1, ienum6, ienum7 = IntConst1, ienum8, ienum9 = LongConst1, ienum10, ienum11 = IntConst2, ienum12 = LongConst2 }; enum SimpleEnum { red, green, blue }; interface TestIntf { ByteEnum opByte(ByteEnum b1, out ByteEnum b2); ShortEnum opShort(ShortEnum s1, out ShortEnum s2); IntEnum opInt(IntEnum i1, out IntEnum i2); SimpleEnum opSimple(SimpleEnum s1, out SimpleEnum s2); void shutdown(); }; }; Ice-3.5.1/rb/test/Slice/0000755000076400007640000000000012223561477013014 5ustar mesmesIce-3.5.1/rb/test/Slice/keyword/0000755000076400007640000000000012223561477014500 5ustar mesmesIce-3.5.1/rb/test/Slice/keyword/Key.ice0000644000076400007640000000217612223561477015720 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** module BEGIN { enum END { alias }; struct and { int begin; }; interface break { void case(int clone, int def); void to_a(); void instance_variable_set(); void instance_variables(); }; class display { int when; void do(break* dup, out int else); }; class elsif extends display implements break { }; sequence rescue; dictionary ensure; exception next { int new; }; exception nil extends next { int not; int or; }; local interface extend { END for(display freeze, elsif hash, break* if, display inspect, elsif method, int methods) throws nil; }; const int redo = 1; }; Ice-3.5.1/rb/test/Slice/keyword/Client.rb0000755000076400007640000000431712223561477016253 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' rubyDir = nil for toplevel in [".", "..", "../..", "../../..", "../../../.."] path = Pathname.new(toplevel).join("ruby", "Ice.rb") if path.file? rubyDir = Pathname.new(toplevel).join("ruby") break end end if not rubyDir fail "can't find toplevel directory!" end require 'Ice' Ice::loadSlice('--underscore Key.ice') def test(b) if !b raise RuntimeError, 'test assertion failed' end end class DisplayI < BEGIN_::Display def _do(_dup, current=nil) end end def run(args, communicator) print "testing type names... " STDOUT.flush a = BEGIN_::END_::Alias b = BEGIN_::And.new b._begin = 0; c = BEGIN_::BreakPrx::uncheckedCast(communicator.stringToProxy("test:tcp")) test(c.method(:_case)) test(c.method(:_to_a)) test(c.method(:_instance_variable_set)) test(c.method(:_instance_variables)) d = BEGIN_::DisplayPrx::uncheckedCast(communicator.stringToProxy("test:tcp")) test(d.method(:_do)) d1 = DisplayI.new e = BEGIN_::ElsifPrx::uncheckedCast(communicator.stringToProxy("test:tcp")) test(e.method(:_do)) test(e.method(:_case)) f = BEGIN_::Next.new f._new = 0 g = BEGIN_::Nil.new g._new = 0 g._not = 0 g._or = 0 # TODO: Test local interface #h = BEGIN_::ExtendPrx::uncheckedCast(communicator.stringToProxy("test:tcp")) i = BEGIN_::Redo puts "ok" return true end begin initData = Ice::InitializationData.new initData.properties = Ice.createProperties(ARGV) communicator = Ice.initialize(ARGV, initData) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Slice/keyword/run.py0000755000076400007640000000175312223561477015667 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil sys.stdout.write("starting client... ") sys.stdout.flush() clientProc = TestUtil.startClient("Client.rb", "--Ice.Default.Host=127.0.0.1", startReader = False) print("ok") clientProc.startReader() clientProc.waitTestSuccess() Ice-3.5.1/rb/test/Slice/macros/0000755000076400007640000000000012223561477014300 5ustar mesmesIce-3.5.1/rb/test/Slice/macros/Client.rb0000755000076400007640000000232512223561477016050 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' rubyDir = nil for toplevel in [".", "..", "../..", "../../..", "../../../.."] path = Pathname.new(toplevel).join("ruby", "Ice.rb") if path.file? rubyDir = Pathname.new(toplevel).join("ruby") break end end if not rubyDir fail "can't find toplevel directory!" end require 'Ice' Ice::loadSlice('Test.ice') def test(b) if !b raise RuntimeError, 'test assertion failed' end end status = true begin print "testing Slice predefined macros... " STDOUT.flush d = Test::Default.new test(d.x == 10) test(d.y == 10) nd = Test::NoDefault.new test(nd.x != 10) test(nd.y != 10) c = Test::RubyOnly.new test(c.lang.eql? "ruby") test(c.version == Ice::intVersion()) puts "ok" rescue => ex puts $! print ex.backtrace.join("\n") status = false end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Slice/macros/run.py0000755000076400007640000000175412223561477015470 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil sys.stdout.write("starting client... ") sys.stdout.flush() clientProc = TestUtil.startClient("Client.rb", "--Ice.Default.Host=127.0.0.1", startReader = False) print("ok") clientProc.startReader() clientProc.waitTestSuccess() Ice-3.5.1/rb/test/Slice/macros/Test.ice0000644000076400007640000000177512223561477015713 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** // // This macro sets the default value only when compiling with slice2rb. // #ifdef __SLICE2RB__ # define DEFAULT(X) = X #else # define DEFAULT(X) /**/ #endif // // This macro sets the default value only when not compiling with slice2rb. // #ifndef __SLICE2RB__ # define NODEFAULT(X) = X #else # define NODEFAULT(X) /**/ #endif module Test { class Default { int x DEFAULT(10); int y DEFAULT(10); }; class NoDefault { int x NODEFAULT(10); int y NODEFAULT(10); }; // // This class is only defined when compiling with slice2rb. // #ifdef __SLICE2RB__ class RubyOnly { string lang DEFAULT("ruby"); int version DEFAULT(ICE_VERSION); }; #endif }; Ice-3.5.1/rb/test/Slice/structure/0000755000076400007640000000000012223561477015054 5ustar mesmesIce-3.5.1/rb/test/Slice/structure/Client.rb0000755000076400007640000001042212223561477016621 0ustar mesmes#!/usr/bin/env ruby # ********************************************************************** # # 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. # # ********************************************************************** require 'pathname' rubyDir = nil for toplevel in [".", "..", "../..", "../../..", "../../../.."] path = Pathname.new(toplevel).join("ruby", "Ice.rb") if path.file? rubyDir = Pathname.new(toplevel).join("ruby") break end end if not rubyDir fail "can't find toplevel directory!" end require 'Ice' Ice::loadSlice('Test.ice') def test(b) if !b raise RuntimeError, 'test assertion failed' end end def allTests(communicator) print "testing equals() for Slice structures... " STDOUT.flush # # Define some default values. # def_s2 = Test::S2.new(true, 98, 99, 100, 101, 1.0, 2.0, "string", ["one", "two", "three"], {"abc"=>"def"}, \ Test::S1.new("name"), Test::C.new(5), communicator.stringToProxy("test")) # # Compare default-constructed structures. # test(Test::S2.new.eql?(Test::S2.new)) # # Change one primitive member at a time. # v = def_s2.clone test(v.eql?(def_s2)) v = def_s2.clone v.bo = false test(!v.eql?(def_s2)) v = def_s2.clone v.by = v.by - 1 test(!v.eql?(def_s2)) v = def_s2.clone v.sh = v.sh - 1 test(!v.eql?(def_s2)) v = def_s2.clone v.i = v.i - 1 test(!v.eql?(def_s2)) v = def_s2.clone v.l = v.l - 1 test(!v.eql?(def_s2)) v = def_s2.clone v.f = v.f - 1 test(!v.eql?(def_s2)) v = def_s2.clone v.d = v.d - 1 test(!v.eql?(def_s2)) v = def_s2.clone v.str = "" test(!v.eql?(def_s2)) # # String member # v1 = def_s2.clone v1.str = "string" test(v1.eql?(def_s2)) v1 = def_s2.clone v2 = def_s2.clone v1.str = nil test(!v1.eql?(v2)) v1 = def_s2.clone v2 = def_s2.clone v2.str = nil test(!v1.eql?(v2)) v1 = def_s2.clone v2 = def_s2.clone v1.str = nil v2.str = nil test(v1.eql?(v2)) # # Sequence member # v1 = def_s2.clone v1.ss = def_s2.ss.clone test(v1.eql?(def_s2)) v1 = def_s2.clone v1.ss = [] test(!v1.eql?(def_s2)) v1 = def_s2.clone v1.ss = ["one", "two", "three"] test(v1.eql?(def_s2)) v1 = def_s2.clone v2 = def_s2.clone v1.ss = nil test(!v1.eql?(v2)) v1 = def_s2.clone v2 = def_s2.clone v2.ss = nil test(!v1.eql?(v2)) # # Dictionary member # v1 = def_s2.clone v1.sd = {"abc"=>"def"} test(v1.eql?(def_s2)) v1 = def_s2.clone v1.sd = {} test(!v1.eql?(def_s2)) v1 = def_s2.clone v2 = def_s2.clone v1.sd = nil test(!v1.eql?(v2)) v1 = def_s2.clone v2 = def_s2.clone v2.sd = nil test(!v1.eql?(v2)) # # Struct member # v1 = def_s2.clone v1.s = def_s2.s.clone test(v1.eql?(def_s2)) v1 = def_s2.clone v1.s = Test::S1.new("name") test(v1.eql?(def_s2)) v1 = def_s2.clone v1.s = Test::S1.new("noname") test(!v1.eql?(def_s2)) # # Class member # v1 = def_s2.clone v1.cls = def_s2.cls.clone test(!v1.eql?(def_s2)) # # Proxy member # v1 = def_s2.clone v1.prx = communicator.stringToProxy("test") test(v1.eql?(def_s2)) v1 = def_s2.clone v1.prx = communicator.stringToProxy("test2") test(!v1.eql?(def_s2)) v1 = def_s2.clone v2 = def_s2.clone v1.prx = nil test(!v1.eql?(v2)) v1 = def_s2.clone v2 = def_s2.clone v2.prx = nil test(!v1.eql?(v2)) puts "ok" end def run(args, communicator) allTests(communicator) return true end begin initData = Ice::InitializationData.new initData.properties = Ice.createProperties(ARGV) communicator = Ice.initialize(ARGV, initData) status = run(ARGV, communicator) rescue => ex puts $! print ex.backtrace.join("\n") status = false end if communicator begin communicator.destroy() rescue => ex puts $! print ex.backtrace.join("\n") status = false end end exit(status ? 0 : 1) Ice-3.5.1/rb/test/Slice/structure/run.py0000755000076400007640000000175412223561477016244 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil sys.stdout.write("starting client... ") sys.stdout.flush() clientProc = TestUtil.startClient("Client.rb", "--Ice.Default.Host=127.0.0.1", startReader = False) print("ok") clientProc.startReader() clientProc.waitTestSuccess() Ice-3.5.1/rb/test/Slice/structure/Test.ice0000644000076400007640000000130212223561477016451 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** [["cpp:include:list"]] module Test { sequence StringSeq; dictionary StringDict; class C { int i; }; struct S1 { string name; }; struct S2 { bool bo; byte by; short sh; int i; long l; float f; double d; string str; StringSeq ss; StringDict sd; S1 s; C cls; Object* prx; }; }; Ice-3.5.1/cpp/0000755000076400007640000000000012223561504011144 5ustar mesmesIce-3.5.1/cpp/README0000644000076400007640000000020412223561477012031 0ustar mesmesFor build and installation instructions, please refer to the manual: http://doc.zeroc.com/display/Rel/Ice+3.5.1+Build+Instructions Ice-3.5.1/cpp/doc/0000755000076400007640000000000012223561476011721 5ustar mesmesIce-3.5.1/cpp/doc/images/0000755000076400007640000000000012223561476013166 5ustar mesmesIce-3.5.1/cpp/doc/images/next.gif0000644000076400007640000000145312223561476014636 0ustar mesmesGIF89a4ĿxxxwwwvvvuuullljjjUUUJJJ!U,4UU$87 UE@34B-DÀ۸sͻo)r!ȓ+_UHAسkߞH&O*;Ice-3.5.1/cpp/doc/images/nextx.gif0000644000076400007640000000145112223561476015024 0ustar mesmesGIF89a4Ŀ!F,4FF(:9$FEA67C>F0?C$B.6:E*5=E)4)3(2'!%% C*\B~(0Ha"%hȱFpɓ0`˗0[bPbD̛/Sϟ@YSQ/PӧP`ԫX]( ׯ`Johvm pʅ߅sBه ˆ#^̃ǐ#KLeȌt(ϠC92R^ͺװUa۸sͻm;d@ȓ+_^#DxNسkg‹蹑@;Ice-3.5.1/cpp/doc/images/prevx.gif0000644000076400007640000000145712223561476015030 0ustar mesmesGIF89a4Ŀ!F,4FF(:9$FEA67C>F0?C$B.6:E*5=E)4)3(2'%%,/2*\Ȑa%DdhHbBEJ4ȱǍ6@ɓa(#˗0\A̛8c,2bϟ@.YCH }LPJ} jՅ ŠK%BT(˶mʌ@ Kݻ$p߻,}8@È 30!c+y0@˘3k\9rBMӨEPƁװc˞MC< ͻ b +_μЕaسkν,􀔂Q7;Ice-3.5.1/cpp/doc/images/logo.gif0000644000076400007640000000302312223561476014613 0ustar mesmesGIF89aV8O%%'YBBDkz@v䌺肽`pru556RTV%pĚU#1gGiddewzP*xGr;=@Z\abyz{W2twz2HPAAFJ܄:Q9a5GILqdP!,V6gccgW /c s&a6W Al97ʩ6A,A|^7midp {Ll75fdFLA6WDp)=zLy| 0ar Jyhh2!+( R O pR6=Tƒ<9Kl| B(J >D4qȈ% >PGGL*TG>?nܡ3cƝZ `Г0$H [ @ (AM m4CE1/)QA㋞A'`HN2`p@0bM BRdtE0`>/ X"* "oPPI(tY$@ X:HI8aA(l1 * q!dF BV!xTV5IpL~@~<b C "50QD+ܐC2ȠL~1ą4"Y$0Ȍ~G56p@ %d  ~EH<X ɖ?+EhPv-& N_Xxa0ލQDc z <@< * dppAD <,O D,8J> p<-#|HA \6ug;b@"vP [-(1 (LaGBU,5!FT;Ice-3.5.1/cpp/doc/images/closed.gif0000644000076400007640000000013612223561476015126 0ustar mesmesGIF89a!Made with GIMP! ,#2wQn}JQ頜eL׶S;Ice-3.5.1/cpp/doc/images/caution.gif0000644000076400007640000000201712223561476015317 0ustar mesmesGIF87a!!11BBZZcckkss{{sss{s{cZcc19B191,uH_@Ȑ 6DHB $N$ 4>pиa (e|QGE(YaD`P 8j,XEJt@P?MeHL)%d)؝ JCgep`-[ tYb 16|o "ؕd=H)UDFW4  热-XċBݐ'ơ:o ;Ice-3.5.1/cpp/doc/images/up.gif0000644000076400007640000000235112223561476014302 0ustar mesmesGIF89a4Ŀxxxwwwvvvuuuaaa```UUUJJJ,4PÆ*\Ȱvŋ3jч@*Iɓ(S 0cʜI͛1Qbϟ@ JOBtӧM!DJI[DʵWz@׳`Q۷:ƒx+ o 2LǎF7`Ș13x̠3$ ̐A$UA5Ȟrϸչ{V@ SDN)"s={H kO'R'~y(ƫWcJ 1N?zϟ(A_}$eB 6 (Lȅ jT t ~!ND(0 1D8ƈAR#@)D<L6PFB`Xf\vYbD=`hly ,C&ix|CuР;Ice-3.5.1/cpp/doc/images/important.gif0000644000076400007640000000207112223561476015672 0ustar mesmesGIF87a)))999BB1BBBJJJRRRZZ)ccccRccckkBkkkssR{{{9{ZZc{c!9k{JRZZsRck!19R!)1Zc{1B19J!,HpA*ܲĆ ""Bae!A+3,|ҤcG,0$WRTC dd͔ML9& |ܰs 5WR@ARM< $J rSG 8Pܼ"i'c9,""LdOW`+D2ͫ2$01@;T*<@?(06B$/:B#.#-")KD,!=OSSlo2*\Ȑ(S iHbBB>4ȱǍtBɓU(˗0xB̛8caϟ@.9H MPJ} &2j ŠKl)S)˶mʌ4 Kݻr0߻&e8@È P#c%a0@˘3k\9 BMӨEPfװc˞M@0 ͻ m+_μЕ@%سkν&z4Q;Ice-3.5.1/cpp/doc/images/home.gif0000644000076400007640000000245012223561476014606 0ustar mesmesGIF89a4xxxwwwuuummmlllkkkaaa```VVVUUUJJJ,4 *\pAŋ3j܈I,TIɓ(S$bʜI͛8eĄ@ JQ2,)!ӧPJJi %"hJV^KVJI@X+۶VʝKJG<ػL}La.pƎ4 &@ @3g&i KB4X ˰]vA& c&33V 3 2KX7`]S>s,`hJ d t̗|X=)_EJ߿`tl2񭠔 X Rx` g wTu`}v(J]v9v)(4X[6چmvR)7# JmpKdQ0IeM0W^y=y Ji`dih&`.Ap)tiq矀*蠄' 袌6裐F( =f馜v駙AJ©ꪬ* E Q j@@;Ice-3.5.1/cpp/doc/images/tip.gif0000644000076400007640000000200512223561476014446 0ustar mesmesGIF87a  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~, HA*xX)J"Btvoa{&!%J,2M3QUQsj)TK!s W&tV{{BYTI7yFЛх*^Uh k`֔x˞ )Hv[?]m&V'^BxpBÀ#DẂV2 g-Oz3& kQ«k='ۘɔ=x"m|_@;Ice-3.5.1/cpp/doc/images/upx.gif0000644000076400007640000000225712223561476014477 0ustar mesmesGIF89a4Ŀ,4@*\0 Aŋ3jxc0~XIɓ(S$9bʜI͛8eQD@ JQ5zI1ӧPJJ) )$hʵׯ`nEhӪ] … mʝ+C鉶x݋]PjÈ+vǐ)Ѡ˘3C8nϠa(%ӨS_9עX@۸?|/P@7猼ysJC$Nu뺫gz O|yW_˟O'OR(Vo`AF(Vht ($z ,0Ƹ" ;Ȁ8<91BD‘H&L6$ @Q Ui @@;Ice-3.5.1/cpp/doc/images/collapseAll.gif0000644000076400007640000000017512223561476016113 0ustar mesmesGIF89a̙!,BX ƋD'f0_gےj'SmİdDL{LfNNue$;Ice-3.5.1/cpp/doc/images/note.gif0000644000076400007640000000205612223561476014625 0ustar mesmesGIF87a  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~, HA*ثR:[1F{1J&R<(Zʓ[Hi&L5 :+ub)LS`QzRAJ5kr͚3F Ftn9 <Ҙ9Mu lFQE=5k-5Szҿw=QbsT¸$eJ{Jq\ǫ=@W˚Z!l3ƦR<-%3!c[B*'{ƚxyǨ^Sj lĊQ9o;6$H;Ice-3.5.1/cpp/doc/images/opened.gif0000644000076400007640000000014112223561476015123 0ustar mesmesGIF89a!Made with GIMP! ,&2wQ>thȉTȖ0;Ice-3.5.1/cpp/doc/images/expandAll.gif0000644000076400007640000000021512223561476015563 0ustar mesmesGIF89a̙!,RX=.!dʆoYXh-V#AH(os=8Ůu1 ((#R,HRn/;Ice-3.5.1/cpp/doc/images/warning.gif0000644000076400007640000000203412223561476015321 0ustar mesmesGIF87a!)1BJRZks{{{RRZZ{{99JJ11))))))!!,yC p`6Da p#ǏQ\̈#E S@q#PL"K"NJSpT9@2C^!3 3sh@7 z {5kdeKv5+͚C рJYg0@,Sjuf 8@a@3T G;P}@NNI2C"t́ag}Q;m7fD>ou;w ;Ice-3.5.1/cpp/doc/indexFooter0000644000076400007640000000275112223561476014137 0ustar mesmes
Home
Ice-3.5.1/cpp/doc/slicefiles0000755000076400007640000000621712223561476013777 0ustar mesmesSLICEFILES = ..\..\slice\Freeze\BackgroundSaveEvictor.ice \ ..\..\slice\Freeze\CatalogData.ice \ ..\..\slice\Freeze\Connection.ice \ ..\..\slice\Freeze\ConnectionF.ice \ ..\..\slice\Freeze\DB.ice \ ..\..\slice\Freeze\Evictor.ice \ ..\..\slice\Freeze\EvictorF.ice \ ..\..\slice\Freeze\EvictorStorage.ice \ ..\..\slice\Freeze\Exception.ice \ ..\..\slice\Freeze\Transaction.ice \ ..\..\slice\Freeze\TransactionalEvictor.ice \ ..\..\slice\Glacier2\PermissionsVerifier.ice \ ..\..\slice\Glacier2\PermissionsVerifierF.ice \ ..\..\slice\Glacier2\Router.ice \ ..\..\slice\Glacier2\RouterF.ice \ ..\..\slice\Glacier2\Session.ice \ ..\..\slice\Glacier2\SSLInfo.ice \ ..\..\slice\Ice\BuiltinSequences.ice \ ..\..\slice\Ice\Communicator.ice \ ..\..\slice\Ice\CommunicatorF.ice \ ..\..\slice\Ice\Connection.ice \ ..\..\slice\Ice\ConnectionF.ice \ ..\..\slice\Ice\Current.ice \ ..\..\slice\Ice\Endpoint.ice \ ..\..\slice\Ice\EndpointF.ice \ ..\..\slice\Ice\EndpointTypes.ice \ ..\..\slice\Ice\FacetMap.ice \ ..\..\slice\Ice\Identity.ice \ ..\..\slice\Ice\ImplicitContext.ice \ ..\..\slice\Ice\ImplicitContextF.ice \ ..\..\slice\Ice\LocalException.ice \ ..\..\slice\Ice\Locator.ice \ ..\..\slice\Ice\LocatorF.ice \ ..\..\slice\Ice\Logger.ice \ ..\..\slice\Ice\LoggerF.ice \ ..\..\slice\Ice\ObjectAdapter.ice \ ..\..\slice\Ice\ObjectAdapterF.ice \ ..\..\slice\Ice\ObjectFactory.ice \ ..\..\slice\Ice\ObjectFactoryF.ice \ ..\..\slice\Ice\Plugin.ice \ ..\..\slice\Ice\PluginF.ice \ ..\..\slice\Ice\Process.ice \ ..\..\slice\Ice\ProcessF.ice \ ..\..\slice\Ice\Properties.ice \ ..\..\slice\Ice\PropertiesF.ice \ ..\..\slice\Ice\Router.ice \ ..\..\slice\Ice\RouterF.ice \ ..\..\slice\Ice\ServantLocator.ice \ ..\..\slice\Ice\ServantLocatorF.ice \ ..\..\slice\Ice\SliceChecksumDict.ice \ ..\..\slice\Ice\Stats.ice \ ..\..\slice\Ice\StatsF.ice \ ..\..\slice\IceBox\IceBox.ice \ ..\..\slice\IceGrid\Admin.ice \ ..\..\slice\IceGrid\Descriptor.ice \ ..\..\slice\IceGrid\Exception.ice \ ..\..\slice\IceGrid\FileParser.ice \ ..\..\slice\IceGrid\Locator.ice \ ..\..\slice\IceGrid\Observer.ice \ ..\..\slice\IceGrid\Query.ice \ ..\..\slice\IceGrid\Registry.ice \ ..\..\slice\IceGrid\Session.ice \ ..\..\slice\IceGrid\UserAccountMapper.ice \ ..\..\slice\IcePatch2\FileInfo.ice \ ..\..\slice\IcePatch2\FileServer.ice \ ..\..\slice\IceSSL\Endpoint.ice \ ..\..\slice\IceStorm\IceStorm.ice Ice-3.5.1/cpp/doc/swish/0000755000076400007640000000000012223561476013056 5ustar mesmesIce-3.5.1/cpp/doc/swish/swishcgi.conf0000644000076400007640000000114412223561476015545 0ustar mesmesuse lib '/var/www/html/doc/swishdir'; my $ice_version = '3.5.1'; my $suffix = '-IceTouch'; my $referer = $ENV{HTTP_REFERER} ? $ENV{HTTP_REFERER} : ''; if ($referer =~ m{/Ice-([0-9]+\.[0-9]+\.[0-9]+)(b|-IceTouch)?/}) { $ice_version = $1; $suffix = ${2} ? ${2} : ''; } $index_loc = '../html/doc/Ice-' . $ice_version . $suffix . '/swishdir/index.swish-e'; return { swish_index => $index_loc, template => { package => 'TemplateSlice', options => { filename => 'TemplateSlice', }, }, display_props => '', prepend_path => '../', page_size => 200, }; Ice-3.5.1/cpp/doc/swish/swish.cgi0000755000076400007640000032355312223561476014715 0ustar mesmes#!/usr/bin/perl -w package SwishSearch; use strict; # This is set to where Swish-e's "make install" installed the helper modules. use lib ( '/usr/local/lib/swish-e/perl' ); my $DEFAULT_CONFIG_FILE = '.swishcgi.conf'; ################################################################################### # # If this text is displayed on your browser then your web server # is not configured to run .cgi programs. Contact your web server administrator. # # To display documentation for this program type "perldoc swish.cgi" # # swish.cgi $Revision$ Copyright (C) 2001 Bill Moseley swishscript@hank.org # Example CGI program for searching with SWISH-E # # This example program will only run under an OS that supports fork(). # Under windows it uses a piped open which MAY NOT BE SECURE. # # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version # 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # The above lines must remain at the top of this program # # $Id$ # #################################################################################### # This is written this way so the script can be used as a CGI script or a mod_perl # module without any code changes. # use CGI (); # might not be needed if using Apache::Request #================================================================================= # CGI entry point # #================================================================================= use vars '$speedy_config'; # Global for caching in persistent environment such as SpeedyCGI # Run the script -- entry point if running as a CGI script unless ( $ENV{MOD_PERL} ) { if ( !$speedy_config ) { $speedy_config = default_config(); # Merge with disk config file. $speedy_config = merge_read_config( $speedy_config ); } process_request( $speedy_config ); } #================================================================================== # This sets the default configuration parameters # # Any configuration read from disk is merged with these settings. # # Only a few settings are actually required. Some reasonable defaults are used # for most. If fact, you can probably create a complete config as: # # return = { # swish_binary => '/usr/local/bin/swish-e', # swish_index => '/usr/local/share/swish/index.swish-e', # title_property => 'swishtitle', # Not required, but recommended # }; # # But, that doesn't really show all the options. # # You can modify the options below, or you can use a config file. The config file # is .swishcgi.conf by default (read from the current directory) that must return # a hash reference. For example, to create a config file that changes the default # title and index file name, plus uses Template::Toolkit to generate output # create a config file as: # # # Example config file -- returns a hash reference # return { # title => 'Search Our Site', # swish_index => 'index.web', # # template => { # package => 'SWISH::TemplateToolkit', # file => 'swish.tt', # options => { # INCLUDE_PATH => '/home/user/swish-e/example', # }, # }, # }; # # #----------------------------------------------------------------------------------- sub default_config { ##### Configuration Parameters ######### #---- This lists all the options, with many commented out --- # By default, this config is used -- see the process_request() call below. # You should adjust for your site, and how your swish index was created. ##>> ##>> Please don't post this entire section on the swish-e list if looking for help! ##>> ##>> Send a small example, without all the comments. #====================================================================== # *** NOTES **** # Items beginning with an "x" or "#" are commented out # the "x" form simply renames (hides) that setting. It's used # to make it easy to disable a mult-line configuation setting. # # If you do not understand a setting then best to leave the default. # # Please follow the documentation (perldoc swish.cgi) and set up # a test using the defaults before making changes. It's much easier # to modify a working example than to try to get a modified example to work... # # Again, this is a Perl hash structure. Commas are important. #====================================================================== return { title => 'Search our site', # Title of your choice. Displays on the search page swish_binary => '/usr/local/bin/swish-e', # Location of swish-e binary # By default, this script tries to read a config file. You should probably # comment this out if not used save a disk stat config_file => $DEFAULT_CONFIG_FILE, # Default config file # The location of your index file. Typically, this would not be in # your web tree. # If you have more than one index to search then specify an array # reference. e.g. swish_index =>[ qw( index1 index2 index3 )], swish_index => 'index.swish-e', # Location of your index file # See "select_indexes" below for how to # select more than one index. page_size => 15, # Number of results per page - default 15 # prepend this path to the filename (swishdocpath) returned by swish. This is used to # make the href link back to the original document. Comment out to disable. #prepend_path => 'http://localhost/mydocs', # This is the property that is used for the href link back to the original # document. It's "swishdocpath" by default #link_property => 'swishdocpath', ## Display properties ## # Everything swish records about a file is called a "property". These # next three settings tell the swish.cgi script which properties should be passed # to the templating coded for output generation. # First is the property name to use as the main link text to the indexed document. # Typically, this will be 'swishtitle' if have indexed html documents, # but you can specify any PropertyName defined in your document. # By default, swish will display the pathname for documents that do not # have a title. # In other words, this is used for the text of the links of the search results. # title_property title_property => 'swishtitle', # Swish has a configuration directive "StoreDescription" that will save part or # all of a document's contents in the index file. This can then be displayed # along with results. If you are indexing a lot of files this can use a lot of disk # space, so test carefully before indexing your entire site. # Building swish with zlib can greatly reduce the space used by StoreDescription. # # This settings tells this script to display this property as the description. # Normally, this should be 'swishdescription', but you can specify another property name. # There is no default. description_prop => 'swishdescription', # Property names listed here will be displayed in a table below each result # You may wish to modify this list if you are using document properties (PropertyNames) # in your swish-e index configuration # There is no default. display_props => [qw/swishlastmodified swishdocsize swishdocpath/], # Results can be sorted by any of the properties listed here # They will be displayed in a drop-down list on the form. # You may modify this list if you are using document properties of your own creation # Swish uses the rank as the default sort sorts => [qw/swishrank swishlastmodified swishtitle swishdocpath/], # Secondary_sort is used to sort within a sort # You may enter a property name followed by a direction (asc|desc) secondary_sort => [qw/swishlastmodified desc/], # You can limit by MetaNames here. Names listed here will be displayed in # a line of radio buttons. # The default is to not allow any metaname selection. # To use this feature you must define MetaNames while indexing. # The special "swishdefault" says to search any text that was not indexed # as a specific metaname (e.g. typically the body of a HTML document and its title). # To see how this might work, add to your *swish-e* config file: # MetaNames swishtitle swishdocpath # reindex and try: metanames => [qw/ swishdefault swishtitle swishdocpath /], # Add "all" to this list to test the meta_groups feature described below # Another example: if you indexed an email archive # that defined the metanames subject name email (as in the swish-e discussion archive) # you might use: #metanames => [qw/body subject name email/], # Searching multiple meta names: # You can also group metanames into "meta-metanames". # Example: Say you defined metanames "author", "comment" and "keywords" # You want to allow searching "author", "comment" and the document body ("swishdefault") # But you would also like an "all" search that searches all metanames, including "keywords": # # metanames => [qw/swishdefault author comment all/], # # Now, the "all" metaname is not a real metaname. It must be expanded into its # individual metanames using meta_groups: # # "meta_groups" maps a fake metaname to a list of real metanames # # meta_groups => { # all => [qw/swishdefault author comment keywords / ], # }, # # swish.cgi will then take a query like # # all=(query words) # # and create the query # # swishdefault=(query words) OR author=(query words) OR comment=(query words) OR keywords=(query words) # # This is not ideal, but should work for most cases # (might fail under windows since the query is passed through the shell). # To enable this group add "all" to the list of metanames above meta_groups => { all => [qw/swishdefault swishtitle swishdocpath/], }, # Note that you can use other words than "all". The script just checks if a given metaname is # listed in "meta_groups" and expands as needed. # "name_labels" is used to map MetaNames and PropertyNames to user-friendly names # on the CGI form. name_labels => { swishdefault => 'Title & Body', swishtitle => 'Title', swishrank => 'Rank', swishlastmodified => 'Last Modified Date', swishdocpath => 'Document Path', swishdocsize => 'Document Size', all => 'All', # group of metanames subject => 'Message Subject', # other examples name => "Poster's Name", email => "Poster's Email", sent => 'Message Date', }, timeout => 10, # limit time used by swish when fetching results - DoS protection. # does not work under Windows max_query_length => 100, # limit length of query string. Swish also has a limit (default is 40) # You might want to set swish-e's limit higher, and use this to get a # somewhat more friendly message. max_chars => 500, # Limits the size of the description_prop if it is not highlighted # This structure defines term highlighting, and what type of highlighting to use # If you are using metanames in your searches and they map to properties that you # will display, you may need to adjust the "meta_to_prop_map". highlight => { # Pick highlighting module -- you must make sure the module can be found # The highlighting modules are in the example/modules directory by default # Ok speed, but doesn't handle phrases or stopwords # Deals with stemming, and shows words in context # Takes into consideration WordCharacters, IgnoreFirstChars and IgnoreLastChars. #package => 'SWISH::DefaultHighlight', # Somewhat slow, but deals with phases, stopwords, and stemming. # Takes into consideration WordCharacters, IgnoreFirstChars and IgnoreLastChars. package => 'SWISH::PhraseHighlight', # Faster: phrases without regard to wordcharacter settings # doesn't do context display, so must match in first X words, so may not even highlight # doesn't handle stemming or stopwords. #package => 'SWISH::SimpleHighlight', show_words => 10, # Number of "swish words" words to show around highlighted word max_words => 100, # If no words are found to highlighted then show this many words occurrences => 6, # Limit number of occurrences of highlighted words highlight_on => '', # HTML highlighting codes highlight_off => '', #highlight_on => '', #highlight_off => '', # This maps (real) search metatags to display properties. # e.g. if searching in "swishdefault" then highlight in the # swishtitle and swishdescription properties # Do not include "fake" metanames defined with meta_groups, just # list the real metanames used in your index, and the properties they # relate to. meta_to_prop_map => { swishdefault => [ qw/swishtitle swishdescription/ ], swishtitle => [ qw/swishtitle/ ], swishdocpath => [ qw/swishdocpath/ ], }, }, # If you specify more than one index file (as an array reference) you # can set this allow selection of which indexes to search. # The default is to search all indexes specified if this is not used. # When used, the first index is the default index. # You need to specify your indexes as an array reference: #swish_index => [ qw/ index.swish-e index.other index2.other index3.other index4.other / ], Xselect_indexes => { # pick radio_group, popup_menu, or checkbox_group method => 'checkbox_group', #method => 'radio_group', #method => 'popup_menu', columns => 3, # labels must match up one-to-one with elements in "swish_index" labels => [ 'Main Index', 'Other Index', qw/ two three four/ ], description => 'Select Site: ', # Optional - Set the default index if none is selected # This needs to be an index file name listed in swish_index # above, not a label default_index => '', }, # Similar to select_indexes, this adds a metaname search # based on a metaname. You can use any metaname, and this will # add an "AND" search to limit results to a subset of your records. # i.e. it adds something like 'site=(foo or bar or baz)' if foo, bar, and baz were selected. # This really just allows you to limit existing searches by a metaname, instead of # selecting a metaname (with metanames option above). # Swish-e's ExtractPath would work well with this. For example, # to allow limiting searches to specific sections of the apache docs use this # in your swish-e config file: # ExtractPath site regex !^/usr/local/apache/htdocs/manual/([^/]+)/.+$!$1! # ExtractPathDefault site other # which extracts the segment of the path after /manual/ and indexes that name # under the metaname "site". Then searches can be limited to files with that # path (e.g. query would be swishdefault=foo AND site=vhosts to limit searches # to the virtual host section. Xselect_by_meta => { #method => 'radio_group', # pick: radio_group, popup_menu, or checkbox_group method => 'checkbox_group', #method => 'popup_menu', columns => 3, metaname => 'site', # Can't be a metaname used elsewhere! values => [qw/misc mod vhosts other/], labels => { misc => 'General Apache docs', mod => 'Apache Modules', vhosts => 'Virtual hosts', }, description => 'Limit search to these areas: ', }, # The 'template' setting defines what generates the output # The default is "TemplateDefault" which is reasonably ugly, # but does not require installation of a separate templating system. # Note that some of the above options may not be available # for templating, as it's up to you to layout the form # and swish-e results in your template. # TemplateDefault is the default xtemplate => { package => 'SWISH::TemplateDefault', }, xtemplate => { package => 'SWISH::TemplateDumper', }, xtemplate => { package => 'SWISH::TemplateToolkit', file => 'swish.tt', options => { INCLUDE_PATH => '/usr/local/share/swish-e', #PRE_PROCESS => 'config', }, }, xtemplate => { package => 'SWISH::TemplateHTMLTemplate', options => { filename => 'swish.tmpl', path => '/usr/local/share/swish-e', die_on_bad_params => 0, loop_context_vars => 1, cache => 1, }, }, # The "on_intranet" setting is just a flag that can be used to say you do # not have an external internet connection. It's here because the default # page generation includes links to images on swish-e.or and on www.w3.org. # If this is set to one then those images will not be shown. # (This only effects the default ouput module SWISH::TemplateDefault) on_intranet => 0, # Here you can hard-code debugging options. The will help you find # where you made your mistake ;) # Using all at once will generate a lot of messages to STDERR # Please see the documentation before using these. # Typically, you will set these from the command line instead of in the configuration. # debug_options => 'basic, command, headers, output, summary, dump', # This defines the package object for reading CGI parameters # Defaults to CGI. Might be useful with mod_perl. # request_package => 'CGI', # request_package => 'Apache::Request', # use_library => 1, # set true and will use the SWISH::API module # will cache based on index files when running under mod_perl # Minor adjustment to page display. The page navigation normally looks like: # Page: 1 5 6 7 8 9 24 # where the first page and last page are always displayed. These can be disabled by # by setting to true values ( 1 ) no_first_page_navigation => 0, no_last_page_navigation => 0, num_pages_to_show => 12, # number of pages to offer # Limit to date ranges # This adds in the date_range limiting options # You will need the DateRanges.pm module from the author to use that feature # Noramlly, you will want to limit by the last modified date, so specify # "swishlastmodified" as the property_name. If indexing a mail archive, and, for # example, you store the date (a unix timestamp) as "date" then specify # "date" as the property_name. date_ranges => { property_name => 'swishlastmodified', # property name to limit by # what you specify here depends on the DateRanges.pm module. time_periods => [ 'All', 'Today', 'Yesterday', #'Yesterday onward', 'This Week', 'Last Week', 'Last 90 Days', 'This Month', 'Last Month', #'Past', #'Future', #'Next 30 Days', ], line_break => 0, default => 'All', date_range => 1, }, # This is suppose to reduce the load on systems if hit with a large number # of requests. Although this will limit the number of swish-e processes run # it will not limit the number of CGI requests. I feel like a better solution # is to use mod_perl (with the SWISH::API module). # I also think that running /bin/ps for every is not ideal. # This only works on unix-based systems when running the swish-e binary. # It greps /swish-e/ from the output of ps and aborts if the count is < limit_procs # Set max number of swish-e binaries and ps command to run limit_procs => 0, # max number of swish process to run (zero to not limit) ps_prog => '/bin/ps -Unobody -ocommand', # command to list number of swish binaries }; } #^^^^^^^^^^^^^^^^^^^^^^^^^ end of user config ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #======================================================================================== #================================================================================= # mod_perl entry point # # As an example, you might use a PerlSetVar to point to paths to different # config files, and then cache the different configurations by path. # #================================================================================= my %cached_configs; sub handler { my $r = shift; if ( my $config_path = $r->dir_config( 'Swish_Conf_File' ) ) { # Already cached? # Note that this is cached for the life of the server -- must restart if want to change config if ( $cached_configs{ $config_path } ) { process_request( $cached_configs{ $config_path } ); return Apache::Constants::OK(); } # Else, load config my $config = default_config(); $config->{config_file} = $config_path; # Merge with disk config file. $cached_configs{ $config_path } = merge_read_config( $config ); process_request( $cached_configs{ $config_path } ); return Apache::Constants::OK(); } # Otherwise, use hard-coded config my $config = default_config(); # Merge with disk config file. $config = merge_read_config( $config ); process_request( default_config() ); return Apache::Constants::OK(); } #============================================================================ # Read config settings from disk, and merge # Note, all errors are ignored since by default this script looks for a # config file. # #============================================================================ sub merge_read_config { my $config = shift; set_default_debug_flags(); set_debug($config); # get from config or from %ENV return $config unless $config->{config_file}; my $return = do $config->{config_file}; # load the config file unless ( ref $return eq 'HASH' ) { # First, let's check for file not found for the default config, which we can ignore my $error = $@ || $!; if ( $config->{config_file} eq $DEFAULT_CONFIG_FILE && !-e $config->{config_file} ) { warn "Config file '$config->{config_file}': $!" if $config->{debug}; return $config; } die "Config file '$config->{config_file}': $error"; } if ( $config->{debug} || $return->{debug} ) { require Data::Dumper; print STDERR "\n---------- Read config parameters from '$config->{config_file}' ------\n", Data::Dumper::Dumper($return), "-------------------------\n"; } set_debug( $return ); # Merge settings return { %$config, %$return }; } #-------------------------------------------------------------------------------------------------- sub set_default_debug_flags { # Debug flags defined $SwishSearch::DEBUG_BASIC = 1; # Show command used to run swish $SwishSearch::DEBUG_COMMAND = 2; # Show command used to run swish $SwishSearch::DEBUG_HEADERS = 4; # Swish output headers $SwishSearch::DEBUG_OUTPUT = 8; # Swish output besides headers $SwishSearch::DEBUG_SUMMARY = 16; # Summary of results parsed $SwishSearch::DEBUG_RESULTS = 32; # Detail of results parsed $SwishSearch::DEBUG_DUMP_DATA = 64; # dump data that is sent to templating modules } #--------------------------------------------------------------------------------------------------- sub set_debug { my $conf = shift; $conf->{debug} = 0; my $debug_string = $ENV{SWISH_DEBUG} ||$conf->{debug_options}; return unless $debug_string; my %debug = ( basic => [$SwishSearch::DEBUG_BASIC, 'Basic debugging'], command => [$SwishSearch::DEBUG_COMMAND, 'Show command used to run swish'], headers => [$SwishSearch::DEBUG_HEADERS, 'Show headers returned from swish'], output => [$SwishSearch::DEBUG_OUTPUT, 'Show output from swish'], summary => [$SwishSearch::DEBUG_SUMMARY, 'Show summary of results'], results => [$SwishSearch::DEBUG_RESULTS, 'Show detail of results'], dump => [$SwishSearch::DEBUG_DUMP_DATA, 'Show all data available to templates'], ); $conf->{debug} = 1; my @debug_str; for ( split /\s*,\s*/, $debug_string ) { if ( exists $debug{ lc $_ } ) { push @debug_str, lc $_; $conf->{debug} |= $debug{ lc $_ }->[0]; next; } print STDERR "Unknown debug option '$_'. Must be one of:\n", join( "\n", map { sprintf(' %10s: %10s', $_, $debug{$_}->[1]) } sort { $debug{$a}->[0] <=> $debug{$b}->[0] }keys %debug), "\n\n"; exit; } print STDERR "Debug level set to: $conf->{debug} [", join( ', ', @debug_str), "]\n"; } #============================================================================ # # This is the main controller (entry point), where a config hash is passed in. # # Loads the request module (e.g. CGI.pm), and the output module # Also sets up debugging # #============================================================================ sub process_request { my $conf = shift; # configuration parameters # Limit number of requests - questionable value limit_swish( $conf->{limit_procs}, $conf->{ps_prog} ) if !$conf->{use_library} && $conf->{limit_procs} && $conf->{limit_procs} =~ /^\d+$/ && $conf->{ps_prog}; # Set default property used or the href link to the document $conf->{link_property} ||= 'swishdocpath'; # Use CGI.pm by default my $request_package = $conf->{request_package} || 'CGI'; load_module( $request_package ); my $request_object = $request_package->new; # load the templating module my $template = $conf->{template} || { package => 'SWISH::TemplateDefault' }; load_module( $template->{package} ); # Allow fixup within the config file if ( $conf->{request_fixup} && ref $conf->{request_fixup} eq 'CODE' ) { &{$conf->{request_fixup}}( $request_object, $conf ); } set_debug_input( $conf, $request_object ) if $conf->{debug} && !$ENV{GATEWAY_INTERFACE}; # Create search object and build a query based on CGI parameters my $search = SwishQuery->new( config => $conf, request => $request_object, ); # run the query (run if there's a query) $search->run_query; # currently, results is the just the $search object if ( $search->hits ) { $search->set_navigation; # sets links } show_debug_output( $conf, $search ) if $conf->{debug}; $template->{package}->show_template( $template, $search ); } # For limiting number of swish-e binaries sub limit_swish { my ( $limit_procs, $ps_prog ) = @_; my $num_procs = scalar grep { /swish-e/ } `$ps_prog`; return if $num_procs <= $limit_procs; warn "swish.cgi - limited due to too many currently running swish-e binaries: $num_procs running is more than $limit_procs\n"; ## Abort print < Too Many Requests Too Many Requests -- Try again later EOF exit; } #============================================================================ # # Loads a perl module -- and shows a pretty web page to say the obvious # # #============================================================================ sub load_module { my $package = shift; $package =~ s[::][/]g; eval { require "$package.pm" }; if ( $@ ) { print < Software Error

Software Error

Please check error log

EOF die "$0 $@\n"; } } #================================================================== # set debugging input # #================================================================== sub set_debug_input { my ( $conf, $request_object ) = @_; print STDERR 'Enter a query [all]: '; my $query = ; $query =~ tr/\r//d; chomp $query; unless ( $query ) { print STDERR "Using 'not asdfghjklzxcv' to match all records\n"; $query = 'not asdfghjklzxcv'; } $request_object->param('query', $query ); print STDERR 'Enter max results to display [1]: '; my $max = ; chomp $max; $max = 1 unless $max && $max =~/^\d+$/; $conf->{page_size} = $max; } #================================================================== # show debugging output # #================================================================== sub show_debug_output { my ( $conf, $results ) = @_; require Data::Dumper; if ( $results->hits ) { print STDERR "swish.cgi: returned a page of $results->{navigation}{showing} results of $results->{navigation}{hits} total hits\n"; } else { print STDERR "swish.cgi: No results\n"; } if ($conf->{debug} & $SwishSearch::DEBUG_HEADERS ) { print STDERR "\n------------- Index Headers ------------\n"; if ( $results->{_headers} ) { print STDERR Data::Dumper::Dumper( $results->{_headers} ); } else { print STDERR "No headers\n"; } print STDERR "--------------------------\n"; } if ( $conf->{debug} & $SwishSearch::DEBUG_DUMP_DATA ) { print STDERR "\n------------- Results structure passed to template ------------\n", Data::Dumper::Dumper( $results ), "--------------------------\n"; } elsif ( $conf->{debug} & $SwishSearch::DEBUG_SUMMARY ) { print STDERR "\n------------- Results summary ------------\n"; if ( $results->{hits} ) { print STDERR "$_->{swishrank} $_->{swishdocpath}\n" for @{ $results->{_results}}; } else { print STDERR "** NO RESULTS **\n"; } } elsif ( $conf->{debug} & $SwishSearch::DEBUG_RESULTS ) { print STDERR "\n------------- Results detail ------------\n"; if ( $results->{hits} ) { print STDERR Data::Dumper::Dumper( $results->{_results} ); } else { print STDERR "** NO RESULTS **\n"; } print STDERR "--------------------------\n"; } } #================================================================================================== package SwishQuery; #================================================================================================== use Carp; # Or use this instead -- PLEASE see perldoc CGI::Carp for details # CGI::Carp doesn't help that much #use CGI::Carp; # qw(fatalsToBrowser); use SWISH::ParseQuery; #-------------------------------------------------------------------------------- # new() doesn't do much, just create the object #-------------------------------------------------------------------------------- sub new { my $class = shift; my %options = @_; my $conf = $options{config}; croak "Failed to set the swish index files in config setting 'swish_index'" unless $conf->{swish_index}; croak "Failed to specify 'swish_binary' in configuration" unless $conf->{swish_binary}; # initialize the request search hash my $sh = { prog => $conf->{swish_binary}, config => $conf, q => $options{request}, hits => 0, MOD_PERL => $ENV{MOD_PERL}, }; my $self = bless $sh, $class; # load highlight module, if requsted if ( my $highlight = $self->config('highlight') ) { $highlight->{package} ||= 'SWISH::DefaultHighlight'; SwishSearch::load_module( $highlight->{package} ); } # Fetch the swish-e query from the CGI parameters $self->set_query; return $self; } sub hits { shift->{hits} } sub config { my ($self, $setting, $value ) = @_; confess "Failed to pass 'config' a setting" unless $setting; my $cur = $self->{config}{$setting} if exists $self->{config}{$setting}; $self->{config}{$setting} = $value if $value; return $cur; } # Returns false if all of @values are not valid options - for checking # $config is what $self->config returns sub is_valid_config_option { my ( $self, $config, $err_msg, @values ) = @_; unless ( $config ) { $self->errstr( "No config option set: $err_msg" ); return; } # Allow multiple values. my @options = ref $config eq 'ARRAY' ? @$config : ( $config ); my %lookup = map { $_ => 1 } @options; for ( @values ) { unless ( exists $lookup{ $_ } ) { $self->errstr( $err_msg ); return; } } return 1; } sub header { my $self = shift; return unless ref $self->{_headers} eq 'HASH'; return $self->{_headers}{$_[0]} || ''; } # return a ref to an array sub results { my $self = shift; return $self->{_results} || undef; } sub navigation { my $self = shift; return unless ref $self->{navigation} eq 'HASH'; return exists $self->{navigation}{$_[0]} ? $self->{navigation}{$_[0]} : ''; } sub CGI { $_[0]->{q} }; sub swish_command { my ($self, $param_name, $value ) = @_; return $self->{swish_command} || {} unless $param_name; return $self->{swish_command}{$param_name} || '' unless $value; $self->{swish_command}{$param_name} = $value; } # For use when forking sub swish_command_array { my ($self ) = @_; my @params; my $swish_command = $self->swish_command; for ( keys %$swish_command ) { my $value = $swish_command->{$_}; if ( /^-/ ) { push @params, $_; push @params, ref $value eq 'ARRAY' ? @$value : $value; next; } # special cases if ( $_ eq 'limits' ) { push @params, '-L', $value->{prop}, $value->{low}, $value->{high}; next; } die "Unknown swish_command '$_' = '$value'"; } return @params; } sub errstr { my ($self, $value ) = @_; $self->{_errstr} = $value if $value; return $self->{_errstr} || ''; } #============================================================================== # Set query from the CGI parameters #------------------------------------------------------------------------------ sub set_query { my $self = shift; my $q = $self->{q}; # Sets the query string, and any -L limits. return unless $self->build_query; # Set the starting position (which is offset by one) my $start = $q->param('start') || 0; $start = 0 unless $start =~ /^\d+$/ && $start >= 0; $self->swish_command( '-b', $start+1 ); # Set the max hits my $page_size = $self->config('page_size') || 15; $self->swish_command( '-m', $page_size ); return unless $self->set_index_file; # Set the sort option, if any return unless $self->set_sort_order; return 1; } #============================================ # This returns "$self" just in case we want to seperate out into two objects later sub run_query { my $self = shift; my $q = $self->{q}; my $conf = $self->{config}; return $self unless $self->swish_command('-w'); my $time_out_str = 'Timed out'; my $timeout = $self->config('timeout') || 0; eval { local $SIG{ALRM} = sub { kill 'KILL', $self->{pid} if $self->{pid}; die $time_out_str . "\n"; }; alarm $timeout if $timeout && $^O !~ /Win32/i; $self->run_swish; alarm 0 unless $^O =~ /Win32/i; # catch zombies waitpid $self->{pid}, 0 if $self->{pid}; # for IPC::Open2 }; if ( $@ ) { warn "$0 aborted: $@"; # if $conf->{debug}; $self->errstr( $@ =~ /$time_out_str/ ? "Search timed out after $timeout seconds." : "Service currently unavailable" ); return $self; } } # Build href for repeated search via GET (forward, backward links) sub set_navigation { my $self = shift; my $q = $self->{q}; # Single string # default fields my @std_fields = qw/query metaname sort reverse/; # Extra fields could be added in the config file if ( my $extra = $self->config('extra_fields') ) { push @std_fields, @$extra; } my @query_string = map { "$_=" . $q->escape( $q->param($_) ) } grep { $q->param($_) } @std_fields; # Perhaps arrays for my $p ( qw/si sbm/ ) { my @settings = $q->param($p); next unless @settings; push @query_string, "$p=" . $q->escape( $_ ) for @settings; } if ( $self->config('date_ranges' ) ) { my $dr = SWISH::DateRanges::GetDateRangeArgs( $q ); push @query_string, $dr, if $dr; } $self->{query_href} = $q->script_name . '?' . join '&', @query_string; $self->{my_url} = $q->script_name; my $hits = $self->hits; my $start = $self->swish_command('-b') || 1; $start--; $self->{navigation} = { showing => $hits, from => $start + 1, to => $start + $hits, hits => $self->header('number of hits') || 0, run_time => $self->header('run time') || 'unknown', search_time => $self->header('search time') || 'unknown', }; $self->set_page ( $self->swish_command( '-m' ) ); return $self; } #============================================================ # Build a query string from swish # Just builds the -w string #------------------------------------------------------------ sub build_query { my $self = shift; my $q = $self->{q}; # set up the query string to pass to swish. my $query = $q->param('query') || ''; for ( $query ) { # trim the query string s/\s+$//; s/^\s+//; } $self->{query_simple} = $query; # without metaname $q->param('query', $query ); # clean up the query, if needed. # Read in the date limits, if any. This can create a new query, which is why it is here return unless $self->get_date_limits( \$query ); unless ( $query ) { $self->errstr('Please enter a query string') if $q->param('submit'); return; } if ( length( $query ) > $self->{config}{max_query_length} ) { $self->errstr('Please enter a shorter query'); return; } # Adjust the query string for metaname search # *Everything* is a metaname search # Might also like to allow searching more than one metaname at the same time my $metaname = $q->param('metaname') || 'swishdefault'; return unless $self->is_valid_config_option( $self->config('metanames') || 'swishdefault', 'Bad MetaName provided', $metaname ); # save the metaname so we know what field to highlight # Note that this might be a fake metaname $self->{metaname} = $metaname; # prepend metaname to query # expand query when using meta_groups my $meta_groups = $self->config('meta_groups'); if ( $meta_groups && $meta_groups->{$metaname} ) { $query = join ' OR ', map { "$_=($query)" } @{$meta_groups->{$metaname}}; # This is used to create a fake entry in the parsed query so highlighting # can find the query words $self->{real_metaname} = $meta_groups->{$metaname}[0]; } else { $query = $metaname . "=($query)"; } ## Look for a "limit" metaname -- perhaps used with ExtractPath # Here we don't worry about user supplied data my $limits = $self->config('select_by_meta'); my @limits = $q->param('sbm'); # Select By Metaname # Note that this could be messed up by ending the query in a NOT or OR # Should look into doing: # $query = "( $query ) AND " . $limits->{metaname} . '=(' . join( ' OR ', @limits ) . ')'; if ( @limits && ref $limits eq 'HASH' && $limits->{metaname} ) { $query .= ' and ' . $limits->{metaname} . '=(' . join( ' or ', @limits ) . ')'; } $self->swish_command('-w', $query ); return 1; } #======================================================================== # Get the index files from the form, or from the config settings # Uses index numbers to hide path names #------------------------------------------------------------------------ sub set_index_file { my $self = shift; my $q = $self->CGI; # Set the index file - first check for options my $si = $self->config('select_indexes'); if ( $si && ref $self->config('swish_index') eq 'ARRAY' ) { my @choices = $q->param('si'); if ( !@choices ) { if ( $si->{default_index} ) { $self->swish_command('-f', $si->{'default_index'}); return 1; } else { $self->errstr('Please select a source to search'); return; } } my @indexes = @{$self->config('swish_index')}; my @selected_indexes = grep {/^\d+$/ && $_ >= 0 && $_ < @indexes } @choices; if ( !@selected_indexes ) { $self->errstr('Invalid source selected'); return $self; } my %dups; my @idx = grep { !$dups{$_}++ } map { ref($_) ? @$_ : $_ } @indexes[ @selected_indexes ]; $self->swish_command( '-f', \@idx ); } else { $self->swish_command( '-f', $self->config('swish_index') ); } return 1; } #================================================================================ # Parse out the date limits from the form or from GET request # #--------------------------------------------------------------------------------- sub get_date_limits { my ( $self, $query_ref ) = @_; # reference to query since may be modified my $conf = $self->{config}; # Are date ranges enabled? return 1 unless $conf->{date_ranges}; eval { require SWISH::DateRanges }; if ( $@ ) { print STDERR "\n------ Can't use DateRanges feature ------------\n", "\nScript will run, but you can't use the date range feature\n", $@, "\n--------------\n" if $conf->{debug}; delete $conf->{date_ranges}; return 1; } my $q = $self->{q}; my %limits; unless ( SWISH::DateRanges::DateRangeParse( $q, \%limits ) ) { $self->errstr( $limits{dr_error} || 'Bad date range selection' ); return; } # Store the values for later (for display on templates) $self->{DateRanges_time_low} = $limits{dr_time_low}; $self->{DateRanges_time_high} = $limits{dr_time_high}; # Allow searchs just be date if not "All dates" search # $$$ should place some limits here, and provide a switch to disable # as it can bring up a lot of results. $$query_ref ||= 'not skaiqwdsikdeekk' if $limits{dr_time_high}; # Now specify limits, if a range was specified my $limit_prop = $conf->{date_ranges}{property_name} || 'swishlastmodified'; if ( $limits{dr_time_low} && $limits{dr_time_high} ) { my %limits = ( prop => $limit_prop, low => $limits{dr_time_low}, high => $limits{dr_time_high}, ); $self->swish_command( 'limits', \%limits ); } return 1; } #================================================================ # Set the sort order # Just builds the -s string #---------------------------------------------------------------- sub set_sort_order { my $self = shift; my $q = $self->{q}; my $sorts_array = $self->config('sorts'); my $sortby = $q->param('sort') || ''; return 1 unless $sorts_array && $sortby; return unless $self->is_valid_config_option( $sorts_array, 'Invalid Sort Option Selected', $sortby ); my $conf = $self->{config}; # Now set sort option - if a valid option submitted (or you could let swish-e return the error). my $direction = $sortby eq 'swishrank' ? $q->param('reverse') ? 'asc' : 'desc' : $q->param('reverse') ? 'desc' : 'asc'; my @sort_params = ( $sortby, $direction ); if ( $conf->{secondary_sort} ) { my @secondary = ref $conf->{secondary_sort} ? @{ $conf->{secondary_sort} } : $conf->{secondary_sort}; push @sort_params, @secondary if $sortby ne $secondary[0]; } $self->swish_command( '-s', \@sort_params ); return 1; } #======================================================== # Sets prev and next page links. # Feel free to clean this code up! # # Pass: # $results - reference to a hash (for access to the headers returned by swish) # $q - CGI object # # Returns: # Sets entries in the $results hash # sub set_page { my ( $self, $Page_Size ) = @_; my $q = $self->{q}; my $config = $self->{config}; my $navigation = $self->{navigation}; my $start = $navigation->{from} - 1; # Current starting record index # Set start number for "prev page" and the number of hits on the prev page my $prev = $start - $Page_Size; $prev = 0 if $prev < 0; if ( $prev < $start ) { $navigation->{prev} = $prev; $navigation->{prev_count} = $start - $prev; } my $last = $navigation->{hits} - 1; # Set start number for "next page" and number of hits on the next page my $next = $start + $Page_Size; $next = $last if $next > $last; my $cur_end = $start + $self->{hits} - 1; if ( $next > $cur_end ) { $navigation->{next} = $next; $navigation->{next_count} = $next + $Page_Size > $last ? $last - $next + 1 : $Page_Size; } # Calculate pages ( is this -1 correct here? ) # Build an array of a range of page numbers. my $total_pages = int (($navigation->{hits} -1) / $Page_Size); # total pages for all results. if ( $total_pages ) { my @pages = 0..$total_pages; my $show_pages = $config->{num_pages_to_show} || 12; # To make the number always work $show_pages-- unless $config->{no_first_page_navigation}; $show_pages-- unless $config->{no_last_page_navigation}; # If too many pages then limit if ( @pages > $show_pages ) { my $start_page = int ( $start / $Page_Size - $show_pages/2) ; $start_page = 0 if $start_page < 0; # if close to the end then move of center $start_page = $total_pages - $show_pages if $start_page + $show_pages - 1 > $total_pages; @pages = $start_page..$start_page + $show_pages - 1; # Add first and last pages, unless config says otherwise unshift @pages, 0 unless $start_page == 0 || $config->{no_first_page_navigation}; push @pages, $total_pages unless $start_page + $show_pages - 1 == $total_pages || $config->{no_last_page_navigation} } # Build "canned" pages HTML $navigation->{pages} = join ' ', map { my $page_start = $_ * $Page_Size; my $page = $_ + 1; $page_start == $start ? $page : qq[$page]; } @pages; # Build just the raw data - an array of hashes # for custom page display with templates $navigation->{page_array} = [ map { { page_number => $_ + 1, # page number to display page_start => $_ * $Page_Size, cur_page => $_ * $Page_Size == $start, # flag } } @pages ]; } } #================================================== # Format and return the date range options in HTML # #-------------------------------------------------- sub get_date_ranges { my $self = shift; my $q = $self->{q}; my $conf = $self->{config}; return '' unless $conf->{date_ranges}; # pass parametes, and a hash to store the returned values. my %fields; SWISH::DateRanges::DateRangeForm( $q, $conf->{date_ranges}, \%fields ); # Set the layout: my $string = '
Limit to: ' . ( $fields{buttons} ? "$fields{buttons}
" : '' ) . ( $fields{date_range_button} || '' ) . ( $fields{date_range_low} ? " $fields{date_range_low} through $fields{date_range_high}" : '' ); return $string; } #============================================ # Run swish-e and gathers headers and results # Currently requires fork() to run. # # Pass: # $sh - an array with search parameters # # Returns: # a reference to a hash that contains the headers and results # or possibly a scalar with an error message. # sub run_swish { my $self = shift; my $results = $self->{results}; my $conf = $self->{config}; my $q = $self->{q}; my @properties; my %seen; # Gather up the properties we need in results for ( qw/ title_property description_prop display_props link_property/ ) { push @properties, ref $conf->{$_} ? @{$conf->{$_}} : $conf->{$_} if $conf->{$_} && !$seen{$_}++; } # Add in the default props that should be seen. for ( qw/swishrank/ ) { push @properties, $_ unless $seen{$_}; } # add in the default prop - a number must be first (this might be a duplicate in -x, oh well) unshift @properties, 'swishreccount'; $self->swish_command( -x => join( '\t', map { "<$_>" } @properties ) . '\n' ); $self->swish_command( -H => 9 ); if ( $conf->{debug} & $SwishSearch::DEBUG_COMMAND ) { require Data::Dumper; print STDERR "---- Swish parameters ----\n"; print STDERR Data::Dumper::Dumper($self->swish_command); print STDERR "\n-----------------------------------------------\n"; } # Use the swish-e library? return $self->run_library( @properties ) if $self->config('use_library'); my $fh = $^O =~ /Win32/i ? windows_fork( $conf, $self ) : real_fork( $conf, $self ); # read in from child my %stops_removed; my $unknown_output = ''; while (<$fh>) { chomp; print STDERR "$_\n" if $conf->{debug} & $SwishSearch::DEBUG_OUTPUT; tr/\r//d; # This will not work correctly with multiple indexes when different values are used. if ( /^# ([^:]+):\s+(.+)$/ ) { my $h = lc $1; my $value = $2; $self->{_headers}{$h} = $value; push @{$self->{_headers}{'removed stopwords'}}, $value if $h eq 'removed stopword' && !$stops_removed{$value}++; next; } # return swish errors as a message to the script $self->errstr($1), return if /^err:\s*(.+)/; # Or, if you want to log the errors and just say "Service Unavailable" use this: #die "$1\n" if /^err:\s*(.+)/; # Found a result if ( /^\d/ ) { my %h; @h{@properties} = split /\t/; $self->add_result_to_list( \%h ); next; } elsif ( /^\.$/ ) { last; } else { next if /^#/; } $unknown_output .= "'$_'\n"; } die "Swish returned unknown output: $unknown_output\n" if $unknown_output; $self->{hits} = $self->{_results} ? @{$self->{_results}} : 0; } # Filters in place sub html_escape { $_[0] = '' unless defined $_[0]; for ($_[0]) { s/&/&/g; s//>/g; s/"/"/g; } } #============================================================================ # Adds a result to the result list and highlight the search words # This is a common source of bugs! The problem is that highlighting is done in this code. # This is good, especially for the description because it is trimmed down as processing each # result. Otherwise, would use a lot of memory. It's bad because the highlighting is # creating html which really should be done in the template output code. # What that means is the properties that are "searched" are run through the highlighting # code (and thus HTML escaped) but other properties are not. # If highlighting (and trimming) is to be kept here then either we need to # html escape all display properties, or flag which ones are escaped. # Since we know the ultimate output is HTML, the current method will be to escape here. sub add_result_to_list { my ( $self, $props ) = @_; # Push the result onto the list push @{$self->{_results}}, $props; # We need to save the text of the link prop (almost always swishdocpath) # because all properties are escaped. my $link_property = $self->config('link_property') || 'swishdocpath'; my $link_href = ( $self->config('prepend_path') || '' ) . $props->{$link_property}; # Replace spaces ***argh this is the wrong place to do this! *** # This doesn't really work -- file names could still have chars that need to be escaped. $link_href =~ s/\s/%20/g; # Returns hash of the properties that were highlighted my $highlighted = $self->highlight_props( $props ) || {}; my $trim_prop = $self->config('description_prop') || ''; $props->{$trim_prop} ||= '' if $trim_prop; # HTML escape all properties that were not highlighted for my $prop (keys %$props) { next if $highlighted->{$prop}; # not highlighted, so escape html_escape( $props->{$prop} ); if ( $prop eq $trim_prop ) { my $max = $self->config('max_chars') || 500; $props->{$trim_prop} = substr( $props->{$trim_prop}, 0, $max) . ' ...' if length $props->{$trim_prop} > $max; } } $props->{swishdocpath_href} = $link_href; # backwards compatible $props->{link_property} = $link_href; # backwards compatible } #======================================================================================= # This will call the highlighting module as needed. # The highlighting module MUST html escape the property. # returns a hash of properties highlighted sub highlight_props { my ( $self, $props ) = @_; # make sure we have the config we need. my $highlight_settings = $self->config('highlight') || return; my $meta_to_prop = $highlight_settings->{meta_to_prop_map} || return; # Initialize highlight module ( could probably do this once per instance ) # pass in the config highlight settings, and the swish-e headers as a hash. $self->{_highlight_object} ||= $highlight_settings->{package}->new( $highlight_settings, $self->{_headers} ); my $highlight_object = $self->{_highlight_object} || return; # parse the query on first result my $parsed_words = $self->header( 'parsed words' ) || die "Failed to find 'Parsed Words' in swish headers"; $self->{parsed_query} ||= ( parse_query( $parsed_words ) || return ); my %highlighted; # track which were highlighted to detect if need to trim the description # this is probably backwards -- might be better to loop through the %$props while ( my( $meta, $phrases ) = each %{$self->{parsed_query}} ) { next unless $meta_to_prop->{$meta}; # is it a prop defined to highlight? # loop through the properties for the metaname for ( @{ $meta_to_prop->{$meta} } ) { if ( $props->{$_} ) { $highlighted{$_}++ if $highlight_object->highlight( \$props->{$_}, $phrases, $_ ); } } } return \%highlighted; } #================================================================== # Run swish-e by using the SWISH::API module # my %cached_handles; sub run_library { my ( $self, @props ) = @_; SwishSearch::load_module( 'SWISH::API' ); my $indexes = $self->swish_command('-f'); print STDERR "swish.cgi: running library thus no 'output' available -- try 'summary'\n" if ($self->{config}{debug} || 0) & $SwishSearch::DEBUG_OUTPUT; eval { require Time::HiRes }; my $start_time = [Time::HiRes::gettimeofday()] unless $@; unless ( $cached_handles{$indexes} ) { my $swish = SWISH::API->new( ref $indexes ? join(' ', @$indexes) : $indexes ); if ( $swish->Error ) { $self->errstr( join ': ', $swish->ErrorString, $swish->LastErrorMsg ); delete $cached_handles{$indexes} if $swish->CriticalError; return; } # read headers (currently only reads one set) my %headers; my $index = ($swish->IndexNames)[0]; for ( $swish->HeaderNames ) { my @value = $swish->HeaderValue( $index, $_ ); my $x = @value; next unless @value; $headers{ lc($_) } = join ' ', @value; } $cached_handles{$indexes} = { swish => $swish, headers => \%headers, }; } my $swish = $cached_handles{$indexes}{swish}; my $headers = $cached_handles{$indexes}{headers}; $self->{_headers} = $headers; my $search = $swish->New_Search_Object; # probably could cache this, too if ( my $limits = $self->swish_command( 'limits' ) ) { $search->SetSearchLimit( @{$limits}{ qw/prop low high/ } ); } if ( $swish->Error ) { $self->errstr( join ': ', $swish->ErrorString, $swish->LastErrorMsg ); delete $cached_handles{$indexes} if $swish->CriticalError; return; } if ( my $sort = $self->swish_command('-s') ) { $search->SetSort( ref $sort ? join( ' ', @$sort) : $sort ); } my $search_time = [Time::HiRes::gettimeofday()] if $start_time; my $results = $search->Execute( $self->swish_command('-w') ); $headers->{'search time'} = sprintf('%0.3f seconds', Time::HiRes::tv_interval( $search_time, [Time::HiRes::gettimeofday()] )) if $start_time; if ( $swish->Error ) { $self->errstr( join ': ', $swish->ErrorString, $swish->LastErrorMsg ); delete $cached_handles{$indexes} if $swish->CriticalError; return; } # Add in results-related headers $headers->{'parsed words'} = join ' ', $results->ParsedWords( ($swish->IndexNames)[0] ); if ( ! $results->Hits ) { $self->errstr('No results'); return; } $headers->{'number of hits'} = $results->Hits; # Get stopwords removed from each index (really need to track headers per index to be correct) for my $index ( $swish->IndexNames ) { my @stopwords = $results->RemovedStopwords( $index ); push @{$headers->{'removed stopwords'}}, @stopwords if @stopwords; } # Now fetch properties $results->SeekResult( $self->swish_command( '-b' ) - 1 ); my $page_size = $self->swish_command( '-m' ); if ( $swish->Error ) { $self->errstr( join ': ', $swish->ErrorString, $swish->LastErrorMsg ); delete $cached_handles{$indexes} if $swish->CriticalError; return; } my $hit_count; while ( my $result = $results->NextResult ) { my %props; for my $prop ( @props ) { # Note, we use ResultPropertyStr instead since this is a general purpose # script (it converts dates to a string, for example). # $result->Property is a faster method and does not convert dates and numbers to strings. #my $value = $result->Property( $prop ); my $value = $result->ResultPropertyStr( $prop ); next unless $value; # ?? $props{$prop} = $value; } $hit_count++; $self->add_result_to_list( \%props ); last unless --$page_size; } $headers->{'run time'} = sprintf('%0.3f seconds', Time::HiRes::tv_interval( $start_time, [Time::HiRes::gettimeofday()] )) if $start_time; $self->{hits} = $hit_count; } #================================================================== # Run swish-e by forking # use Symbol; sub real_fork { my ( $conf, $self ) = @_; # Run swish my $fh = gensym; my $pid = open( $fh, '-|' ); die "Failed to fork: $!\n" unless defined $pid; if ( !$pid ) { # in child unless ( exec $self->{prog}, $self->swish_command_array ) { warn "Child process Failed to exec '$self->{prog}' Error: $!"; print "Failed to exec Swish"; # send this message to parent. exit; } } else { $self->{pid} = $pid; } return $fh; } #===================================================================================== # Windows work around # from perldoc perlfok -- na, that doesn't work. Try IPC::Open2 # sub windows_fork { my ( $conf, $self ) = @_; require IPC::Open2; my ( $rdrfh, $wtrfh ); # Ok, I'll say it. Windows sucks. my @command = map { s/"/\\"/g; qq["$_"] } $self->{prog}, $self->swish_command_array; my $pid = IPC::Open2::open2($rdrfh, $wtrfh, @command ); $self->{pid} = $pid; return $rdrfh; } 1; __END__ =head1 NAME swish.cgi -- Example Perl script for searching with the SWISH-E search engine. =head1 DESCRIPTION C is a CGI script for searching with the SWISH-E search engine version 2.1-dev and above. It returns results a page at a time, with matching words from the source document highlighted, showing a few words of content on either side of the highlighted word. The script is highly configurable. Features include searching multiple (or selectable) indexes, limiting searches to a subset of documents, sorting by a number of different properties, and limiting results to a date range. On unix type systems the swish.cgi script is installed in the directory $prefix/lib/swish-e, which is typically /usr/local/lib/swish-e. This can be overridden by the configure options --prefix or --libexecdir. The standard configuration (i.e. not using a config file) should work with most swish index files. Customization of the parameters will be needed if you are indexing special meta data and want to search and/or display the meta data. The configuration can be modified by editing this script directly, or by using a configuration file (.swishcgi.conf by default). The script's configuration file is described below. You are strongly encouraged to get the default configuration working before making changes. Most problems using this script are the result of configuration modifications. The script is modular in design. Both the highlighting code and output generation is handled by modules, which are included in the F distribution directory and installed in the $libexecdir/perl directory. This allows for easy customization of the output without changing the main CGI script. Included with the Swish-e distribution is a module to generate standard HTML output. There's also modules and template examples to use with the popular Perl templating systems HTML::Template and Template-Toolkit. This is very useful if your site already uses one of these templating systems The HTML::Template and Template-Toolkit packages are not distributed with Swish-e. They are available from the CPAN (http://search.cpan.org). This scipt can also run basically unmodified as a mod_perl handler, providing much better performance than running as a CGI script. Usage under mod_perl is described below. Please read the rest of the documentation. There's a C section, and a C section. This script should work on Windows, but security may be an issue. =head1 REQUIREMENTS A reasonably current version of Perl. 5.00503 or above is recommended (anything older will not be supported). The Date::Calc module is required to use the date range feature of the script. The Date::Calc module is also available from CPAN. =head1 INSTALLATION Here's an example installation session under Linux. It should be similar for other operating systems. For the sake of simplicity in this installation example all files are placed in web server space, including files such as swish-e index and configuration files that would normally not be made available via the web server. Access to these files should be limited once the script is running. Either move the files to other locations (and adjust the script's configuration) or use features of the web server to limit access (such as with F<.htaccess>). Please get a simple installation working before modifying the configuration file. Most problems reported for using this script have been due to improper configuration. The script's default settings are setup for initial testing. By default the settings expect to find most files and the swish-e binary in the same directory as the script. For I reasons, once you have tested the script you will want to change settings to limit access to some of these files by the web server (either by moving them out of web space, or using access control such as F<.htaccess>). An example of using F<.htaccess> on Apache is given below. It's expected that swish-e has already been unpacked and the swish-e binary has be compiled from source and "make install" has been run. If swish-e was installed from a vendor package (such as from a RPM or Debian package) see that pakage's documentation for where files are installed. Example Installation: =over 4 =item 1 Symlink or copy the swish.cgi. Symlink (or copy if your platform or webserver does not allow symlinks) the swish.cgi script from the installation directory to a local directory. Typically, this would be the cgi-bin directory or a location where CGI script are located. In this example a new directory is created and the script is symlinked. ~$ mkdir swishdir ~$ cd swishdir ~/swishdir$ ln -s /usr/local/lib/swish-e/swish.cgi The installation directory is set at configure time with the --prefix or --libexecdir options, but by default is in /usr/local/lib/swish-e. =item 2 Create an index Use an editor and create a simple configuration file for indexing your files. In this example the Apache documentation is indexed. Last we run a simple query to test that the index works correctly. ~/swishdir$ cat swish.conf IndexDir /usr/local/apache/htdocs IndexOnly .html .htm DefaultContents HTML* StoreDescription HTML* 200000 MetaNames swishdocpath swishtitle ReplaceRules remove /usr/local/apache/ If you do not have the Apache docs installed then pick another directory to index such as /usr/share/doc. Create the index. ~/swishdir$ swish-e -c swish.conf Indexing Data Source: "File-System" Indexing "/usr/local/apache/htdocs" Removing very common words... no words removed. Writing main index... Sorting words ... Sorting 7005 words alphabetically Writing header ... Writing index entries ... Writing word text: Complete Writing word hash: Complete Writing word data: Complete 7005 unique words indexed. 5 properties sorted. 124 files indexed. 1485844 total bytes. 171704 total words. Elapsed time: 00:00:02 CPU time: 00:00:02 Indexing done! Now, verify that the index can be searched: ~/swishdir$ swish-e -w install -m 1 # SWISH format: 2.1-dev-25 # Search words: install # Number of hits: 14 # Search time: 0.001 seconds # Run time: 0.040 seconds 1000 htdocs/manual/dso.html "Apache 1.3 Dynamic Shared Object (DSO) support" 17341 . Let's see what files we have in our directory now: ~/swishdir$ ls -1 index.swish-e index.swish-e.prop swish.cgi swish.conf =item 3 Test the CGI script This is a simple step, but often overlooked. You should test from the command line instead of jumping ahead and testing with the web server. See the C section below for more information. ~/swishdir$ ./swish.cgi | head Content-Type: text/html; charset=ISO-8859-1 Search our site The above shows that the script can be run directly, and generates a correct HTTP header and HTML. If you run the above and see something like this: ~/swishdir >./swish.cgi bash: ./swish.cgi: No such file or directory then you probably need to edit the script to point to the correct location of your perl program. Here's one way to find out where perl is located (again, on unix): ~/swishdir$ which perl /usr/local/bin/perl ~/swishdir$ /usr/local/bin/perl -v This is perl, v5.6.0 built for i586-linux ... Good! We are using a reasonably current version of perl. Now that we know perl is at F we can adjust the "shebang" line in the perl script (e.g. the first line of the script): ~/swishdir$ pico swish.cgi (edit the #! line) ~/swishdir$ head -1 swish.cgi #!/usr/local/bin/perl -w =item 4 Test with the web server How you do this is completely dependent on your web server, and you may need to talk to your web server admin to get this working. Often files with the .cgi extension are automatically set up to run as CGI scripts, but not always. In other words, this step is really up to you to figure out! This example shows creating a I from the web server space to the directory used above. This will only work if the web server is configured to follow symbolic links (the default for Apache). This operation requires root access: ~/swishdir$ su -c "ln -s $HOME/swishdir /usr/local/apache/htdocs/swishdir" Password: ********* If your account is on an ISP and your web directory is F<~/public_html> the you might just move the entire directory: mv ~/swishdir ~/public_html Now, let's make a real HTTP request: ~/swishdir$ GET http://localhost/swishdir/swish.cgi | head -3 #!/usr/local/bin/perl -w package SwishSearch; use strict; Oh, darn. It looks like Apache is not running the script and instead returning it as a static page. Apache needs to be told that swish.cgi is a CGI script. F<.htaccess> comes to the rescue: ~/swishdir$ cat .htaccess # Deny everything by default Deny From All # But allow just CGI script Options ExecCGI Allow From All SetHandler cgi-script That "Deny From All" prevents access to all files (such as config and index files), and only access is allowed to the F script. Let's try the request one more time: ~/swishdir >GET http://localhost/swishdir/swish.cgi | head Search our site

That looks better! Now use your web browser to test. Now, you may note that the links are not valid on the search results page. The swish config file contained the line: ReplaceRules remove /usr/local/apache/ To make those links works (and assuming your web server will follow symbolic links): ~/swishtest$ ln -s /usr/local/apache/htdocs BTW - "GET" used above is a program included with Perl's LWP library. If you do no have this you might try something like: wget -O - http://localhost/swishdir/swish.cgi | head and if nothing else, you can always telnet to the web server and make a basic request. ~/swishtest$ telnet localhost 80 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /swishtest/swish.cgi http/1.0 HTTP/1.1 200 OK Date: Wed, 13 Feb 2002 20:14:31 GMT Server: Apache/1.3.20 (Unix) mod_perl/1.25_01 Connection: close Content-Type: text/html; charset=ISO-8859-1 Search our site This may seem like a lot of work compared to using a browser, but browsers are a poor tool for basic CGI debugging. =back If you have problems check the C section below. =head1 CONFIGURATION If you want to change the location of the swish-e binary or the index file, use multiple indexes, add additional metanames and properties, change the default highlighting behavior, etc., you will need to adjust the script's configuration settings. Again, please get a test setup working with the default parameters before making changes to any configuration settings. Better to debug one thing at a time... In general, you will need to adjust the script's settings to match the index file you are searching. For example, if you are indexing a hypermail list archive you may want to make the script use metanames/properties of Subject, Author, and, Email address. Or you may wish to provide a way to limit searches to subsets of documents (e.g. parts of your directory tree). To make things somewhat "simple", the configuration parameters are included near the top of the swish.cgi program. That is the only place that the individual parameters are defined and explained, so you will need to open up the swish.cgi script in an editor to view the options. Further questions about individual settings should be referred to the swish-e discussion list. The parameters are all part of a perl C structure, and the comments at the top of the program should get you going. The perl hash structure may seem a bit confusing, but it makes it easy to create nested and complex parameters. Syntax is important, so cut-n-paste should be your best defense if you are not a perl programmer. By the way, Perl has a number of quote operators. For example, to quote a string you might write: title => 'Search My Site', Some options take more than one parameter, where each parameter must be quoted. For example: metanames => [ 'swishdefault', 'swishtitle', 'swishdocpath' ], which assigns an array ( [...] ) of three strings to the "metanames" variable. Lists of quoted strings are so common in perl that there's a special operator called "qw" (quote word) to save typing all those quotes: metanames => [ qw/ swishdefault swishtitle swishdocpath / ], or to use the parenthesis as the quote character (you can pick any): metanames => [ qw( swishdefault swishtitle swishdocpath ) ], There are two options for changing the configuration settings from their default values: One way is to edit the script directly, or the other was is to use a separate configuration file. In either case, the configuration settings are a basic perl hash reference. Using a configuration file is described below, but contains the same hash structure. There are many configuration settings, and some of them are commented out either by using a "#" symbol, or by simply renaming the configuration directive (e.g. by adding an "x" to the parameter name). A very basic configuration setup might look like: return { title => 'Search the Swish-e list', # Title of your choice. swish_binary => 'swish-e', # Location of swish-e binary swish_index => 'index.swish-e', # Location of your index file }; Or if searching more than one index: return { title => 'Search the Swish-e list', swish_binary => 'swish-e', swish_index => ['index.swish-e', 'index2'], }; Both of these examples return a reference to a perl hash ( C ). In the second example, the multiple index files are set as an array reference. Note that in the example above the swish-e binary file is relative to the current directory. If running under mod_perl you will need to use absolute paths. The script can also use the SWISH::API perl module (included with the swish-e distribution in the F directory) to access the swish-e index. The C option is used to enable the use of the SWISH::API module: return { title => 'Search the Swish-e list', swish_index => ['index.swish-e', 'index2'], use_library => 1, # enable use of the SWISH::API module }; The module must be available via the @INC array, like all Perl modules. Using the SWISH::API module avoids the need to fork and execute a the swish-e program. Under mod_perl you will may see a significant performance improvement when using the SWISH::API module. Under normal CGI usage you will probably not see any speed improvements. B As mentioned above, configuration settings can be either set in the F script, or set in a separate configuration file. Settings in a configuration file will override the settings in the script. By default, the F script will attempt to read settings from the file F<.swishcgi.conf>. For example, you might only wish to change the title used in the script. Simply create a file called F<.swishcgi.conf> in the same directory as the CGI script: > cat .swishcgi.conf # Example swish.cgi configuration script. return { title => 'Search Our Mailing List Archive', }; The settings you use will depend on the index you create with swish: return { title => 'Search the Apache documentation', swish_binary => 'swish-e', swish_index => 'index.swish-e', metanames => [qw/swishdefault swishdocpath swishtitle/], display_props => [qw/swishtitle swishlastmodified swishdocsize swishdocpath/], title_property => 'swishdocpath', prepend_path => 'http://myhost/apachedocs', name_labels => { swishdefault => 'Search All', swishtitle => 'Title', swishrank => 'Rank', swishlastmodified => 'Last Modified Date', swishdocpath => 'Document Path', swishdocsize => 'Document Size', }, }; The above configuration defines metanames to use on the form. Searches can be limited to these metanames. "display_props" tells the script to display the property "swishlastmodified" (the last modified date of the file), the document size, and path with the search results. The parameter "name_labels" is a hash (reference) that is used to give friendly names to the metanames. Here's another example. Say you want to search either (or both) the Apache 1.3 documentation and the Apache 2.0 documentation indexed seperately. return { title => 'Search the Apache Documentation', date_ranges => 0, swish_index => [ qw/ index.apache index.apache2 / ], select_indexes => { method => 'checkbox_group', labels => [ '1.3.23 docs', '2.0 docs' ], # Must match up one-to-one to swish_index description => 'Select: ', }, }; Now you can select either or both sets of documentation while searching. All the possible settings are included in the default configuration located near the top of the F script. Open the F script with an editor to look at the various settings. Contact the Swish-e Discussion list for help in configuring the script. =head1 DEBUGGING Most problems with using this script have been a result of improper configuration. Please get the script working with default settings before adjusting the configuration settings. The key to debugging CGI scripts is to run them from the command line, not with a browser. First, make sure the program compiles correctly: $ perl -c swish.cgi swish.cgi syntax OK Next, simply try running the program: $ ./swish.cgi | head Content-Type: text/html; charset=ISO-8859-1 Search our site Under Windows you will need to run the script as: C:\wwwroot\swishtest> perl swish.cgi Now, you know that the program compiles and will run from the command line. Next, try accessing the script from a web browser. If you see the contents of the CGI script instead of its output then your web server is not configured to run the script. With Apache look at settings like ScriptAlias, SetHandler, and Options. If an error is reported (such as Internal Server Error or Forbidden) you need to locate your web server's error_log file and carefully read what the problem is. Contact your web administrator for help locating the web server's error log. If you don't have access to the web server's error_log file, you can modify the script to report errors to the browser screen. Open the script and search for "CGI::Carp". (Author's suggestion is to debug from the command line -- adding the browser and web server into the equation only complicates debugging.) The script does offer some basic debugging options that allow debugging from the command line. The debugging options are enabled by setting an environment variable "SWISH_DEBUG". How that is set depends on your operating system and the shell you are using. These examples are using the "bash" shell syntax. Note: You can also use the "debug_options" configuration setting, but the recommended method is to set the environment variable. You can list the available debugging options like this: $ SWISH_DEBUG=help ./swish.cgi >outfile Unknown debug option 'help'. Must be one of: basic: Basic debugging command: Show command used to run swish headers: Show headers returned from swish output: Show output from swish summary: Show summary of results dump: Show all data available to templates Debugging options may be combined: $ SWISH_DEBUG=command,headers,summary ./swish.cgi >outfile You will be asked for an input query and the max number of results to return. You can use the defaults in most cases. It's a good idea to redirect output to a file. Any error messages are sent to stderr, so those will still be displayed (unless you redirect stderr, too). Here are some examples: ~/swishtest$ SWISH_DEBUG=basic ./swish.cgi >outfile Debug level set to: 1 Enter a query [all]: Using 'not asdfghjklzxcv' to match all records Enter max results to display [1]: ------ Can't use DateRanges feature ------------ Script will run, but you can't use the date range feature Can't locate Date/Calc.pm in @INC (@INC contains: modules /usr/local/lib/perl5/5.6.0/i586-linux /usr/local/lib/perl5/5.6.0 /usr/local/lib/perl5/site_perl/5.6.0/i586-linux /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl/5.005/i586-linux /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl .) at modules/DateRanges.pm line 107, line 2. BEGIN failed--compilation aborted at modules/DateRanges.pm line 107, line 2. Compilation failed in require at ./swish.cgi line 971, line 2. -------------- Can't exec "./swish-e": No such file or directory at ./swish.cgi line 1245, line 2. Child process Failed to exec './swish-e' Error: No such file or directory at ./swish.cgi line 1246, line 2. Failed to find any results The above indicates two problems. First problem is that the Date::Calc module is not installed. The Date::Calc module is needed to use the date limiting feature of the script. The second problem is a bit more serious. It's saying that the script can't find the swish-e binary file. In this example it's specified as being in the current directory. Either correct the path to the swish-e binary, or make a local copy or symlink to the swish-e binary. ~/swishtest$ cat .swishcgi.conf return { title => 'Search the Apache Documentation', swish_binary => '/usr/local/bin/swish-e', date_ranges => 0, }; Now, let's try again: ~/swishtest$ SWISH_DEBUG=basic ./swish.cgi >outfile Debug level set to: 1 ---------- Read config parameters from '.swishcgi.conf' ------ $VAR1 = { 'date_ranges' => 0, 'title' => 'Search the Apache Documentation' }; ------------------------- Enter a query [all]: Using 'not asdfghjklzxcv' to match all records Enter max results to display [1]: Found 1 results Can't locate SWISH::TemplateDefault.pm in @INC (@INC contains: modules /usr/local/lib/perl5/5.6.0/i586-linux /usr/local/lib/perl5/5.6.0 /usr/local/lib/perl5/site_perl/5.6.0/i586-linux /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl/5.005/i586-linux /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl .) at ./swish.cgi line 608. This means that the swish.cgi script could not locate a required module. To correct this locate where the SWISH::Template module is installed and add a "use lib" line to your configuration file (or to the swish.cgi script): ~/swishtest$ cat .swishcgi.conf use lib '/home/bill/local/lib/perl'; return { title => 'Search the Apache Documentation', date_ranges => 0, }; ~/swishtest$ SWISH_DEBUG=basic ./swish.cgi >outfile Debug level set to: 1 ---------- Read config parameters from '.swishcgi.conf' ------ $VAR1 = { 'date_ranges' => 0, 'title' => 'Search the Apache Documentation' }; ------------------------- Enter a query [all]: Using 'not asdfghjklzxcv' to match all records Enter max results to display [1]: Found 1 results That is much better! The "use lib" statement tells Perl where to look for modules by adding the path supplied to an array called @INC. Note that most modules are in the SWISH namespace. For example, the default output module is called SWISH::TemplateDefault. When Perl is looking for that module it is looking for the file F. If the "use lib" statement is set as: use lib '/home/bill/local/lib/perl'; then Perl will look (among other places) for the file /home/bill/local/lib/perl/SWISH/TemplateDefault.pm when attempting to load the SWISH::TemplateDefault module. Relative paths may also be used. use lib 'modules'; will cause Perl to look for the file: ./modules/SWISH/TemplateDefault.pm relative to where the swish.cgi script is running. (This is not true when running under mod_perl). Here's another common problem. Everything checks out, but when you run the script you see the message: Swish returned unknown output Ok, let's find out what output it is returning: ~/swishtest$ SWISH_DEBUG=headers,output ./swish.cgi >outfile Debug level set to: 13 ---------- Read config parameters from '.swishcgi.conf' ------ $VAR1 = { 'swish_binary' => '/usr/local/bin/swish-e', 'date_ranges' => 0, 'title' => 'Search the Apache Documentation' }; ------------------------- Enter a query [all]: Using 'not asdfghjklzxcv' to match all records Enter max results to display [1]: usage: swish [-i dir file ... ] [-S system] [-c file] [-f file] [-l] [-v (num)] ... version: 2.0 docs: http://sunsite.berkeley.edu/SWISH-E/ *** 9872 Failed to run swish: 'Swish returned unknown output' *** Failed to find any results Oh, looks like /usr/local/bin/swish-e is version 2.0 of swish. We need 2.1-dev and above! =head1 Frequently Asked Questions Here's some common questions and answers. =head2 How do I change the way the output looks? The script uses a module to generate output. By default it uses the SWISH::TemplateDefault.pm module. The module used is selected in the swish.cgi configuration file. Modules are located in the example/modules/SWISH directory in the distribution, but are installed in the $prefix/lib/swish-e/perl/SWISH/ directory. To make simple changes you can edit the installed SWISH::TemplatDefault module directly, otherwise make a copy of the module and modify its package name. For example, change directories to the location of the installed module and copy the module to a new name: $ cp TemplateDefault.pm MyTemplateDefault.pm Then at the top of the module adjust the "package" line to: package SWISH::MyTemplateDefault; To use this modules you need to adjust the configuration settings (either at the top of F or in a configuration file: template => { package => 'SWISH::MyTemplateDefault', }, The module does not need to be in the SWISH namespace, and can be stored in any location as long as the module can be found via the @INC array (i.e. modify the "use lib" statement in swish.cgi if needed). =head2 How do I use a templating system with swish.cgi? In addition to the TemplateDefault.pm module, the swish-e distribution includes two other Perl modules for generating output using the templating systems HTML::Template and Template-Toolkit. Templating systems use template files to generate the HTML, and make maintaining the look of a large (or small) site much easier. HTML::Template and Template-Toolkit are separate packages and can be downloaded from the CPAN. See http://search.cpan.org. Two basic templates are provided as examples for generating output using these templating systems. The example templates are located in the F directory. The module F uses the file F to generate its output, while the module F uses the F file. (Note: swish.tt was renamed from search.tt Jun 03, 2004.) To use either of these modules you will need to adjust the "template" configuration setting. Examples for both templating systems are provided in the configuration settings near the top of the F program. Use of these modules is an advanced usage of F and are provided as examples only. All of the output generation modules are passed a hash with the results from the search, plus other data use to create the output page. You can see this hash by using the debugging option "dump" or by using the included SWISH::TemplateDumper module: ~/swishtest >cat .swishcgi.conf return { title => 'Search the Apache Documentation', template => { package => 'SWISH::TemplateDumper', }, }; And run a query. For example: http://localhost/swishtest/swish.cgi?query=install =head2 Why are there three different highlighting modules? Three are three highlighting modules included with the swish-e distribution. Each is a trade-off of speed vs. accuracy: SWISH::DefaultHighlight - reasonably fast, but does not highlight phrases SWISH::PhraseHighlight - reasonably slow, but is reasonably accurate SWISH::SimpleHighlight - fast, some phrases, but least accurate Eh, the default is actually "PhraseHighlight". Oh well. All of the highlighting modules slow down the script. Optimizations to these modules are welcome! =head2 My ISP doesn't provide access to the web server logs There are a number of options. One way it to use the CGI::Carp module. Search in the swish.cgi script for: use Carp; # Or use this instead -- PLEASE see perldoc CGI::Carp for details # use CGI::Carp qw(fatalsToBrowser warningsToBrowser); And change it to look like: #use Carp; # Or use this instead -- PLEASE see perldoc CGI::Carp for details use CGI::Carp qw(fatalsToBrowser warningsToBrowser); This should be only for debugging purposes, as if used in production you may end up sending quite ugly and confusing messages to your browsers. =head2 Why does the output show (NULL)? Swish-e displays (NULL) when attempting to display a property that does not exist in the index. The most common reason for this message is that you did not use StoreDescription in your config file while indexing. StoreDescription HTML* 200000 That tells swish to store the first 200,000 characters of text extracted from the body of each document parsed by the HTML parser. The text is stored as property "swishdescription". The index must be recreated after changing the swish-e configuration. Running: ~/swishtest > ./swish-e -T index_metanames will display the properties defined in your index file. This can happen with other properties, too. For example, this will happen when you are asking for a property to display that is not defined in swish. ~/swishtest > ./swish-e -w install -m 1 -p foo # SWISH format: 2.1-dev-25 # Search words: install err: Unknown Display property name "foo" . ~/swishtest > ./swish-e -w install -m 1 -x 'Property foo=\n' # SWISH format: 2.1-dev-25 # Search words: install # Number of hits: 14 # Search time: 0.000 seconds # Run time: 0.038 seconds Property foo=(NULL) . To check that a property exists in your index you can run: ~/swishtest > ./swish-e -w not dkdk -T index_metanames | grep foo foo : id=10 type=70 META_PROP:STRING(case:ignore) *presorted* Ok, in this case we see that "foo" is really defined as a property. Now let's make sure F is asking for "foo" (sorry for the long lines): ~/swishtest > SWISH_DEBUG=command ./swish.cgi > /dev/null Debug level set to: 3 Enter a query [all]: Using 'not asdfghjklzxcv' to match all records Enter max results to display [1]: ---- Running swish with the following command and parameters ---- ./swish-e \ -w \ 'swishdefault=(not asdfghjklzxcv)' \ -b \ 1 \ -m \ 1 \ -f \ index.swish-e \ -s \ swishrank \ desc \ swishlastmodified \ desc \ -x \ '\t\t\t\t\t\t\t\t\n' \ -H \ 9 If you look carefully you will see that the -x parameter has "fos" instead of "foo", so there's our problem. =head2 How do I use the SWISH::API perl module with swish.cgi? Use the C configuration directive: use_library => 1, This will only provide improved performance when running under mod_perl or other persistent environments. =head2 Why does the "Run time" differ when using the SWISH::API module When using the SWISH::API module the run (and search) times are calculated within the script. When using the swish-e binary the swish-e program reports the times. The "Run time" may include the time required to load and compile the SWISH::API module. =head1 MOD_PERL This script can be run under mod_perl (see http://perl.apache.org). This will improve the response time of the script compared to running under CGI by loading the swish.cgi script into the Apache web server. You must have a mod_perl enabled Apache server to run this script under mod_perl. Configuration is simple. In your httpd.conf or your startup.pl file you need to load the script. For example, in httpd.conf you can use a perl section: use lib '/usr/local/apache/cgi-bin'; # location of the swish.cgi file use lib '/home/yourname/swish-e/example/modules'; # modules required by swish.cgi require "swish.cgi"; Again, note that the paths used will depend on where you installed the script and the modules. When running under mod_perl the swish.cgi script becomes a perl module, and therefore the script does not need to be installed in the cgi-bin directory. (But, you can actually use the same script as both a CGI script and a mod_perl module at the same time, read from the same location.) The above loads the script into mod_perl. Then to configure the script to run add this to your httpd.conf configuration file: PerlSetVar Swish_Conf_File /home/yourname/swish-e/myconfig.pl allow from all SetHandler perl-script PerlHandler SwishSearch Note that you use the "Swish_Conf_File" setting in httpd.conf to tell the script which config file to use. This means you can use the same script (and loaded modules) for different search sites (running on the same Apache server). You can just specify differnt config files for each Location and they can search different indexes and have a completely different look for each site, but all share the same code. B that the config files are cached in the swish.cgi script. Changes to the config file will require restarting the Apache server before they will be reloaded into the swish.cgi script. This avoids calling stat() for every request. Unlike CGI, mod_perl does not change the current directory to the location of the script, so your settings for the swish binary and the path to your index files must be absolute paths (or relative to the server root). Using the SWISH::API module with mod_perl will provide the most performance improvements. Use of the SWISH::API module can be enabled by the configuration setting C: use_library => 1, Without highlighting code enabled, using the SWISH::API module resulted in about 20 requests per second, where running the swish-e binary slowed the script down to about 8 requests per second. Note that the highlighting code is slow. For the best search performance turn off highlighting. In your config file you can add: highlighting => 0, # disable highlighting and the script will show the first 500 chars of the description (or whatever you set for "max_chars"). Without highlight one test was processing about 20 request per second. With The "PhraseHighlight" module that dropped to a little better than two requests per second, "DefaultHighlight" was about 2.3 request per second, and "SimpleHighlight" was about 6 request per second. Experiement with different highlighting options when testing performance. Please post to the swish-e discussion list if you have any questions about running this script under mod_perl. Here's some general request/second on an Athlon XP 1800+ with 1/2GB RAM, Linux 2.4.20. Highlighting Mode None Phrase Default Simple Using SWISH::API 45 1.5 2 12 ---------------------------------------------------------------------------- Using swish-e 12 1.3 1.8 7.5 binary As you can see the highlighting code is a limiting factor. =head1 SpeedyCGI SpeedyCGI (also called PersistentPerl) is another way to run Perl scripts persistently. SpeedyCGI is good if you do not have mod_perl available or do not have root access. SpeedyCGI works on Unix systems by loading the script into a "back end" process and keeping it in memory between requests. New requests are passed to the back end processes which avoids the startup time required by a Perl CGI script. Install SpeedyCGI from http://daemoninc.com/ (your OS may provide a packaged version of SpeedyCGI) and then change the first line of swish.cgi. For example, if the speedy binary is installed in /usr/bin/speedy, use the line: #! /usr/bin/speedy -w -- -t60 The -w option is passed to Perl, and all options following the double-dash are SpeedyCGI options. Note that when using SpeedyCGI configuration data is cached in memory. If you change the swish.cgi configuration file (.swishcgi.conf) then touch the main swish.cgi script to force reloading of configuration data. =head1 Spidering There are two ways to spider with swish-e. One uses the "http" input method that uses code that's part of swish. The other way is to use the new "prog" method along with a perl helper program called C. Here's an example of a configuration file for spidering with the "http" input method. You can see that the configuration is not much different than the file system input method. (But, don't use the http input method -- use the -S prog method shown below.) # Define what to index IndexDir http://www.myserver.name/index.html IndexOnly .html .htm IndexContents HTML* .html .htm DefaultContents HTML* StoreDescription HTML* 200000 MetaNames swishdocpath swishtitle # Define http method specific settings -- see swish-e documentation SpiderDirectory ../swish-e/src/ Delay 0 You index with the command: swish-e -S http -c spider.conf Note that this does take longer. For example, spidering the Apache documentation on a local web server with this method took over a minute, where indexing with the file system took less than two seconds. Using the "prog" method can speed this up. Here's an example configuration file for using the "prog" input method: # Define the location of the spider helper program IndexDir ../swish-e/prog-bin/spider.pl # Tell the spider what to index. SwishProgParameters default http://www.myserver.name/index.html IndexContents HTML* .html .htm DefaultContents HTML* StoreDescription HTML* 200000 MetaNames swishdocpath swishtitle Then to index you use the command: swish-e -c prog.conf -S prog -v 0 Spidering with this method took nine seconds. =head1 Stemmed Indexes Many people enable a feature of swish called word stemming to provide "fuzzy" search options to their users. The stemming code does not actually find the "stem" of word, rather removes and/or replaces common endings on words. Stemming is far from perfect, and many words do not stem as you might expect. Plus, currently only English is supported. But, it can be a helpful tool for searching your site. You may wish to create both a stemmed and non-stemmed index, and provide a checkbox for selecting the index file. To enable a stemmed index you simply add to your configuration file: UseStemming yes If you want to use a stemmed index with this program and continue to highlight search terms you will need to install a perl module that will stem words. This section explains how to do this. The perl module is included with the swish-e distribution. It can be found in the examples directory (where you found this file) and called something like: SWISH-Stemmer-0.05.tar.gz The module should also be available on CPAN (http://search.cpan.org/). Here's an example session for installing the module. (There will be quite a bit of output when running make.) % gzip -dc SWISH-Stemmer-0.05.tar.gz |tar xof - % cd SWISH-Stemmer-0.05 % perl Makefile.PL or % perl Makefile.PL PREFIX=$HOME/perl_lib % make % make test (perhaps su root at this point if you did not use a PREFIX) % make install % cd .. Use the B if you do not have root access or you want to install the modules in a local library. If you do use a PREFIX setting, add a C statement to the top of this swish.cgi program. For example: use lib qw( /home/bmoseley/perl_lib/lib/site_perl/5.6.0 /home/bmoseley/perl_lib/lib/site_perl/5.6.0/i386-linux/ ); Once the stemmer module is installed, and you are using a stemmed index, the C script will automatically detect this and use the stemmer module. =head1 DISCLAIMER Please use this CGI script at your own risk. This script has been tested and used without problem, but you should still be aware that any code running on your server represents a risk. If you have any concerns please carefully review the code. See http://www.w3.org/Security/Faq/www-security-faq.html Security on Windows questionable. =head1 SUPPORT The SWISH-E discussion list is the place to ask for any help regarding SWISH-E or this example script. See http://swish-e.org. Before posting please review: http://swish-e.org/2.2/docs/INSTALL.html#When_posting_please_provide_the_ Please do not contact the author or any of the swish-e developers directly. =head1 LICENSE swish.cgi $Revision$ Copyright (C) 2001 Bill Moseley search@hank.org Example CGI program for searching with SWISH-E This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. =head1 AUTHOR Bill Moseley =cut Ice-3.5.1/cpp/doc/swish/swish.conf0000644000076400007640000000040312223561476015057 0ustar mesmesReplacerules remove /var/www/html/ IndexDir /var/www/html/doc/Ice-3.5.1/reference IndexDir /var/www/html/doc/Ice-3.5.1/manual IndexOnly .html FileRules filename is _sindex\.html DefaultContents HTML* StoreDescription HTML* 200000 obeyRobotsNoIndex yes Ice-3.5.1/cpp/doc/swish/TemplateSlice.pm0000755000076400007640000002741512223561476016163 0ustar mesmes#===================================================================== # These routines format the HTML output. # $Id$ #===================================================================== package TemplateSlice; use strict; use CGI; sub show_template { my ( $class, $template_params, $results ) = @_; my $q = $results->CGI; my $output = $q->header . page_header( $results ); # Show form at top always # $output .= show_form( $results ); if ( $results->results ) { $output .= results_header( $results ); $output .= show_result( $results, $_ ) for @{ $results->results }; } # Form after results (or at top if no results) #$output .= show_form( $results ); $output .= footer( $results ); print $output; } #===================================================================== # This generates the header sub page_header { my $results = shift; my $title = $results->config('title') || 'Search our site with Swish-e'; my $message = $results->errstr; $message = $message ? qq[
$message] : '' ; my $html_title = $results->results ? ( $results->navigation('hits') . ' Result' . ( $results->navigation('hits') == 1 ? ' ' : 's ' ) . 'for [' . CGI::escapeHTML( $results->{query_simple} ) . ']' ) : ( CGI::escapeHTML( $results->{query_simple} ) ? ( 'No results for [' . CGI::escapeHTML( $results->{query_simple} ) . ']' ) : ( 'Please enter a query string.' ) ); my $default_logo = '
Swish-e home page ' ; my $logo = $results->config('on_intranet') ? '' : $results->config('logo') || $default_logo; return < $html_title

$html_title


EOF } #===================================================================== # This generates the form # # Pass: # $results hash sub show_form { my $results = shift; my $q = $results->{q}; my $query = $q->param('query') || ''; $query = CGI::escapeHTML( $query ); # May contain quotes # Here's some form components my $meta_select_list = get_meta_name_limits( $results ); my $sorts = get_sort_select_list( $results ); my $select_index = get_index_select_list( $results ); my $limit_select = get_limit_select( $results ); my $date_ranges_select = $results->get_date_ranges; my $form = $q->script_name; my $advanced_link = qq[advanced form]; my $advanced_form = $q->param('brief') ? $advanced_link : <config('extra_fields'); my $hidden = !$extra ? '' : join "\n", map { $q->hidden($_) } @$extra; return < $hidden
$advanced_form EOF } #===================================================================== # This routine creates the results header display # and navigation bar # # # sub results_header { my $results = shift; my $config = $results->{config}; my $q = $results->{q}; my $swr = $results->header('removed stopwords'); my $stopwords = ''; if ( $swr && ref $swr eq 'ARRAY' ) { $stopwords = @$swr > 1 ? join( ', ', map { "$_" } @$swr ) . ' are very common words and were not included in your search' : join( ', ', map { "$_" } @$swr ) . ' is a very common word and was not included in your search'; } my $limits = ''; # Ok, this is ugly. if ( $results->{DateRanges_time_low} && $results->{DateRanges_time_high} ) { my $low = scalar localtime $results->{DateRanges_time_low}; my $high = scalar localtime $results->{DateRanges_time_high}; $limits = <  Results limited to dates $low to $high EOF } my $query_href = $results->{query_href}; my $query_simple = CGI::escapeHTML( $results->{query_simple} ); my $pages = $results->navigation('pages'); my $prev = $results->navigation('prev'); my $prev_count = $results->navigation('prev_count'); my $next = $results->navigation('next'); my $next_count = $results->navigation('next_count'); my $hits = $results->navigation('hits'); my $from = $results->navigation('from'); my $to = $results->navigation('to'); my $run_time = $results->navigation('run_time'); my $search_time = $results->navigation('search_time'); my $links = ''; $links .= ' Page:' . $pages if $pages; $links .= qq[ Previous $prev_count] if $prev_count; $links .= qq[ Next $next_count] if $next_count; # Save for the bottom of the screen. $results->{LINKS} = $links; $links = qq[$links] if $links; $query_simple = $query_simple ? " Result" . ( $hits == 1 ? ' ' : 's ' ) . "for $query_simple:" : ''; my $range = $hits == 1 ? "" : "$from to $to of $hits results."; return < $query_simple   $range $links $limits $stopwords EOF } #===================================================================== # This routine formats a single result # # sub show_result { my ($results, $this_result ) = @_; my $conf = $results->{conf}; my $DocTitle = $results->config('title_property') || 'swishtitle'; my $title = $this_result->{$DocTitle} || $this_result->{swishdocpath} || '?'; my $name_labels = $results->config('name_labels'); # The the properties to display my $props = ''; my $display_props = $results->config('display_props'); if ( $display_props ) { $props = join "\n", '
', map ( { '' } @$display_props ), '
' . ( $name_labels->{$_} || $_ ) . ': ' . '' . ( defined $this_result->{$_} ? $this_result->{$_} : '' ) . '' . '
'; } my $description_prop = $results->config('description_prop'); my $description = ''; if ( $description_prop ) { $description = $this_result->{ $description_prop } || ''; } return <
$this_result->{swishreccount} $title
$description $props
EOF } #===================================================================== # This is displayed on the bottom of every page # # sub footer { my $links = ''; my $results = shift; if ($results) { my $links = qq[
$results->{LINKS}
] if $results->{LINKS}; } return < EOF } #================================================================== # Form setup for sorts and metas # # This could be methods of $results object # (and then available for Template-Toolkit) # But that's too much HTML in the object, perhaps. # # #================================================================== sub get_meta_name_limits { my ( $results ) = @_; my $metanames = $results->config('metanames'); return '' unless $metanames; my $name_labels = $results->config('name_labels'); my $q = $results->CGI; return join "\n", 'Limit search to:', $q->radio_group( -name =>'metaname', -values => $metanames, -default=>$metanames->[0], -labels =>$name_labels ), '
'; } sub get_sort_select_list { my ( $results ) = @_; my $sort_metas = $results->config('sorts'); return '' unless $sort_metas; my $name_labels = $results->config('name_labels'); my $q = $results->CGI; return join "\n", 'Sort by:', $q->popup_menu( -name =>'sort', -values => $sort_metas, -default=>$sort_metas->[0], -labels =>$name_labels ), $q->checkbox( -name => 'reverse', -label => 'Reverse Sort' ); } sub get_index_select_list { my ( $results ) = @_; my $q = $results->CGI; my $indexes = $results->config('swish_index'); return '' unless ref $indexes eq 'ARRAY'; my $select_config = $results->config('select_indexes'); return '' unless $select_config && ref $select_config eq 'HASH'; # Should return a warning, as this might be a likely mistake # This jumps through hoops so that real index file name is not exposed return '' unless exists $select_config->{labels} && ref $select_config->{labels} eq 'ARRAY' && @$indexes == @{$select_config->{labels}}; my @labels = @{$select_config->{labels}}; my %map; for ( 0..$#labels ) { $map{$_} = $labels[$_]; } my $method = $select_config->{method} || 'checkbox_group'; my @cols = $select_config->{columns} ? ('-columns', $select_config->{columns}) : (); return join "\n", '
', ( $select_config->{description} || 'Select: '), $q->$method( -name => 'si', -values => [0..$#labels], -default=> 0, -labels => \%map, @cols ); } sub get_limit_select { my ( $results ) = @_; my $q = $results->CGI; my $limit = $results->config('select_by_meta'); return '' unless ref $limit eq 'HASH'; my $method = $limit->{method} || 'checkbox_group'; my @options = ( -name => 'sbm', -values => $limit->{values}, -labels => $limit->{labels} || {}, ); push @options, ( -columns=> $limit->{columns} ) if $limit->{columns}; return join "\n", '
', ( $limit->{description} || 'Select: '), $q->$method( @options ); } 1; Ice-3.5.1/cpp/doc/htmlFooter0000644000076400007640000000002412223561476013763 0ustar mesmes
Ice-3.5.1/cpp/doc/symboltree.js0000644000076400007640000001617412223561476014455 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** var symboltree = new Object(); symboltree.id = 'SymbolTree'; symboltree.cookie = 'SliceSymbolTree'; symboltree.main = function() { // // Look for a collapsible list. // symboltree.tree = document.getElementById(symboltree.id); if(!symboltree.tree) { alert('There is no symbol tree on this page.'); return; } if(symboltree.tree.style) { // // Assign class 'CollapsibleList' to all the unordered lists. // That way, if the browser does not support DOM, the CCS style // that removes the bullets and indent does not apply. // symboltree.tree.className = 'CollapsibleList'; var ul = symboltree.tree.getElementsByTagName('ul'); for(var i = 0; i < ul.length; ++i) { ul[i].className = 'CollapsibleList'; } } else { return; // Browser doesn't support DOM, don't do anything. } // // Find all
  • list items. // var list = symboltree.tree.getElementsByTagName('li'); for(var i = 0; i < list.length; ++i) { // // If this list contains sub-lists, it needs a collapse/expand widget. // if(list[i].getElementsByTagName('ul').length != 0) { // // Attach an event listener to the widget. // symboltree.addHandler(list[i], 'click', symboltree.handleEvent); // // The list starts out collapsed by default. Set state and class name, and // hide all the entries in this list. // list[i].setAttribute('state', 'collapsed'); list[i].className = 'CollapsedList'; var children = list[i].childNodes; for(var j = 0; j < children.length; ++j) { if(children[j].tagName == 'UL' || children[j].tagName == 'LI') { children[j].style.display = 'none'; } } } else { // // We have a plain
  • list item without
      sub-lists. We attach a class name // to these items so we can refer to them separately in the style sheet. // list[i].className = 'ListEntry'; } } // // Save expanded list indexes in cookie when page unloads. // symboltree.addHandler(window, 'unload', symboltree.save); // // Load state of list. // symboltree.restore(); // // Set handler for the "Expand All" and "Collapse All" buttons. // var expandAll = document.getElementById('ExpandAllButton'); symboltree.addHandler(expandAll, 'click', symboltree.expandAll); var collapseAll = document.getElementById('CollapseAllButton'); symboltree.addHandler(collapseAll, 'click', symboltree.collapseAll); } // // Mouse click event handler for collapse/expand widget. // symboltree.handleEvent = function(e) { var target; if(!e) { e = window.event; } if(e.target) { target = e.target; } else if(e.currentTarget) { target = e.currentTarget; } else if(e.srcObject) { target = e.srcObject; } else if(e.srcElement) { target = e.srcElement; } if(!target) { alert('No target for event!'); } if(!target.className || (target.className != 'CollapsedList' && target.className != 'ExpandedList')) { return; // Ignore event because it bubbled up from child element (namely, from a link in the list). } // // Toggle the list. // if(target.getAttribute('state') == 'expanded') { symboltree.collapse(target); } else { symboltree.expand(target); } // // Stop event from bubbling up. // if(e.stopPropagation) { e.stopPropagation(); // For standards-compliant browsers. } else { e.cancelBubble = true; // For IE } } // // Expand sub-list. The state of the list is remembered in the 'state' attribute. // Expanded lists have a class name of 'ExpandedList', so the style sheet can select // the correct icon. To expand a list, we change the display of all immediate // child
        and
      • nodes to 'block'. // symboltree.expand = function(list) { var state = list.getAttribute('state'); if(state && state != 'expanded') { list.setAttribute('state', 'expanded'); list.className = 'ExpandedList'; var children = list.childNodes; for(var i = 0; i < children.length; ++i) { if(children[i].tagName == 'UL' || children[i].tagName == 'LI') { children[i].style.display = 'block'; } } } } symboltree.expandAll = function() { var list = symboltree.tree.getElementsByTagName('li'); for(var i = 0; i < list.length; ++i) { if(list[i].getElementsByTagName('ul').length != 0) { symboltree.expand(list[i]); } } } // // Collapse a sub-list. The state of the list is remembered in the 'state' attribute. // Collapsed lists have a class name of 'CollapsedList', so the style sheet can select // the correct icon. To collapse a list, we change the display of all immediate // child
          and
        • nodes to 'none'. // symboltree.collapse = function(list) { var state = list.getAttribute('state'); if(state && state != 'collapsed') { list.setAttribute('state', 'collapsed'); list.className = 'CollapsedList'; var children = list.childNodes; for(var i = 0; i < children.length; ++i) { if(children[i].tagName == 'UL' || children[i].tagName == 'LI') { children[i].style.display = 'none'; } } } } symboltree.collapseAll = function() { var list = symboltree.tree.getElementsByTagName('li'); for(var i = 0; i < list.length; ++i) { if(list[i].getElementsByTagName('ul').length != 0) { symboltree.collapse(list[i]); } } } // // Save state of the list in a cookie. We save the index of each // expanded
        • element. // symboltree.save = function() { var list = symboltree.tree.getElementsByTagName('li'); var saved = new Array(); for(var i = 0; i < list.length; ++i) { if(list[i].getElementsByTagName('ul').length != 0) { var state = list[i].getAttribute('state'); if(state && state == 'expanded') { saved[saved.length] = i; } } } if(saved.length == 0) { saved[0] = 'none'; } document.cookie = symboltree.cookie + '=' + saved; } // // Restore the state of the list from a cookie. // symboltree.restore = function() { var regex = new RegExp(symboltree.cookie + '=[^;]+', 'i'); if (document.cookie.match(regex)) { var value = document.cookie.match(regex)[0].split('=')[1]; if(value != 'none') { var indexes = value.split(','); var list = symboltree.tree.getElementsByTagName('li'); for(var i = 0; i < indexes.length; ++i) { symboltree.expand(list[indexes[i]]); } } } } // // Add an event handler. // symboltree.addHandler = function(target, event, handler) { if(target.addEventListener) { target.addEventListener(event, handler, false); } else { target.attachEvent('on' + event, handler); } } symboltree.main(); // Start running. Ice-3.5.1/cpp/doc/indexHeader0000644000076400007640000000530112223561476014063 0ustar mesmes TITLE
          Home

          Ice-3.5.1/cpp/doc/Makefile0000644000076400007640000000413312223561476013362 0ustar mesmes# ********************************************************************** # # 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 = .. TARGETS = reference/index.html SLICEFILES = $(wildcard ../../slice/Ice/*.ice) \ $(wildcard ../../slice/Freeze/*.ice) \ $(wildcard ../../slice/IceBox/*.ice) \ $(wildcard ../../slice/IceGrid/*.ice) \ $(wildcard ../../slice/Glacier2/*.ice) \ $(wildcard ../../slice/IceSSL/*.ice) \ $(wildcard ../../slice/IceStorm/*.ice) \ $(wildcard ../../slice/IcePatch2/*.ice) include $(top_srcdir)/config/Make.rules IMAGES = images JAVASCRIPT = symboltree.js reference/index.html: $(SLICEFILES) $(MAKE) clean $(bindir)/slice2html --ice -I$(slicedir) --hdr=htmlHeader --ftr=htmlFooter \ --indexhdr=indexHeader --indexftr=indexFooter \ --image-dir=images --logo-url="http://www.zeroc.com" --search="/cgi-bin/swish.cgi" \ --output-dir=reference --index=3 --summary=120 $(SLICEFILES) mkdir reference/$(IMAGES) cp $(IMAGES)/*.gif reference/$(IMAGES) cp $(JAVASCRIPT) reference clean:: -rm -rf reference/* install:: install-common reference/index.html @if test ! -d $(install_docdir) ; \ then \ echo "Creating $(install_docdir)..." ; \ $(call mkdir,$(install_docdir)) ; \ fi ; \ if test ! -d $(install_docdir)/reference ; \ then \ echo "Creating $(install_docdir)/reference..." ; \ $(call mkdir,$(install_docdir)/reference) ; \ fi ; \ echo "Installing HTML..." ; \ $(call installdata,reference/*.*,$(install_docdir)/reference) ; \ for i in reference/*; \ do if test -d $$i ; \ then \ if test ! -d $(install_docdir)/$$i ; \ then \ echo "Creating $(install_docdir)/$$i..." ; \ $(call mkdir,$(install_docdir)/$$i) ; \ fi ; \ echo "Installing files in $$i..." ; \ $(call installdata,$$i/*.*,$(install_docdir)/$$i) ; \ fi; \ done ; \ Ice-3.5.1/cpp/doc/htmlHeader0000644000076400007640000000232612223561476013724 0ustar mesmes TITLE
          Ice-3.5.1/cpp/include/0000755000076400007640000000000012223561476012577 5ustar mesmesIce-3.5.1/cpp/include/Ice/0000755000076400007640000000000012223561476013277 5ustar mesmesIce-3.5.1/cpp/include/Ice/Format.h0000644000076400007640000000151712223561476014704 0ustar mesmes// ********************************************************************** // // 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 ICE_FORMAT_H #define ICE_FORMAT_H #include namespace Ice { // // This enumeration describes the possible formats for classes and exceptions. // ICE_API enum FormatType { // // Indicates that no preference was specified. // DefaultFormat, // // A minimal format that eliminates the possibility for slicing unrecognized types. // CompactFormat, // // Allow slicing and preserve slices for unknown types. // SlicedFormat }; } #endif Ice-3.5.1/cpp/include/Ice/FactoryTableInit.h0000644000076400007640000000132012223561476016647 0ustar mesmes// ********************************************************************** // // 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 ICE_FACTORYTABLEINIT_H #define ICE_FACTORYTABLEINIT_H #include namespace IceInternal { class ICE_API FactoryTableInit { public: FactoryTableInit(); ~FactoryTableInit(); }; static FactoryTableInit factoryTableInitializer; // Dummy variable to force initialization of factoryTable extern ICE_API FactoryTable* factoryTable; } #endif Ice-3.5.1/cpp/include/Ice/ObjectAdapterFactoryF.h0000644000076400007640000000122512223561476017615 0ustar mesmes// ********************************************************************** // // 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 ICE_OBJECT_ADAPTER_FACTORY_F_H #define ICE_OBJECT_ADAPTER_FACTORY_F_H #include #include namespace IceInternal { class ObjectAdapterFactory; IceUtil::Shared* upCast(ObjectAdapterFactory*); typedef IceInternal::Handle ObjectAdapterFactoryPtr; } #endif Ice-3.5.1/cpp/include/Ice/ConnectionMonitorF.h0000644000076400007640000000121112223561476017220 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECTION_MONITOR_F_H #define ICE_CONNECTION_MONITOR_F_H #include #include namespace IceInternal { class ConnectionMonitor; ICE_API IceUtil::Shared* upCast(ConnectionMonitor*); typedef IceInternal::Handle ConnectionMonitorPtr; } #endif Ice-3.5.1/cpp/include/Ice/ObserverHelper.h0000644000076400007640000000623012223561476016400 0ustar mesmes// ********************************************************************** // // 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 ICE_OBSERVERHELPER_H #define ICE_OBSERVERHELPER_H #include #include #include namespace IceInternal { template class ObserverHelperT { public: typedef IceInternal::Handle TPtr; ObserverHelperT() { } ~ObserverHelperT() { if(_observer) { _observer->detach(); } } operator bool() const { return _observer; } T* operator->() const { return _observer.get(); } void attach(const TPtr& o) { // // Don't detach the existing observer. The observer is being // replaced and the observed object is still being observed! // // if(_observer) // { // _observer->detach(); // } _observer = o; if(_observer) { _observer->attach(); } } T* get() const { return _observer.get(); } void adopt(ObserverHelperT& other) { _observer = other._observer; other._observer = 0; } void detach() { if(_observer) { _observer->detach(); _observer = 0; } } void failed(const std::string& reason) { if(_observer) { _observer->failed(reason); } } protected: TPtr _observer; }; class ICE_API DispatchObserver : public ObserverHelperT { public: void userException() { if(_observer) { _observer->userException(); } } void reply(Ice::Int size) { if(_observer) { _observer->reply(size); } } }; class ICE_API InvocationObserver : public ObserverHelperT { public: InvocationObserver(IceProxy::Ice::Object*, const std::string&, const Ice::Context*); InvocationObserver(Instance*, const std::string&); InvocationObserver() { } void attach(IceProxy::Ice::Object*, const std::string&, const Ice::Context*); void attach(Instance*, const std::string&); void retried() { if(_observer) { _observer->retried(); } } ::Ice::Instrumentation::RemoteObserverPtr getRemoteObserver(const Ice::ConnectionInfoPtr& con, const Ice::EndpointPtr& endpt, int requestId, int size) { if(_observer) { return _observer->getRemoteObserver(con, endpt, requestId, size); } return 0; } void userException() { if(_observer) { _observer->userException(); } } private: using ObserverHelperT::attach; }; } #endif Ice-3.5.1/cpp/include/Ice/UndefSysMacros.h0000644000076400007640000000174512223561476016364 0ustar mesmes// ********************************************************************** // // 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 ICE_UNDEF_SYS_MACROS_H #define ICE_UNDEF_SYS_MACROS_H // // This header includes macros that can end up being dragged into // the generated code from system headers, such as major() or NDEBUG. // If a Slice symbol has the same name as a macro, the generated // code most likely won't compile (but, depending how the macro is // defined, may even compile). // // Here, we undefine symbols that cause such problems. // // The #ifdef ... #endif protection is necessary to prevent // warnings on some platforms. // #ifdef major #undef major #endif #ifdef minor #undef minor #endif #ifdef min #undef min #endif #ifdef max #undef max #endif #endif Ice-3.5.1/cpp/include/Ice/ProtocolPluginFacadeF.h0000644000076400007640000000122012223561476017615 0ustar mesmes// ********************************************************************** // // 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 ICE_PROTOCOL_PLUGIN_FACADE_F_H #define ICE_PROTOCOL_PLUGIN_FACADE_F_H #include #include namespace IceInternal { class ProtocolPluginFacade; ICE_API IceUtil::Shared* upCast(ProtocolPluginFacade*); typedef Handle ProtocolPluginFacadePtr; } #endif Ice-3.5.1/cpp/include/Ice/Ice.h0000644000076400007640000000266712223561476014163 0ustar mesmes// ********************************************************************** // // 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 ICE_ICE_H #define ICE_ICE_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef ICE_OS_WINRT # include #endif #include #include #include #include #include #include #include #include #include #include #include #include #ifndef ICE_OS_WINRT # include #endif #ifndef _WIN32 # include #endif #endif Ice-3.5.1/cpp/include/Ice/SlicedDataF.h0000644000076400007640000000163112223561476015554 0ustar mesmes// ********************************************************************** // // 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 ICE_SLICED_DATA_F_H #define ICE_SLICED_DATA_F_H #include #include namespace Ice { struct SliceInfo; ICE_API IceUtil::Shared* upCast(SliceInfo*); typedef IceInternal::Handle SliceInfoPtr; typedef ::std::vector SliceInfoSeq; class SlicedData; ICE_API IceUtil::Shared* upCast(SlicedData*); typedef IceInternal::Handle SlicedDataPtr; class UnknownSlicedObject; ICE_API IceUtil::Shared* upCast(UnknownSlicedObject*); typedef IceInternal::Handle UnknownSlicedObjectPtr; } #endif Ice-3.5.1/cpp/include/Ice/OutgoingAsync.h0000644000076400007640000003631612223561476016252 0ustar mesmes// ********************************************************************** // // 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 ICE_OUTGOING_ASYNC_H #define ICE_OUTGOING_ASYNC_H #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef ICE_CPP11 # include // for std::function #endif namespace IceInternal { class CallbackBase; typedef IceUtil::Handle CallbackBasePtr; } namespace Ice { class ICE_API AsyncResult : virtual public IceUtil::Shared, private IceUtil::noncopyable { public: virtual bool operator==(const AsyncResult&) const; virtual bool operator<(const AsyncResult&) const; virtual Int getHash() const; virtual CommunicatorPtr getCommunicator() const { return _communicator; } virtual ConnectionPtr getConnection() const { return 0; } virtual ObjectPrx getProxy() const { return 0; } bool isCompleted() const; void waitForCompleted(); bool isSent() const; void waitForSent(); void throwLocalException() const; bool sentSynchronously() const { return _sentSynchronously; // No lock needed, immutable once __send() is called } LocalObjectPtr getCookie() const { return _cookie; // No lock needed, cookie is immutable } const std::string& getOperation() const { return _operation; } ::IceInternal::BasicStream* __getOs() { return &_os; } ::IceInternal::BasicStream* __startReadParams() { _is.startReadEncaps(); return &_is; } void __endReadParams() { _is.endReadEncaps(); } void __readEmptyParams() { _is.skipEmptyEncaps(); } void __readParamEncaps(const ::Ice::Byte*& encaps, ::Ice::Int& sz) { _is.readEncaps(encaps, sz); } bool __wait(); void __throwUserException(); void __exceptionAsync(const Exception&); static void __check(const AsyncResultPtr&, const ::IceProxy::Ice::Object*, const ::std::string&); static void __check(const AsyncResultPtr&, const Connection*, const ::std::string&); static void __check(const AsyncResultPtr&, const Communicator*, const ::std::string&); virtual void __exception(const Exception&); // Required to be public for AsynchronousException void __sent(); // Required to be public for AsynchronousSent virtual void __attachRemoteObserver(const Ice::ConnectionInfoPtr& c, const Ice::EndpointPtr& endpt, Ice::Int requestId, Ice::Int sz) { _remoteObserver.attach(_observer.getRemoteObserver(c, endpt, requestId, sz)); } IceInternal::InvocationObserver& __getObserver() { return _observer; } protected: static void __check(const AsyncResultPtr&, const ::std::string&); AsyncResult(const CommunicatorPtr&, const IceInternal::InstancePtr&, const std::string&, const IceInternal::CallbackBasePtr&, const LocalObjectPtr&); void __sentAsync(); void __response(); void __warning(const std::exception&) const; void __warning() const; virtual ~AsyncResult(); // Must be heap-allocated. const CommunicatorPtr _communicator; const IceInternal::InstancePtr _instance; const std::string& _operation; const IceInternal::CallbackBasePtr _callback; const LocalObjectPtr _cookie; IceUtil::Monitor _monitor; IceInternal::BasicStream _is; IceInternal::BasicStream _os; static const unsigned char OK; static const unsigned char Done; static const unsigned char Sent; static const unsigned char EndCalled; unsigned char _state; bool _sentSynchronously; IceUtil::UniquePtr _exception; IceInternal::InvocationObserver _observer; IceInternal::ObserverHelperT _remoteObserver; }; } namespace IceInternal { // // See comments in OutgoingAsync.cpp // extern ICE_API CallbackBasePtr __dummyCallback; class LocalExceptionWrapper; // // This interface is used by the connection to handle OutgoingAsync // and BatchOutgoingAsync messages. // class ICE_API OutgoingAsyncMessageCallback : virtual public IceUtil::Shared { public: virtual ~OutgoingAsyncMessageCallback() { } // // Called by the connection when the message is confirmed sent. The connection is locked // when this is called so this method can call the sent callback. Instead, this method // returns true if there's a sent callback and false otherwise. If true is returned, the // connection will call the __sent() method bellow (which in turn should call the sent // callback). // virtual bool __sent(Ice::ConnectionI*) = 0; // // Called by the connection to call the user sent callback. // virtual void __sent() = 0; // // Called by the connection when the request failed. The boolean indicates whether or // not the message was possibly sent (this is useful for retry to figure out whether // or not the request can't be retried without breaking at-most-once semantics.) // virtual void __finished(const Ice::LocalException&, bool) = 0; }; class ICE_API OutgoingAsync : public OutgoingAsyncMessageCallback, public Ice::AsyncResult, private IceUtil::TimerTask { public: OutgoingAsync(const Ice::ObjectPrx&, const std::string&, const CallbackBasePtr&, const Ice::LocalObjectPtr&); void __prepare(const std::string&, Ice::OperationMode, const Ice::Context*); virtual Ice::ObjectPrx getProxy() const { return _proxy; } virtual bool __sent(Ice::ConnectionI*); virtual void __sent(); virtual void __finished(const Ice::LocalException&, bool); void __finished(const LocalExceptionWrapper&); void __finished(); bool __send(bool); BasicStream* __startWriteParams(Ice::FormatType format) { _os.startWriteEncaps(_encoding, format); return &_os; } void __endWriteParams() { _os.endWriteEncaps(); } void __writeEmptyParams() { _os.writeEmptyEncaps(_encoding); } void __writeParamEncaps(const ::Ice::Byte* encaps, ::Ice::Int size) { if(size == 0) { _os.writeEmptyEncaps(_encoding); } else { _os.writeEncaps(encaps, size); } } ::IceInternal::BasicStream* __getIs() { return &_is; } protected: Ice::ObjectPrx _proxy; private: int handleException(const Ice::LocalException&, bool); int handleException(const LocalExceptionWrapper&); void runTimerTask(); // Implementation of TimerTask::runTimerTask() Ice::ConnectionIPtr _timerTaskConnection; Handle< IceDelegate::Ice::Object> _delegate; Ice::EncodingVersion _encoding; int _cnt; Ice::OperationMode _mode; }; class ICE_API BatchOutgoingAsync : public OutgoingAsyncMessageCallback, public Ice::AsyncResult { public: BatchOutgoingAsync(const Ice::CommunicatorPtr&, const InstancePtr&, const std::string&, const CallbackBasePtr&, const Ice::LocalObjectPtr&); virtual bool __sent(Ice::ConnectionI*); virtual void __sent(); virtual void __finished(const Ice::LocalException&, bool); }; class ICE_API ProxyBatchOutgoingAsync : public BatchOutgoingAsync { public: ProxyBatchOutgoingAsync(const Ice::ObjectPrx&, const std::string&, const CallbackBasePtr&, const Ice::LocalObjectPtr&); void __send(); virtual Ice::ObjectPrx getProxy() const { return _proxy; } private: Ice::ObjectPrx _proxy; }; class ICE_API ConnectionBatchOutgoingAsync : public BatchOutgoingAsync { public: ConnectionBatchOutgoingAsync(const Ice::ConnectionIPtr&, const Ice::CommunicatorPtr&, const InstancePtr&, const std::string&, const CallbackBasePtr&, const Ice::LocalObjectPtr&); void __send(); virtual Ice::ConnectionPtr getConnection() const; private: const Ice::ConnectionIPtr _connection; }; class ICE_API CommunicatorBatchOutgoingAsync : public Ice::AsyncResult { public: CommunicatorBatchOutgoingAsync(const Ice::CommunicatorPtr&, const InstancePtr&, const std::string&, const CallbackBasePtr&, const Ice::LocalObjectPtr&); void flushConnection(const Ice::ConnectionIPtr&); void ready(); private: void check(bool); int _useCount; }; // // Base class for all callbacks. // class ICE_API CallbackBase : public IceUtil::Shared { public: void checkCallback(bool obj, bool cb) { if(!obj) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "callback object cannot be null"); } if(!cb) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "callback cannot be null"); } } virtual void __completed(const ::Ice::AsyncResultPtr&) const = 0; virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr&) = 0; virtual void __sent(const ::Ice::AsyncResultPtr&) const = 0; virtual bool __hasSentCallback() const = 0; }; // // Base class for generic callbacks. // class ICE_API GenericCallbackBase : virtual public CallbackBase { }; // // Generic callback template that requires the caller to down-cast the // proxy and the cookie that are obtained from the AsyncResult. // template class AsyncCallback : public GenericCallbackBase { public: typedef T callback_type; typedef IceUtil::Handle TPtr; typedef void (T::*Callback)(const ::Ice::AsyncResultPtr&); AsyncCallback(const TPtr& instance, Callback cb, Callback sentcb = 0) : callback(instance), completed(cb), sent(sentcb) { checkCallback(instance, cb != 0); } virtual void __completed(const ::Ice::AsyncResultPtr& result) const { (callback.get()->*completed)(result); } virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr&) { return this; // Nothing to do, the cookie is not type-safe. } virtual void __sent(const ::Ice::AsyncResultPtr& result) const { if(sent) { (callback.get()->*sent)(result); } } virtual bool __hasSentCallback() const { return sent != 0; } TPtr callback; Callback completed; Callback sent; }; #ifdef ICE_CPP11 template struct callback_type { static const int value = 1; }; template<> struct callback_type { static const int value = 2; }; template<> struct callback_type { static const int value = 3; }; template struct callable_type { static const int value = 1; }; template struct callable_type::value && !::std::is_bind_expression::value>::type> { template struct TypeCheck; template struct AsyncResultCallback { typedef void (T::*ok)(const ::Ice::AsyncResultPtr&) const; }; template struct ExceptionCallback { typedef void (T::*ok)(const ::Ice::Exception&) const; }; typedef char (&other)[1]; typedef char (&asyncResult)[2]; typedef char (&exception)[3]; template static other check(...); template static asyncResult check(TypeCheck::ok, &T::operator()>*); template static exception check(TypeCheck::ok, &T::operator()>*); enum { value = sizeof(check(0)) }; }; template<> struct callable_type { static const int value = 2; }; template<> struct callable_type { static const int value = 3; }; template struct is_callable { static const bool value = callable_type::value == callback_type::value; }; template class Function : public std::function { public: template Function(T f, typename ::std::enable_if::value>::type* = 0) : std::function(f) { } Function() { } Function(::std::nullptr_t) : ::std::function(nullptr) { } }; class Cpp11AsyncCallback : public GenericCallbackBase { public: Cpp11AsyncCallback(const ::std::function& completed, const ::std::function& sent) : _completed(completed), _sent(sent) { checkCallback(true, completed != nullptr); } virtual void __completed(const ::Ice::AsyncResultPtr& result) const { _completed(result); } virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr&) { return this; // Nothing to do, the cookie is not type-safe. } virtual void __sent(const ::Ice::AsyncResultPtr& result) const { if(_sent != nullptr) { _sent(result); } } virtual bool __hasSentCallback() const { return _sent != nullptr; } ::std::function< void (const ::Ice::AsyncResultPtr&)> _completed; ::std::function< void (const ::Ice::AsyncResultPtr&)> _sent; }; #endif } namespace Ice { typedef IceUtil::Handle< ::IceInternal::GenericCallbackBase> CallbackPtr; template CallbackPtr newCallback(const IceUtil::Handle& instance, void (T::*cb)(const ::Ice::AsyncResultPtr&), void (T::*sentcb)(const ::Ice::AsyncResultPtr&) = 0) { return new ::IceInternal::AsyncCallback(instance, cb, sentcb); } template CallbackPtr newCallback(T* instance, void (T::*cb)(const ::Ice::AsyncResultPtr&), void (T::*sentcb)(const ::Ice::AsyncResultPtr&) = 0) { return new ::IceInternal::AsyncCallback(instance, cb, sentcb); } #ifdef ICE_CPP11 inline CallbackPtr newCallback(const ::IceInternal::Function& completed, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return new ::IceInternal::Cpp11AsyncCallback(completed, sent); } #endif // // Operation callbacks are specified in Proxy.h // // // Interfaces for the deprecated AMI mapping. // class ICE_API AMISentCallback { public: virtual ~AMISentCallback() { } virtual void ice_sent() = 0; }; class ICE_API AMICallbackBase : virtual public IceUtil::Shared { public: virtual void ice_exception(const Exception&) = 0; void __exception(const Exception&); void __sent(bool); }; } #endif Ice-3.5.1/cpp/include/Ice/MetricsAdminI.h0000644000076400007640000004611512223561476016147 0ustar mesmes// ********************************************************************** // // 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 ICE_METRICSADMIN_I_H #define ICE_METRICSADMIN_I_H #include #include #include #include #ifdef _MSC_VER # define ICE_CPP11_REGEXP #endif #ifdef __MINGW32__ // // No regexp support with MinGW, when MinGW C++11 mode is not experimental // we can use std::regex. // #elif defined(ICE_CPP11_REGEXP) # include #else # include #endif #include namespace IceMX { class Updater; template class MetricsHelperT; } namespace IceInternal { class ICE_API MetricsMapI : public IceUtil::Shared { public: class ICE_API RegExp : public IceUtil::Shared { public: RegExp(const std::string&, const std::string&); ~RegExp(); template bool match(const IceMX::MetricsHelperT& helper, bool reject) { std::string value; try { value = helper(_attribute); } catch(const std::exception&) { return !reject; } return match(value); } private: bool match(const std::string&); const std::string _attribute; #ifdef __MINGW32__ // // No regexp support with MinGW, when MinGW C++11 mode is not experimental // we can use std::regex. // #elif defined(ICE_CPP11_REGEXP) # if _MSC_VER < 1600 std::tr1::regex _regex; # else std::regex _regex; # endif #else regex_t _preg; #endif }; typedef IceUtil::Handle RegExpPtr; MetricsMapI(const std::string&, const Ice::PropertiesPtr&); MetricsMapI(const MetricsMapI&); virtual void destroy() = 0; virtual IceMX::MetricsFailuresSeq getFailures() = 0; virtual IceMX::MetricsFailures getFailures(const std::string&) = 0; virtual IceMX::MetricsMap getMetrics() const = 0; virtual MetricsMapI* clone() const = 0; const Ice::PropertyDict& getProperties() const; protected: const Ice::PropertyDict _properties; const std::vector _groupByAttributes; const std::vector _groupBySeparators; const int _retain; const std::vector _accept; const std::vector _reject; }; typedef IceUtil::Handle MetricsMapIPtr; class ICE_API MetricsMapFactory : public Ice::LocalObject { public: MetricsMapFactory(IceMX::Updater*); virtual MetricsMapIPtr create(const std::string&, const Ice::PropertiesPtr&) = 0; void update(); private: IceMX::Updater* _updater; }; typedef IceUtil::Handle MetricsMapFactoryPtr; template class MetricsMapT : public MetricsMapI, private IceUtil::Mutex { public: typedef MetricsType T; typedef IceInternal::Handle TPtr; typedef IceUtil::Handle MetricsMapTPtr; typedef IceMX::MetricsMap MetricsType::* SubMapMember; class EntryT; typedef IceUtil::Handle EntryTPtr; class EntryT : public Ice::LocalObject { public: EntryT(MetricsMapT* map, const TPtr& object, const typename std::list::iterator& p) : _map(map), _object(object), _detachedPos(p) { } ~EntryT() { assert(_object->total > 0); for(typename std::map >::const_iterator p = _subMaps.begin(); p != _subMaps.end(); ++p) { p->second.first->destroy(); // Break cyclic reference counts. } } void failed(const std::string& exceptionName) { IceUtil::Mutex::Lock sync(*_map); ++_object->failures; ++_failures[exceptionName]; } template typename MetricsMapT::EntryTPtr getMatching(const std::string& mapName, const IceMX::MetricsHelperT& helper) { MetricsMapIPtr m; { IceUtil::Mutex::Lock sync(*_map); typename std::map >::iterator p = _subMaps.find(mapName); if(p == _subMaps.end()) { std::pair map = _map->createSubMap(mapName); if(map.first) { p = _subMaps.insert(make_pair(mapName, map)).first; } } if(p == _subMaps.end()) { return 0; } m = p->second.first; } MetricsMapT* map = dynamic_cast*>(m.get()); assert(map); return map->getMatching(helper); } void detach(Ice::Long lifetime) { IceUtil::Mutex::Lock sync(*_map); _object->totalLifetime += lifetime; if(--_object->current == 0) { _map->detached(this); } } template void execute(Function func) { IceUtil::Mutex::Lock sync(*_map); func(_object); } MetricsMapT* getMap() { return _map.get(); } private: IceMX::MetricsFailures getFailures() const { IceMX::MetricsFailures f; f.id = _object->id; f.failures = _failures; return f; } IceMX::MetricsPtr clone() const { TPtr metrics = TPtr::dynamicCast(_object->ice_clone()); for(typename std::map >::const_iterator p = _subMaps.begin(); p != _subMaps.end(); ++p) { metrics.get()->*p->second.second = p->second.first->getMetrics(); } return metrics; } bool isDetached() const { return _object->current == 0; } void attach(const IceMX::MetricsHelperT& helper) { ++_object->total; ++_object->current; helper.initMetrics(_object); } friend class MetricsMapT; MetricsMapTPtr _map; TPtr _object; IceMX::StringIntDict _failures; std::map > _subMaps; typename std::list::iterator _detachedPos; }; MetricsMapT(const std::string& mapPrefix, const Ice::PropertiesPtr& properties, const std::map >& subMaps) : MetricsMapI(mapPrefix, properties), _destroyed(false) { std::vector subMapNames; typename std::map >::const_iterator p; for(p = subMaps.begin(); p != subMaps.end(); ++p) { subMapNames.push_back(p->first); const std::string subMapsPrefix = mapPrefix + "Map."; std::string subMapPrefix = subMapsPrefix + p->first + '.'; if(properties->getPropertiesForPrefix(subMapPrefix).empty()) { if(properties->getPropertiesForPrefix(subMapsPrefix).empty()) { subMapPrefix = mapPrefix; } else { continue; // This sub-map isn't configured. } } _subMaps.insert(std::make_pair(p->first, std::make_pair(p->second.first, p->second.second->create(subMapPrefix, properties)))); } } MetricsMapT(const MetricsMapT& other) : MetricsMapI(other), _destroyed(false) { } virtual void destroy() { Lock sync(*this); _destroyed = true; _objects.clear(); // Break cyclic reference counts _detachedQueue.clear(); // Break cyclic reference counts } virtual IceMX::MetricsMap getMetrics() const { IceMX::MetricsMap objects; Lock sync(*this); for(typename std::map::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { objects.push_back(p->second->clone()); } return objects; } virtual IceMX::MetricsFailuresSeq getFailures() { IceMX::MetricsFailuresSeq failures; Lock sync(*this); for(typename std::map::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { IceMX::MetricsFailures f = p->second->getFailures(); if(!f.failures.empty()) { failures.push_back(f); } } return failures; } virtual IceMX::MetricsFailures getFailures(const std::string& id) { Lock sync(*this); typename std::map::const_iterator p = _objects.find(id); if(p != _objects.end()) { return p->second->getFailures(); } return IceMX::MetricsFailures(); } std::pair createSubMap(const std::string& subMapName) { typename std::map >::const_iterator p = _subMaps.find(subMapName); if(p != _subMaps.end()) { return std::pair(p->second.second->clone(), p->second.first); } return std::pair(MetricsMapIPtr(), static_cast(0)); } EntryTPtr getMatching(const IceMX::MetricsHelperT& helper, const EntryTPtr& previous = EntryTPtr()) { // // Check the accept and reject filters. // for(std::vector::const_iterator p = _accept.begin(); p != _accept.end(); ++p) { if(!(*p)->match(helper, false)) { return 0; } } for(std::vector::const_iterator p = _reject.begin(); p != _reject.end(); ++p) { if((*p)->match(helper, true)) { return 0; } } // // Compute the key from the GroupBy property. // std::string key; try { if(_groupByAttributes.size() == 1) { key = helper(_groupByAttributes.front()); } else { std::ostringstream os; std::vector::const_iterator q = _groupBySeparators.begin(); for(std::vector::const_iterator p = _groupByAttributes.begin(); p != _groupByAttributes.end(); ++p) { os << helper(*p); if(q != _groupBySeparators.end()) { os << *q++; } } key = os.str(); } } catch(const std::exception&) { return 0; } // // Lookup the metrics object. // Lock sync(*this); if(_destroyed) { return 0; } if(previous && previous->_object->id == key) { assert(_objects[key] == previous); return previous; } typename std::map::const_iterator p = _objects.find(key); if(p == _objects.end()) { TPtr t = new T(); t->id = key; p = _objects.insert(typename std::map::value_type( key, new EntryT(this, t, _detachedQueue.end()))).first; } p->second->attach(helper); return p->second; } private: virtual MetricsMapI* clone() const { return new MetricsMapT(*this); } void detached(EntryT* entry) { // This is called with the map mutex locked. if(_retain == 0 || _destroyed) { return; } assert(static_cast(_detachedQueue.size()) <= _retain); // If the entry is already detached and in the queue, just move it to the back. if(entry->_detachedPos != _detachedQueue.end()) { if(entry->_detachedPos != --_detachedQueue.end()) // If not already at the end { _detachedQueue.splice(_detachedQueue.end(), _detachedQueue, entry->_detachedPos); entry->_detachedPos = --_detachedQueue.end(); } return; } // Otherwise, compress the queue by removing entries which are no longer detached. if(static_cast(_detachedQueue.size()) == _retain) { // Remove entries which are no longer detached typename std::list::iterator p = _detachedQueue.begin(); while(p != _detachedQueue.end()) { if(!(*p)->isDetached()) { (*p)->_detachedPos = _detachedQueue.end(); p = _detachedQueue.erase(p); } else { ++p; } } } // If there's still no room, remove the oldest entry (at the front). if(static_cast(_detachedQueue.size()) == _retain) { _objects.erase(_detachedQueue.front()->_object->id); _detachedQueue.pop_front(); } // Add the entry at the back of the queue. entry->_detachedPos = _detachedQueue.insert(_detachedQueue.end(), entry); assert(entry->_detachedPos != _detachedQueue.end()); return; } friend class EntryT; bool _destroyed; std::map _objects; std::list _detachedQueue; std::map > _subMaps; }; template class MetricsMapFactoryT : public MetricsMapFactory { public: MetricsMapFactoryT(IceMX::Updater* updater) : MetricsMapFactory(updater) { } virtual MetricsMapIPtr create(const std::string& mapPrefix, const Ice::PropertiesPtr& properties) { return new MetricsMapT(mapPrefix, properties, _subMaps); } template void registerSubMap(const std::string& subMap, IceMX::MetricsMap MetricsType::* member) { _subMaps[subMap] = std::pair(member, new MetricsMapFactoryT(0)); } private: std::map > _subMaps; }; class MetricsViewI : public IceUtil::Shared { public: MetricsViewI(const std::string&); void destroy(); bool addOrUpdateMap(const Ice::PropertiesPtr&, const std::string&, const MetricsMapFactoryPtr&, const Ice::LoggerPtr&); bool removeMap(const std::string&); IceMX::MetricsView getMetrics(); IceMX::MetricsFailuresSeq getFailures(const std::string&); IceMX::MetricsFailures getFailures(const std::string&, const std::string&); std::vector getMaps() const; MetricsMapIPtr getMap(const std::string&) const; private: const std::string _name; std::map _maps; }; typedef IceUtil::Handle MetricsViewIPtr; class ICE_API MetricsAdminI : public IceMX::MetricsAdmin, public Ice::PropertiesAdminUpdateCallback, private IceUtil::Mutex { public: MetricsAdminI(const ::Ice::PropertiesPtr&, const Ice::LoggerPtr&); void destroy(); void updateViews(); template void registerMap(const std::string& map, IceMX::Updater* updater) { bool updated; MetricsMapFactoryPtr factory; { Lock sync(*this); factory = new MetricsMapFactoryT(updater); _factories[map] = factory; updated = addOrUpdateMap(map, factory); } if(updated) { factory->update(); } } template void registerSubMap(const std::string& map, const std::string& subMap, IceMX::MetricsMap MetricsType::* member) { bool updated; IceUtil::Handle > factory; { Lock sync(*this); std::map::const_iterator p = _factories.find(map); if(p == _factories.end()) { return; } factory = dynamic_cast*>(p->second.get()); factory->template registerSubMap(subMap, member); removeMap(map); updated = addOrUpdateMap(map, factory); } if(updated) { factory->update(); } } void unregisterMap(const std::string&); virtual Ice::StringSeq getMetricsViewNames(Ice::StringSeq&, const ::Ice::Current&); virtual void enableMetricsView(const std::string&, const ::Ice::Current&); virtual void disableMetricsView(const std::string&, const ::Ice::Current&); virtual IceMX::MetricsView getMetricsView(const std::string&, Ice::Long&, const ::Ice::Current&); virtual IceMX::MetricsFailuresSeq getMapMetricsFailures(const std::string&, const std::string&, const ::Ice::Current&); virtual IceMX::MetricsFailures getMetricsFailures(const std::string&, const std::string&, const std::string&, const ::Ice::Current&); std::vector getMaps(const std::string&) const; const Ice::LoggerPtr& getLogger() const; void setProperties(const Ice::PropertiesPtr&); private: MetricsViewIPtr getMetricsView(const std::string&); void updated(const Ice::PropertyDict&); bool addOrUpdateMap(const std::string&, const MetricsMapFactoryPtr&); bool removeMap(const std::string&); std::map _views; std::set _disabledViews; std::map _factories; const Ice::LoggerPtr _logger; Ice::PropertiesPtr _properties; }; typedef IceUtil::Handle MetricsAdminIPtr; }; #endif Ice-3.5.1/cpp/include/Ice/MetricsObserverI.h0000644000076400007640000003525612223561476016712 0ustar mesmes// ********************************************************************** // // 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 ICEMX_METRICSOBSERVER_I_H #define ICEMX_METRICSOBSERVER_I_H #include #include #include #include #include #include #include #include namespace IceMX { template class MetricsHelperT { public: virtual std::string operator()(const std::string&) const = 0; virtual void initMetrics(const IceInternal::Handle&) const { // To be overriden in specialization to initialize state attributes } protected: template class AttributeResolverT { class Resolver { public: Resolver(const std::string& name) : _name(name) { } virtual ~Resolver() { } virtual std::string operator()(const Helper* h) const = 0; protected: std::string _name; }; public: AttributeResolverT() : _default(0) { } ~AttributeResolverT() { for(typename std::map::iterator p = _attributes.begin(); p != _attributes.end();++p) { delete p->second; } } std::string operator()(const Helper* helper, const std::string& attribute) const { typename std::map::const_iterator p = _attributes.find(attribute); if(p == _attributes.end()) { if(attribute == "none") { return ""; } if(_default) { return (helper->*_default)(attribute); } throw std::invalid_argument(attribute); } return (*p->second)(helper); } void setDefault(std::string (Helper::*memberFn)(const std::string&) const) { _default = memberFn; } template void add(const std::string& name, Y Helper::*member) { _attributes.insert(typename std::map::value_type(name, new HelperMemberResolver(name, member))); } template void add(const std::string& name, Y (Helper::*memberFn)() const) { _attributes.insert(typename std::map::value_type(name, new HelperMemberFunctionResolver(name, memberFn))); } template void add(const std::string& name, O (Helper::*getFn)() const, Y I::*member) { _attributes.insert(typename std::map::value_type(name, new MemberResolver(name, getFn, member))); } template void add(const std::string& name, O (Helper::*getFn)() const, Y (I::*memberFn)() const) { _attributes.insert(typename std::map::value_type(name, new MemberFunctionResolver(name, getFn, memberFn))); } private: template class HelperMemberResolver : public Resolver { public: HelperMemberResolver(const std::string& name, Y Helper::*member) : Resolver(name), _member(member) { } virtual std::string operator()(const Helper* r) const { return toString(r->*_member); } private: Y Helper::*_member; }; template class HelperMemberFunctionResolver : public Resolver { public: HelperMemberFunctionResolver(const std::string& name, Y (Helper::*memberFn)() const) : Resolver(name), _memberFn(memberFn) { } virtual std::string operator()(const Helper* r) const { return toString((r->*_memberFn)()); } private: Y (Helper::*_memberFn)() const; }; template class MemberResolver : public Resolver { public: MemberResolver(const std::string& name, O (Helper::*getFn)() const, Y I::*member) : Resolver(name), _getFn(getFn), _member(member) { } virtual std::string operator()(const Helper* r) const { O o = (r->*_getFn)(); I* v = dynamic_cast(IceInternal::ReferenceWrapper::get(o)); if(v) { return toString(v->*_member); } else { throw std::invalid_argument(Resolver::_name); } } private: O (Helper::*_getFn)() const; Y I::*_member; }; template class MemberFunctionResolver : public Resolver { public: MemberFunctionResolver(const std::string& name, O (Helper::*getFn)() const, Y (I::*memberFn)() const) : Resolver(name), _getFn(getFn), _memberFn(memberFn) { } virtual std::string operator()(const Helper* r) const { O o = (r->*_getFn)(); I* v = dynamic_cast(IceInternal::ReferenceWrapper::get(o)); if(v) { return toString((v->*_memberFn)()); } else { throw std::invalid_argument(Resolver::_name); } } private: O (Helper::*_getFn)() const; Y (I::*_memberFn)() const; }; template static std::string toString(const I& v) { std::ostringstream os; os << v; return os.str(); } static const std::string& toString(const std::string& s) { return s; } static std::string toString(const ::Ice::EndpointPtr& e) { return e->toString(); } static std::string toString(const ::Ice::ConnectionPtr& e) { return e->toString(); } static std::string toString(bool v) { return v ? "true" : "false"; } std::map _attributes; std::string (Helper::*_default)(const std::string&) const; }; }; class Updater : public IceUtil::Shared { public: virtual void update() = 0; }; typedef IceUtil::Handle UpdaterPtr; template class UpdaterT : public Updater { public: UpdaterT(T* updater, void (T::*fn)()) : _updater(updater), _fn(fn) { } virtual void update() { (_updater.get()->*_fn)(); } private: const IceUtil::Handle _updater; void (T::*_fn)(); }; template Updater* newUpdater(const IceInternal::Handle& updater, void (T::*fn)()) { if(updater) { return new UpdaterT(updater.get(), fn); } else { return 0; } } template class ObserverT : virtual public ::Ice::Instrumentation::Observer { public: typedef T MetricsType; typedef typename IceInternal::MetricsMapT::EntryTPtr EntryPtrType; typedef std::vector EntrySeqType; ObserverT() : _previousDelay(0) { } virtual void attach() { if(!_watch.isStarted()) { _watch.start(); } } virtual void detach() { ::Ice::Long lifetime = _previousDelay + _watch.stop(); for(typename EntrySeqType::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { (*p)->detach(lifetime); } } virtual void failed(const std::string& exceptionName) { for(typename EntrySeqType::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { (*p)->failed(exceptionName); } } template void forEach(const Function& func) { for(typename EntrySeqType::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { (*p)->execute(func); } } void init(const MetricsHelperT& /*helper*/, EntrySeqType& objects, ObserverT* previous = 0) { _objects.swap(objects); if(previous == 0) { return; } _previousDelay = previous->_previousDelay + previous->_watch.delay(); // // Detach entries from previous observer which are no longer // attached to this new observer. // for(typename EntrySeqType::const_iterator p = previous->_objects.begin(); p != previous->_objects.end(); ++p) { if(find(_objects.begin(), _objects.end(), *p) == _objects.end()) { (*p)->detach(_previousDelay); } } } EntryPtrType getEntry(IceInternal::MetricsMapT* map) { for(typename EntrySeqType::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { if((*p)->getMap() == map) { return *p; } } return 0; } template IceInternal::Handle getObserver(const std::string& mapName, const MetricsHelperT& helper) { std::vector::EntryTPtr> metricsObjects; for(typename EntrySeqType::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { typename IceInternal::MetricsMapT::EntryTPtr e = (*p)->getMatching(mapName, helper); if(e) { metricsObjects.push_back(e); } } if(metricsObjects.empty()) { return 0; } IceInternal::Handle obsv = new ObserverImpl(); obsv->init(helper, metricsObjects); return obsv; } private: EntrySeqType _objects; IceUtilInternal::StopWatch _watch; IceUtil::Int64 _previousDelay; }; template class ObserverFactoryT : public Updater, private IceUtil::Mutex { public: typedef IceUtil::Handle ObserverImplPtrType; typedef typename ObserverImplType::MetricsType MetricsType; typedef std::vector > > MetricsMapSeqType; ObserverFactoryT(const IceInternal::MetricsAdminIPtr& metrics, const std::string& name) : _metrics(metrics), _name(name), _enabled(false) { _metrics->registerMap(name, this); } ~ObserverFactoryT() { if(_metrics) { _metrics->unregisterMap(_name); } } ObserverImplPtrType getObserver(const MetricsHelperT& helper) { IceUtil::Mutex::Lock sync(*this); if(!_metrics) { return 0; } typename ObserverImplType::EntrySeqType metricsObjects; for(typename MetricsMapSeqType::const_iterator p = _maps.begin(); p != _maps.end(); ++p) { typename ObserverImplType::EntryPtrType entry = (*p)->getMatching(helper); if(entry) { metricsObjects.push_back(entry); } } if(metricsObjects.empty()) { return 0; } ObserverImplPtrType obsv = new ObserverImplType(); obsv->init(helper, metricsObjects); return obsv; } template ObserverImplPtrType getObserver(const MetricsHelperT& helper, const ObserverPtrType& observer) { ObserverImplPtrType old = ObserverImplPtrType::dynamicCast(observer); if(!observer || !old) { return getObserver(helper); } IceUtil::Mutex::Lock sync(*this); if(!_metrics) { return 0; } typename ObserverImplType::EntrySeqType metricsObjects; for(typename MetricsMapSeqType::const_iterator p = _maps.begin(); p != _maps.end(); ++p) { typename ObserverImplType::EntryPtrType entry = (*p)->getMatching(helper, old->getEntry(p->get())); if(entry) { metricsObjects.push_back(entry); } } if(metricsObjects.empty()) { old->detach(); return 0; } ObserverImplPtrType obsv = new ObserverImplType(); obsv->init(helper, metricsObjects, old.get()); return obsv; } template void registerSubMap(const std::string& subMap, MetricsMap MetricsType::* member) { assert(_metrics); _metrics->registerSubMap(_name, subMap, member); } bool isEnabled() const { return _enabled; } virtual void update() { UpdaterPtr updater; { IceUtil::Mutex::Lock sync(*this); if(!_metrics) { return; } std::vector maps = _metrics->getMaps(_name); _maps.clear(); for(std::vector::const_iterator p = maps.begin(); p != maps.end(); ++p) { _maps.push_back(IceUtil::Handle >::dynamicCast(*p)); assert(_maps.back()); } _enabled = !_maps.empty(); updater = _updater; } if(updater) { updater->update(); } } void setUpdater(const UpdaterPtr& updater) { IceUtil::Mutex::Lock sync(*this); _updater = updater; } void destroy() { IceUtil::Mutex::Lock sync(*this); _metrics = 0; _maps.clear(); } private: IceInternal::MetricsAdminIPtr _metrics; const std::string _name; MetricsMapSeqType _maps; volatile bool _enabled; UpdaterPtr _updater; }; typedef ObserverT ObserverI; } #endif Ice-3.5.1/cpp/include/Ice/ConnectionAsync.h0000644000076400007640000001124212223561476016545 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECTION_ASYNC_H #define ICE_CONNECTION_ASYNC_H #include #include namespace Ice { template class CallbackNC_Connection_flushBatchRequests : public Callback_Connection_flushBatchRequests_Base, public ::IceInternal::OnewayCallbackNC { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); CallbackNC_Connection_flushBatchRequests(const TPtr& obj, Exception excb, Sent sentcb) : ::IceInternal::OnewayCallbackNC(obj, 0, excb, sentcb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::Ice::ConnectionPtr __con = __result->getConnection(); assert(__con); try { __con->end_flushBatchRequests(__result); assert(false); } catch(::Ice::Exception& ex) { ::IceInternal::CallbackNC::__exception(__result, ex); } } }; #ifdef ICE_CPP11 class Cpp11FnCallbackNC_Connection_flushBatchRequests : virtual public ::IceInternal::Cpp11FnCallbackNC { public: Cpp11FnCallbackNC_Connection_flushBatchRequests(const ::IceInternal::Function& excb, const ::IceInternal::Function& sentcb) : ::IceInternal::Cpp11FnCallbackNC(excb, sentcb) { CallbackBase::checkCallback(true, excb != nullptr); } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::Ice::ConnectionPtr __con = __result->getConnection(); assert(__con); try { __con->end_flushBatchRequests(__result); assert(false); } catch(::Ice::Exception& ex) { ::IceInternal::Cpp11FnCallbackNC::__exception(__result, ex); } } }; #endif template Callback_Connection_flushBatchRequestsPtr newCallback_Connection_flushBatchRequests(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Connection_flushBatchRequests(instance, excb, sentcb); } template Callback_Connection_flushBatchRequestsPtr newCallback_Connection_flushBatchRequests(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Connection_flushBatchRequests(instance, excb, sentcb); } template class Callback_Connection_flushBatchRequests : public Callback_Connection_flushBatchRequests_Base, public ::IceInternal::OnewayCallback { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); typedef void (T::*Sent)(bool , const CT&); Callback_Connection_flushBatchRequests(const TPtr& obj, Exception excb, Sent sentcb) : ::IceInternal::OnewayCallback(obj, 0, excb, sentcb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::Ice::ConnectionPtr __con = __result->getConnection(); assert(__con); try { __con->end_flushBatchRequests(__result); assert(false); } catch(::Ice::Exception& ex) { ::IceInternal::Callback::__exception(__result, ex); } } }; template Callback_Connection_flushBatchRequestsPtr newCallback_Connection_flushBatchRequests(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Connection_flushBatchRequests(instance, excb, sentcb); } template Callback_Connection_flushBatchRequestsPtr newCallback_Connection_flushBatchRequests(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Connection_flushBatchRequests(instance, excb, sentcb); } } #endif Ice-3.5.1/cpp/include/Ice/Config.h0000644000076400007640000000275212223561476014663 0ustar mesmes// ********************************************************************** // // 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 ICE_CONFIG_H #define ICE_CONFIG_H #include // // Some include files we need almost everywhere // #include #include #include #include #include #include #ifndef ICE_OS_WINRT # if defined(_WIN32) # include # else # include # include # include # endif #endif // // Define the Ice and IceInternal namespace, so that we can use the following // everywhere in our code: // // using namespace Ice; // using namespace IceInternal; // namespace Ice { } namespace IceInternal { } #ifndef ICE_API # ifdef ICE_API_EXPORTS # define ICE_API ICE_DECLSPEC_EXPORT # else # define ICE_API ICE_DECLSPEC_IMPORT # endif #endif namespace Ice { typedef unsigned char Byte; typedef short Short; typedef int Int; typedef IceUtil::Int64 Long; typedef float Float; typedef double Double; } namespace IceInternal { // TODO: Should not be inline, this is not performance critical. #ifdef _WIN32 inline int getSystemErrno() { return GetLastError(); } #else inline int getSystemErrno() { return errno; } #endif } #endif Ice-3.5.1/cpp/include/Ice/Outgoing.h0000644000076400007640000001253412223561476015250 0ustar mesmes// ********************************************************************** // // 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 ICE_OUTGOING_H #define ICE_OUTGOING_H #include #include #include #include #include #include #include #include #include #include namespace Ice { class LocalException; } namespace IceInternal { // // An exception wrapper, which is used for local exceptions that // require special retry considerations. // class ICE_API LocalExceptionWrapper { public: LocalExceptionWrapper(const Ice::LocalException&, bool); LocalExceptionWrapper(const LocalExceptionWrapper&); const Ice::LocalException* get() const; // // If true, always repeat the request. Don't take retry settings // or "at-most-once" guarantees into account. // // If false, only repeat the request if the retry settings allow // to do so, and if "at-most-once" does not need to be guaranteed. // bool retry() const; static void throwWrapper(const ::std::exception&); private: const LocalExceptionWrapper& operator=(const LocalExceptionWrapper&); IceUtil::UniquePtr _ex; bool _retry; }; class ICE_API OutgoingMessageCallback : private IceUtil::noncopyable { public: virtual ~OutgoingMessageCallback() { } virtual void sent(bool) = 0; virtual void finished(const Ice::LocalException&, bool) = 0; }; class ICE_API Outgoing : public OutgoingMessageCallback { public: Outgoing(RequestHandler*, const std::string&, Ice::OperationMode, const Ice::Context*, InvocationObserver&); ~Outgoing(); bool invoke(); // Returns true if ok, false if user exception. void abort(const Ice::LocalException&); virtual void sent(bool); virtual void finished(BasicStream&); void finished(const Ice::LocalException&, bool); // Inlined for speed optimization. BasicStream* os() { return &_os; } BasicStream* startReadParams() { _is.startReadEncaps(); return &_is; } void endReadParams() { _is.endReadEncaps(); } void readEmptyParams() { _is.skipEmptyEncaps(); } void readParamEncaps(const Ice::Byte*& encaps, Ice::Int& sz) { _is.readEncaps(encaps, sz); } BasicStream* startWriteParams(Ice::FormatType format) { _os.startWriteEncaps(_encoding, format); return &_os; } void endWriteParams() { _os.endWriteEncaps(); } void writeEmptyParams() { _os.writeEmptyEncaps(_encoding); } void writeParamEncaps(const Ice::Byte* encaps, Ice::Int size) { if(size == 0) { _os.writeEmptyEncaps(_encoding); } else { _os.writeEncaps(encaps, size); } } bool hasResponse() { return !_is.b.empty(); } void throwUserException(); void attachRemoteObserver(const Ice::ConnectionInfoPtr& c, const Ice::EndpointPtr& endpt, Ice::Int requestId, Ice::Int size) { _remoteObserver.attach(_observer.getRemoteObserver(c, endpt, requestId, size)); } private: // // Optimization. The request handler and the reference may not be // deleted while a stack-allocated Outgoing still holds it. // RequestHandler* _handler; IceUtil::UniquePtr _exception; InvocationObserver& _observer; ObserverHelperT _remoteObserver; enum { StateUnsent, StateInProgress, StateOK, StateUserException, StateLocalException, StateFailed } _state; Ice::EncodingVersion _encoding; BasicStream _is; BasicStream _os; bool _sent; // // NOTE: we use an attribute for the monitor instead of inheriting // from the monitor template. Otherwise, the template would be // exported from the DLL on Windows and could cause linker errors // because of multiple definition of IceUtil::Monitor, // see bug 1541. // IceUtil::Monitor _monitor; }; class BatchOutgoing : public OutgoingMessageCallback { public: BatchOutgoing(RequestHandler*, InvocationObserver&); BatchOutgoing(Ice::ConnectionI*, Instance*, InvocationObserver&); void invoke(); virtual void sent(bool); virtual void finished(const Ice::LocalException&, bool); BasicStream* os() { return &_os; } void attachRemoteObserver(const Ice::ConnectionInfoPtr& connection, const Ice::EndpointPtr& endpt, Ice::Int sz) { _remoteObserver.attach(_observer.getRemoteObserver(connection, endpt, 0, sz)); } private: IceUtil::Monitor _monitor; RequestHandler* _handler; Ice::ConnectionI* _connection; bool _sent; IceUtil::UniquePtr _exception; BasicStream _os; InvocationObserver& _observer; ObserverHelperT _remoteObserver; }; } #endif Ice-3.5.1/cpp/include/Ice/StreamHelpers.h0000644000076400007640000006207412223561476016237 0ustar mesmes// ********************************************************************** // // 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 ICE_STREAM_TRAITS_H #define ICE_STREAM_TRAITS_H #include #include #include namespace Ice { // The stream helper category // Allows streams to select the desired StreamHelper for a given streamable object; // see StreamableTraits below. // typedef int StreamHelperCategory; const StreamHelperCategory StreamHelperCategoryUnknown = 0; const StreamHelperCategory StreamHelperCategoryBuiltin = 1; const StreamHelperCategory StreamHelperCategoryStruct = 2; const StreamHelperCategory StreamHelperCategoryStructClass = 3; // struct with cpp:class metadata const StreamHelperCategory StreamHelperCategoryEnum = 4; const StreamHelperCategory StreamHelperCategorySequence = 5; const StreamHelperCategory StreamHelperCategoryDictionary = 6; const StreamHelperCategory StreamHelperCategoryProxy = 7; const StreamHelperCategory StreamHelperCategoryClass = 8; const StreamHelperCategory StreamHelperCategoryUserException = 9; // // The optional format. // // Optional data members and parameters are encoded with a specific // optional format. This optional format describes how the data is encoded // and how it can be skipped by the unmarshaling code if the optional // isn't known to the receiver. // enum OptionalFormat { OptionalFormatF1 = 0, // Fixed 1-byte encoding OptionalFormatF2 = 1, // Fixed 2 bytes encoding OptionalFormatF4 = 2, // Fixed 4 bytes encoding OptionalFormatF8 = 3, // Fixed 8 bytes encoding OptionalFormatSize = 4, // "Size encoding" on 1 to 5 bytes, e.g. enum, class identifier OptionalFormatVSize = 5, // "Size encoding" on 1 to 5 bytes followed by data, e.g. string, fixed size // struct, or containers whose size can be computed prior to marshaling OptionalFormatFSize = 6, // Fixed size on 4 bytes followed by data, e.g. variable-size struct, container. OptionalFormatClass = 7 }; // // Is the provided type a container? // For now, the implementation only checks if there is a T::iterator typedef // using SFINAE // template struct IsContainer { template static char test(typename C::iterator*); template static long test(...); static const bool value = sizeof(test(0)) == sizeof(char); }; // // Is the provided type a map? // For now, the implementation only checks if there is a T::mapped_type typedef // using SFINAE // template struct IsMap { template static char test(typename C::mapped_type*); template static long test(...); static const bool value = IsContainer::value && sizeof(test(0)) == sizeof(char); }; // // Base traits template. // Types with no specialized trait use this trait. // template struct StreamableTraits { static const StreamHelperCategory helper = IsMap::value ? StreamHelperCategoryDictionary : (IsContainer::value ? StreamHelperCategorySequence : StreamHelperCategoryUnknown); // // When extracting a sequence from a stream, we can ensure the // stream has at least StreamableTraits::minWireSize * size bytes // For containers, the minWireSize is 1 (just 1 byte for an empty container). // static const int minWireSize = 1; // // Is this type encoded on a fixed number of bytes? // Used only for marshaling/unmarshaling optional data members and parameters. // static const bool fixedLength = false; }; // // StreamableTraits specialization for array / range mapped sequences // The type can be a std::pair or a // std::pair, std::pair > // template struct StreamableTraits< ::std::pair > { static const StreamHelperCategory helper = StreamHelperCategorySequence; static const int minWireSize = 1; static const bool fixedLength = false; }; // // StreamableTraits specialization for user exceptions. // template<> struct StreamableTraits { static const StreamHelperCategory helper = StreamHelperCategoryUserException; // // There is no sequence/dictionary of UserException (so no need for minWireSize) // and no optional UserException (so no need for fixedLength) // }; // // StreamableTraits specialization for builtins (these are needed for sequence // marshaling to figure out the minWireSize of each built-in). // template<> struct StreamableTraits { static const StreamHelperCategory helper = StreamHelperCategoryBuiltin; static const int minWireSize = 1; static const bool fixedLength = true; }; template<> struct StreamableTraits { static const StreamHelperCategory helper = StreamHelperCategoryBuiltin; static const int minWireSize = 1; static const bool fixedLength = true; }; template<> struct StreamableTraits { static const StreamHelperCategory helper = StreamHelperCategoryBuiltin; static const int minWireSize = 2; static const bool fixedLength = true; }; template<> struct StreamableTraits { static const StreamHelperCategory helper = StreamHelperCategoryBuiltin; static const int minWireSize = 4; static const bool fixedLength = true; }; template<> struct StreamableTraits { static const StreamHelperCategory helper = StreamHelperCategoryBuiltin; static const int minWireSize = 8; static const bool fixedLength = true; }; template<> struct StreamableTraits { static const StreamHelperCategory helper = StreamHelperCategoryBuiltin; static const int minWireSize = 4; static const bool fixedLength = true; }; template<> struct StreamableTraits { static const StreamHelperCategory helper = StreamHelperCategoryBuiltin; static const int minWireSize = 8; static const bool fixedLength = true; }; template<> struct StreamableTraits< ::std::string> { static const StreamHelperCategory helper = StreamHelperCategoryBuiltin; static const int minWireSize = 1; static const bool fixedLength = false; }; template<> struct StreamableTraits< ::std::wstring> { static const StreamHelperCategory helper = StreamHelperCategoryBuiltin; static const int minWireSize = 1; static const bool fixedLength = false; }; // // vector is a special type in C++: the streams are responsible // to handle it like a built-in type. // template<> struct StreamableTraits< ::std::vector > { static const StreamHelperCategory helper = StreamHelperCategoryBuiltin; static const int minWireSize = 1; static const bool fixedLength = false; }; template struct StreamableTraits< ::IceInternal::ProxyHandle > { static const StreamHelperCategory helper = StreamHelperCategoryProxy; static const int minWireSize = 2; static const bool fixedLength = false; }; template struct StreamableTraits< ::IceInternal::Handle > { static const StreamHelperCategory helper = StreamHelperCategoryClass; static const int minWireSize = 1; static const bool fixedLength = false; }; // // StreamHelper templates used by streams to read and write data. // // Base StreamHelper template; it must be specialized for each type template struct StreamHelper; // Helper for builtins, delegates read/write to the stream. template struct StreamHelper { template static inline void write(S* stream, const T& v) { stream->write(v); } template static inline void read(S* stream, T& v) { stream->read(v); } }; // "helpers" for the StreamHelper below // We generate specializations, which can be instantiated explicitly and exported from DLLs // template struct StreamWriter; template struct StreamReader; // Helper for structs template struct StreamHelper { template static inline void write(S* stream, const T& v) { StreamWriter::write(stream, v); } template static inline void read(S* stream, T& v) { StreamReader::read(stream, v); } }; // Helper for class structs template struct StreamHelper { template static inline void write(S* stream, const T& v) { StreamWriter::write(stream, v); } template static inline void read(S* stream, T& v) { v = new typename T::element_type; StreamReader::read(stream, v); } }; // Helper for enums template struct StreamHelper { template static inline void write(S* stream, const T& v) { if(static_cast(v) < StreamableTraits::minValue || static_cast(v) > StreamableTraits::maxValue) { IceInternal::Ex::throwMarshalException(__FILE__, __LINE__, "enumerator out of range"); } stream->writeEnum(static_cast(v), StreamableTraits::maxValue); } template static inline void read(S* stream, T& v) { Int value = stream->readEnum(StreamableTraits::maxValue); if(value < StreamableTraits::minValue || value > StreamableTraits::maxValue) { IceInternal::Ex::throwMarshalException(__FILE__, __LINE__, "enumerator out of range"); } v = static_cast(value); } }; // Helper for sequences template struct StreamHelper { template static inline void write(S* stream, const T& v) { stream->writeSize(static_cast(v.size())); for(typename T::const_iterator p = v.begin(); p != v.end(); ++p) { stream->write(*p); } } template static inline void read(S* stream, T& v) { Int sz = stream->readAndCheckSeqSize(StreamableTraits::minWireSize); T(sz).swap(v); for(typename T::iterator p = v.begin(); p != v.end(); ++p) { stream->read(*p); } } }; // Helper for array and range:array custom sequence parameters template struct StreamHelper, StreamHelperCategorySequence> { template static inline void write(S* stream, const std::pair& v) { stream->write(v.first, v.second); } template static inline void read(S* stream, std::pair& v) { stream->read(v); } }; // Helper for range custom sequence parameters template struct StreamHelper, StreamHelperCategorySequence> { template static inline void write(S* stream, const std::pair& v) { stream->writeSize(static_cast(IceUtilInternal::distance(v.first, v.second))); for(T p = v.first; p != v.second; ++p) { stream->write(*p); } } template static inline void read(S* stream, std::pair& v) { stream->read(v); } }; template<> struct StreamHelper::const_iterator, ::std::vector::const_iterator>, StreamHelperCategorySequence> { template static inline void write(S* stream, const std::pair< ::std::vector::const_iterator, ::std::vector::const_iterator>& v) { stream->writeSize(static_cast(IceUtilInternal::distance(v.first, v.second))); for(::std::vector::const_iterator p = v.first; p != v.second; ++p) { stream->write(static_cast(*p)); } } // no read: only used for marshaling }; // Helper for zero-copy array sequence parameters template struct StreamHelper, std::pair >, StreamHelperCategorySequence> { template static inline void read(S* stream, std::pair, std::pair >& v) { stream->read(v.second, v.first); } // no write: only used for unmarshaling }; // Helper for dictionaries template struct StreamHelper { template static inline void write(S* stream, const T& v) { stream->writeSize(static_cast(v.size())); for(typename T::const_iterator p = v.begin(); p != v.end(); ++p) { stream->write(p->first); stream->write(p->second); } } template static inline void read(S* stream, T& v) { Int sz = stream->readSize(); v.clear(); while(sz--) { typename T::value_type p; stream->read(const_cast(p.first)); typename T::iterator i = v.insert(v.end(), p); stream->read(i->second); } } }; // Helper for user exceptions template struct StreamHelper { template static inline void write(S* stream, const T& v) { stream->writeException(v); } // no read: only used for marshaling }; // Helper for proxies template struct StreamHelper { template static inline void write(S* stream, const T& v) { stream->write(v); } template static inline void read(S* stream, T& v) { stream->read(v); } }; // Helper for classes template struct StreamHelper { template static inline void write(S* stream, const T& v) { stream->write(v); } template static inline void read(S* stream, T& v) { stream->read(v); } }; // // Helpers to read/write optional attributes or members. // // // Extract / compute the optionalFormat // This is used _only_ for the base StreamOptionalHelper below // /!\ Do not use in StreamOptionalHelper specializations, and do // not provide specialization not handled by the base StreamOptionalHelper // template struct GetOptionalFormat; template<> struct GetOptionalFormat { static const OptionalFormat value = OptionalFormatF1; }; template<> struct GetOptionalFormat { static const OptionalFormat value = OptionalFormatF2; }; template<> struct GetOptionalFormat { static const OptionalFormat value = OptionalFormatF4; }; template<> struct GetOptionalFormat { static const OptionalFormat value = OptionalFormatF8; }; template<> struct GetOptionalFormat { static const OptionalFormat value = OptionalFormatVSize; }; template<> struct GetOptionalFormat { static const OptionalFormat value = OptionalFormatClass; }; template struct GetOptionalFormat { static const OptionalFormat value = OptionalFormatSize; }; // Base helper: simply read/write the data template struct StreamOptionalHelper { typedef StreamableTraits Traits; // If this optionalFormat fails to compile, you must either define your specialization // for GetOptionalFormat (in which case the optional data will be marshaled/unmarshaled // with straight calls to write/read on the stream), or define your own // StreamOptionalHelper specialization (which gives you more control over marshaling) // static const OptionalFormat optionalFormat = GetOptionalFormat::value; template static inline void write(S* stream, const T& v) { stream->write(v); } template static inline void read(S* stream, T& v) { stream->read(v); } }; // Helper to write fixed size structs template struct StreamOptionalHelper { static const OptionalFormat optionalFormat = OptionalFormatVSize; template static inline void write(S* stream, const T& v) { stream->writeSize(StreamableTraits::minWireSize); stream->write(v); } template static inline void read(S* stream, T& v) { stream->skipSize(); stream->read(v); } }; // Helper to write variable size structs template struct StreamOptionalHelper { static const OptionalFormat optionalFormat = OptionalFormatFSize; template static inline void write(S* stream, const T& v) { stream->write(static_cast(0)); typename S::size_type p = stream->pos(); stream->write(v); stream->rewrite(static_cast(stream->pos() - p), p - 4); } template static inline void read(S* stream, T& v) { stream->skip(4); stream->read(v); } }; // Class structs are encoded like structs template struct StreamOptionalHelper : StreamOptionalHelper { }; // Optional proxies are encoded like variable size structs, using the FSize encoding template struct StreamOptionalHelper : StreamOptionalHelper { }; // // Helpers to read/write optional sequences or dictionaries // template struct StreamOptionalContainerHelper; // // Encode containers of variable size elements with the FSize optional // type, since we can't easily figure out the size of the container // before encoding. This is the same encoding as variable size structs // so we just re-use its implementation. // template struct StreamOptionalContainerHelper { static const OptionalFormat optionalFormat = OptionalFormatFSize; template static inline void write(S* stream, const T& v, Int) { StreamOptionalHelper::write(stream, v); } template static inline void read(S* stream, T& v) { StreamOptionalHelper::read(stream, v); } }; // // Encode containers of fixed size elements with the VSize optional // type since we can figure out the size of the container before // encoding. // template struct StreamOptionalContainerHelper { static const OptionalFormat optionalFormat = OptionalFormatVSize; template static inline void write(S* stream, const T& v, Int n) { // // The container size is the number of elements * the size of // an element and the size-encoded number of elements (1 or // 5 depending on the number of elements). // stream->writeSize(sz * n + (n < 255 ? 1 : 5)); stream->write(v); } template static inline void read(S* stream, T& v) { stream->skipSize(); stream->read(v); } }; // // Optimization: containers of 1 byte elements are encoded with the // VSize optional type. There's no need to encode an additional size // for those, the number of elements of the container can be used to // skip the optional. // template struct StreamOptionalContainerHelper { static const OptionalFormat optionalFormat = OptionalFormatVSize; template static inline void write(S* stream, const T& v, Int) { stream->write(v); } template static inline void read(S* stream, T& v) { stream->read(v); } }; // // Helper to write sequences, delegates to the optional container // helper template partial specializations. // template struct StreamOptionalHelper { typedef typename T::value_type E; static const int size = StreamableTraits::minWireSize; static const bool fixedLength = StreamableTraits::fixedLength; // The optional type of a sequence depends on whether or not elements are fixed // or variable size elements and their size. static const OptionalFormat optionalFormat = StreamOptionalContainerHelper::optionalFormat; template static inline void write(S* stream, const T& v) { StreamOptionalContainerHelper::write(stream, v, static_cast(v.size())); } template static inline void read(S* stream, T& v) { StreamOptionalContainerHelper::read(stream, v); } }; template struct StreamOptionalHelper, StreamHelperCategorySequence, false> { typedef std::pair P; static const int size = StreamableTraits::minWireSize; static const bool fixedLength = StreamableTraits::fixedLength; // The optional type of a sequence depends on whether or not elements are fixed // or variable size elements and their size. static const OptionalFormat optionalFormat = StreamOptionalContainerHelper::optionalFormat; template static inline void write(S* stream, const P& v) { Int n = static_cast(v.second - v.first); StreamOptionalContainerHelper::write(stream, v, n); } template static inline void read(S* stream, P& v) { StreamOptionalContainerHelper::read(stream, v); } }; template struct StreamOptionalHelper, StreamHelperCategorySequence, false> { typedef std::pair P; static const int size = StreamableTraits::minWireSize; static const bool fixedLength = StreamableTraits::fixedLength; // The optional type of a sequence depends on whether or not elements are fixed // or variable size elements and their size. static const OptionalFormat optionalFormat = StreamOptionalContainerHelper::optionalFormat; template static inline void write(S* stream, const P& v) { Int n = static_cast(v.second - v.first); StreamOptionalContainerHelper::write(stream, v, n); } template static inline void read(S* stream, P& v) { StreamOptionalContainerHelper::read(stream, v); } }; template struct StreamOptionalHelper, std::pair >, StreamHelperCategorySequence, false> { typedef std::pair, std::pair > P; static const int size = StreamableTraits::minWireSize; static const bool fixedLength = StreamableTraits::fixedLength; // The optional type of a sequence depends on whether or not elements are fixed // or variable size elements and their size. static const OptionalFormat optionalFormat = StreamOptionalContainerHelper::optionalFormat; template static inline void read(S* stream, P& v) { StreamOptionalContainerHelper::read(stream, v); } // no write: only used for unmarshaling }; // // Helper to write dictionaries, delegates to the optional container // helper template partial specializations. // template struct StreamOptionalHelper { typedef typename T::key_type K; typedef typename T::mapped_type V; static const int size = StreamableTraits::minWireSize + StreamableTraits::minWireSize; static const bool fixedLength = StreamableTraits::fixedLength && StreamableTraits::fixedLength; // The optional type of a dictionary depends on whether or not elements are fixed // or variable size elements. static const OptionalFormat optionalFormat = StreamOptionalContainerHelper::optionalFormat; template static inline void write(S* stream, const T& v) { StreamOptionalContainerHelper::write(stream, v, static_cast(v.size())); } template static inline void read(S* stream, T& v) { StreamOptionalContainerHelper::read(stream, v); } }; } #endif Ice-3.5.1/cpp/include/Ice/Object.h0000644000076400007640000001141212223561476014655 0ustar mesmes// ********************************************************************** // // 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 ICE_OBJECT_H #define ICE_OBJECT_H #include #include #include #include #include #include #include #include #include namespace IceInternal { class Incoming; class BasicStream; class Direct; } namespace Ice { enum DispatchStatus { DispatchOK, DispatchUserException, DispatchAsync }; class ICE_API DispatchInterceptorAsyncCallback : public virtual IceUtil::Shared { public: virtual bool response(bool) = 0; virtual bool exception(const std::exception&) = 0; virtual bool exception() = 0; }; typedef IceUtil::Handle DispatchInterceptorAsyncCallbackPtr; class ICE_API Request { public: virtual ~Request() {} virtual bool isCollocated() = 0; virtual const Current& getCurrent() = 0; }; class ICE_API Object : virtual public IceUtil::Shared { public: virtual bool operator==(const Object&) const; virtual bool operator<(const Object&) const; virtual ICE_DEPRECATED_API Int ice_getHash() const; virtual bool ice_isA(const std::string&, const Current& = Current()) const; DispatchStatus ___ice_isA(IceInternal::Incoming&, const Current&); virtual void ice_ping(const Current& = Current()) const; DispatchStatus ___ice_ping(IceInternal::Incoming&, const Current&); virtual std::vector< std::string> ice_ids(const Current& = Current()) const; DispatchStatus ___ice_ids(IceInternal::Incoming&, const Current&); virtual const std::string& ice_id(const Current& = Current()) const; DispatchStatus ___ice_id(IceInternal::Incoming&, const Current&); virtual Int ice_operationAttributes(const std::string&) const; static const std::string& ice_staticId(); virtual ObjectPtr ice_clone() const; virtual void ice_preMarshal(); virtual void ice_postUnmarshal(); static std::string __all[]; virtual DispatchStatus ice_dispatch(Ice::Request&, const DispatchInterceptorAsyncCallbackPtr& = 0); virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&); virtual DispatchStatus __collocDispatch(IceInternal::Direct&); virtual void __write(IceInternal::BasicStream*) const; virtual void __read(IceInternal::BasicStream*); virtual void __write(const OutputStreamPtr&) const; virtual void __read(const InputStreamPtr&); // // Virtual methods to support garbage collection of Slice class instances. These // methods are overriden by Slice classes which can have cycles. // virtual void __addObject(IceInternal::GCCountMap&) {} virtual bool __usesGC() { return false; } void __decRefUnsafe() { --_ref; } protected: Object() {} // This class is abstract. virtual ~Object() {} virtual void __writeImpl(IceInternal::BasicStream*) const {} virtual void __readImpl(IceInternal::BasicStream*) {} virtual void __writeImpl(const OutputStreamPtr&) const; virtual void __readImpl(const InputStreamPtr&); static void __checkMode(OperationMode, OperationMode); }; class ICE_API Blobject : virtual public Object { public: // // Returns true if ok, false if user exception. // virtual bool ice_invoke(const std::vector&, std::vector&, const Current&) = 0; virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&); }; class ICE_API BlobjectArray : virtual public Object { public: // // Returns true if ok, false if user exception. // virtual bool ice_invoke(const std::pair&, std::vector&, const Current&) = 0; virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&); }; class ICE_API BlobjectAsync : virtual public Object { public: virtual void ice_invoke_async(const AMD_Object_ice_invokePtr&, const std::vector&, const Current&) = 0; virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&); }; class ICE_API BlobjectArrayAsync : virtual public Object { public: virtual void ice_invoke_async(const AMD_Object_ice_invokePtr&, const std::pair&, const Current&) = 0; virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&); }; ICE_API void ice_writeObject(const OutputStreamPtr&, const ObjectPtr&); ICE_API void ice_readObject(const InputStreamPtr&, ObjectPtr&); } #endif Ice-3.5.1/cpp/include/Ice/Functional.h0000644000076400007640000001044012223561476015551 0ustar mesmes// ********************************************************************** // // 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 ICE_FUNCTIONAL_H #define ICE_FUNCTIONAL_H #include #include // ---------------------------------------------------------------------- // Inline functions that return function objects that work with // IceInternal::Handle // ---------------------------------------------------------------------- namespace Ice { template inline ::IceUtilInternal::MemFun > memFun(R (T::*p)(void)) { return ::IceUtilInternal::MemFun >(p); } template inline ::IceUtilInternal::MemFun1, A> memFun1(R (T::*p)(A)) { return ::IceUtilInternal::MemFun1, A>(p); } template inline ::IceUtilInternal::VoidMemFun > voidMemFun(void (T::*p)(void)) { return ::IceUtilInternal::VoidMemFun >(p); } template inline ::IceUtilInternal::VoidMemFun1, A> voidMemFun1(void (T::*p)(A)) { return ::IceUtilInternal::VoidMemFun1, A>(p); } template inline ::IceUtilInternal::SecondMemFun > secondMemFun(R (T::*p)(void)) { return ::IceUtilInternal::SecondMemFun >(p); } template inline ::IceUtilInternal::SecondMemFun1, A> secondMemFun1(R (T::*p)(A)) { return ::IceUtilInternal::SecondMemFun1, A>(p); } template inline ::IceUtilInternal::SecondVoidMemFun > secondVoidMemFun(void (T::*p)(void)) { return ::IceUtilInternal::SecondVoidMemFun >(p); } template inline ::IceUtilInternal::SecondVoidMemFun1, A> secondVoidMemFun1(void (T::*p)(A)) { return ::IceUtilInternal::SecondVoidMemFun1, A>(p); } template inline ::IceUtilInternal::ConstMemFun > constMemFun(R (T::*p)(void) const) { return ::IceUtilInternal::ConstMemFun >(p); } template inline ::IceUtilInternal::ConstMemFun1, A> constMemFun1(R (T::*p)(A) const) { return ::IceUtilInternal::ConstMemFun1, A>(p); } template inline ::IceUtilInternal::ConstVoidMemFun > constVoidMemFun(void (T::*p)(void) const) { return ::IceUtilInternal::ConstVoidMemFun >(p); } template inline ::IceUtilInternal::ConstVoidMemFun1, A> constVoidMemFun1(void (T::*p)(A) const) { return ::IceUtilInternal::ConstVoidMemFun1, A>(p); } template inline ::IceUtilInternal::SecondConstMemFun > secondConstMemFun(R (T::*p)(void) const) { return ::IceUtilInternal::SecondConstMemFun >(p); } template inline ::IceUtilInternal::SecondConstMemFun1, A> secondConstMemFun1(R (T::*p)(A) const) { return ::IceUtilInternal::SecondConstMemFun1, A>(p); } template inline ::IceUtilInternal::SecondConstVoidMemFun > secondConstVoidMemFun(void (T::*p)(void) const) { return ::IceUtilInternal::SecondConstVoidMemFun >(p); } template inline ::IceUtilInternal::SecondConstVoidMemFun1, A> secondConstVoidMemFun1(void (T::*p)(A) const) { return ::IceUtilInternal::SecondConstVoidMemFun1, A>(p); } } #endif Ice-3.5.1/cpp/include/Ice/UserExceptionFactory.h0000644000076400007640000000141312223561476017574 0ustar mesmes// ********************************************************************** // // 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 ICE_USER_EXCEPTION_FACTORY_H #define ICE_USER_EXCEPTION_FACTORY_H #include #include #include namespace IceInternal { class ICE_API UserExceptionFactory : public IceUtil::Shared { public: virtual void createAndThrow(const ::std::string&) = 0; virtual ~UserExceptionFactory() {} }; typedef ::IceUtil::Handle UserExceptionFactoryPtr; } #endif Ice-3.5.1/cpp/include/Ice/ObjectFactoryManagerF.h0000644000076400007640000000121012223561476017601 0ustar mesmes// ********************************************************************** // // 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 ICE_OBJECT_FACTORY_MANAGER_F_H #define ICE_OBJECT_FACTORY_MANAGER_F_H #include #include namespace IceInternal { class ObjectFactoryManager; IceUtil::Shared* upCast(ObjectFactoryManager*); typedef Handle ObjectFactoryManagerPtr; } #endif Ice-3.5.1/cpp/include/Ice/CommunicatorAsync.h0000644000076400007640000001142212223561476017106 0ustar mesmes// ********************************************************************** // // 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 ICE_COMMUNICATOR_ASYNC_H #define ICE_COMMUNICATOR_ASYNC_H #include namespace Ice { template class CallbackNC_Communicator_flushBatchRequests : public Callback_Communicator_flushBatchRequests_Base, public ::IceInternal::OnewayCallbackNC { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); CallbackNC_Communicator_flushBatchRequests(const TPtr& obj, Exception excb, Sent sentcb) : ::IceInternal::OnewayCallbackNC(obj, 0, excb, sentcb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::Ice::CommunicatorPtr __com = __result->getCommunicator(); assert(__com); try { __com->end_flushBatchRequests(__result); assert(false); } catch(::Ice::Exception& ex) { ::IceInternal::CallbackNC::__exception(__result, ex); } } }; #ifdef ICE_CPP11 class Cpp11FnCallbackNC_Communicator_flushBatchRequests : virtual public ::IceInternal::Cpp11FnCallbackNC { public: Cpp11FnCallbackNC_Communicator_flushBatchRequests( const ::IceInternal::Function& excb, const ::IceInternal::Function& sentcb) : ::IceInternal::Cpp11FnCallbackNC(excb, sentcb) { CallbackBase::checkCallback(true, excb != nullptr); } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::Ice::CommunicatorPtr __com = __result->getCommunicator(); assert(__com); try { __com->end_flushBatchRequests(__result); assert(false); } catch(::Ice::Exception& ex) { ::IceInternal::Cpp11FnCallbackNC::__exception(__result, ex); } } }; #endif template Callback_Communicator_flushBatchRequestsPtr newCallback_Communicator_flushBatchRequests(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Communicator_flushBatchRequests(instance, excb, sentcb); } template Callback_Communicator_flushBatchRequestsPtr newCallback_Communicator_flushBatchRequests(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Communicator_flushBatchRequests(instance, excb, sentcb); } template class Callback_Communicator_flushBatchRequests : public Callback_Communicator_flushBatchRequests_Base, public ::IceInternal::OnewayCallback { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); typedef void (T::*Sent)(bool , const CT&); Callback_Communicator_flushBatchRequests(const TPtr& obj, Exception excb, Sent sentcb) : ::IceInternal::OnewayCallback(obj, 0, excb, sentcb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::Ice::CommunicatorPtr __com = __result->getCommunicator(); assert(__com); try { __com->end_flushBatchRequests(__result); assert(false); } catch(::Ice::Exception& ex) { ::IceInternal::Callback::__exception(__result, ex); } } }; template Callback_Communicator_flushBatchRequestsPtr newCallback_Communicator_flushBatchRequests(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Communicator_flushBatchRequests(instance, excb, sentcb); } template Callback_Communicator_flushBatchRequestsPtr newCallback_Communicator_flushBatchRequests(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Communicator_flushBatchRequests(instance, excb, sentcb); } } #endif Ice-3.5.1/cpp/include/Ice/GCCountMap.h0000644000076400007640000000077412223561476015420 0ustar mesmes// ********************************************************************** // // 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 ICE_GCCOUNTMAP_H #define ICE_GCCOUNTMAP_H #include namespace IceInternal { class GCShared; typedef ::std::map GCCountMap; } #endif Ice-3.5.1/cpp/include/Ice/LocalObject.h0000644000076400007640000000155612223561476015640 0ustar mesmes// ********************************************************************** // // 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 ICE_LOCAL_OBJECT_H #define ICE_LOCAL_OBJECT_H #include #include namespace IceInternal { class BasicStream; } namespace Ice { class ICE_API LocalObject : virtual public ::IceUtil::Shared { public: virtual bool operator==(const LocalObject&) const; virtual bool operator<(const LocalObject&) const; ICE_DEPRECATED_API ::Ice::Int ice_getHash() const { return internal_getHash(); } protected: virtual ::Ice::Int internal_getHash() const; }; } #endif Ice-3.5.1/cpp/include/Ice/OutgoingAsyncF.h0000644000076400007640000000322412223561476016350 0ustar mesmes// ********************************************************************** // // 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 ICE_OUTGOING_ASYNC_F_H #define ICE_OUTGOING_ASYNC_F_H #include #include namespace Ice { class AsyncResult; ICE_API IceUtil::Shared* upCast(::Ice::AsyncResult*); typedef IceInternal::Handle AsyncResultPtr; } namespace IceInternal { class OutgoingAsync; ICE_API IceUtil::Shared* upCast(OutgoingAsync*); typedef IceInternal::Handle OutgoingAsyncPtr; class OutgoingAsyncMessageCallback; ICE_API IceUtil::Shared* upCast(OutgoingAsyncMessageCallback*); typedef IceInternal::Handle OutgoingAsyncMessageCallbackPtr; class BatchOutgoingAsync; ICE_API IceUtil::Shared* upCast(BatchOutgoingAsync*); typedef IceInternal::Handle BatchOutgoingAsyncPtr; class ProxyBatchOutgoingAsync; ICE_API IceUtil::Shared* upCast(ProxyBatchOutgoingAsync*); typedef IceInternal::Handle ProxyBatchOutgoingAsyncPtr; class ConnectionBatchOutgoingAsync; ICE_API IceUtil::Shared* upCast(ConnectionBatchOutgoingAsync*); typedef IceInternal::Handle ConnectionBatchOutgoingAsyncPtr; class CommunicatorBatchOutgoingAsync; ICE_API IceUtil::Shared* upCast(CommunicatorBatchOutgoingAsync*); typedef IceInternal::Handle CommunicatorBatchOutgoingAsyncPtr; } #endif Ice-3.5.1/cpp/include/Ice/NativePropertiesAdmin.h0000644000076400007640000000337212223561476017731 0ustar mesmes// ********************************************************************** // // 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 ICE_PROPERTIES_ADMIN_H #define ICE_PROPERTIES_ADMIN_H #include namespace Ice { // // An application can be notified when its configuration properties are modified // via the Properties admin facet. The application must define a subclass of // PropertiesAdminUpdateCallback and register it with the facet. The facet // implements the class NativePropertiesAdmin, so the application needs to // downcast the facet to this type in order to register the callback. // // For example: // // Ice::ObjectPtr obj = communicator->findAdminFacet("Properties"); // assert(obj); // May be null if the facet is not enabled // NativePropertiesAdminPtr facet = NativePropertiesAdminPtr::dynamicCast(obj); // PropertiesAdminUpdateCallbackPtr myCallback = ...; // facet->addUpdateCallback(myCallback); // // Ice ignores any exceptions raised by the callback. // class ICE_API PropertiesAdminUpdateCallback : virtual public Ice::LocalObject { public: virtual void updated(const PropertyDict&) = 0; }; typedef IceUtil::Handle PropertiesAdminUpdateCallbackPtr; class ICE_API NativePropertiesAdmin : virtual public IceUtil::Shared { public: virtual void addUpdateCallback(const PropertiesAdminUpdateCallbackPtr&) = 0; virtual void removeUpdateCallback(const PropertiesAdminUpdateCallbackPtr&) = 0; }; typedef IceUtil::Handle NativePropertiesAdminPtr; } #endif Ice-3.5.1/cpp/include/Ice/NetworkF.h0000644000076400007640000000112212223561476015203 0ustar mesmes// ********************************************************************** // // 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 ICE_NETWORK_F_H #define ICE_NETWORK_F_H #include #include namespace IceInternal { class NetworkProxy; ICE_API IceUtil::Shared* upCast(NetworkProxy*); typedef Handle NetworkProxyPtr; } #endif Ice-3.5.1/cpp/include/Ice/LocalObjectF.h0000644000076400007640000000114612223561476015741 0ustar mesmes// ********************************************************************** // // 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 ICE_LOCAL_OBJECT_F_H #define ICE_LOCAL_OBJECT_F_H #include #include namespace Ice { class LocalObject; ICE_API IceUtil::Shared* upCast(::Ice::LocalObject*); typedef IceInternal::Handle< LocalObject > LocalObjectPtr; } #endif Ice-3.5.1/cpp/include/Ice/ProxyFactoryF.h0000644000076400007640000000114312223561476016226 0ustar mesmes// ********************************************************************** // // 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 ICE_PROXY_FACTORY_F_H #define ICE_PROXY_FACTORY_F_H #include #include namespace IceInternal { class ProxyFactory; IceUtil::Shared* upCast(ProxyFactory*); typedef IceInternal::Handle ProxyFactoryPtr; } #endif Ice-3.5.1/cpp/include/Ice/Handle.h0000644000076400007640000000723712223561476014654 0ustar mesmes// ********************************************************************** // // 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 ICE_HANDLE_H #define ICE_HANDLE_H #include #include // // "Handle" or "smart pointer" template for classes derived from // IceInternal::GCShared, IceUtil::Shared, or IceUtil::SimpleShared. // // In constrast to IceUtil::Handle, IceInternal::Handle can be used // for a type T that has been declared but not defined. The only // requirement is a declaration of the following function: // // namespace IceInternal // { // X* upCast(T*); // } // // Where X is (or derives from) IceUtil::Shared or IceUtil::SimpleShared. // namespace IceInternal { template class Handle : public ::IceUtil::HandleBase { public: Handle(T* p = 0) { this->_ptr = p; if(this->_ptr) { upCast(this->_ptr)->__incRef(); } } template Handle(const Handle& r) { this->_ptr = r._ptr; if(this->_ptr) { upCast(this->_ptr)->__incRef(); } } template Handle(const ::IceUtil::Handle& r) { this->_ptr = r._ptr; if(this->_ptr) { upCast(this->_ptr)->__incRef(); } } Handle(const Handle& r) { this->_ptr = r._ptr; if(this->_ptr) { upCast(this->_ptr)->__incRef(); } } ~Handle() { if(this->_ptr) { upCast(this->_ptr)->__decRef(); } } Handle& operator=(T* p) { if(this->_ptr != p) { if(p) { upCast(p)->__incRef(); } T* ptr = this->_ptr; this->_ptr = p; if(ptr) { upCast(ptr)->__decRef(); } } return *this; } template Handle& operator=(const Handle& r) { if(this->_ptr != r._ptr) { if(r._ptr) { upCast(r._ptr)->__incRef(); } T* ptr = this->_ptr; this->_ptr = r._ptr; if(ptr) { upCast(ptr)->__decRef(); } } return *this; } template Handle& operator=(const ::IceUtil::Handle& r) { if(this->_ptr != r._ptr) { if(r._ptr) { upCast(r._ptr)->__incRef(); } T* ptr = this->_ptr; this->_ptr = r._ptr; if(ptr) { upCast(ptr)->__decRef(); } } return *this; } Handle& operator=(const Handle& r) { if(this->_ptr != r._ptr) { if(r._ptr) { upCast(r._ptr)->__incRef(); } T* ptr = this->_ptr; this->_ptr = r._ptr; if(ptr) { upCast(ptr)->__decRef(); } } return *this; } template static Handle dynamicCast(const ::IceUtil::HandleBase& r) { return Handle(dynamic_cast(r._ptr)); } template static Handle dynamicCast(Y* p) { return Handle(dynamic_cast(p)); } void __clearHandleUnsafe() { this->_ptr = 0; } }; } #endif Ice-3.5.1/cpp/include/Ice/Proxy.h0000644000076400007640000027554112223561476014607 0ustar mesmes// ********************************************************************** // // 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 ICE_PROXY_H #define ICE_PROXY_H #include #include #include #include #include #include #include #include #include #include #include #include #include //#include // Can't include RouterF.h here, otherwise we have cyclic includes //#include // Can't include RouterF.h here, otherwise we have cyclic includes #include #include #include #include #include namespace IceProxy { namespace Ice { class Locator; ICE_API ::IceProxy::Ice::Object* upCast(::IceProxy::Ice::Locator*); class Router; ICE_API ::IceProxy::Ice::Object* upCast(::IceProxy::Ice::Router*); } } namespace IceInternal { class LocalExceptionWrapper; } namespace Ice { typedef ::IceInternal::ProxyHandle< ::IceProxy::Ice::Router> RouterPrx; typedef ::IceInternal::ProxyHandle< ::IceProxy::Ice::Locator> LocatorPrx; class LocalException; ICE_API void ice_writeObjectPrx(const ::Ice::OutputStreamPtr&, const ObjectPrx&); ICE_API void ice_readObjectPrx(const ::Ice::InputStreamPtr&, ObjectPrx&); class Callback_Object_ice_isA_Base : virtual public ::IceInternal::CallbackBase { }; typedef ::IceUtil::Handle< Callback_Object_ice_isA_Base> Callback_Object_ice_isAPtr; class Callback_Object_ice_ping_Base : virtual public ::IceInternal::CallbackBase { }; typedef ::IceUtil::Handle< Callback_Object_ice_ping_Base> Callback_Object_ice_pingPtr; class Callback_Object_ice_ids_Base : virtual public ::IceInternal::CallbackBase { }; typedef ::IceUtil::Handle< Callback_Object_ice_ids_Base> Callback_Object_ice_idsPtr; class Callback_Object_ice_id_Base : virtual public ::IceInternal::CallbackBase { }; typedef ::IceUtil::Handle< Callback_Object_ice_id_Base> Callback_Object_ice_idPtr; class Callback_Object_ice_invoke_Base : virtual public ::IceInternal::CallbackBase { }; typedef ::IceUtil::Handle< Callback_Object_ice_invoke_Base> Callback_Object_ice_invokePtr; class Callback_Object_ice_flushBatchRequests_Base : virtual public ::IceInternal::CallbackBase { }; typedef ::IceUtil::Handle< Callback_Object_ice_flushBatchRequests_Base> Callback_Object_ice_flushBatchRequestsPtr; // // Deprecated AMI callbacks // class ICE_API AMI_Object_ice_invoke : public Ice::AMICallbackBase { public: virtual void ice_response(bool, const std::vector&) = 0; void __response(bool ok, const std::vector& outParams) { ice_response(ok, outParams); } void __exception(const Ice::Exception& ex) { ice_exception(ex); } void __sent(bool sentSynchronously) { AMICallbackBase::__sent(sentSynchronously); } }; typedef IceUtil::Handle AMI_Object_ice_invokePtr; class ICE_API AMI_Array_Object_ice_invoke : public Ice::AMICallbackBase { public: virtual void ice_response(bool, const std::pair&) = 0; void __response(bool ok, const std::pair& outParams) { ice_response(ok, outParams); } void __exception(const Ice::Exception& ex) { ice_exception(ex); } void __sent(bool sentSynchronously) { AMICallbackBase::__sent(sentSynchronously); } }; typedef IceUtil::Handle AMI_Array_Object_ice_invokePtr; class ICE_API AMI_Object_ice_flushBatchRequests : public Ice::AMICallbackBase { public: void __exception(const Ice::Exception& ex) { ice_exception(ex); } void __sent(bool sentSynchronously) { AMICallbackBase::__sent(sentSynchronously); } }; typedef IceUtil::Handle AMI_Object_ice_flushBatchRequestsPtr; } #ifdef ICE_CPP11 namespace IceInternal { class ICE_API Cpp11FnCallbackNC : virtual public CallbackBase { public: Cpp11FnCallbackNC(const ::std::function& excb, const ::std::function& sentcb) : _exception(excb), _sent(sentcb) { } virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr&) { return this; } virtual void __sent(const ::Ice::AsyncResultPtr& result) const { if(_sent != nullptr) { _sent(result->sentSynchronously()); } } virtual bool __hasSentCallback() const { return _sent != nullptr; } protected: void __exception(const ::Ice::AsyncResultPtr&, const ::Ice::Exception& ex) const { if(_exception != nullptr) { _exception(ex); } } ::std::function _exception; ::std::function _sent; }; class ICE_API Cpp11FnOnewayCallbackNC : virtual public ::IceInternal::Cpp11FnCallbackNC { public: Cpp11FnOnewayCallbackNC(const ::std::function& cb, const ::std::function& excb, const ::std::function& sentcb) : Cpp11FnCallbackNC(excb, sentcb), _cb(cb) { CallbackBase::checkCallback(true, cb || excb != nullptr); } virtual void __completed(const ::Ice::AsyncResultPtr&) const; private: ::std::function _cb; }; } #endif namespace IceProxy { namespace Ice { class ICE_API Object : public ::IceUtil::Shared { public: bool operator==(const Object&) const; bool operator!=(const Object&) const; bool operator<(const Object&) const; ICE_DEPRECATED_API ::Ice::Int ice_getHash() const; ::Ice::CommunicatorPtr ice_getCommunicator() const; ::std::string ice_toString() const; bool ice_isA(const ::std::string& typeId) { return ice_isA(typeId, 0); } bool ice_isA(const ::std::string& typeId, const ::Ice::Context& context) { return ice_isA(typeId, &context); } #ifdef ICE_CPP11 ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Context& ctx, const ::IceInternal::Function& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_isA(typeId, &ctx, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::IceInternal::Function& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_isA(typeId, 0, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::IceInternal::Function& completed, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return begin_ice_isA(typeId, 0, ::Ice::newCallback(completed, sent), 0); } ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Context& ctx, const ::IceInternal::Function& completed, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return begin_ice_isA(typeId, &ctx, ::Ice::newCallback(completed, sent), 0); } #endif ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId) { return begin_ice_isA(typeId, 0, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Context& __ctx) { return begin_ice_isA(typeId, &__ctx, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_isA(typeId, 0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Context& __ctx, const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_isA(typeId, &__ctx, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Callback_Object_ice_isAPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_isA(typeId, 0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Context& __ctx, const ::Ice::Callback_Object_ice_isAPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_isA(typeId, &__ctx, __del, __cookie); } bool end_ice_isA(const ::Ice::AsyncResultPtr&); void ice_ping() { ice_ping(0); } void ice_ping(const ::Ice::Context& context) { ice_ping(&context); } #ifdef ICE_CPP11 ::Ice::AsyncResultPtr begin_ice_ping(const ::IceInternal::Function& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_ping(0, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& ctx, const ::IceInternal::Function& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_ping(&ctx, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_ping(const ::IceInternal::Function& completed, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return begin_ice_ping(0, ::Ice::newCallback(completed, sent), 0); } ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& ctx, const ::IceInternal::Function& completed, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return begin_ice_ping(&ctx, ::Ice::newCallback(completed, sent), 0); } #endif ::Ice::AsyncResultPtr begin_ice_ping() { return begin_ice_ping(0, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& __ctx) { return begin_ice_ping(&__ctx, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_ping(0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& __ctx, const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_ping(&__ctx, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Callback_Object_ice_pingPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_ping(0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& __ctx, const ::Ice::Callback_Object_ice_pingPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_ping(&__ctx, __del, __cookie); } void end_ice_ping(const ::Ice::AsyncResultPtr&); ::std::vector< ::std::string> ice_ids() { return ice_ids(0); } ::std::vector< ::std::string> ice_ids(const ::Ice::Context& context) { return ice_ids(&context); } #ifdef ICE_CPP11 ::Ice::AsyncResultPtr begin_ice_ids(const ::IceInternal::Function&)>& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_ids(0, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& ctx, const ::IceInternal::Function&)>& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_ids(&ctx, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_ids(const ::IceInternal::Function& completed, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return begin_ice_ids(0, ::Ice::newCallback(completed, sent), 0); } ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& ctx, const ::IceInternal::Function& completed, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return begin_ice_ids(&ctx, ::Ice::newCallback(completed, sent), 0); } #endif ::Ice::AsyncResultPtr begin_ice_ids() { return begin_ice_ids(0, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& __ctx) { return begin_ice_ids(&__ctx, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_ids(0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& __ctx, const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_ids(&__ctx, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Callback_Object_ice_idsPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_ids(0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& __ctx, const ::Ice::Callback_Object_ice_idsPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_ids(&__ctx, __del, __cookie); } ::std::vector< ::std::string> end_ice_ids(const ::Ice::AsyncResultPtr&); ::std::string ice_id() { return ice_id(0); } ::std::string ice_id(const ::Ice::Context& context) { return ice_id(&context); } #ifdef ICE_CPP11 ::Ice::AsyncResultPtr begin_ice_id(const ::IceInternal::Function& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_id(0, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& ctx, const ::IceInternal::Function& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_id(&ctx, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_id(const ::IceInternal::Function& completed, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return begin_ice_id(0, ::Ice::newCallback(completed, sent), 0); } ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& ctx, const ::IceInternal::Function& completed, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return begin_ice_id(&ctx, ::Ice::newCallback(completed, sent), 0); } #endif ::Ice::AsyncResultPtr begin_ice_id() { return begin_ice_id(0, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& __ctx) { return begin_ice_id(&__ctx, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_id(0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& __ctx, const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_id(&__ctx, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Callback_Object_ice_idPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_id(0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& __ctx, const ::Ice::Callback_Object_ice_idPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_id(&__ctx, __del, __cookie); } ::std::string end_ice_id(const ::Ice::AsyncResultPtr&); // Returns true if ok, false if user exception. bool ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, ::std::vector< ::Ice::Byte>& outParams) { return ice_invoke(operation, mode, inParams, outParams, 0); } bool ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, ::std::vector< ::Ice::Byte>& outParams, const ::Ice::Context& context) { return ice_invoke(operation, mode, inParams, outParams, &context); } bool ice_invoke_async(const ::Ice::AMI_Object_ice_invokePtr&, const ::std::string&, ::Ice::OperationMode, const ::std::vector< ::Ice::Byte>&); bool ice_invoke_async(const ::Ice::AMI_Object_ice_invokePtr&, const ::std::string&, ::Ice::OperationMode, const ::std::vector< ::Ice::Byte>&, const ::Ice::Context&); #ifdef ICE_CPP11 ::Ice::AsyncResultPtr begin_ice_invoke( const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, const ::IceInternal::Function&)>& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_invoke(operation, mode, inParams, 0, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_invoke( const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, const ::Ice::Context& ctx, const ::IceInternal::Function&)>& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_invoke(operation, mode, inParams, &ctx, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_invoke( const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams, const ::IceInternal::Function&)>& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_invoke(operation, mode, inParams, 0, response, exception, sent); } ::Ice::AsyncResultPtr begin_ice_invoke( const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams, const ::Ice::Context& ctx, const ::IceInternal::Function&)>& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_ice_invoke(operation, mode, inParams, &ctx, response, exception, sent); } #endif ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams) { return begin_ice_invoke(operation, mode, inParams, 0, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, const ::Ice::Context& __ctx) { return begin_ice_invoke(operation, mode, inParams, &__ctx, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_invoke(operation, mode, inParams, 0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, const ::Ice::Context& __ctx, const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_invoke(operation, mode, inParams, &__ctx, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, const ::Ice::Callback_Object_ice_invokePtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_invoke(operation, mode, inParams, 0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, const ::Ice::Context& __ctx, const ::Ice::Callback_Object_ice_invokePtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_invoke(operation, mode, inParams, &__ctx, __del, __cookie); } bool end_ice_invoke(::std::vector< ::Ice::Byte>&, const ::Ice::AsyncResultPtr&); bool ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams, ::std::vector< ::Ice::Byte>& outParams) { return ice_invoke(operation, mode, inParams, outParams, 0); } bool ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams, ::std::vector< ::Ice::Byte>& outParams, const ::Ice::Context& context) { return ice_invoke(operation, mode, inParams, outParams, &context); } bool ice_invoke_async(const ::Ice::AMI_Array_Object_ice_invokePtr&, const ::std::string&, ::Ice::OperationMode, const ::std::pair&); bool ice_invoke_async(const ::Ice::AMI_Array_Object_ice_invokePtr&, const ::std::string&, ::Ice::OperationMode, const ::std::pair&, const ::Ice::Context&); ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams) { return begin_ice_invoke(operation, mode, inParams, 0, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams, const ::Ice::Context& __ctx, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_invoke(operation, mode, inParams, &__ctx, ::IceInternal::__dummyCallback, __cookie); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams, const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_invoke(operation, mode, inParams, 0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams, const ::Ice::Context& __ctx, const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_invoke(operation, mode, inParams, &__ctx, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams, const ::Ice::Callback_Object_ice_invokePtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_invoke(operation, mode, inParams, 0, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams, const ::Ice::Context& __ctx, const ::Ice::Callback_Object_ice_invokePtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_invoke(operation, mode, inParams, &__ctx, __del, __cookie); } bool ___end_ice_invoke(::std::pair&, const ::Ice::AsyncResultPtr&); ::Ice::Identity ice_getIdentity() const; ::Ice::ObjectPrx ice_identity(const ::Ice::Identity&) const; ::Ice::Context ice_getContext() const; ::Ice::ObjectPrx ice_context(const ::Ice::Context&) const; const ::std::string& ice_getFacet() const; ::Ice::ObjectPrx ice_facet(const ::std::string&) const; ::std::string ice_getAdapterId() const; ::Ice::ObjectPrx ice_adapterId(const ::std::string&) const; ::Ice::EndpointSeq ice_getEndpoints() const; ::Ice::ObjectPrx ice_endpoints(const ::Ice::EndpointSeq&) const; ::Ice::Int ice_getLocatorCacheTimeout() const; ::Ice::ObjectPrx ice_locatorCacheTimeout(::Ice::Int) const; bool ice_isConnectionCached() const; ::Ice::ObjectPrx ice_connectionCached(bool) const; ::Ice::EndpointSelectionType ice_getEndpointSelection() const; ::Ice::ObjectPrx ice_endpointSelection(::Ice::EndpointSelectionType) const; bool ice_isSecure() const; ::Ice::ObjectPrx ice_secure(bool) const; ::Ice::EncodingVersion ice_getEncodingVersion() const; ::Ice::ObjectPrx ice_encodingVersion(const ::Ice::EncodingVersion&) const; bool ice_isPreferSecure() const; ::Ice::ObjectPrx ice_preferSecure(bool) const; ::Ice::RouterPrx ice_getRouter() const; ::Ice::ObjectPrx ice_router(const ::Ice::RouterPrx&) const; ::Ice::LocatorPrx ice_getLocator() const; ::Ice::ObjectPrx ice_locator(const ::Ice::LocatorPrx&) const; bool ice_isCollocationOptimized() const; ::Ice::ObjectPrx ice_collocationOptimized(bool) const; ::Ice::ObjectPrx ice_twoway() const; bool ice_isTwoway() const; ::Ice::ObjectPrx ice_oneway() const; bool ice_isOneway() const; ::Ice::ObjectPrx ice_batchOneway() const; bool ice_isBatchOneway() const; ::Ice::ObjectPrx ice_datagram() const; bool ice_isDatagram() const; ::Ice::ObjectPrx ice_batchDatagram() const; bool ice_isBatchDatagram() const; ::Ice::ObjectPrx ice_compress(bool) const; ::Ice::ObjectPrx ice_timeout(int) const; ::Ice::ObjectPrx ice_connectionId(const ::std::string&) const; ::std::string ice_getConnectionId() const; ::Ice::ConnectionPtr ice_getConnection(); ::Ice::ConnectionPtr ice_getCachedConnection() const; void ice_flushBatchRequests(); bool ice_flushBatchRequests_async(const ::Ice::AMI_Object_ice_flushBatchRequestsPtr&); #ifdef ICE_CPP11 ::Ice::AsyncResultPtr begin_ice_flushBatchRequests( const ::IceInternal::Function& exception, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return begin_ice_flushBatchRequestsInternal( new ::IceInternal::Cpp11FnOnewayCallbackNC(nullptr, exception, sent), 0); } #endif ::Ice::AsyncResultPtr begin_ice_flushBatchRequests() { return begin_ice_flushBatchRequestsInternal(::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_flushBatchRequests(const ::Ice::CallbackPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_flushBatchRequestsInternal(__del, __cookie); } ::Ice::AsyncResultPtr begin_ice_flushBatchRequests(const ::Ice::Callback_Object_ice_flushBatchRequestsPtr& __del, const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_flushBatchRequestsInternal(__del, __cookie); } void end_ice_flushBatchRequests(const ::Ice::AsyncResultPtr&); ::IceInternal::ReferencePtr __reference() const { return _reference; } ::Ice::Int __hash() const; void __copyFrom(const ::Ice::ObjectPrx&); int __handleException(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>&, const ::Ice::LocalException&, bool, int&, ::IceInternal::InvocationObserver&); int __handleExceptionWrapper(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>&, const ::IceInternal::LocalExceptionWrapper&, ::IceInternal::InvocationObserver&); int __handleExceptionWrapperRelaxed(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>&, const ::IceInternal::LocalExceptionWrapper&, bool, int&, ::IceInternal::InvocationObserver&); void __checkTwowayOnly(const ::std::string&) const; void __checkAsyncTwowayOnly(const ::std::string&) const; void __end(const ::Ice::AsyncResultPtr&, const std::string&) const; ::IceInternal::Handle< ::IceDelegate::Ice::Object> __getDelegate(bool); void __setRequestHandler(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>&, const ::IceInternal::RequestHandlerPtr&); protected: virtual ::IceInternal::Handle< ::IceDelegateM::Ice::Object> __createDelegateM(); virtual ::IceInternal::Handle< ::IceDelegateD::Ice::Object> __createDelegateD(); virtual Object* __newInstance() const; private: #ifdef ICE_CPP11 ::Ice::AsyncResultPtr __begin_ice_isA( const ::std::string& typeId, const ::Ice::Context* ctx, const ::IceInternal::Function& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { class Cpp11CB : public ::IceInternal::Cpp11FnCallbackNC { public: Cpp11CB(const ::std::function& responseFunc, const ::std::function& exceptionFunc, const ::std::function& sentFunc) : ::IceInternal::Cpp11FnCallbackNC(exceptionFunc, sentFunc), _response(responseFunc) { CallbackBase::checkCallback(true, responseFunc || exceptionFunc != nullptr); } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::Ice::ObjectPrx __proxy = ::Ice::ObjectPrx::uncheckedCast(__result->getProxy()); bool __ret; try { __ret = __proxy->end_ice_isA(__result); } catch(::Ice::Exception& ex) { Cpp11FnCallbackNC::__exception(__result, ex); return; } if(_response != nullptr) { _response(__ret); } } private: ::std::function _response; }; return begin_ice_isA(typeId, ctx, new Cpp11CB(response, exception, sent), 0); } ::Ice::AsyncResultPtr __begin_ice_ping( const ::Ice::Context* ctx, const ::IceInternal::Function& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { return begin_ice_ping(ctx, new ::IceInternal::Cpp11FnOnewayCallbackNC(response, exception, sent), 0); } ::Ice::AsyncResultPtr __begin_ice_id( const ::Ice::Context* ctx, const ::IceInternal::Function& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { class Cpp11CB : public ::IceInternal::Cpp11FnCallbackNC { public: Cpp11CB(const ::std::function& responseFunc, const ::std::function& exceptionFunc, const ::std::function& sentFunc) : ::IceInternal::Cpp11FnCallbackNC(exceptionFunc, sentFunc), _response(responseFunc) { CallbackBase::checkCallback(true, responseFunc || exceptionFunc != nullptr); } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::Ice::ObjectPrx __proxy = ::Ice::ObjectPrx::uncheckedCast(__result->getProxy()); ::std::string __ret; try { __ret = __proxy->end_ice_id(__result); } catch(::Ice::Exception& ex) { Cpp11FnCallbackNC::__exception(__result, ex); return; } if(_response != nullptr) { _response(__ret); } } private: ::std::function _response; }; return begin_ice_id(ctx, new Cpp11CB(response, exception, sent), 0); } ::Ice::AsyncResultPtr __begin_ice_ids( const ::Ice::Context* ctx, const ::IceInternal::Function&)>& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { class Cpp11CB : public ::IceInternal::Cpp11FnCallbackNC { public: Cpp11CB(const ::std::function&)>& responseFunc, const ::std::function& exceptionFunc, const ::std::function& sentFunc) : ::IceInternal::Cpp11FnCallbackNC(exceptionFunc, sentFunc), _response(responseFunc) { CallbackBase::checkCallback(true, responseFunc || exceptionFunc != nullptr); } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::Ice::ObjectPrx __proxy = ::Ice::ObjectPrx::uncheckedCast(__result->getProxy()); ::std::vector< ::std::string> __ret; try { __ret = __proxy->end_ice_ids(__result); } catch(::Ice::Exception& ex) { Cpp11FnCallbackNC::__exception(__result, ex); return; } if(_response != nullptr) { _response(__ret); } } private: ::std::function&)> _response; }; return begin_ice_ids(ctx, new Cpp11CB(response, exception, sent), 0); } #endif bool ice_isA(const ::std::string&, const ::Ice::Context*); ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string&, const ::Ice::Context*, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr&); void ice_ping(const ::Ice::Context*); ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context*, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr&); ::std::vector< ::std::string> ice_ids(const ::Ice::Context*); ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context*, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr&); ::std::string ice_id(const ::Ice::Context*); ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context*, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr&); #ifdef ICE_CPP11 ::Ice::AsyncResultPtr __begin_ice_invoke( const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, const ::Ice::Context* ctx, const ::IceInternal::Function&)>& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { class Cpp11CB : public ::IceInternal::Cpp11FnCallbackNC { public: Cpp11CB(const ::std::function&)>& responseFunc, const ::std::function& exceptionFunc, const ::std::function& sentFunc) : ::IceInternal::Cpp11FnCallbackNC(exceptionFunc, sentFunc), _response(responseFunc) { CallbackBase::checkCallback(true, responseFunc || exceptionFunc != nullptr); } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::Ice::ObjectPrx __proxy = ::Ice::ObjectPrx::uncheckedCast(__result->getProxy()); bool __ret; ::std::vector< ::Ice::Byte> p1; try { __ret = __proxy->end_ice_invoke(p1, __result); } catch(::Ice::Exception& ex) { Cpp11FnCallbackNC::__exception(__result, ex); return; } if(_response != nullptr) { _response(__ret, p1); } } private: ::std::function&)> _response; }; return begin_ice_invoke(operation, mode, inParams, ctx, new Cpp11CB(response, exception, sent), 0); } ::Ice::AsyncResultPtr __begin_ice_invoke( const ::std::string& operation, ::Ice::OperationMode mode, const ::std::pair& inParams, const ::Ice::Context* ctx, const ::IceInternal::Function&)>& response, const ::IceInternal::Function& exception = ::IceInternal::Function(), const ::IceInternal::Function& sent = ::IceInternal::Function()) { class Cpp11CB : public ::IceInternal::Cpp11FnCallbackNC { public: Cpp11CB(const ::std::function&)>& responseFunc, const ::std::function& exceptionFunc, const ::std::function& sentFunc) : ::IceInternal::Cpp11FnCallbackNC(exceptionFunc, sentFunc), _response(responseFunc) { CallbackBase::checkCallback(true, _response || _exception != nullptr); } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { bool __ret; ::std::pair p1; try { __ret = __result->getProxy()->___end_ice_invoke(p1, __result); } catch(::Ice::Exception& ex) { Cpp11FnCallbackNC::__exception(__result, ex); return; } if(_response != nullptr) { _response(__ret, p1); } } private: ::std::function&)> _response; }; return begin_ice_invoke(operation, mode, inParams, ctx, new Cpp11CB(response, exception, sent), 0); } #endif bool ice_invoke(const ::std::string&, ::Ice::OperationMode, const ::std::vector< ::Ice::Byte>&, ::std::vector< ::Ice::Byte>&, const ::Ice::Context*); ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string&, ::Ice::OperationMode, const ::std::vector< ::Ice::Byte>&, const ::Ice::Context*, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr&); bool ice_invoke(const ::std::string&, ::Ice::OperationMode, const ::std::pair&, ::std::vector< ::Ice::Byte>&, const ::Ice::Context*); ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string&, ::Ice::OperationMode, const ::std::pair&, const ::Ice::Context*, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr&); ::Ice::AsyncResultPtr begin_ice_flushBatchRequestsInternal(const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr&); ::IceInternal::Handle< ::IceDelegate::Ice::Object> createDelegate(bool); void setup(const ::IceInternal::ReferencePtr&); friend class ::IceInternal::ProxyFactory; ::IceInternal::ReferencePtr _reference; ::IceInternal::Handle< ::IceDelegate::Ice::Object> _delegate; IceUtil::Mutex _mutex; }; } } ICE_API ::std::ostream& operator<<(::std::ostream&, const ::IceProxy::Ice::Object&); namespace IceDelegate { namespace Ice { class ICE_API Object : public ::IceUtil::Shared { public: virtual bool ice_isA(const ::std::string&, const ::Ice::Context*, ::IceInternal::InvocationObserver&) = 0; virtual void ice_ping(const ::Ice::Context*, ::IceInternal::InvocationObserver&) = 0; virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context*, ::IceInternal::InvocationObserver&) = 0; virtual ::std::string ice_id(const ::Ice::Context*, ::IceInternal::InvocationObserver&) = 0; virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode, const ::std::pair&, ::std::vector< ::Ice::Byte>&, const ::Ice::Context*, ::IceInternal::InvocationObserver&) = 0; virtual void ice_flushBatchRequests(::IceInternal::InvocationObserver&) = 0; virtual ::IceInternal::RequestHandlerPtr __getRequestHandler() const = 0; virtual void __setRequestHandler(const ::IceInternal::RequestHandlerPtr&) = 0; }; } } namespace IceDelegateM { namespace Ice { class ICE_API Object : virtual public ::IceDelegate::Ice::Object { public: virtual ~Object(); virtual bool ice_isA(const ::std::string&, const ::Ice::Context*, ::IceInternal::InvocationObserver&); virtual void ice_ping(const ::Ice::Context*, ::IceInternal::InvocationObserver&); virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context*, ::IceInternal::InvocationObserver&); virtual ::std::string ice_id(const ::Ice::Context*, ::IceInternal::InvocationObserver&); virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode, const ::std::pair&, ::std::vector< ::Ice::Byte>&, const ::Ice::Context*, ::IceInternal::InvocationObserver&); virtual void ice_flushBatchRequests(::IceInternal::InvocationObserver&); virtual ::IceInternal::RequestHandlerPtr __getRequestHandler() const; virtual void __setRequestHandler(const ::IceInternal::RequestHandlerPtr&); void __copyFrom(const ::IceInternal::Handle< ::IceDelegateM::Ice::Object>&); protected: ::IceInternal::RequestHandlerPtr __handler; private: void setup(const ::IceInternal::ReferencePtr&, const ::Ice::ObjectPrx&, bool); friend class ::IceProxy::Ice::Object; }; } } namespace IceDelegateD { namespace Ice { class ICE_API Object : virtual public ::IceDelegate::Ice::Object { public: virtual bool ice_isA(const ::std::string&, const ::Ice::Context*, ::IceInternal::InvocationObserver&); virtual void ice_ping(const ::Ice::Context*, ::IceInternal::InvocationObserver&); virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context*, ::IceInternal::InvocationObserver&); virtual ::std::string ice_id(const ::Ice::Context*, ::IceInternal::InvocationObserver&); virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode, const ::std::pair&, ::std::vector< ::Ice::Byte>&, const ::Ice::Context*, ::IceInternal::InvocationObserver&); virtual void ice_flushBatchRequests(::IceInternal::InvocationObserver&); virtual ::IceInternal::RequestHandlerPtr __getRequestHandler() const; virtual void __setRequestHandler(const ::IceInternal::RequestHandlerPtr&); void __copyFrom(const ::IceInternal::Handle< ::IceDelegateD::Ice::Object>&); protected: ::IceInternal::ReferencePtr __reference; ::Ice::ObjectAdapterPtr __adapter; void __initCurrent(::Ice::Current&, const ::std::string&, ::Ice::OperationMode, const ::Ice::Context*); private: void setup(const ::IceInternal::ReferencePtr&, const ::Ice::ObjectAdapterPtr&); friend class ::IceProxy::Ice::Object; }; } } namespace Ice { ICE_API bool proxyIdentityLess(const ObjectPrx&, const ObjectPrx&); ICE_API bool proxyIdentityEqual(const ObjectPrx&, const ObjectPrx&); ICE_API bool proxyIdentityAndFacetLess(const ObjectPrx&, const ObjectPrx&); ICE_API bool proxyIdentityAndFacetEqual(const ObjectPrx&, const ObjectPrx&); struct ProxyIdentityLess : std::binary_function { bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const { return proxyIdentityLess(lhs, rhs); } }; struct ProxyIdentityEqual : std::binary_function { bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const { return proxyIdentityEqual(lhs, rhs); } }; struct ProxyIdentityAndFacetLess : std::binary_function { bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const { return proxyIdentityAndFacetLess(lhs, rhs); } }; struct ProxyIdentityAndFacetEqual : std::binary_function { bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const { return proxyIdentityAndFacetEqual(lhs, rhs); } }; } namespace IceInternal { // // Inline comparison functions for proxies // template inline bool operator==(const ProxyHandle& lhs, const ProxyHandle& rhs) { ::IceProxy::Ice::Object* l = lhs.__upCast(); ::IceProxy::Ice::Object* r = rhs.__upCast(); if(l && r) { return *l == *r; } else { return !l && !r; } } template inline bool operator!=(const ProxyHandle& lhs, const ProxyHandle& rhs) { return !operator==(lhs, rhs); } template inline bool operator<(const ProxyHandle& lhs, const ProxyHandle& rhs) { ::IceProxy::Ice::Object* l = lhs.__upCast(); ::IceProxy::Ice::Object* r = rhs.__upCast(); if(l && r) { return *l < *r; } else { return !l && r; } } template inline bool operator<=(const ProxyHandle& lhs, const ProxyHandle& rhs) { return lhs < rhs || lhs == rhs; } template inline bool operator>(const ProxyHandle& lhs, const ProxyHandle& rhs) { return !(lhs < rhs || lhs == rhs); } template inline bool operator>=(const ProxyHandle& lhs, const ProxyHandle& rhs) { return !(lhs < rhs); } // // checkedCast and uncheckedCast functions without facet: // template P checkedCastImpl(const ::Ice::ObjectPrx& b, const ::Ice::Context* context) { P d = 0; if(b.get()) { typedef typename P::element_type T; d = dynamic_cast(b.get()); if(!d && (context == 0 ? b->ice_isA(T::ice_staticId()) : b->ice_isA(T::ice_staticId(), *context))) { d = new T; d->__copyFrom(b); } } return d; } template P uncheckedCastImpl(const ::Ice::ObjectPrx& b) { P d = 0; if(b) { typedef typename P::element_type T; d = dynamic_cast(b.get()); if(!d) { d = new T; d->__copyFrom(b); } } return d; } // // checkedCast and uncheckedCast with facet: // // // Helper with type ID. // ICE_API ::Ice::ObjectPrx checkedCastImpl(const ::Ice::ObjectPrx&, const std::string&, const std::string&, const ::Ice::Context*); // // Specializations for P = ::Ice::ObjectPrx // We have to use inline functions for broken compilers such as VC7. // template<> inline ::Ice::ObjectPrx checkedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context* context) { return checkedCastImpl(b, f, "::Ice::Object", context); } template<> inline ::Ice::ObjectPrx uncheckedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::string& f) { ::Ice::ObjectPrx d = 0; if(b) { d = b->ice_facet(f); } return d; } template P checkedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context* context) { P d = 0; typedef typename P::element_type T; ::Ice::ObjectPrx bb = checkedCastImpl(b, f, T::ice_staticId(), context); if(bb) { d = new T; d->__copyFrom(bb); } return d; } template P uncheckedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f) { P d = 0; if(b) { typedef typename P::element_type T; ::Ice::ObjectPrx bb = b->ice_facet(f); d = new T; d->__copyFrom(bb); } return d; } } // // checkedCast and uncheckedCast functions provided in the global namespace // template inline P checkedCast(const ::IceInternal::ProxyHandle& b) { Y* tag = 0; Ice::Context* ctx = 0; return ::IceInternal::checkedCastHelper(b, tag, ctx); } template inline P checkedCast(const ::IceInternal::ProxyHandle& b, const ::Ice::Context& context) { Y* tag = 0; return ::IceInternal::checkedCastHelper(b, tag, &context); } template inline P uncheckedCast(const ::IceInternal::ProxyHandle& b) { Y* tag = 0; return ::IceInternal::uncheckedCastHelper(b, tag); } template inline P checkedCast(const ::Ice::ObjectPrx& b, const std::string& f) { Ice::Context* ctx = 0; return ::IceInternal::checkedCastImpl

          (b, f, ctx); } template inline P checkedCast(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& context) { return ::IceInternal::checkedCastImpl

          (b, f, &context); } template inline P uncheckedCast(const ::Ice::ObjectPrx& b, const std::string& f) { return ::IceInternal::uncheckedCastImpl

          (b, f); } namespace IceInternal { // // Base template for operation callbacks. // template class CallbackNC : virtual public CallbackBase { public: typedef T callback_type; typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); CallbackNC(const TPtr& instance, Exception excb, Sent sentcb) : callback(instance), exception(excb), sent(sentcb) { } virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr& cookie) { if(cookie != 0) // Makes sure begin_ was called without a cookie { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "cookie specified for callback without cookie"); } return this; } virtual void __sent(const ::Ice::AsyncResultPtr& result) const { if(sent) { (callback.get()->*sent)(result->sentSynchronously()); } } virtual bool __hasSentCallback() const { return sent != 0; } TPtr callback; Exception exception; Sent sent; protected: void __exception(const ::Ice::AsyncResultPtr&, const ::Ice::Exception& ex) const { if(exception) { (callback.get()->*exception)(ex); } } }; template class Callback : virtual public CallbackBase { public: typedef T callback_type; typedef CT cookie_type; typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); typedef void (T::*Sent)(bool, const CT&); Callback(const TPtr& instance, Exception excb, Sent sentcb) : callback(instance), exception(excb), sent(sentcb) { } virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr& cookie) { if(cookie && !CT::dynamicCast(cookie)) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "unexpected cookie type"); } return this; } virtual void __sent(const ::Ice::AsyncResultPtr& result) const { if(sent) { (callback.get()->*sent)(result->sentSynchronously(), CT::dynamicCast(result->getCookie())); } } virtual bool __hasSentCallback() const { return sent != 0; } TPtr callback; Exception exception; Sent sent; protected: void __exception(const ::Ice::AsyncResultPtr& result, const ::Ice::Exception& ex) const { if(exception) { (callback.get()->*exception)(ex, CT::dynamicCast(result->getCookie())); } } }; // // Base class for twoway operation callbacks. // template class TwowayCallbackNC : public CallbackNC { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); TwowayCallbackNC(const TPtr& instance, bool cb, Exception excb, Sent sentcb) : CallbackNC(instance, excb, sentcb) { CallbackBase::checkCallback(instance, cb || excb != 0); } }; template class TwowayCallback : public Callback { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); typedef void (T::*Sent)(bool, const CT&); TwowayCallback(const TPtr& instance, bool cb, Exception excb, Sent sentcb) : Callback(instance, excb, sentcb) { CallbackBase::checkCallback(instance, cb || excb != 0); } }; // // Base template class for oneway operations callbacks. // template class OnewayCallbackNC : public CallbackNC { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); typedef void (T::*Response)(); OnewayCallbackNC(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : CallbackNC(instance, excb, sentcb), response(cb) { CallbackBase::checkCallback(instance, cb != 0 || excb != 0); } virtual void __completed(const ::Ice::AsyncResultPtr& result) const { try { result->getProxy()->__end(result, result->getOperation()); } catch(const ::Ice::Exception& ex) { CallbackNC::__exception(result, ex); return; } if(response) { (CallbackNC::callback.get()->*response)(); } } Response response; }; template class OnewayCallback : public Callback { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); typedef void (T::*Sent)(bool, const CT&); typedef void (T::*Response)(const CT&); OnewayCallback(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : Callback(instance, excb, sentcb), response(cb) { CallbackBase::checkCallback(instance, cb != 0 || excb != 0); } virtual void __completed(const ::Ice::AsyncResultPtr& result) const { try { result->getProxy()->__end(result, result->getOperation()); } catch(const ::Ice::Exception& ex) { Callback::__exception(result, ex); return; } if(response) { (Callback::callback.get()->*response)(CT::dynamicCast(result->getCookie())); } } Response response; }; } namespace Ice { template class CallbackNC_Object_ice_isA : public Callback_Object_ice_isA_Base, public ::IceInternal::TwowayCallbackNC { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); typedef void (T::*Response)(bool); CallbackNC_Object_ice_isA(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallbackNC(instance, cb != 0, excb, sentcb), response(cb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { bool __ret; try { __ret = __result->getProxy()->end_ice_isA(__result); } catch(const ::Ice::Exception& ex) { ::IceInternal::CallbackNC::__exception(__result, ex); return; } if(response) { (::IceInternal::CallbackNC::callback.get()->*response)(__ret); } } Response response; }; template class Callback_Object_ice_isA : public Callback_Object_ice_isA_Base, public ::IceInternal::TwowayCallback { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); typedef void (T::*Sent)(bool, const CT&); typedef void (T::*Response)(bool, const CT&); Callback_Object_ice_isA(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallback(instance, cb != 0, excb, sentcb), response(cb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { bool __ret; try { __ret = __result->getProxy()->end_ice_isA(__result); } catch(const ::Ice::Exception& ex) { ::IceInternal::Callback::__exception(__result, ex); return; } if(response) { (::IceInternal::Callback::callback.get()->*response)(__ret, CT::dynamicCast(__result->getCookie())); } } Response response; }; template class CallbackNC_Object_ice_ping : public Callback_Object_ice_ping_Base, public ::IceInternal::OnewayCallbackNC { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); typedef void (T::*Response)(); CallbackNC_Object_ice_ping(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::OnewayCallbackNC(instance, cb, excb, sentcb) { } }; template class Callback_Object_ice_ping : public Callback_Object_ice_ping_Base, public ::IceInternal::OnewayCallback { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); typedef void (T::*Sent)(bool, const CT&); typedef void (T::*Response)(const CT&); Callback_Object_ice_ping(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::OnewayCallback(instance, cb, excb, sentcb) { } }; template class CallbackNC_Object_ice_ids : public Callback_Object_ice_ids_Base, public ::IceInternal::TwowayCallbackNC { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); typedef void (T::*Response)(const ::std::vector< ::std::string>&); CallbackNC_Object_ice_ids(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallbackNC(instance, cb != 0, excb, sentcb), response(cb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::std::vector< ::std::string> __ret; try { __ret = __result->getProxy()->end_ice_ids(__result); } catch(const ::Ice::Exception& ex) { ::IceInternal::CallbackNC::__exception(__result, ex); return; } if(response) { (::IceInternal::CallbackNC::callback.get()->*response)(__ret); } } Response response; }; template class Callback_Object_ice_ids : public Callback_Object_ice_ids_Base, public ::IceInternal::TwowayCallback { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); typedef void (T::*Sent)(bool, const CT&); typedef void (T::*Response)(const ::std::vector< ::std::string>&, const CT&); Callback_Object_ice_ids(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallback(instance, cb != 0, excb, sentcb), response(cb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::std::vector< ::std::string> __ret; try { __ret = __result->getProxy()->end_ice_ids(__result); } catch(const ::Ice::Exception& ex) { ::IceInternal::Callback::__exception(__result, ex); return; } if(response) { (::IceInternal::Callback::callback.get()->*response)(__ret, CT::dynamicCast(__result->getCookie())); } } Response response; }; template class CallbackNC_Object_ice_id : public Callback_Object_ice_id_Base, public ::IceInternal::TwowayCallbackNC { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); typedef void (T::*Response)(const ::std::string&); CallbackNC_Object_ice_id(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallbackNC(instance, cb != 0, excb, sentcb), response(cb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::std::string __ret; try { __ret = __result->getProxy()->end_ice_id(__result); } catch(const ::Ice::Exception& ex) { ::IceInternal::CallbackNC::__exception(__result, ex); return; } if(response) { (::IceInternal::CallbackNC::callback.get()->*response)(__ret); } } Response response; }; template class Callback_Object_ice_id : public Callback_Object_ice_id_Base, public ::IceInternal::TwowayCallback { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); typedef void (T::*Sent)(bool, const CT&); typedef void (T::*Response)(const ::std::string&, const CT&); Callback_Object_ice_id(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallback(instance, cb != 0, excb, sentcb), response(cb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { ::std::string __ret; try { __ret = __result->getProxy()->end_ice_id(__result); } catch(const ::Ice::Exception& ex) { ::IceInternal::Callback::__exception(__result, ex); return; } if(response) { (::IceInternal::Callback::callback.get()->*response)(__ret, CT::dynamicCast(__result->getCookie())); } } Response response; }; template class CallbackNC_Object_ice_invoke : public Callback_Object_ice_invoke_Base, public ::IceInternal::TwowayCallbackNC { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); typedef void (T::*Response)(bool, const std::vector< ::Ice::Byte>&); typedef void (T::*ResponseArray)(bool, const std::pair&); CallbackNC_Object_ice_invoke(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallbackNC(instance, cb != 0, excb, sentcb), response(cb), responseArray(0) { } CallbackNC_Object_ice_invoke(const TPtr& instance, ResponseArray cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallbackNC(instance, cb != 0, excb, sentcb), response(0), responseArray(cb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { if(response) { bool __ok; std::vector< ::Ice::Byte> outParams; try { __ok = __result->getProxy()->end_ice_invoke(outParams, __result); } catch(const ::Ice::Exception& ex) { ::IceInternal::CallbackNC::__exception(__result, ex); return; } (::IceInternal::CallbackNC::callback.get()->*response)(__ok, outParams); } else { bool __ok; std::pair outParams; try { __ok = __result->getProxy()->___end_ice_invoke(outParams, __result); } catch(const ::Ice::Exception& ex) { ::IceInternal::CallbackNC::__exception(__result, ex); return; } if(responseArray) { (::IceInternal::CallbackNC::callback.get()->*responseArray)(__ok, outParams); } } } Response response; ResponseArray responseArray; }; template class Callback_Object_ice_invoke : public Callback_Object_ice_invoke_Base, public ::IceInternal::TwowayCallback { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); typedef void (T::*Sent)(bool, const CT&); typedef void (T::*Response)(bool, const std::vector< ::Ice::Byte>&, const CT&); typedef void (T::*ResponseArray)(bool, const std::pair&, const CT&); Callback_Object_ice_invoke(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallback(instance, cb != 0, excb, sentcb), response(cb), responseArray(0) { } Callback_Object_ice_invoke(const TPtr& instance, ResponseArray cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallback(instance, cb != 0, excb, sentcb), response(0), responseArray(cb) { } virtual void __completed(const ::Ice::AsyncResultPtr& __result) const { if(response) { bool __ok; std::vector< ::Ice::Byte> outParams; try { __ok = __result->getProxy()->end_ice_invoke(outParams, __result); } catch(const ::Ice::Exception& ex) { ::IceInternal::Callback::__exception(__result, ex); return; } (::IceInternal::Callback::callback.get()->*response)(__ok, outParams, CT::dynamicCast(__result->getCookie())); } else { bool __ok; std::pair outParams; try { __ok = __result->getProxy()->___end_ice_invoke(outParams, __result); } catch(const ::Ice::Exception& ex) { ::IceInternal::Callback::__exception(__result, ex); return; } if(responseArray) { (::IceInternal::Callback::callback.get()->*responseArray)(__ok, outParams, CT::dynamicCast( __result->getCookie())); } } } Response response; ResponseArray responseArray; }; template class CallbackNC_Object_ice_flushBatchRequests : public Callback_Object_ice_flushBatchRequests_Base, public ::IceInternal::OnewayCallbackNC { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); typedef void (T::*Sent)(bool); CallbackNC_Object_ice_flushBatchRequests(const TPtr& instance, Exception excb, Sent sentcb) : ::IceInternal::OnewayCallbackNC(instance, 0, excb, sentcb) { } }; template class Callback_Object_ice_flushBatchRequests : public Callback_Object_ice_flushBatchRequests_Base, public ::IceInternal::OnewayCallback { public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); typedef void (T::*Sent)(bool, const CT&); Callback_Object_ice_flushBatchRequests(const TPtr& instance, Exception excb, Sent sentcb) : ::IceInternal::OnewayCallback(instance, 0, excb, sentcb) { } }; template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(const IceUtil::Handle& instance, void (T::*cb)(bool), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_isA(instance, cb, excb, sentcb); } template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(const IceUtil::Handle& instance, void (T::*cb)(bool, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_isA(instance, cb, excb, sentcb); } template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_isA(instance, 0, excb, sentcb); } template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_isA(instance, 0, excb, sentcb); } template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(T* instance, void (T::*cb)(bool), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_isA(instance, cb, excb, sentcb); } template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(T* instance, void (T::*cb)(bool, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_isA(instance, cb, excb, sentcb); } template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_isA(instance, 0, excb, sentcb); } template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_isA(instance, 0, excb, sentcb); } template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(const IceUtil::Handle& instance, void (T::*cb)(), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ping(instance, cb, excb, sentcb); } template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(const IceUtil::Handle& instance, void (T::*cb)(const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_ping(instance, cb, excb, sentcb); } template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ping(instance, 0, excb, sentcb); } template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_ping(instance, 0, excb, sentcb); } template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(T* instance, void (T::*cb)(), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ping(instance, cb, excb, sentcb); } template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(T* instance, void (T::*cb)(const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_ping(instance, cb, excb, sentcb); } template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ping(instance, 0, excb, sentcb); } template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_ping(instance, 0, excb, sentcb); } template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(const IceUtil::Handle& instance, void (T::*cb)(const ::std::vector< ::std::string>&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ids(instance, cb, excb, sentcb); } template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(const IceUtil::Handle& instance, void (T::*cb)(const ::std::vector< ::std::string>&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_ids(instance, cb, excb, sentcb); } template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ids(instance, 0, excb, sentcb); } template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_ids(instance, 0, excb, sentcb); } template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(T* instance, void (T::*cb)(const ::std::vector< ::std::string>&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ids(instance, cb, excb, sentcb); } template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(T* instance, void (T::*cb)(const ::std::vector< ::std::string>&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_ids(instance, cb, excb, sentcb); } template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ids(instance, 0, excb, sentcb); } template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_ids(instance, 0, excb, sentcb); } template Callback_Object_ice_idPtr newCallback_Object_ice_id(const IceUtil::Handle& instance, void (T::*cb)(const ::std::string&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_id(instance, cb, excb, sentcb); } template Callback_Object_ice_idPtr newCallback_Object_ice_id(const IceUtil::Handle& instance, void (T::*cb)(const ::std::string&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_id(instance, cb, excb, sentcb); } template Callback_Object_ice_idPtr newCallback_Object_ice_id(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_id(instance, 0, excb, sentcb); } template Callback_Object_ice_idPtr newCallback_Object_ice_id(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_id(instance, 0, excb, sentcb); } template Callback_Object_ice_idPtr newCallback_Object_ice_id(T* instance, void (T::*cb)(const ::std::string&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_id(instance, cb, excb, sentcb); } template Callback_Object_ice_idPtr newCallback_Object_ice_id(T* instance, void (T::*cb)(const ::std::string&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_id(instance, cb, excb, sentcb); } template Callback_Object_ice_idPtr newCallback_Object_ice_id(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_id(instance, 0, excb, sentcb); } template Callback_Object_ice_idPtr newCallback_Object_ice_id(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_id(instance, 0, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::vector&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_invoke(instance, cb, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::pair&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_invoke(instance, cb, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::vector&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_invoke(instance, cb, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::pair&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_invoke(instance, cb, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_invoke(instance, 0, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_invoke(instance, 0, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(T* instance, void (T::*cb)(bool, const std::vector&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_invoke(instance, cb, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(T* instance, void (T::*cb)(bool, const std::pair&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_invoke(instance, cb, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(T* instance, void (T::*cb)(bool, const std::vector&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_invoke(instance, cb, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(T* instance, void (T::*cb)(bool, const std::pair&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_invoke(instance, cb, excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_invoke( instance, static_cast&)>(0), excb, sentcb); } template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_invoke( instance, static_cast&, const CT&)>(0), excb, sentcb); } template Callback_Object_ice_flushBatchRequestsPtr newCallback_Object_ice_flushBatchRequests(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_flushBatchRequests(instance, excb, sentcb); } template Callback_Object_ice_flushBatchRequestsPtr newCallback_Object_ice_flushBatchRequests(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_flushBatchRequests(instance, excb, sentcb); } template Callback_Object_ice_flushBatchRequestsPtr newCallback_Object_ice_flushBatchRequests(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_flushBatchRequests(instance, excb, sentcb); } template Callback_Object_ice_flushBatchRequestsPtr newCallback_Object_ice_flushBatchRequests(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_flushBatchRequests(instance, excb, sentcb); } } #endif Ice-3.5.1/cpp/include/Ice/Incoming.h0000644000076400007640000000617312223561476015222 0ustar mesmes// ********************************************************************** // // 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 ICE_INCOMING_H #define ICE_INCOMING_H #include #include #include #include #include #include #include #include #include #include namespace IceInternal { class ICE_API IncomingBase : private IceUtil::noncopyable { public: void __adopt(IncomingBase&); BasicStream* __startWriteParams(Ice::FormatType); void __endWriteParams(bool); void __writeEmptyParams(); void __writeParamEncaps(const Ice::Byte*, Ice::Int, bool); void __writeUserException(const Ice::UserException&, Ice::FormatType); protected: IncomingBase(Instance*, Ice::ConnectionI*, const Ice::ObjectAdapterPtr&, bool, Ice::Byte, Ice::Int); IncomingBase(IncomingBase&); // Adopts the argument. It must not be used afterwards. void __warning(const Ice::Exception&) const; void __warning(const std::string&) const; bool __servantLocatorFinished(); void __handleException(const std::exception&); void __handleException(); Ice::Current _current; Ice::ObjectPtr _servant; Ice::ServantLocatorPtr _locator; Ice::LocalObjectPtr _cookie; DispatchObserver _observer; bool _response; Ice::Byte _compress; BasicStream _os; // // Optimization. The connection may not be deleted while a // stack-allocated Incoming still holds it. // Ice::ConnectionI* _connection; std::deque _interceptorAsyncCallbackQueue; }; class ICE_API Incoming : public IncomingBase { public: Incoming(Instance*, Ice::ConnectionI*, const Ice::ObjectAdapterPtr&, bool, Ice::Byte, Ice::Int); const Ice::Current& getCurrent() { return _current; } void push(const Ice::DispatchInterceptorAsyncCallbackPtr&); void pop(); void startOver(); void killAsync(); void setActive(IncomingAsync&); bool isRetriable() { return _inParamPos != 0; } void invoke(const ServantManagerPtr&, BasicStream*); // Inlined for speed optimization. BasicStream* startReadParams() { // // Remember the encoding used by the input parameters, we'll // encode the response parameters with the same encoding. // _current.encoding = _is->startReadEncaps(); return _is; } void endReadParams() const { _is->endReadEncaps(); } void readEmptyParams() { _current.encoding = _is->skipEmptyEncaps(); } void readParamEncaps(const Ice::Byte*& v, Ice::Int& sz) { _current.encoding = _is->readEncaps(v, sz); } private: BasicStream* _is; IncomingAsyncPtr _cb; Ice::Byte* _inParamPos; }; } #endif Ice-3.5.1/cpp/include/Ice/Service.h0000644000076400007640000001466012223561476015057 0ustar mesmes// ********************************************************************** // // 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 ICE_SERVICE_H #define ICE_SERVICE_H #include #include #ifdef _WIN32 # include #endif namespace Ice { class ICE_API Service { public: Service(); virtual ~Service(); // // Shutdown the service. The default implementation invokes shutdown() // on the communicator. // virtual bool shutdown(); // // Notify the service about a signal interrupt. The default // implementation invokes shutdown(). // virtual void interrupt(); // // The primary entry point for services. This function examines // the given argument vector for reserved options and takes the // appropriate action. The reserved options are shown below. // // Win32: // // --service NAME // // Unix: // // --daemon [--nochdir] [--noclose] // // If --service or --daemon are specified, the program runs as // a service, otherwise the program runs as a regular foreground // process. Any service-specific (and Ice-specific) options // are stripped from argv (just as for Ice::initialize()). // // The return value is an exit status code: EXIT_FAILURE or // EXIT_SUCCESS. // int main(int&, char*[], const InitializationData& = InitializationData()); int main(int, char* const [], const Ice::InitializationData& = Ice::InitializationData()); #ifdef _WIN32 int main(int&, wchar_t*[], const InitializationData& = InitializationData()); #endif int main(StringSeq&, const InitializationData& = InitializationData()); // // Returns the communicator created by the service. // Ice::CommunicatorPtr communicator() const; // // Returns the Service singleton. // static Service* instance(); // // Indicates whether the program is running as a Win32 service or // Unix daemon. // bool service() const; // // Returns the program name. If the program is running as a Win32 // service, the return value is the service name. Otherwise the // return value is the executable name (i.e., argv[0]). // std::string name() const; // // Returns true if the operating system supports running the // program as a Win32 service or Unix daemon. // bool checkSystem() const; // // Alternative entry point for services that use their own // command-line options. Instead of invoking main(), the // program processes its command-line options and invokes // run(). To run as a Win32 service or Unix daemon, the // program must first invoke configureService() or // configureDaemon(), respectively. // // The return value is an exit status code: EXIT_FAILURE or // EXIT_SUCCESS. // #ifdef _WIN32 int run(int&, wchar_t*[], const InitializationData& = InitializationData()); #endif int run(int&, char*[], const InitializationData& = InitializationData()); #ifdef _WIN32 // // Configures the program to run as a Win32 service with the // given name. // void configureService(const std::string&); static void setModuleHandle(HMODULE); #else // // Configures the program to run as a Unix daemon. The first // argument indicates whether the daemon should change its // working directory to the root directory. The second // argument indicates whether extraneous file descriptors are // closed. If the value of the last argument is not an empty // string, the daemon writes its process ID to the given // filename. // void configureDaemon(bool, bool, const std::string&); #endif // // Invoked by the CtrlCHandler. // virtual void handleInterrupt(int); protected: // // Prepare a service for execution, including the creation and // activation of object adapters and servants. // virtual bool start(int, char*[], int&) = 0; // // Blocks until the service shuts down. The default implementation // invokes waitForShutdown() on the communicator. // virtual void waitForShutdown(); // // Clean up resources after shutting down. // virtual bool stop(); // // Initialize a communicator. // virtual Ice::CommunicatorPtr initializeCommunicator(int&, char*[], const InitializationData&); // // Log a system error, which includes a description of the // current system error code. // virtual void syserror(const std::string&); // // Log an error. // virtual void error(const std::string&); // // Log a warning. // virtual void warning(const std::string&); // // Log trace information. // virtual void trace(const std::string&); // // Log a literal message. // virtual void print(const std::string&); // // Enable the CtrlCHandler to invoke interrupt() when a signal occurs. // void enableInterrupt(); // // Ignore signals. // void disableInterrupt(); // // Log Helpers // typedef LoggerOutput ServiceSysError; typedef LoggerOutput ServiceError; typedef LoggerOutput ServiceWarning; typedef LoggerOutput ServiceTrace; typedef LoggerOutput ServicePrint; private: Ice::LoggerPtr _logger; Ice::CommunicatorPtr _communicator; bool _nohup; bool _service; std::string _name; static Service* _instance; #ifdef _WIN32 int runService(int, char*[], const InitializationData&); void terminateService(DWORD); bool waitForServiceState(SC_HANDLE, DWORD, SERVICE_STATUS&); void showServiceStatus(const std::string&, SERVICE_STATUS&); SERVICE_STATUS_HANDLE _statusHandle; std::vector _serviceArgs; InitializationData _initData; public: void serviceMain(int, wchar_t*[]); void control(int); #else int runDaemon(int, char*[], const InitializationData&); bool _changeDirectory; bool _closeFiles; std::string _pidFile; #endif }; } // End of namespace Ice #endif Ice-3.5.1/cpp/include/Ice/Exception.h0000644000076400007640000000573212223561476015415 0ustar mesmes// ********************************************************************** // // 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 ICE_EXCEPTION_H #define ICE_EXCEPTION_H #include #include #include #include #include #include namespace IceInternal { class BasicStream; namespace Ex { ICE_API void throwUOE(const ::std::string&, const ::Ice::ObjectPtr&); ICE_API void throwMemoryLimitException(const char*, int, size_t, size_t); ICE_API void throwMarshalException(const char*, int, const std::string&); } } namespace Ice { typedef IceUtil::Exception Exception; class ICE_API LocalException : public IceUtil::Exception { public: LocalException(const char*, int); virtual ~LocalException() throw(); virtual std::string ice_name() const = 0; virtual LocalException* ice_clone() const = 0; virtual void ice_throw() const = 0; }; class ICE_API UserException : public IceUtil::Exception { public: virtual std::string ice_name() const = 0; virtual UserException* ice_clone() const = 0; virtual void ice_throw() const = 0; virtual void __write(::IceInternal::BasicStream*) const; virtual void __read(::IceInternal::BasicStream*); virtual void __write(const OutputStreamPtr&) const; virtual void __read(const InputStreamPtr&); virtual bool __usesClasses() const; protected: virtual void __writeImpl(::IceInternal::BasicStream*) const = 0; virtual void __readImpl(::IceInternal::BasicStream*) = 0; virtual void __writeImpl(const OutputStreamPtr&) const; virtual void __readImpl(const InputStreamPtr&); }; typedef ::IceInternal::Handle UserExceptionPtr; class ICE_API SystemException : public IceUtil::Exception { public: SystemException(const char*, int); virtual ~SystemException() throw(); virtual std::string ice_name() const = 0; virtual SystemException* ice_clone() const = 0; virtual void ice_throw() const = 0; }; typedef ::IceInternal::Handle SystemExceptionPtr; #if defined(__SUNPRO_CC) // // COMPILERFIX: With Sun CC the presence of the overloaded operator // in ProxyHandle.h // // template // OStream& operator<<(OStream& os, ::IceInternal::ProxyHandle p) // // prevents the compiler from using the overloaded operator for // Exception in IceUtil/Exception.h // // std::ostream& operator<<(std::ostream&, const Exception&); // // thus causing a compile error and making these overloads necessary. // ICE_API std::ostream& operator<<(std::ostream&, const LocalException&); ICE_API std::ostream& operator<<(std::ostream&, const UserException&); ICE_API std::ostream& operator<<(std::ostream&, const SystemException&); #endif } #endif Ice-3.5.1/cpp/include/Ice/MetricsFunctional.h0000644000076400007640000000536312223561476017110 0ustar mesmes// ********************************************************************** // // 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 ICE_METRICSFUNCTIONAL_H #define ICE_METRICSFUNCTIONAL_H namespace IceInternal { template struct ReferenceWrapper { static R* get(const R& v) { return const_cast(&v); } }; template struct ReferenceWrapper > { static R* get(const IceInternal::ProxyHandle& v) { return v.get(); } }; template struct ReferenceWrapper& > { static R* get(const IceInternal::ProxyHandle& v) { return v.get(); } }; template struct ReferenceWrapper > { static R* get(const IceInternal::Handle& v) { return v.get(); } }; template struct ReferenceWrapper& > { static R* get(const IceInternal::Handle& v) { return v.get(); } }; template struct ReferenceWrapper { static R* get(R* v) { return v; } }; template struct ReferenceWrapper { static R* get(const R& v) { return const_cast(&v); } }; }; namespace IceMX { template struct ApplyOnMember { ApplyOnMember(Y T::*member, Func func) : func(func), member(member) { } template void operator()(const R& v) { func(IceInternal::ReferenceWrapper::get(v)->*member); } Func func; Y T::*member; }; template struct Decrement { void operator()(T& v) { --v; } }; template struct Increment { void operator()(T& v) { ++v; } }; template struct Add { Add(T value) : value(value) { } template void operator()(Y& v) { v += value; } T value; }; template ApplyOnMember applyOnMember(Y T::*member, F func) { return ApplyOnMember(member, func); } template ApplyOnMember > add(Y T::*member, V value) { return applyOnMember(member, Add(value)); } template ApplyOnMember > inc(Y T::*member) { return applyOnMember(member, Increment()); } template ApplyOnMember > dec(Y T::*member) { return applyOnMember(member, Decrement()); } } #endif Ice-3.5.1/cpp/include/Ice/StringConverter.h0000644000076400007640000001053512223561476016612 0ustar mesmes// ********************************************************************** // // 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 ICE_STRING_CONVERTER_H #define ICE_STRING_CONVERTER_H #include #include #include #include #include #include #include #include namespace Ice { // // Provides bytes to toUTF8. Raises MemoryLimitException when too many // bytes are requested. // class ICE_API UTF8Buffer { public: virtual Byte* getMoreBytes(size_t howMany, Byte* firstUnused) = 0; virtual ~UTF8Buffer() {} }; // // A StringConverter converts narrow or wide-strings to and from UTF-8 byte sequences. // It's used by the communicator during marshaling (toUTF8) and unmarshaling (fromUTF8). // It report errors by raising StringConversionFailed or MemoryLimitException. // template class BasicStringConverter : public IceUtil::Shared { public: // // Returns a pointer to byte after the last written byte (which may be // past the last byte returned by getMoreBytes). // virtual Byte* toUTF8(const charT* sourceStart, const charT* sourceEnd, UTF8Buffer&) const = 0; // // Unmarshals a UTF-8 sequence into a basic_string // virtual void fromUTF8(const Byte* sourceStart, const Byte* sourceEnd, std::basic_string& target) const = 0; }; typedef BasicStringConverter StringConverter; typedef IceUtil::Handle StringConverterPtr; typedef BasicStringConverter WstringConverter; typedef IceUtil::Handle WstringConverterPtr; // // Converts to and from UTF-16 or UTF-32 depending on sizeof(wchar_t) // class ICE_API UnicodeWstringConverter : public WstringConverter { public: UnicodeWstringConverter(IceUtil::ConversionFlags = IceUtil::lenientConversion); virtual Byte* toUTF8(const wchar_t*, const wchar_t*, UTF8Buffer&) const; virtual void fromUTF8(const Byte*, const Byte*, std::wstring&) const; private: const IceUtil::ConversionFlags _conversionFlags; }; #ifdef _WIN32 // // Converts to/from UTF-8 using MultiByteToWideChar and WideCharToMultiByte // class ICE_API WindowsStringConverter : public StringConverter { public: explicit WindowsStringConverter(unsigned int); virtual Byte* toUTF8(const char*, const char*, UTF8Buffer&) const; virtual void fromUTF8(const Byte*, const Byte*, std::string& target) const; private: unsigned int _cp; UnicodeWstringConverter _unicodeWstringConverter; }; #endif // // A special plug-in that sets stringConverter and wstringConverter during // construction (when the provided stringConverter resp. wstringConverter // are not null). Both initialize and destroy are no-op. See Ice::InitializationData. // class ICE_API StringConverterPlugin : public Ice::Plugin { public: StringConverterPlugin(const CommunicatorPtr& communicator, const StringConverterPtr&, const WstringConverterPtr& = 0); virtual void initialize(); virtual void destroy(); }; // // Converts the given string from the native narrow string encoding to // UTF8 using the given converter. If the converter is null, returns // the given string. // ICE_API std::string nativeToUTF8(const Ice::StringConverterPtr&, const std::string&); // // Converts the given string from the native narrow string encoding to // UTF8 using the communicator's converter. If the converter is null, // returns the given string. // ICE_API std::string nativeToUTF8(const Ice::CommunicatorPtr&, const std::string&); // // Converts the given string from UTF8 to the native narrow string // encoding using the given converter. If the converter is null, // returns the given string. // ICE_API std::string UTF8ToNative(const Ice::StringConverterPtr&, const std::string&); // // Converts the given string from UTF8 to the native narrow string // encoding using the communicator's converter. If the converter is // null, returns the given string. // ICE_API std::string UTF8ToNative(const Ice::CommunicatorPtr&, const std::string&); } #endif Ice-3.5.1/cpp/include/Ice/GCShared.h0000644000076400007640000000172112223561476015071 0ustar mesmes// ********************************************************************** // // 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 ICE_GC_SHARED_H #define ICE_GC_SHARED_H #include #include #include namespace IceInternal { class GC; class ICE_API GCShared : public virtual IceUtil::Shared { public: virtual ~GCShared() {} GCShared& operator=(const GCShared&) { return *this; } virtual void __incRef(); virtual void __decRef(); virtual int __getRef() const; virtual void __setNoDelete(bool); virtual void __gcReachable(GCCountMap&) const = 0; virtual void __gcClear() = 0; int __getRefUnsafe() const { return _ref; } }; } #endif Ice-3.5.1/cpp/include/Ice/.headers0000644000076400007640000001307312223561476014717 0ustar mesmesSDK_HEADERS = \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Application.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\BasicStream.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Buffer.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\BuiltinSequences.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Communicator.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\CommunicatorAsync.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\CommunicatorF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Config.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Connection.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionAsync.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionFactoryF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionIF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionMonitorF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Current.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Direct.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Dispatcher.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\DispatchInterceptor.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\DynamicLibrary.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\DynamicLibraryF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Endpoint.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\EndpointF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\EndpointFactory.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\EndpointFactoryF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\EndpointIF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\EndpointTypes.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Exception.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\FacetMap.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\FactoryTable.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\FactoryTableInit.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Format.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Functional.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\GCCountMap.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\GCShared.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Handle.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Ice.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IconvStringConverter.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Identity.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ImplicitContext.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ImplicitContextF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Incoming.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IncomingAsync.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IncomingAsyncF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Initialize.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\InstanceF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Instrumentation.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\InstrumentationF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LocalException.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LocalObject.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LocalObjectF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Locator.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LocatorF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Logger.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LoggerF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LoggerUtil.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Metrics.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MetricsAdminI.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MetricsFunctional.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MetricsObserverI.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\NativePropertiesAdmin.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\NetworkF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Object.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectAdapter.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectAdapterF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectAdapterFactoryF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectFactory.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectFactoryF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectFactoryManagerF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObserverHelper.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Outgoing.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\OutgoingAsync.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\OutgoingAsyncF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Plugin.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PluginF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Process.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ProcessF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Properties.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PropertiesAdmin.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PropertiesF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Protocol.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ProtocolPluginFacade.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ProtocolPluginFacadeF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Proxy.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ProxyF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ProxyFactoryF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ProxyHandle.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ReferenceF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\RequestHandlerF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Router.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\RouterF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ServantLocator.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ServantLocatorF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ServantManagerF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Service.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SliceChecksumDict.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SliceChecksums.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SlicedData.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SlicedDataF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Stats.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\StatsF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Stream.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\StreamF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\StreamHelpers.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\StringConverter.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\UndefSysMacros.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\UserExceptionFactory.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Version.h \ Ice-3.5.1/cpp/include/Ice/IncomingAsync.h0000644000076400007640000000444512223561476016220 0ustar mesmes// ********************************************************************** // // 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 ICE_INCOMING_ASYNC_H #define ICE_INCOMING_ASYNC_H #include #include namespace Ice { class ICE_API AMDCallback : virtual public Ice::LocalObject { public: virtual void ice_exception(const ::std::exception&) = 0; virtual void ice_exception() = 0; }; } namespace IceInternal { // // We need virtual inheritance from AMDCallback, because we use multiple // inheritance from Ice::AMDCallback for generated AMD code. // class ICE_API IncomingAsync : public IncomingBase, virtual public Ice::AMDCallback { public: IncomingAsync(Incoming&); // Adopts the argument. It must not be used afterwards. void __deactivate(Incoming&); virtual void ice_exception(const ::std::exception&); virtual void ice_exception(); protected: void __response(); void __exception(const std::exception&); void __exception(); bool __validateResponse(bool); private: // // We need a separate InstancePtr, because _is and _os only hold a // Instance* for optimization. // const InstancePtr _instanceCopy; // // We need a separate ConnectionIPtr, because IncomingBase only // holds a ConnectionI* for optimization. // const Ice::ConnectionIPtr _connectionCopy; const bool _retriable; bool _active; }; } namespace Ice { class ICE_API AMD_Object_ice_invoke : virtual public Ice::AMDCallback { public: virtual void ice_response(bool, const std::vector&) = 0; virtual void ice_response(bool, const std::pair&) = 0; }; } namespace IceAsync { namespace Ice { class ICE_API AMD_Object_ice_invoke : public ::Ice::AMD_Object_ice_invoke, public IceInternal::IncomingAsync { public: AMD_Object_ice_invoke(IceInternal::Incoming&); virtual void ice_response(bool, const std::vector< ::Ice::Byte>&); virtual void ice_response(bool, const std::pair&); }; } } #endif Ice-3.5.1/cpp/include/Ice/LoggerUtil.h0000644000076400007640000000464412223561476015535 0ustar mesmes// ********************************************************************** // // 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 ICE_LOGGER_UTIL_H #define ICE_LOGGER_UTIL_H #include #include #include namespace Ice { class ICE_API LoggerOutputBase : private IceUtil::noncopyable { public: std::string str() const; std::ostringstream& __str(); // For internal use only. Don't use in your code. private: std::ostringstream _str; }; template inline LoggerOutputBase& operator<<(LoggerOutputBase& out, const T& val) { out.__str() << val; return out; } template LoggerOutputBase& operator<<(LoggerOutputBase& os, ::IceInternal::ProxyHandle p) { return os << (p ? p->ice_toString() : ""); } ICE_API LoggerOutputBase& operator<<(LoggerOutputBase&, std::ios_base& (*)(std::ios_base&)); ICE_API LoggerOutputBase& operator<<(LoggerOutputBase&, const ::std::exception& ex); template class LoggerOutput : public LoggerOutputBase { public: inline LoggerOutput(const LPtr& lptr) : _logger(lptr) {} inline ~LoggerOutput() { flush(); } inline void flush() { std::string s = __str().str(); if(!s.empty()) { L& ref = *_logger; (ref.*output)(s); } __str().str(""); } private: LPtr _logger; }; typedef LoggerOutput Print; typedef LoggerOutput Warning; typedef LoggerOutput Error; class ICE_API Trace : public LoggerOutputBase { public: Trace(const LoggerPtr&, const std::string&); ~Trace(); void flush(); private: LoggerPtr _logger; std::string _category; }; // // A special plug-in that installs a logger during a communicator's initialization. // Both initialize and destroy are no-op. See Ice::InitializationData. // class ICE_API LoggerPlugin : public Ice::Plugin { public: LoggerPlugin(const CommunicatorPtr& communicator, const LoggerPtr&); virtual void initialize(); virtual void destroy(); }; } #endif Ice-3.5.1/cpp/include/Ice/ProtocolPluginFacade.h0000644000076400007640000000461412223561476017521 0ustar mesmes// ********************************************************************** // // 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 ICE_PROTOCOL_PLUGIN_FACADE_H #define ICE_PROTOCOL_PLUGIN_FACADE_H #include #include #include #include #include #include #include #include #include namespace IceInternal { // // Global function to obtain a ProtocolPluginFacade given a Communicator // instance. // ICE_API ProtocolPluginFacadePtr getProtocolPluginFacade(const Ice::CommunicatorPtr&); // // ProtocolPluginFacade wraps the internal operations that protocol // plug-ins may need. // class ICE_API ProtocolPluginFacade : public ::IceUtil::Shared { public: // // Get the Communicator instance with which this facade is // associated. // Ice::CommunicatorPtr getCommunicator() const; // // Get the default hostname to be used in endpoints. // std::string getDefaultHost() const; // // Get the default encoding to be used in endpoints. // Ice::EncodingVersion getDefaultEncoding() const; // // Get the network trace level and category name. // int getNetworkTraceLevel() const; const char* getNetworkTraceCategory() const; // // Get the endpoint host resolver. // EndpointHostResolverPtr getEndpointHostResolver() const; // // Get the protocol support. // ProtocolSupport getProtocolSupport() const; // // Get the IP address preference // bool preferIPv6() const; // // Get the network proxy. // NetworkProxyPtr getNetworkProxy() const; // // Register an EndpointFactory. // void addEndpointFactory(const EndpointFactoryPtr&) const; // // Get an EndpointFactory. // EndpointFactoryPtr getEndpointFactory(Ice::Short) const; private: ProtocolPluginFacade(const Ice::CommunicatorPtr&); friend ICE_API ProtocolPluginFacadePtr getProtocolPluginFacade(const Ice::CommunicatorPtr&); InstancePtr _instance; Ice::CommunicatorPtr _communicator; }; } #endif Ice-3.5.1/cpp/include/Ice/IconvStringConverter.h0000644000076400007640000002175412223561476017616 0ustar mesmes// ********************************************************************** // // 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 ICE_ICONV_STRING_CONVERTER #define ICE_ICONV_STRING_CONVERTER #include #include #include #include #ifndef _WIN32 #include #endif #if (defined(__APPLE__) && _LIBICONV_VERSION < 0x010B) || defined(__FreeBSD__) // // See http://sourceware.org/bugzilla/show_bug.cgi?id=2962 // # define ICE_CONST_ICONV_INBUF 1 #endif // // On Windows, we need to be very careful with errno: if we use different C // runtime libraries for the main program and the libiconv DLL, we end up with // two different errnos ... a not-so-good work-around is to ignore errno // altogether, by defining ICE_NO_ERRNO // namespace Ice { // // Converts charT encoded with internalCode to and from UTF-8 byte sequences // // The implementation allocates a pair of iconv_t on each thread, to avoid // opening / closing iconv_t objects all the time. // // template class IconvStringConverter : public Ice::BasicStringConverter { public: #ifdef _WIN32 IconvStringConverter(const char*); #else IconvStringConverter(const char* = nl_langinfo(CODESET)); #endif virtual ~IconvStringConverter(); virtual Ice::Byte* toUTF8(const charT*, const charT*, Ice::UTF8Buffer&) const; virtual void fromUTF8(const Ice::Byte*, const Ice::Byte*, std::basic_string&) const; private: std::pair createDescriptors() const; std::pair getDescriptors() const; static void cleanupKey(void*); static void close(std::pair); #ifdef _WIN32 DWORD _key; #else mutable pthread_key_t _key; #endif const std::string _internalCode; }; // // Implementation // #ifdef __SUNPRO_CC extern "C" { typedef void (*IcePthreadKeyDestructor)(void*); } #endif template IconvStringConverter::IconvStringConverter(const char* internalCode) : _internalCode(internalCode) { // // Verify that iconv supports conversion to/from internalCode // try { close(createDescriptors()); } catch(const Ice::StringConversionException& sce) { throw Ice::InitializationException(__FILE__, __LINE__, sce.reason); } // // Create thread-specific key // #ifdef _WIN32 _key = TlsAlloc(); if(_key == TLS_OUT_OF_INDEXES) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } #else #ifdef __SUNPRO_CC int rs = pthread_key_create(&_key, reinterpret_cast(&cleanupKey)); #else int rs = pthread_key_create(&_key, &cleanupKey); #endif if(rs != 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rs); } #endif } template IconvStringConverter::~IconvStringConverter() { #ifdef _WIN32 void* val = TlsGetValue(_key); if(val != 0) { cleanupKey(val); } if(TlsFree(_key) == 0) { assert(0); } #else void* val = pthread_getspecific(_key); if(val != 0) { cleanupKey(val); } if(pthread_key_delete(_key) != 0) { assert(0); } #endif } template std::pair IconvStringConverter::createDescriptors() const { std::pair cdp; const char* externalCode = "UTF-8"; cdp.first = iconv_open(_internalCode.c_str(), externalCode); if(cdp.first == iconv_t(-1)) { throw Ice::StringConversionException( __FILE__, __LINE__, std::string("iconv cannot convert from ") + externalCode + " to " + _internalCode); } cdp.second = iconv_open(externalCode, _internalCode.c_str()); if(cdp.second == iconv_t(-1)) { iconv_close(cdp.first); throw Ice::StringConversionException( __FILE__, __LINE__, std::string("iconv cannot convert from ") + _internalCode + " to " + externalCode); } return cdp; } template std::pair IconvStringConverter::getDescriptors() const { #ifdef _WIN32 void* val = TlsGetValue(_key); #else void* val = pthread_getspecific(_key); #endif if(val != 0) { return *static_cast*>(val); } else { std::pair cdp = createDescriptors(); #ifdef _WIN32 if(TlsSetValue(_key, new std::pair(cdp)) == 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } #else int rs = pthread_setspecific(_key, new std::pair(cdp)); if(rs != 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rs); } #endif return cdp; } } template /*static*/ void IconvStringConverter::cleanupKey(void* val) { std::pair* cdp = static_cast*>(val); close(*cdp); delete cdp; } template /*static*/ void IconvStringConverter::close(std::pair cdp) { #ifndef NDEBUG int rs = iconv_close(cdp.first); assert(rs == 0); rs = iconv_close(cdp.second); assert(rs == 0); #else iconv_close(cdp.first); iconv_close(cdp.second); #endif } template Ice::Byte* IconvStringConverter::toUTF8(const charT* sourceStart, const charT* sourceEnd, Ice::UTF8Buffer& buf) const { iconv_t cd = getDescriptors().second; // // Reset cd // #ifdef NDEBUG iconv(cd, 0, 0, 0, 0); #else size_t rs = iconv(cd, 0, 0, 0, 0); assert(rs == 0); #endif #ifdef ICE_CONST_ICONV_INBUF const char* inbuf = reinterpret_cast(sourceStart); #else char* inbuf = reinterpret_cast(const_cast(sourceStart)); #endif size_t inbytesleft = (sourceEnd - sourceStart) * sizeof(charT); char* outbuf = 0; size_t count = 0; // // Loop while we need more buffer space // do { size_t howMany = std::max(inbytesleft, size_t(4)); outbuf = reinterpret_cast(buf.getMoreBytes(howMany, reinterpret_cast(outbuf))); count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &howMany); #ifdef ICE_NO_ERRNO } while(count == size_t(-1)); #else } while(count == size_t(-1) && errno == E2BIG); #endif if(count == size_t(-1)) { std::string msg = "Unknown error"; #ifndef ICE_NO_ERRNO if(errno != 0) { msg = strerror(errno); } #endif throw Ice::StringConversionException(__FILE__, __LINE__, msg); } return reinterpret_cast(outbuf); } template void IconvStringConverter::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd, std::basic_string& target) const { iconv_t cd = getDescriptors().first; // // Reset cd // #ifdef NDEBUG iconv(cd, 0, 0, 0, 0); #else size_t rs = iconv(cd, 0, 0, 0, 0); assert(rs == 0); #endif #ifdef ICE_CONST_ICONV_INBUF const char* inbuf = reinterpret_cast(sourceStart); #else char* inbuf = reinterpret_cast(const_cast(sourceStart)); #endif size_t inbytesleft = sourceEnd - sourceStart; // // Result buffer // char* buf = 0; size_t bufsize = 0; char* outbuf = 0; size_t outbytesleft = 0; size_t count = 0; // // Loop while we need more buffer space // do { size_t increment = std::max(inbytesleft * sizeof(wchar_t), size_t(8)); bufsize += increment; char* newbuf = static_cast(realloc(buf, bufsize)); if(newbuf == 0) { free(buf); throw Ice::StringConversionException( __FILE__, __LINE__, "Out of memory"); } outbuf = newbuf + (outbuf - buf); outbytesleft += increment; buf = newbuf; count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); #ifdef ICE_NO_ERRNO } while(count == size_t(-1)); #else } while(count == size_t(-1) && errno == E2BIG); #endif if(count == size_t(-1)) { std::string msg = "Unknown error"; #ifndef ICE_NO_ERRNO if(errno != 0) { msg = strerror(errno); } #endif free(buf); throw Ice::StringConversionException(__FILE__, __LINE__, msg); } size_t length = (bufsize - outbytesleft) / sizeof(charT); std::basic_string result(reinterpret_cast(buf), length); target.swap(result); free(buf); } } #endif Ice-3.5.1/cpp/include/Ice/DynamicLibrary.h0000644000076400007640000000471712223561476016372 0ustar mesmes// ********************************************************************** // // 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 ICE_DYNAMIC_LIBRARY_H #define ICE_DYNAMIC_LIBRARY_H #include #include #include namespace IceInternal { class ICE_API DynamicLibrary : public ::IceUtil::Shared { public: DynamicLibrary(const Ice::StringConverterPtr&); ~DynamicLibrary(); #ifdef _WIN32 typedef FARPROC symbol_type; #else typedef void* symbol_type; #endif // // Load an entry point. This is really a convenience function // which combines calls to load() and getSymbol(). However, it // does add some value. // // An entry point has the following format: // // name[,version]:function // // The name of the library is constructed from the given // information. If no version is supplied and the boolean // argument is true, the Ice version (10 * major + minor) is // used instead. // // For example, consider the following entry point: // // foo:create // // This would result in libfoo.so.11 (Unix) and foo11.dll // (Windows), where the Ice version is 1.1.x. // // Now consider this entry point: // // foo,12:create // // The library names in this case are libfoo.so.12 (Unix) and // foo12.dll (Windows). // // On Windows platforms, a 'd' is appended to the version for // debug builds. // // Returns 0 if a failure occurred. // symbol_type loadEntryPoint(const std::string&, bool = true); // // Open a library with the given path. // bool load(const std::string&); // // Retrieve a symbol from the library. Returns 0 if no match is found. // symbol_type getSymbol(const std::string&); // // Get the error message for the last failure. // const std::string& getErrorMessage() const; private: #ifdef _WIN32 HINSTANCE _hnd; #else void* _hnd; #endif std::string _err; const Ice::StringConverterPtr _stringConverter; }; class ICE_API DynamicLibraryList : public ::IceUtil::Shared { public: void add(const DynamicLibraryPtr&); private: std::vector _libraries; }; } #endif Ice-3.5.1/cpp/include/Ice/ProxyF.h0000644000076400007640000000175712223561476014711 0ustar mesmes// ********************************************************************** // // 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 ICE_PROXY_F_H #define ICE_PROXY_F_H #include #include #include namespace IceProxy { namespace Ice { class Object; inline Object* upCast(Object* o) { return o; } } } namespace IceDelegate { namespace Ice { class Object; inline Object* upCast(Object* o) { return o; } } } namespace IceDelegateM { namespace Ice { class Object; inline Object* upCast(Object* o) { return o; } } } namespace IceDelegateD { namespace Ice { class Object; inline Object* upCast(Object* o) { return o; } } } namespace Ice { typedef IceInternal::ProxyHandle< ::IceProxy::Ice::Object> ObjectPrx; } #endif Ice-3.5.1/cpp/include/Ice/ConnectionIF.h0000644000076400007640000000135612223561476015773 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECTIONI_F_H #define ICE_CONNECTIONI_F_H #include #include namespace Ice { class ConnectionI; ICE_API Ice::LocalObject* upCast(Ice::ConnectionI*); typedef IceInternal::Handle ConnectionIPtr; } namespace IceInternal { enum AsyncStatus { AsyncStatusQueued = 0, AsyncStatusSent = 1, AsyncStatusInvokeSentCallback = 2 }; } #endif Ice-3.5.1/cpp/include/Ice/EndpointIF.h0000644000076400007640000000134012223561476015445 0ustar mesmes// ********************************************************************** // // 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 ICE_ENDPOINT_I_F_H #define ICE_ENDPOINT_I_F_H #include #include namespace IceInternal { class EndpointI; ICE_API Ice::LocalObject* upCast(EndpointI*); typedef Handle EndpointIPtr; class EndpointHostResolver; ICE_API IceUtil::Shared* upCast(EndpointHostResolver*); typedef Handle EndpointHostResolverPtr; } #endif Ice-3.5.1/cpp/include/Ice/Dispatcher.h0000644000076400007640000000322612223561476015541 0ustar mesmes// ********************************************************************** // // 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 ICE_DISPATCHER_H #define ICE_DISPATCHER_H #include #include #include #include #ifdef ICE_CPP11 # include #endif namespace Ice { class ICE_API DispatcherCall : virtual public IceUtil::Shared { public: virtual ~DispatcherCall() { } virtual void run() = 0; }; typedef IceUtil::Handle DispatcherCallPtr; class ICE_API Dispatcher : virtual public IceUtil::Shared { public: virtual void dispatch(const DispatcherCallPtr&, const ConnectionPtr&) = 0; }; typedef IceUtil::Handle DispatcherPtr; } #ifdef ICE_CPP11 namespace IceInternal { class ICE_API Cpp11Dispatcher : public ::Ice::Dispatcher { public: Cpp11Dispatcher(const ::std::function& cb) : _cb(cb) { } virtual void dispatch(const ::Ice::DispatcherCallPtr& call, const ::Ice::ConnectionPtr& conn); private: const ::std::function _cb; }; } namespace Ice { inline DispatcherPtr newDispatcher(const ::std::function& cb) { return new ::IceInternal::Cpp11Dispatcher(cb); } } #endif #endif Ice-3.5.1/cpp/include/Ice/BasicStream.h0000644000076400007640000010540312223561476015650 0ustar mesmes// ********************************************************************** // // 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 ICE_BASIC_STREAM_H #define ICE_BASIC_STREAM_H #include #include #include #include #include #include #include #include #include #include #include namespace Ice { class UserException; template class BasicStringConverter; typedef BasicStringConverter StringConverter; typedef IceUtil::Handle StringConverterPtr; typedef BasicStringConverter WstringConverter; typedef IceUtil::Handle WstringConverterPtr; } namespace IceInternal { template inline void patchHandle(void* addr, const Ice::ObjectPtr& v) { IceInternal::Handle* p = static_cast*>(addr); __patch(*p, v); // Generated __patch method, necessary for forward declarations. } class ICE_API BasicStream : public Buffer { public: typedef size_t size_type; typedef void (*PatchFunc)(void*, const Ice::ObjectPtr&); BasicStream(Instance*, const Ice::EncodingVersion&, bool = false); BasicStream(Instance*, const Ice::EncodingVersion&, const Ice::Byte*, const Ice::Byte*); ~BasicStream() { // Inlined for performance reasons. if(_currentReadEncaps != &_preAllocatedReadEncaps || _currentWriteEncaps != &_preAllocatedWriteEncaps) { clear(); // Not inlined. } } void clear(); // // Must return Instance*, because we don't hold an InstancePtr for // optimization reasons (see comments below). // Instance* instance() const { return _instance; } // Inlined for performance reasons. void* closure() const; void* closure(void*); void swap(BasicStream&); void resetEncaps(); void resize(Container::size_type sz) { // // Check memory limit if stream is not unlimited. // if(!_unlimited && sz > _messageSizeMax) { IceInternal::Ex::throwMemoryLimitException(__FILE__, __LINE__, sz, _messageSizeMax); } b.resize(sz); } void startWriteObject(const Ice::SlicedDataPtr& data) { assert(_currentWriteEncaps && _currentWriteEncaps->encoder); _currentWriteEncaps->encoder->startInstance(ObjectSlice, data); } void endWriteObject() { assert(_currentWriteEncaps && _currentWriteEncaps->encoder); _currentWriteEncaps->encoder->endInstance(); } void startReadObject() { assert(_currentReadEncaps && _currentReadEncaps->decoder); _currentReadEncaps->decoder->startInstance(ObjectSlice); } Ice::SlicedDataPtr endReadObject(bool preserve) { assert(_currentReadEncaps && _currentReadEncaps->decoder); return _currentReadEncaps->decoder->endInstance(preserve); } void startWriteException(const Ice::SlicedDataPtr& data) { assert(_currentWriteEncaps && _currentWriteEncaps->encoder); _currentWriteEncaps->encoder->startInstance(ExceptionSlice, data); } void endWriteException() { assert(_currentWriteEncaps && _currentWriteEncaps->encoder); _currentWriteEncaps->encoder->endInstance(); } void startReadException() { assert(_currentReadEncaps && _currentReadEncaps->decoder); _currentReadEncaps->decoder->startInstance(ExceptionSlice); } Ice::SlicedDataPtr endReadException(bool preserve) { assert(_currentReadEncaps && _currentReadEncaps->decoder); return _currentReadEncaps->decoder->endInstance(preserve); } void startWriteEncaps(); void startWriteEncaps(const Ice::EncodingVersion& encoding, Ice::FormatType format) { checkSupportedEncoding(encoding); WriteEncaps* oldEncaps = _currentWriteEncaps; if(!oldEncaps) // First allocated encaps? { _currentWriteEncaps = &_preAllocatedWriteEncaps; } else { _currentWriteEncaps = new WriteEncaps(); _currentWriteEncaps->previous = oldEncaps; } _currentWriteEncaps->format = format; _currentWriteEncaps->encoding = encoding; _currentWriteEncaps->start = b.size(); write(Ice::Int(0)); // Placeholder for the encapsulation length. write(_currentWriteEncaps->encoding); } void endWriteEncaps() { assert(_currentWriteEncaps); // Size includes size and version. const Ice::Int sz = static_cast(b.size() - _currentWriteEncaps->start); write(sz, &(*(b.begin() + _currentWriteEncaps->start))); WriteEncaps* oldEncaps = _currentWriteEncaps; _currentWriteEncaps = _currentWriteEncaps->previous; if(oldEncaps == &_preAllocatedWriteEncaps) { oldEncaps->reset(); } else { delete oldEncaps; } } void endWriteEncapsChecked(); // Used by public stream API. void writeEmptyEncaps(const Ice::EncodingVersion& encoding) { checkSupportedEncoding(encoding); write(Ice::Int(6)); // Size write(encoding); } void writeEncaps(const Ice::Byte* v, Ice::Int sz) { if(sz < 6) { throwEncapsulationException(__FILE__, __LINE__); } Container::size_type pos = b.size(); resize(pos + sz); memcpy(&b[pos], &v[0], sz); } const Ice::EncodingVersion& getWriteEncoding() const { return _currentWriteEncaps ? _currentWriteEncaps->encoding : _encoding; } const Ice::EncodingVersion& startReadEncaps() { ReadEncaps* oldEncaps = _currentReadEncaps; if(!oldEncaps) // First allocated encaps? { _currentReadEncaps = &_preAllocatedReadEncaps; } else { _currentReadEncaps = new ReadEncaps(); _currentReadEncaps->previous = oldEncaps; } _currentReadEncaps->start = i - b.begin(); // // I don't use readSize() and writeSize() for encapsulations, // because when creating an encapsulation, I must know in advance // how many bytes the size information will require in the data // stream. If I use an Int, it is always 4 bytes. For // readSize()/writeSize(), it could be 1 or 5 bytes. // Ice::Int sz; read(sz); if(sz < 6) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } if(i - sizeof(Ice::Int) + sz > b.end()) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } _currentReadEncaps->sz = sz; read(_currentReadEncaps->encoding); checkSupportedEncoding(_currentReadEncaps->encoding); // Make sure the encoding is supported return _currentReadEncaps->encoding; } void endReadEncaps() { assert(_currentReadEncaps); if(_currentReadEncaps->encoding != Ice::Encoding_1_0) { skipOpts(); if(i != b.begin() + _currentReadEncaps->start + _currentReadEncaps->sz) { throwEncapsulationException(__FILE__, __LINE__); } } else if(i != b.begin() + _currentReadEncaps->start + _currentReadEncaps->sz) { if(i + 1 != b.begin() + _currentReadEncaps->start + _currentReadEncaps->sz) { throwEncapsulationException(__FILE__, __LINE__); } // // Ice version < 3.3 had a bug where user exceptions with // class members could be encoded with a trailing byte // when dispatched with AMD. So we tolerate an extra byte // in the encapsulation. // ++i; } ReadEncaps* oldEncaps = _currentReadEncaps; _currentReadEncaps = _currentReadEncaps->previous; if(oldEncaps == &_preAllocatedReadEncaps) { oldEncaps->reset(); } else { delete oldEncaps; } } Ice::EncodingVersion skipEmptyEncaps() { Ice::Int sz; read(sz); if(sz != static_cast(sizeof(Ice::Int)) + 2) { throwEncapsulationException(__FILE__, __LINE__); } if(i + 2 > b.end()) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } Ice::EncodingVersion encoding; read(encoding); return encoding; } void endReadEncapsChecked(); // Used by public stream API. Ice::EncodingVersion readEncaps(const Ice::Byte*& v, Ice::Int& sz) { Ice::EncodingVersion encoding; v = i; read(sz); if(sz < 6) { throwEncapsulationException(__FILE__, __LINE__); } if(i - sizeof(Ice::Int) + sz > b.end()) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } read(encoding); i += sz - sizeof(Ice::Int) - 2; return encoding; } const Ice::EncodingVersion& getReadEncoding() const { return _currentReadEncaps ? _currentReadEncaps->encoding : _encoding; } Ice::Int getReadEncapsSize(); Ice::EncodingVersion skipEncaps(); void startWriteSlice(const std::string& typeId, int compactId, bool last) { assert(_currentWriteEncaps && _currentWriteEncaps->encoder); _currentWriteEncaps->encoder->startSlice(typeId, compactId, last); } void endWriteSlice() { assert(_currentWriteEncaps && _currentWriteEncaps->encoder); _currentWriteEncaps->encoder->endSlice(); } std::string startReadSlice() { assert(_currentReadEncaps && _currentReadEncaps->decoder); return _currentReadEncaps->decoder->startSlice(); } void endReadSlice() { assert(_currentReadEncaps && _currentReadEncaps->decoder); _currentReadEncaps->decoder->endSlice(); } void skipSlice() { assert(_currentReadEncaps && _currentReadEncaps->decoder); _currentReadEncaps->decoder->skipSlice(); } void readPendingObjects(); void writePendingObjects(); void writeSize(Ice::Int v) // Inlined for performance reasons. { assert(v >= 0); if(v > 254) { write(Ice::Byte(255)); write(v); } else { write(static_cast(v)); } } void rewriteSize(Ice::Int v, Container::iterator dest) { assert(v >= 0); if(v > 254) { *dest++ = Ice::Byte(255); write(v, dest); } else { *dest = static_cast(v); } } Ice::Int readSize() // Inlined for performance reasons. { Ice::Byte byte; read(byte); unsigned char val = static_cast(byte); if(val == 255) { Ice::Int v; read(v); if(v < 0) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } return v; } else { return static_cast(static_cast(byte)); } } Ice::Int readAndCheckSeqSize(int); void startSize() { _sizePos = static_cast(b.size()); write(Ice::Int(0)); } void endSize() { assert(_sizePos >= 0); rewrite(static_cast(b.size()) - _sizePos - 4, _sizePos); _sizePos = -1; } void writeBlob(const std::vector&); void readBlob(std::vector&, Ice::Int); void writeBlob(const Ice::Byte* v, Container::size_type sz) { if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz); memcpy(&b[pos], &v[0], sz); } } void readBlob(const Ice::Byte*& v, Container::size_type sz) { if(sz > 0) { v = i; if(static_cast(b.end() - i) < sz) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } i += sz; } else { v = i; } } template void write(const T& v) { Ice::StreamHelper::helper>::write(this, v); } template void read(T& v) { Ice::StreamHelper::helper>::read(this, v); } template void write(Ice::Int tag, const IceUtil::Optional& v) { if(!v) { return; // Optional not set } if(writeOpt(tag, Ice::StreamOptionalHelper::helper, Ice::StreamableTraits::fixedLength>::optionalFormat)) { Ice::StreamOptionalHelper::helper, Ice::StreamableTraits::fixedLength>::write(this, *v); } } template void read(Ice::Int tag, IceUtil::Optional& v) { if(readOpt(tag, Ice::StreamOptionalHelper::helper, Ice::StreamableTraits::fixedLength>::optionalFormat)) { v.__setIsSet(); Ice::StreamOptionalHelper::helper, Ice::StreamableTraits::fixedLength>::read(this, *v); } else { v = IceUtil::None; } } // // Template functions for sequences and custom sequences // template void write(const std::vector& v) { if(v.empty()) { writeSize(0); } else { write(&v[0], &v[0] + v.size()); } } template void write(const T* begin, const T* end) { writeSize(static_cast(end - begin)); for(const T* p = begin; p != end; ++p) { write(*p); } } // Read/write type and tag for optionals bool writeOpt(Ice::Int tag, Ice::OptionalFormat format) { assert(_currentWriteEncaps); if(_currentWriteEncaps->encoder) { return _currentWriteEncaps->encoder->writeOpt(tag, format); } else { return writeOptImpl(tag, format); } } bool readOpt(Ice::Int tag, Ice::OptionalFormat expectedFormat) { assert(_currentReadEncaps); if(_currentReadEncaps->decoder) { return _currentReadEncaps->decoder->readOpt(tag, expectedFormat); } else { return readOptImpl(tag, expectedFormat); } } // Byte void write(Ice::Byte v) { b.push_back(v); } void write(const Ice::Byte*, const Ice::Byte*); void read(Ice::Byte& v) { if(i >= b.end()) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } v = *i++; } void read(std::vector&); void read(std::pair&); // This method is useful for generic stream helpers void read(std::pair& p, ::IceUtil::ScopedArray& result) { result.reset(); read(p); } // Bool void write(bool v) { b.push_back(static_cast(v)); } void write(const std::vector&); void write(const bool*, const bool*); void read(bool& v) { if(i >= b.end()) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } v = (0 != *i++); } void read(std::vector&); void read(std::pair&, ::IceUtil::ScopedArray&); // Short void write(Ice::Short); void write(const Ice::Short*, const Ice::Short*); void read(Ice::Short&); void read(std::vector&); void read(std::pair&, ::IceUtil::ScopedArray&); // Int void write(Ice::Int v) // Inlined for performance reasons. { Container::size_type pos = b.size(); resize(pos + sizeof(Ice::Int)); write(v, &b[pos]); } void write(Ice::Int v, Container::iterator dest) { #ifdef ICE_BIG_ENDIAN const Ice::Byte* src = reinterpret_cast(&v) + sizeof(Ice::Int) - 1; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest = *src; #else const Ice::Byte* src = reinterpret_cast(&v); *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest = *src; #endif } void read(Ice::Int& v) // Inlined for performance reasons. { if(b.end() - i < static_cast(sizeof(Ice::Int))) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } const Ice::Byte* src = &(*i); i += sizeof(Ice::Int); #ifdef ICE_BIG_ENDIAN Ice::Byte* dest = reinterpret_cast(&v) + sizeof(Ice::Int) - 1; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest = *src; #else Ice::Byte* dest = reinterpret_cast(&v); *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest = *src; #endif } void write(const Ice::Int*, const Ice::Int*); void read(std::vector&); void read(std::pair&, ::IceUtil::ScopedArray&); // Long void write(Ice::Long); void write(const Ice::Long*, const Ice::Long*); void read(Ice::Long&); void read(std::vector&); void read(std::pair&, ::IceUtil::ScopedArray&); // Float void write(Ice::Float); void write(const Ice::Float*, const Ice::Float*); void read(Ice::Float&); void read(std::vector&); void read(std::pair&, ::IceUtil::ScopedArray&); // Double void write(Ice::Double); void write(const Ice::Double*, const Ice::Double*); void read(Ice::Double&); void read(std::vector&); void read(std::pair&, ::IceUtil::ScopedArray&); // // NOTE: This function is not implemented. It is declared here to // catch programming errors that assume a call such as write("") // will invoke write(const std::string&), when in fact the compiler // will silently select a different overloading. A link error is the // intended result. // void write(const char*); // String void writeConverted(const std::string& v); void write(const std::string& v, bool convert = true) { Ice::Int sz = static_cast(v.size()); if(convert && sz > 0 && _stringConverter != 0) { writeConverted(v); } else { writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz); memcpy(&b[pos], v.data(), sz); } } } void write(const std::string*, const std::string*, bool = true); void readConverted(std::string&, Ice::Int); void read(std::string& v, bool convert = true) { Ice::Int sz = readSize(); if(sz > 0) { if(b.end() - i < sz) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } if(convert && _stringConverter != 0) { readConverted(v, sz); } else { std::string(reinterpret_cast(&*i), reinterpret_cast(&*i) + sz).swap(v); } i += sz; } else { v.clear(); } } void read(std::vector&, bool = true); void write(const std::wstring& v); void write(const std::wstring*, const std::wstring*); void read(std::wstring&); void read(std::vector&); // Proxy void write(const Ice::ObjectPrx&); template void write(const IceInternal::ProxyHandle& v) { write(Ice::ObjectPrx(upCast(v.get()))); } void read(Ice::ObjectPrx&); template void read(IceInternal::ProxyHandle& v) { __read(this, v); // Generated __read method, necessary for forward declarations. } // Class void write(const Ice::ObjectPtr& v) { initWriteEncaps(); _currentWriteEncaps->encoder->write(v); } template void write(const IceInternal::Handle& v) { write(Ice::ObjectPtr(upCast(v.get()))); } void read(PatchFunc patchFunc, void* patchAddr) { initReadEncaps(); _currentReadEncaps->decoder->read(patchFunc, patchAddr); } template void read(IceInternal::Handle& v) { read(&patchHandle, &v); } // Enum Ice::Int readEnum(Ice::Int); void writeEnum(Ice::Int, Ice::Int); // Exception void writeException(const Ice::UserException&); void throwException(const UserExceptionFactoryPtr& = 0); void sliceObjects(bool); // Read/write/skip optionals bool readOptImpl(Ice::Int, Ice::OptionalFormat); bool writeOptImpl(Ice::Int, Ice::OptionalFormat); void skipOpt(Ice::OptionalFormat); void skipOpts(); // Skip bytes from the stream void skip(size_type size) { if(i + size > b.end()) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } i += size; } void skipSize() { Ice::Byte b; read(b); if(static_cast(b) == 255) { skip(4); } } size_type pos() { return b.size(); } void rewrite(Ice::Int value, size_type p) { write(value, b.begin() + p); } private: // // I can't throw these exception from inline functions from within // this file, because I cannot include the header with the // exceptions. Doing so would screw up the whole include file // ordering. // void throwUnmarshalOutOfBoundsException(const char*, int); void throwEncapsulationException(const char*, int); // // Optimization. The instance may not be deleted while a // stack-allocated BasicStream still holds it. // Instance* _instance; // // The public stream API needs to attach data to a stream. // void* _closure; class ReadEncaps; class WriteEncaps; enum SliceType { NoSlice, ObjectSlice, ExceptionSlice }; typedef std::vector ObjectList; class ICE_API EncapsDecoder : private ::IceUtil::noncopyable { public: virtual ~EncapsDecoder() { } virtual void read(PatchFunc, void*) = 0; virtual void throwException(const UserExceptionFactoryPtr&) = 0; virtual void startInstance(SliceType) = 0; virtual Ice::SlicedDataPtr endInstance(bool) = 0; virtual const std::string& startSlice() = 0; virtual void endSlice() = 0; virtual void skipSlice() = 0; virtual bool readOpt(Ice::Int, Ice::OptionalFormat) { return false; } virtual void readPendingObjects() { } protected: EncapsDecoder(BasicStream* stream, ReadEncaps* encaps, bool sliceObjects, const ObjectFactoryManagerPtr& f) : _stream(stream), _encaps(encaps), _sliceObjects(sliceObjects), _servantFactoryManager(f), _typeIdIndex(0) { } std::string readTypeId(bool); Ice::ObjectPtr newInstance(const std::string&); void addPatchEntry(Ice::Int, PatchFunc, void*); void unmarshal(Ice::Int, const Ice::ObjectPtr&); typedef std::map IndexToPtrMap; typedef std::map TypeIdReadMap; struct PatchEntry { PatchFunc patchFunc; void* patchAddr; }; typedef std::vector PatchList; typedef std::map PatchMap; BasicStream* _stream; ReadEncaps* _encaps; const bool _sliceObjects; ObjectFactoryManagerPtr _servantFactoryManager; // Encapsulation attributes for object un-marshalling PatchMap _patchMap; private: // Encapsulation attributes for object un-marshalling IndexToPtrMap _unmarshaledMap; TypeIdReadMap _typeIdMap; Ice::Int _typeIdIndex; ObjectList _objectList; }; class ICE_API EncapsDecoder10 : public EncapsDecoder { public: EncapsDecoder10(BasicStream* stream, ReadEncaps* encaps, bool sliceObjects, const ObjectFactoryManagerPtr& f) : EncapsDecoder(stream, encaps, sliceObjects, f), _sliceType(NoSlice) { } virtual void read(PatchFunc, void*); virtual void throwException(const UserExceptionFactoryPtr&); virtual void startInstance(SliceType); virtual Ice::SlicedDataPtr endInstance(bool); virtual const std::string& startSlice(); virtual void endSlice(); virtual void skipSlice(); virtual void readPendingObjects(); private: void readInstance(); // Instance attributes SliceType _sliceType; bool _skipFirstSlice; // Slice attributes Ice::Int _sliceSize; std::string _typeId; }; class ICE_API EncapsDecoder11 : public EncapsDecoder { public: EncapsDecoder11(BasicStream* stream, ReadEncaps* encaps, bool sliceObjects, const ObjectFactoryManagerPtr& f) : EncapsDecoder(stream, encaps, sliceObjects, f), _preAllocatedInstanceData(0), _current(0), _objectIdIndex(1) { } virtual void read(PatchFunc, void*); virtual void throwException(const UserExceptionFactoryPtr&); virtual void startInstance(SliceType); virtual Ice::SlicedDataPtr endInstance(bool); virtual const std::string& startSlice(); virtual void endSlice(); virtual void skipSlice(); virtual bool readOpt(Ice::Int, Ice::OptionalFormat); private: Ice::Int readInstance(Ice::Int, PatchFunc, void*); Ice::SlicedDataPtr readSlicedData(); struct IndirectPatchEntry { Ice::Int index; PatchFunc patchFunc; void* patchAddr; }; typedef std::vector IndirectPatchList; typedef std::vector IndexList; typedef std::vector IndexListList; struct InstanceData { InstanceData(InstanceData* previous) : previous(previous), next(0) { if(previous) { previous->next = this; } } ~InstanceData() { if(next) { delete next; } } // Instance attributes SliceType sliceType; bool skipFirstSlice; Ice::SliceInfoSeq slices; // Preserved slices. IndexListList indirectionTables; // Slice attributes Ice::Byte sliceFlags; Ice::Int sliceSize; std::string typeId; int compactId; IndirectPatchList indirectPatchList; InstanceData* previous; InstanceData* next; }; InstanceData _preAllocatedInstanceData; InstanceData* _current; void push(SliceType sliceType) { if(!_current) { _current = &_preAllocatedInstanceData; } else { _current = _current->next ? _current->next : new InstanceData(_current); } _current->sliceType = sliceType; _current->skipFirstSlice = false; } Ice::Int _objectIdIndex; // The ID of the next object to un-marshal. }; class ICE_API EncapsEncoder : private ::IceUtil::noncopyable { public: virtual ~EncapsEncoder() { } virtual void write(const Ice::ObjectPtr&) = 0; virtual void write(const Ice::UserException&) = 0; virtual void startInstance(SliceType, const Ice::SlicedDataPtr&) = 0; virtual void endInstance() = 0; virtual void startSlice(const std::string&, int, bool) = 0; virtual void endSlice() = 0; virtual bool writeOpt(Ice::Int, Ice::OptionalFormat) { return false; } virtual void writePendingObjects() { } protected: EncapsEncoder(BasicStream* stream, WriteEncaps* encaps) : _stream(stream), _encaps(encaps), _typeIdIndex(0) { } Ice::Int registerTypeId(const std::string&); BasicStream* _stream; WriteEncaps* _encaps; typedef std::map PtrToIndexMap; typedef std::map TypeIdWriteMap; // Encapsulation attributes for object marshalling. PtrToIndexMap _marshaledMap; private: // Encapsulation attributes for object marshalling. TypeIdWriteMap _typeIdMap; Ice::Int _typeIdIndex; }; class ICE_API EncapsEncoder10 : public EncapsEncoder { public: EncapsEncoder10(BasicStream* stream, WriteEncaps* encaps) : EncapsEncoder(stream, encaps), _sliceType(NoSlice), _objectIdIndex(0) { } virtual void write(const Ice::ObjectPtr&); virtual void write(const Ice::UserException&); virtual void startInstance(SliceType, const Ice::SlicedDataPtr&); virtual void endInstance(); virtual void startSlice(const std::string&, int, bool); virtual void endSlice(); virtual void writePendingObjects(); private: Ice::Int registerObject(const Ice::ObjectPtr&); // Instance attributes SliceType _sliceType; // Slice attributes Container::size_type _writeSlice; // Position of the slice data members // Encapsulation attributes for object marshalling. Ice::Int _objectIdIndex; PtrToIndexMap _toBeMarshaledMap; }; class ICE_API EncapsEncoder11 : public EncapsEncoder { public: EncapsEncoder11(BasicStream* stream, WriteEncaps* encaps) : EncapsEncoder(stream, encaps), _preAllocatedInstanceData(0), _current(0), _objectIdIndex(1) { } virtual void write(const Ice::ObjectPtr&); virtual void write(const Ice::UserException&); virtual void startInstance(SliceType, const Ice::SlicedDataPtr&); virtual void endInstance(); virtual void startSlice(const std::string&, int, bool); virtual void endSlice(); virtual bool writeOpt(Ice::Int, Ice::OptionalFormat); private: void writeSlicedData(const Ice::SlicedDataPtr&); void writeInstance(const Ice::ObjectPtr&); struct InstanceData { InstanceData(InstanceData* previous) : previous(previous), next(0) { if(previous) { previous->next = this; } } ~InstanceData() { if(next) { delete next; } } // Instance attributes SliceType sliceType; bool firstSlice; // Slice attributes Ice::Byte sliceFlags; Container::size_type writeSlice; // Position of the slice data members Container::size_type sliceFlagsPos; // Position of the slice flags PtrToIndexMap indirectionMap; ObjectList indirectionTable; InstanceData* previous; InstanceData* next; }; InstanceData _preAllocatedInstanceData; InstanceData* _current; Ice::Int _objectIdIndex; // The ID of the next object to marhsal }; class ReadEncaps : private ::IceUtil::noncopyable { public: ReadEncaps() : start(0), decoder(0), previous(0) { // Inlined for performance reasons. } ~ReadEncaps() { // Inlined for performance reasons. delete decoder; } void reset() { // Inlined for performance reasons. delete decoder; decoder = 0; previous = 0; } Container::size_type start; Ice::Int sz; Ice::EncodingVersion encoding; EncapsDecoder* decoder; ReadEncaps* previous; }; class WriteEncaps : private ::IceUtil::noncopyable { public: WriteEncaps() : format(Ice::DefaultFormat), encoder(0), previous(0) { // Inlined for performance reasons. } ~WriteEncaps() { // Inlined for performance reasons. delete encoder; } void reset() { // Inlined for performance reasons. delete encoder; encoder = 0; previous = 0; } Container::size_type start; Ice::EncodingVersion encoding; Ice::FormatType format; EncapsEncoder* encoder; WriteEncaps* previous; }; // // The encoding version to use when there's no encapsulation to // read from or write to. This is for example used to read message // headers or when the user is using the streaming API with no // encapsulation. // Ice::EncodingVersion _encoding; ReadEncaps* _currentReadEncaps; WriteEncaps* _currentWriteEncaps; void initReadEncaps(); void initWriteEncaps(); ReadEncaps _preAllocatedReadEncaps; WriteEncaps _preAllocatedWriteEncaps; bool _sliceObjects; const Container::size_type _messageSizeMax; bool _unlimited; const Ice::StringConverterPtr& _stringConverter; const Ice::WstringConverterPtr& _wstringConverter; int _startSeq; int _minSeqSize; int _sizePos; }; } // End namespace IceInternal #endif Ice-3.5.1/cpp/include/Ice/EndpointFactory.h0000644000076400007640000000170412223561476016562 0ustar mesmes// ********************************************************************** // // 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 ICE_ENDPOINT_FACTORY_H #define ICE_ENDPOINT_FACTORY_H #include #include #include #include namespace IceInternal { class BasicStream; class ICE_API EndpointFactory : public ::IceUtil::Shared { public: virtual ~EndpointFactory(); virtual ::Ice::Short type() const = 0; virtual ::std::string protocol() const = 0; virtual EndpointIPtr create(const std::string&, bool) const = 0; virtual EndpointIPtr read(BasicStream*) const = 0; virtual void destroy() = 0; protected: EndpointFactory(); }; } #endif Ice-3.5.1/cpp/include/Ice/Initialize.h0000644000076400007640000001143512223561476015555 0ustar mesmes// ********************************************************************** // // 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 ICE_INITIALIZE_H #define ICE_INITIALIZE_H #include #include #include #include #include #include #include #include #include #include #include #include namespace Ice { ICE_API void collectGarbage(); ICE_API StringSeq argsToStringSeq(int, char*[]); #ifdef _WIN32 ICE_API StringSeq argsToStringSeq(int, wchar_t*[]); ICE_API StringSeq argsToStringSeq(int, wchar_t*[], const StringConverterPtr&); #endif // // This function assumes that the string sequence only contains // elements of the argument vector. The function shifts the // the argument vector elements so that the vector matches the // contents of the sequence. // ICE_API void stringSeqToArgs(const StringSeq&, int&, char*[]); ICE_API PropertiesPtr createProperties(const StringConverterPtr& = 0); ICE_API PropertiesPtr createProperties(StringSeq&, const PropertiesPtr& = 0, const StringConverterPtr& = 0); ICE_API PropertiesPtr createProperties(int&, char*[], const PropertiesPtr& = 0, const StringConverterPtr& = 0); // // This class is used to notify user of when Ice threads are started // and stopped. // class ICE_API ThreadNotification : public IceUtil::Shared { public: virtual void start() = 0; virtual void stop() = 0; }; typedef IceUtil::Handle ThreadNotificationPtr; // // A special plug-in that installs thread hook during a communicator's initialization. // Both initialize and destroy are no-op. See Ice::InitializationData. // class ICE_API ThreadHookPlugin : public Ice::Plugin { public: ThreadHookPlugin(const CommunicatorPtr& communicator, const ThreadNotificationPtr&); virtual void initialize(); virtual void destroy(); }; // // Communicator initialization info // struct InitializationData { PropertiesPtr properties; LoggerPtr logger; StatsPtr stats; Instrumentation::CommunicatorObserverPtr observer; StringConverterPtr stringConverter; WstringConverterPtr wstringConverter; ThreadNotificationPtr threadHook; DispatcherPtr dispatcher; CompactIdResolverPtr compactIdResolver; }; ICE_API CommunicatorPtr initialize(int&, char*[], const InitializationData& = InitializationData(), Int = ICE_INT_VERSION); ICE_API CommunicatorPtr initialize(Ice::StringSeq&, const InitializationData& = InitializationData(), Int = ICE_INT_VERSION); ICE_API CommunicatorPtr initialize(const InitializationData& = InitializationData(), Int = ICE_INT_VERSION); ICE_API InputStreamPtr createInputStream(const CommunicatorPtr&, const ::std::vector< Byte >&); ICE_API InputStreamPtr createInputStream(const CommunicatorPtr&, const ::std::vector< Byte >&, const EncodingVersion&); ICE_API InputStreamPtr wrapInputStream(const CommunicatorPtr&, const ::std::vector< Byte >&); ICE_API InputStreamPtr wrapInputStream(const CommunicatorPtr&, const ::std::vector< Byte >&, const EncodingVersion&); ICE_API InputStreamPtr createInputStream(const CommunicatorPtr&, const ::std::pair< const Ice::Byte*, const Ice::Byte*>&); ICE_API InputStreamPtr createInputStream(const CommunicatorPtr&, const ::std::pair< const Ice::Byte*, const Ice::Byte*>&, const EncodingVersion&); ICE_API InputStreamPtr wrapInputStream(const CommunicatorPtr&, const ::std::pair< const Ice::Byte*, const Ice::Byte*>&); ICE_API InputStreamPtr wrapInputStream(const CommunicatorPtr&, const ::std::pair< const Ice::Byte*, const Ice::Byte*>&, const EncodingVersion&); ICE_API OutputStreamPtr createOutputStream(const CommunicatorPtr&); ICE_API OutputStreamPtr createOutputStream(const CommunicatorPtr&, const EncodingVersion&); ICE_API LoggerPtr getProcessLogger(); ICE_API void setProcessLogger(const LoggerPtr&); } namespace IceInternal { // // Some Ice extensions need access to the Ice internal instance. Do // not use this operation for regular application code! It is intended // to be used by modules such as Freeze. // ICE_API InstancePtr getInstance(const ::Ice::CommunicatorPtr&); } #endif Ice-3.5.1/cpp/include/Ice/ServantManagerF.h0000644000076400007640000000115212223561476016472 0ustar mesmes// ********************************************************************** // // 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 ICE_SERVANT_MANAGER_F_H #define ICE_SERVANT_MANAGER_F_H #include #include namespace IceInternal { class ServantManager; ICE_API IceUtil::Shared* upCast(ServantManager*); typedef Handle ServantManagerPtr; } #endif Ice-3.5.1/cpp/include/Ice/Stream.h0000644000076400007640000003030012223561476014677 0ustar mesmes// ********************************************************************** // // 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 ICE_STREAM_H #define ICE_STREAM_H #include #include #include #include #include #include #include #include namespace Ice { class ICE_API ReadObjectCallback : public ::IceUtil::Shared { public: virtual void invoke(const ObjectPtr&) = 0; }; typedef IceUtil::Handle ReadObjectCallbackPtr; template class ReadObjectCallbackI : public ReadObjectCallback { public: ReadObjectCallbackI(::IceInternal::Handle& v) : _v(v) { } virtual void invoke(const ObjectPtr& p) { _v = ::IceInternal::Handle::dynamicCast(p); if(p && !_v) { IceInternal::Ex::throwUOE(T::ice_staticId(), p); } } private: ::IceInternal::Handle& _v; }; class ICE_API UserExceptionReader : public UserException { public: UserExceptionReader(const CommunicatorPtr&); ~UserExceptionReader() throw(); virtual void read(const InputStreamPtr&) const = 0; virtual bool usesClasses() const = 0; virtual ::std::string ice_name() const = 0; virtual UserException* ice_clone() const = 0; virtual void ice_throw() const = 0; virtual void __write(IceInternal::BasicStream*) const; virtual void __read(IceInternal::BasicStream*); virtual bool __usesClasses() const; #ifdef __SUNPRO_CC using UserException::__read; using UserException::__write; #endif protected: virtual void __writeImpl(::IceInternal::BasicStream*) const; virtual void __readImpl(::IceInternal::BasicStream*); #ifdef __SUNPRO_CC using UserException::__writeImpl; using UserException::__readImpl; #endif const CommunicatorPtr _communicator; }; class ICE_API UserExceptionReaderFactory : public IceUtil::Shared { public: virtual void createAndThrow(const std::string&) const = 0; }; typedef ::IceUtil::Handle UserExceptionReaderFactoryPtr; class ICE_API InputStream : public ::IceUtil::Shared { public: virtual CommunicatorPtr communicator() const = 0; virtual void sliceObjects(bool) = 0; virtual Int readSize() = 0; virtual Int readAndCheckSeqSize(int) = 0; virtual ObjectPrx readProxy() = 0; template void read(IceInternal::ProxyHandle& v) { ObjectPrx proxy = readProxy(); if(!proxy) { v = 0; } else { v = new T; v->__copyFrom(proxy); } } virtual void readObject(const ReadObjectCallbackPtr&) = 0; template void read(IceInternal::Handle& v) { readObject(new ReadObjectCallbackI(v)); } Int readEnum(Int maxValue) { if(getEncoding() == Encoding_1_0) { if(maxValue < 127) { Byte value; read(value); return value; } else if(maxValue < 32767) { Short value; read(value); return value; } else { Int value; read(value); return value; } } else { return readSize(); } } virtual void throwException() = 0; virtual void throwException(const UserExceptionReaderFactoryPtr&) = 0; virtual void startObject() = 0; virtual SlicedDataPtr endObject(bool) = 0; virtual void startException() = 0; virtual SlicedDataPtr endException(bool) = 0; virtual std::string startSlice() = 0; virtual void endSlice() = 0; virtual void skipSlice() = 0; virtual EncodingVersion startEncapsulation() = 0; virtual void endEncapsulation() = 0; virtual EncodingVersion skipEncapsulation() = 0; virtual EncodingVersion getEncoding() const = 0; virtual void readPendingObjects() = 0; virtual void rewind() = 0; virtual void skip(Int) = 0; virtual void skipSize() = 0; virtual void read(bool&) = 0; virtual void read(Byte&) = 0; virtual void read(Short&) = 0; virtual void read(Int&) = 0; virtual void read(Long&) = 0; virtual void read(Float&) = 0; virtual void read(Double&) = 0; virtual void read(::std::string&, bool = true) = 0; virtual void read(::std::vector< ::std::string>&, bool) = 0; // Overload required for additional bool argument. virtual void read(::std::wstring&) = 0; // // std::vector is a special C++ type, so we give it its own read function // virtual void read(::std::vector&) = 0; virtual void read(::std::pair&, ::IceUtil::ScopedArray&) = 0; virtual void read(::std::pair&) = 0; virtual void read(::std::pair&, ::IceUtil::ScopedArray&) = 0; virtual void read(::std::pair&, ::IceUtil::ScopedArray&) = 0; virtual void read(::std::pair&, ::IceUtil::ScopedArray&) = 0; virtual void read(::std::pair&, ::IceUtil::ScopedArray&) = 0; virtual void read(::std::pair&, ::IceUtil::ScopedArray&) = 0; // This method is useful for generic stream helpers void read(::std::pair& p, ::IceUtil::ScopedArray& result) { result.reset(); read(p); } virtual bool readOptional(Int, OptionalFormat) = 0; template inline void read(T& v) { StreamHelper::helper>::read(this, v); } template inline void read(Int tag, IceUtil::Optional& v) { if(readOptional(tag, StreamOptionalHelper::helper, StreamableTraits::fixedLength>::optionalFormat)) { v.__setIsSet(); StreamOptionalHelper::helper, StreamableTraits::fixedLength>::read(this, *v); } else { v = IceUtil::None; } } virtual void closure(void*) = 0; virtual void* closure() const = 0; }; class ICE_API OutputStream : public ::IceUtil::Shared { public: typedef size_t size_type; virtual CommunicatorPtr communicator() const = 0; virtual void writeSize(Int) = 0; virtual void writeProxy(const ObjectPrx&) = 0; template void write(const IceInternal::ProxyHandle& v) { writeProxy(ObjectPrx(v.get())); } virtual void writeObject(const ObjectPtr&) = 0; template void write(const IceInternal::Handle& v) { writeObject(ObjectPtr(v.get())); } void writeEnum(Int v, Int maxValue) { if(getEncoding() == Encoding_1_0) { if(maxValue < 127) { write(static_cast(v)); } else if(maxValue < 32767) { write(static_cast(v)); } else { write(v); } } else { writeSize(v); } } virtual void writeException(const UserException&) = 0; virtual void startObject(const SlicedDataPtr&) = 0; virtual void endObject() = 0; virtual void startException(const SlicedDataPtr&) = 0; virtual void endException() = 0; virtual void startSlice(const ::std::string&, int, bool) = 0; virtual void endSlice() = 0; virtual void startEncapsulation(const EncodingVersion&, FormatType) = 0; virtual void startEncapsulation() = 0; virtual void endEncapsulation() = 0; virtual EncodingVersion getEncoding() const = 0; virtual void writePendingObjects() = 0; virtual void finished(::std::vector&) = 0; virtual std::pair finished() = 0; virtual size_type pos() = 0; virtual void rewrite(Int, size_type) = 0; virtual void reset(bool) = 0; virtual void write(bool) = 0; virtual void write(Byte) = 0; virtual void write(Short) = 0; virtual void write(Int) = 0; virtual void write(Long) = 0; virtual void write(Float) = 0; virtual void write(Double) = 0; virtual void write(const ::std::string&, bool = true) = 0; virtual void write(const ::std::vector< ::std::string>&, bool) = 0; // Overload required for bool argument. virtual void write(const char*, bool = true) = 0; virtual void write(const ::std::wstring&) = 0; // // std::vector is a special C++ type, so we give it its own write function // virtual void write(const ::std::vector&) = 0; virtual void write(const bool*, const bool*) = 0; virtual void write(const Byte*, const Byte*) = 0; virtual void write(const Short*, const Short*) = 0; virtual void write(const Int*, const Int*) = 0; virtual void write(const Long*, const Long*) = 0; virtual void write(const Float*, const Float*) = 0; virtual void write(const Double*, const Double*) = 0; virtual bool writeOptional(Int, OptionalFormat) = 0; virtual void startSize() = 0; virtual void endSize() = 0; template inline void write(const T& v) { StreamHelper::helper>::write(this, v); } template inline void write(Int tag, const IceUtil::Optional& v) { if(v) { writeOptional(tag, StreamOptionalHelper::helper, StreamableTraits::fixedLength>::optionalFormat); StreamOptionalHelper::helper, StreamableTraits::fixedLength>::write(this, *v); } } // // Template functions for sequences and custom sequences // template void write(const T* begin, const T* end) { writeSize(static_cast(end - begin)); for(const T* p = begin; p != end; ++p) { write(*p); } } }; class ICE_API ObjectReader : public Object { public: virtual void read(const InputStreamPtr&) = 0; private: virtual void __write(::IceInternal::BasicStream*) const; virtual void __read(::IceInternal::BasicStream*); virtual void __write(const OutputStreamPtr&) const; virtual void __read(const InputStreamPtr&); }; typedef ::IceInternal::Handle ObjectReaderPtr; class ICE_API ObjectWriter : public Object { public: virtual void write(const OutputStreamPtr&) const = 0; private: virtual void __write(::IceInternal::BasicStream*) const; virtual void __read(::IceInternal::BasicStream*); virtual void __write(const OutputStreamPtr&) const; virtual void __read(const InputStreamPtr&); }; typedef ::IceInternal::Handle ObjectWriterPtr; class ICE_API UserExceptionWriter : public UserException { public: UserExceptionWriter(const CommunicatorPtr&); ~UserExceptionWriter() throw(); virtual void write(const OutputStreamPtr&) const = 0; virtual bool usesClasses() const = 0; virtual ::std::string ice_name() const = 0; virtual UserException* ice_clone() const = 0; virtual void ice_throw() const = 0; virtual void __write(IceInternal::BasicStream*) const; virtual void __read(IceInternal::BasicStream*); virtual bool __usesClasses() const; #ifdef __SUNPRO_CC using UserException::__read; using UserException::__write; #endif protected: virtual void __writeImpl(::IceInternal::BasicStream*) const; virtual void __readImpl(::IceInternal::BasicStream*); #ifdef __SUNPRO_CC using UserException::__writeImpl; using UserException::__readImpl; #endif const CommunicatorPtr _communicator; }; } #endif Ice-3.5.1/cpp/include/Ice/IncomingAsyncF.h0000644000076400007640000000146012223561476016320 0ustar mesmes// ********************************************************************** // // 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 ICE_INCOMING_ASYNC_F_H #define ICE_INCOMING_ASYNC_F_H #include #include namespace IceInternal { class IncomingAsync; ICE_API IceUtil::Shared* upCast(IncomingAsync*); typedef IceInternal::Handle IncomingAsyncPtr; } namespace Ice { class AMD_Object_ice_invoke; ICE_API IceUtil::Shared* upCast(::Ice::AMD_Object_ice_invoke*); typedef IceInternal::Handle AMD_Object_ice_invokePtr; } #endif Ice-3.5.1/cpp/include/Ice/Direct.h0000644000076400007640000000246412223561476014670 0ustar mesmes// ********************************************************************** // // 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 ICE_DIRECT_H #define ICE_DIRECT_H #include #include #include #include #include #include namespace IceInternal { class ICE_API Direct : public Ice::Request, private IceUtil::noncopyable { public: Direct(const Ice::Current&); void destroy(); const Ice::ObjectPtr& getServant(); virtual bool isCollocated(); virtual const Ice::Current& getCurrent(); virtual Ice::DispatchStatus run(Ice::Object*) = 0; void throwUserException(); protected: // // Optimization. The current may not be deleted while a // stack-allocated Direct still holds it. // const Ice::Current& _current; void setUserException(const Ice::UserException&); private: Ice::ObjectPtr _servant; Ice::ServantLocatorPtr _locator; Ice::LocalObjectPtr _cookie; IceUtil::UniquePtr _userException; }; } #endif Ice-3.5.1/cpp/include/Ice/FactoryTable.h0000644000076400007640000000345212223561476016033 0ustar mesmes// ********************************************************************** // // 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 ICE_FACTORYTABLE_H #define ICE_FACTORYTABLE_H #include #include #include namespace Ice { class ICE_API CompactIdResolver : public IceUtil::Shared { public: virtual ::std::string resolve(Ice::Int) const = 0; }; typedef IceUtil::Handle CompactIdResolverPtr; } namespace IceInternal { class ICE_API FactoryTable : private IceUtil::noncopyable { public: void addExceptionFactory(const ::std::string&, const IceInternal::UserExceptionFactoryPtr&); IceInternal::UserExceptionFactoryPtr getExceptionFactory(const ::std::string&) const; void removeExceptionFactory(const ::std::string&); void addObjectFactory(const ::std::string&, const Ice::ObjectFactoryPtr&); Ice::ObjectFactoryPtr getObjectFactory(const ::std::string&) const; void removeObjectFactory(const ::std::string&); void addTypeId(int, const ::std::string&); std::string getTypeId(int) const; void removeTypeId(int); private: IceUtil::Mutex _m; typedef ::std::pair EFPair; typedef ::std::map< ::std::string, EFPair> EFTable; EFTable _eft; typedef ::std::pair OFPair; typedef ::std::map< ::std::string, OFPair> OFTable; OFTable _oft; typedef ::std::pair< ::std::string, int> TypeIdPair; typedef ::std::map TypeIdTable; TypeIdTable _typeIdTable; }; } #endif Ice-3.5.1/cpp/include/Ice/ConnectionFactoryF.h0000644000076400007640000000153512223561476017211 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECTION_FACTORY_F_H #define ICE_CONNECTION_FACTORY_F_H #include #include namespace IceInternal { class OutgoingConnectionFactory; ICE_API IceUtil::Shared* upCast(OutgoingConnectionFactory*); typedef IceInternal::Handle OutgoingConnectionFactoryPtr; class IncomingConnectionFactory; ICE_API IceUtil::Shared* upCast(IncomingConnectionFactory*); typedef IceInternal::Handle IncomingConnectionFactoryPtr; } #endif Ice-3.5.1/cpp/include/Ice/SlicedData.h0000644000076400007640000000465412223561476015456 0ustar mesmes// ********************************************************************** // // 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 ICE_SLICED_DATA_H #define ICE_SLICED_DATA_H #include #include namespace Ice { // // SliceInfo encapsulates the details of a slice for an unknown class or exception type. // struct ICE_API SliceInfo : public ::IceUtil::Shared { // // The Slice type ID for this slice. // ::std::string typeId; // // The Slice compact type ID for this slice. // int compactId; // // The encoded bytes for this slice, including the leading size integer. // ::std::vector bytes; // // The Ice objects referenced by this slice. // ::std::vector objects; // // Whether or not the slice contains optional members. // bool hasOptionalMembers; // // Whether or not this is the last slice. // bool isLastSlice; }; // // SlicedData holds the slices of unknown types. // class ICE_API SlicedData : public ::IceInternal::GCShared { public: SlicedData(const SliceInfoSeq&); const SliceInfoSeq slices; // // The internal methods below are necessary to support garbage collection // of Ice objects. // virtual void __gcReachable(IceInternal::GCCountMap&) const; virtual void __gcClear(); void __decRefUnsafe() { --_ref; } void __addObject(IceInternal::GCCountMap&); }; // // Unknown sliced object holds instance of unknown type. // class ICE_API UnknownSlicedObject : public Object, private IceInternal::GCShared { public: UnknownSlicedObject(const std::string&); const std::string& getUnknownTypeId() const; SlicedDataPtr getSlicedData() const; virtual void __addObject(::IceInternal::GCCountMap&); virtual bool __usesGC(); virtual void __gcReachable(::IceInternal::GCCountMap&) const; virtual void __gcClear(); virtual void __write(::IceInternal::BasicStream*) const; virtual void __read(::IceInternal::BasicStream*); #ifdef __SUNPRO_CC using Object::__write; using Object::__read; #endif private: const std::string _unknownTypeId; SlicedDataPtr _slicedData; }; } #endif Ice-3.5.1/cpp/include/Ice/RequestHandlerF.h0000644000076400007640000000116612223561476016510 0ustar mesmes// ********************************************************************** // // 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 ICE_REQUEST_HANDLER_F_H #define ICE_REQUEST_HANDLER_F_H #include #include namespace IceInternal { class RequestHandler; ICE_API IceUtil::Shared* upCast(RequestHandler*); typedef IceInternal::Handle RequestHandlerPtr; } #endif Ice-3.5.1/cpp/include/Ice/DynamicLibraryF.h0000644000076400007640000000136412223561476016473 0ustar mesmes// ********************************************************************** // // 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 ICE_DYNAMIC_LIBRARY_F_H #define ICE_DYNAMIC_LIBRARY_F_H #include #include namespace IceInternal { class DynamicLibrary; ICE_API IceUtil::Shared* upCast(DynamicLibrary*); typedef Handle DynamicLibraryPtr; class DynamicLibraryList; ICE_API IceUtil::Shared* upCast(DynamicLibraryList*); typedef Handle DynamicLibraryListPtr; } #endif Ice-3.5.1/cpp/include/Ice/SliceChecksums.h0000644000076400007640000000121412223561476016353 0ustar mesmes// ********************************************************************** // // 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 ICE_SLICE_CHECKSUM_H #define ICE_SLICE_CHECKSUM_H #include namespace Ice { ICE_API SliceChecksumDict sliceChecksums(); } namespace IceInternal { class ICE_API SliceChecksumInit : private IceUtil::noncopyable { public: SliceChecksumInit(const char*[]); }; } #endif Ice-3.5.1/cpp/include/Ice/ProxyHandle.h0000644000076400007640000001570712223561476015717 0ustar mesmes// ********************************************************************** // // 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 ICE_PROXY_HANDLE_H #define ICE_PROXY_HANDLE_H #include #include #include namespace IceInternal { template class ProxyHandle; template class Handle; } namespace IceProxy { namespace Ice { class Object; } } namespace Ice { typedef ::IceInternal::ProxyHandle< ::IceProxy::Ice::Object> ObjectPrx; class ObjectAdapter; typedef ::IceInternal::Handle< ::Ice::ObjectAdapter> ObjectAdapterPtr; typedef ::std::map< ::std::string, ::std::string> Context; } namespace IceInternal { template P checkedCastImpl(const ::Ice::ObjectPrx&, const ::Ice::Context*); template P checkedCastImpl(const ::Ice::ObjectPrx&, const std::string&, const ::Ice::Context*); template P uncheckedCastImpl(const ::Ice::ObjectPrx&); template P uncheckedCastImpl(const ::Ice::ObjectPrx&, const std::string&); // // Upcast // template inline ProxyHandle checkedCastHelper(const ::IceInternal::ProxyHandle& b, T*, const ::Ice::Context*) { return b; } template inline ProxyHandle uncheckedCastHelper(const ::IceInternal::ProxyHandle& b, T*) { return b; } // // Downcast // template inline ProxyHandle checkedCastHelper(const ::IceInternal::ProxyHandle& b, void*, const ::Ice::Context* ctx) { #ifdef __SUNPRO_CC // // Sun CC bug introduced in version 5.10 // const ::Ice::ObjectPrx& o = b; return checkedCastImpl >(o, ctx); #else return checkedCastImpl >(b, ctx); #endif } template inline ProxyHandle uncheckedCastHelper(const ::IceInternal::ProxyHandle& b, void*) { #ifdef __SUNPRO_CC // // Sun CC bug introduced in version 5.10 // const ::Ice::ObjectPrx& o = b; return uncheckedCastImpl >(o); #else return uncheckedCastImpl >(b); #endif } // // Like IceInternal::Handle, but specifically for proxies, with // support for checkedCast() and uncheckedCast() instead of // dynamicCast(). // template class ProxyHandle : public ::IceUtil::HandleBase { public: ProxyHandle(T* p = 0) { this->_ptr = p; if(this->_ptr) { upCast(this->_ptr)->__incRef(); } } template ProxyHandle(const ProxyHandle& r) { this->_ptr = r._ptr; if(this->_ptr) { upCast(this->_ptr)->__incRef(); } } template ProxyHandle(const ::IceUtil::Handle& r) { this->_ptr = r._ptr; if(this->_ptr) { upCast(this->_ptr)->__incRef(); } } ProxyHandle(const ProxyHandle& r) { this->_ptr = r._ptr; if(this->_ptr) { upCast(this->_ptr)->__incRef(); } } ~ProxyHandle() { if(this->_ptr) { upCast(this->_ptr)->__decRef(); } } ProxyHandle& operator=(T* p) { if(this->_ptr != p) { if(p) { upCast(p)->__incRef(); } if(this->_ptr) { upCast(this->_ptr)->__decRef(); } this->_ptr = p; } return *this; } template ProxyHandle& operator=(const ProxyHandle& r) { if(this->_ptr != r._ptr) { if(r._ptr) { upCast(r._ptr)->__incRef(); } if(this->_ptr) { upCast(this->_ptr)->__decRef(); } this->_ptr = r._ptr; } return *this; } template ProxyHandle& operator=(const ::IceUtil::Handle& r) { if(this->_ptr != r._ptr) { if(r._ptr) { upCast(r._ptr)->__incRef(); } if(this->_ptr) { upCast(this->_ptr)->__decRef(); } this->_ptr = r._ptr; } return *this; } ProxyHandle& operator=(const ProxyHandle& r) { if(this->_ptr != r._ptr) { if(r._ptr) { upCast(r._ptr)->__incRef(); } if(this->_ptr) { upCast(this->_ptr)->__decRef(); } this->_ptr = r._ptr; } return *this; } ::IceProxy::Ice::Object* __upCast() const { return upCast(this->_ptr); } template static ProxyHandle checkedCast(const ProxyHandle& r) { Y* tag = 0; Ice::Context* ctx = 0; return ::IceInternal::checkedCastHelper(r, tag, ctx); } template static ProxyHandle checkedCast(const ProxyHandle& r, const std::string& f) { Ice::Context* ctx = 0; #ifdef __SUNPRO_CC // // Sun CC bug introduced in version 5.10 // const ::Ice::ObjectPrx& o = r; return ::IceInternal::checkedCastImpl(o, f, ctx); #else return ::IceInternal::checkedCastImpl(r, f, ctx); #endif } template static ProxyHandle checkedCast(const ProxyHandle& r, const ::Ice::Context& ctx) { Y* tag = 0; return ::IceInternal::checkedCastHelper(r, tag, &ctx); } template static ProxyHandle checkedCast(const ProxyHandle& r, const std::string& f, const ::Ice::Context& ctx) { #ifdef __SUNPRO_CC // // Sun CC bug introduced in version 5.10 // const ::Ice::ObjectPrx& o = r; return ::IceInternal::checkedCastImpl(o, f, &ctx); #else return ::IceInternal::checkedCastImpl(r, f, &ctx); #endif } template static ProxyHandle uncheckedCast(const ProxyHandle& r) { Y* tag = 0; return::IceInternal::uncheckedCastHelper(r, tag); } template static ProxyHandle uncheckedCast(const ProxyHandle& r, const std::string& f) { #ifdef __SUNPRO_CC // // Sun CC bug introduced in version 5.10 // const ::Ice::ObjectPrx& o = r; return ::IceInternal::uncheckedCastImpl >(o, f); #else return ::IceInternal::uncheckedCastImpl(r, f); #endif } }; } template std::ostream& operator<<(std::ostream& os, ::IceInternal::ProxyHandle p) { return os << (p ? p->ice_toString() : std::string("")); } #endif Ice-3.5.1/cpp/include/Ice/ObjectF.h0000644000076400007640000000115112223561476014762 0ustar mesmes// ********************************************************************** // // 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 ICE_OBJECT_F_H #define ICE_OBJECT_F_H #include #include namespace Ice { class Object; ICE_API Object* upCast(Object*); typedef IceInternal::Handle< Object > ObjectPtr; ICE_API void __patch(ObjectPtr&, const ObjectPtr&); } #endif Ice-3.5.1/cpp/include/Ice/StreamF.h0000644000076400007640000000134312223561476015012 0ustar mesmes// ********************************************************************** // // 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 ICE_STREAM_F_H #define ICE_STREAM_F_H #include #include namespace Ice { class InputStream; ICE_API IceUtil::Shared* upCast(::Ice::InputStream*); typedef IceInternal::Handle< InputStream > InputStreamPtr; class OutputStream; ICE_API IceUtil::Shared* upCast(::Ice::OutputStream*); typedef IceInternal::Handle< OutputStream > OutputStreamPtr; } #endif Ice-3.5.1/cpp/include/Ice/DispatchInterceptor.h0000644000076400007640000000147212223561476017432 0ustar mesmes// ********************************************************************** // // 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 ICE_DISPATCH_INTERCEPTOR_H #define ICE_DISPATCH_INTERCEPTOR_H #include namespace Ice { class ICE_API DispatchInterceptor : public virtual Object { public: virtual DispatchStatus dispatch(Request&) = 0; virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&); virtual DispatchStatus __collocDispatch(IceInternal::Direct&); }; typedef IceInternal::Handle DispatchInterceptorPtr; } #endif Ice-3.5.1/cpp/include/Ice/EndpointFactoryF.h0000644000076400007640000000116012223561476016664 0ustar mesmes// ********************************************************************** // // 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 ICE_ENDPOINT_FACTORY_F_H #define ICE_ENDPOINT_FACTORY_F_H #include #include namespace IceInternal { class EndpointFactory; ICE_API IceUtil::Shared* upCast(EndpointFactory*); typedef Handle EndpointFactoryPtr; } #endif Ice-3.5.1/cpp/include/Ice/InstanceF.h0000644000076400007640000000112112223561476015315 0ustar mesmes// ********************************************************************** // // 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 ICE_INSTANCE_F_H #define ICE_INSTANCE_F_H #include #include namespace IceInternal { class Instance; ICE_API IceUtil::Shared* upCast(Instance*); typedef IceInternal::Handle InstancePtr; } #endif Ice-3.5.1/cpp/include/Ice/Buffer.h0000644000076400007640000000674012223561476014670 0ustar mesmes// ********************************************************************** // // 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 ICE_BUFFER_H #define ICE_BUFFER_H #include namespace IceInternal { class ICE_API Buffer : private IceUtil::noncopyable { public: Buffer(size_t maxCapacity) : b(maxCapacity), i(b.begin()) { } Buffer(const Ice::Byte* beg, const Ice::Byte* end) : b(beg, end), i(b.begin()) { } virtual ~Buffer() { } void swapBuffer(Buffer&); class ICE_API Container : private IceUtil::noncopyable { public: // // Standard vector-like operations. // typedef Ice::Byte value_type; typedef Ice::Byte* iterator; typedef const Ice::Byte* const_iterator; typedef Ice::Byte& reference; typedef const Ice::Byte& const_reference; typedef Ice::Byte* pointer; typedef size_t size_type; Container(size_type maxCapacity); Container(const_iterator, const_iterator); ~Container(); iterator begin() { return _buf; } const_iterator begin() const { return _buf; } iterator end() { return _buf + _size; } const_iterator end() const { return _buf + _size; } size_type size() const { return _size; } bool empty() const { return !_size; } void swap(Container&); void clear(); void resize(size_type n) // Inlined for performance reasons. { assert(!_buf || _capacity > 0); if(n == 0) { clear(); } else if(n > _capacity) { reserve(n); } _size = n; } void reset() { assert(!_buf || _capacity > 0); if(_size > 0 && _size * 2 < _capacity) { // // If the current buffer size is smaller than the // buffer capacity, we shrink the buffer memory to the // current size. This is to avoid holding on too much // memory if it's not needed anymore. // if(++_shrinkCounter > 2) { reserve(_size); _shrinkCounter = 0; } } else { _shrinkCounter = 0; } _size = 0; } void push_back(value_type v) { resize(_size + 1); _buf[_size - 1] = v; } reference operator[](size_type n) { assert(n < _size); return _buf[n]; } const_reference operator[](size_type n) const { assert(n < _size); return _buf[n]; } private: Container(const Container&); void operator=(const Container&); void reserve(size_type); pointer _buf; size_type _size; size_type _capacity; size_type _maxCapacity; int _shrinkCounter; }; Container b; Container::iterator i; }; } #endif Ice-3.5.1/cpp/include/Ice/Application.h0000644000076400007640000001137412223561476015721 0ustar mesmes// ********************************************************************** // // 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 ICE_APPLICATION_H #define ICE_APPLICATION_H #include #include namespace Ice { enum SignalPolicy { HandleSignals, NoSignalHandling } ; class Application; } namespace IceInternal { namespace Application { extern ICE_API IceUtil::Mutex* mutex; extern ICE_API IceUtil::Cond* _condVar; // // Variables than can change while run() and communicator->destroy() are running! // extern ICE_API bool _callbackInProgress; extern ICE_API bool _destroyed; extern ICE_API bool _interrupted; // // Variables that are immutable during run() and until communicator->destroy() has returned; // before and after run(), and once communicator->destroy() has returned, we assume that // only the main thread and CtrlCHandler threads are running. // extern ICE_API std::string _appName; extern ICE_API Ice::CommunicatorPtr _communicator; extern ICE_API Ice::SignalPolicy _signalPolicy; extern ICE_API Ice::Application* _application; } } namespace Ice { class ICE_API Application : private IceUtil::noncopyable { public: Application(SignalPolicy = HandleSignals); virtual ~Application(); // // This main() must be called by the global main(). main() // initializes the Communicator, calls run() as a template method, // and destroys the Communicator upon return from run(). It // thereby handles all exceptions properly, i.e., error messages // are printed if exceptions propagate to main(), and the // Communicator is always destroyed, regardless of exceptions. // int main(int, char*[], const Ice::InitializationData& = Ice::InitializationData()); int main(int, char*[], const char*); int main(int, char* const [], const Ice::InitializationData& = Ice::InitializationData()); int main(int, char* const [], const char*); #ifdef _WIN32 int main(int, wchar_t*[], const Ice::InitializationData& = Ice::InitializationData()); int main(int, wchar_t*[], const char*); #endif int main(const StringSeq&, const Ice::InitializationData& = Ice::InitializationData()); int main(const StringSeq&, const char*); virtual int run(int, char*[]) = 0; // // Override this to provide a custom application interrupt // hook. You must call callbackOnInterrupt for this method to // be called. Note that the interruptCallback can be called // concurrently with any other thread (including main) in your // application and thus must take appropriate concurrency // precautions. // virtual void interruptCallback(int); // // Return the application name, i.e., argv[0]. // static const char* appName(); // // One limitation of this class is that there can only be one // Application instance, with one global Communicator, accessible // with this communicator() operation. This limitation is due to // how the signal handling functions below operate. If you require // multiple Communicators, then you cannot use this Application // framework class. // static CommunicatorPtr communicator(); // // These methods can be used to set a Ctrl+C Handler callback. // static void destroyOnInterrupt(); static void shutdownOnInterrupt(); static void ignoreInterrupt(); static void callbackOnInterrupt(); // // These methods can be used to temporarily block a signal and // arrange for delivery of a pending signal later. Any signal that // is received after holdInterrupt() was called is remembered and // delivered when releaseInterupt() is called. That signal is then // handled according to the signal disposition established with // destroyOnInterrupt(), shutdownOnInterrupt() or // ignoreInterrupt(). // static void holdInterrupt(); static void releaseInterrupt(); // // This method returns true if a signal handler was triggered, // false otherwise. This can be used once // Communicator::waitForShutdown() returns to test whether the // shutdown was due to an interrupt (interrupted() returns true in // that case) or because Communicator::shutdown() was called // (interrupted() returns false in that case). // static bool interrupted(); protected: virtual int doMain(int, char*[], const Ice::InitializationData&); #if defined(__SUNPRO_CC) // // Sun C++ 5.x does not like classes with no data members // char _dummy; #endif }; } #endif Ice-3.5.1/cpp/include/Ice/Makefile0000644000076400007640000000142112223561476014735 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/Ice ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/Ice..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/Ice) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/Ice/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/Ice/$$i ; \ done Ice-3.5.1/cpp/include/Ice/Protocol.h0000644000076400007640000001342712223561476015260 0ustar mesmes// ********************************************************************** // // 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 ICE_PROTOCOL_H #define ICE_PROTOCOL_H #include #include namespace IceInternal { // // Size of the Ice protocol header // // Magic number (4 Bytes) // Protocol version major (Byte) // Protocol version minor (Byte) // Encoding version major (Byte) // Encoding version minor (Byte) // Message type (Byte) // Compression status (Byte) // Message size (Int) // const ::Ice::Int headerSize = 14; // // The magic number at the front of each message // extern const ::Ice::Byte magic[4]; // // The current Ice protocol, protocol encoding and encoding version // const ::Ice::Byte protocolMajor = 1; const ::Ice::Byte protocolMinor = 0; const ::Ice::Byte protocolEncodingMajor = 1; const ::Ice::Byte protocolEncodingMinor = 0; const ::Ice::Byte encodingMajor = 1; const ::Ice::Byte encodingMinor = 1; // // The Ice protocol message types // const ::Ice::Byte requestMsg = 0; const ::Ice::Byte requestBatchMsg = 1; const ::Ice::Byte replyMsg = 2; const ::Ice::Byte validateConnectionMsg = 3; const ::Ice::Byte closeConnectionMsg = 4; // // The request header, batch request header and reply header. // extern const ::Ice::Byte requestHdr[headerSize + sizeof(Ice::Int)]; extern const ::Ice::Byte requestBatchHdr[headerSize + sizeof(Ice::Int)]; extern const ::Ice::Byte replyHdr[headerSize]; // // IPv4/IPv6 support enumeration. // enum ProtocolSupport { EnableIPv4, EnableIPv6, EnableBoth }; // Forward declaration class BasicStream; ICE_API void stringToMajorMinor(const ::std::string&, Ice::Byte&, Ice::Byte&); template std::string versionToString(const T& v) { std::ostringstream os; os << v; return os.str(); } template T stringToVersion(const ::std::string& str) { T v; stringToMajorMinor(str, v.major, v.minor); return v; } template bool isSupported(const T& version, const T& supported) { return version.major == supported.major && version.minor <= supported.minor; } ICE_API void throwUnsupportedProtocolException(const char*, int, const Ice::ProtocolVersion&, const Ice::ProtocolVersion&); ICE_API void throwUnsupportedEncodingException(const char*, int, const Ice::EncodingVersion&, const Ice::EncodingVersion&); } namespace Ice { ICE_API extern const ProtocolVersion Protocol_1_0; ICE_API extern const EncodingVersion Encoding_1_0; ICE_API extern const EncodingVersion Encoding_1_1; ICE_API extern const ProtocolVersion currentProtocol; ICE_API extern const EncodingVersion currentProtocolEncoding; ICE_API extern const EncodingVersion currentEncoding; inline ::std::string protocolVersionToString(const Ice::ProtocolVersion& v) { return IceInternal::versionToString(v); } inline ::Ice::ProtocolVersion stringToProtocolVersion(const ::std::string& v) { return IceInternal::stringToVersion(v); } inline ::std::string encodingVersionToString(const Ice::EncodingVersion& v) { return IceInternal::versionToString(v); } inline ::Ice::EncodingVersion stringToEncodingVersion(const ::std::string& v) { return IceInternal::stringToVersion(v); } inline std::ostream& operator<<(std::ostream& out, const ProtocolVersion& version) { return out << static_cast(version.major) << "." << static_cast(version.minor); } inline std::ostream& operator<<(std::ostream& out, const EncodingVersion& version) { return out << static_cast(version.major) << "." << static_cast(version.minor); } } namespace IceInternal { inline void checkSupportedProtocol(const Ice::ProtocolVersion& v) { if(!isSupported(v, Ice::currentProtocol)) { throwUnsupportedProtocolException(__FILE__, __LINE__, v, Ice::currentProtocol); } } inline void checkSupportedProtocolEncoding(const Ice::EncodingVersion& v) { if(!isSupported(v, Ice::currentProtocolEncoding)) { throwUnsupportedEncodingException(__FILE__, __LINE__, v, Ice::currentProtocolEncoding); } } inline void checkSupportedEncoding(const Ice::EncodingVersion& v) { if(!isSupported(v, Ice::currentEncoding)) { throwUnsupportedEncodingException(__FILE__, __LINE__, v, Ice::currentEncoding); } } // // Either return the given protocol if not compatible, or the greatest // supported protocol otherwise. // inline const Ice::ProtocolVersion getCompatibleProtocol(const Ice::ProtocolVersion& v) { if(v.major != Ice::currentProtocol.major) { return v; // Unsupported protocol, return as is. } else if(v.minor < Ice::currentProtocol.minor) { return v; // Supported protocol. } else { // // Unsupported but compatible, use the currently supported // protocol, that's the best we can do. // return Ice::currentProtocol; } } // // Either return the given encoding if not compatible, or the greatest // supported encoding otherwise. // inline const Ice::EncodingVersion& getCompatibleEncoding(const Ice::EncodingVersion& v) { if(v.major != Ice::currentEncoding.major) { return v; // Unsupported encoding, return as is. } else if(v.minor < Ice::currentEncoding.minor) { return v; // Supported encoding. } else { // // Unsupported but compatible, use the currently supported // encoding, that's the best we can do. // return Ice::currentEncoding; } } } #endif Ice-3.5.1/cpp/include/Ice/ReferenceF.h0000644000076400007640000000156312223561476015461 0ustar mesmes// ********************************************************************** // // 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 ICE_REFERENCE_F_H #define ICE_REFERENCE_F_H #include #include namespace IceInternal { class Reference; ICE_API IceUtil::Shared* upCast(Reference*); typedef IceInternal::Handle ReferencePtr; class FixedReference; ICE_API IceUtil::Shared* upCast(FixedReference*); typedef IceInternal::Handle FixedReferencePtr; class RoutableReference; ICE_API IceUtil::Shared* upCast(RoutableReference*); typedef IceInternal::Handle RoutableReferencePtr; } #endif Ice-3.5.1/cpp/include/IceSSL/0000755000076400007640000000000012223561476013661 5ustar mesmesIce-3.5.1/cpp/include/IceSSL/Plugin.h0000644000076400007640000003040712223561476015274 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_PLUGIN_H #define ICE_SSL_PLUGIN_H #include #include #include #include #include // For struct sockaddr_storage #ifdef _WIN32 # include #else # include #endif #ifndef ICE_SSL_API # ifdef ICE_SSL_API_EXPORTS # define ICE_SSL_API ICE_DECLSPEC_EXPORT # else # define ICE_SSL_API ICE_DECLSPEC_IMPORT # endif #endif // // SSL_CTX is the OpenSSL type that holds configuration settings for // all SSL connections. // typedef struct ssl_ctx_st SSL_CTX; // // X509 is the OpenSSL type that represents a certificate. // typedef struct x509_st X509; typedef struct X509_name_st X509NAME; // // EVP_PKEY is the OpenSSL type that represents a public key. // typedef struct evp_pkey_st EVP_PKEY; namespace IceSSL { // // This exception is thrown if the certificate cannot be read. // class ICE_SSL_API CertificateReadException : public IceUtil::Exception { public: CertificateReadException(const char*, int, const std::string&); virtual ~CertificateReadException() throw(); virtual std::string ice_name() const; virtual CertificateReadException* ice_clone() const; virtual void ice_throw() const; std::string reason; private: static const char* _name; }; // // This exception is thrown if the certificate cannot be encoded. // class ICE_SSL_API CertificateEncodingException : public IceUtil::Exception { public: CertificateEncodingException(const char*, int, const std::string&); virtual ~CertificateEncodingException() throw(); virtual std::string ice_name() const; virtual CertificateEncodingException* ice_clone() const; virtual void ice_throw() const; std::string reason; private: static const char* _name; }; // // This exception is thrown if a distinguished name cannot be parsed. // class ICE_SSL_API ParseException : public IceUtil::Exception { public: ParseException(const char*, int, const std::string&); virtual ~ParseException() throw(); virtual std::string ice_name() const; virtual ParseException* ice_clone() const; virtual void ice_throw() const; std::string reason; private: static const char* _name; }; // // Forward declaration. // class Certificate; typedef IceUtil::Handle CertificatePtr; // // A representation of a PublicKey. // class ICE_SSL_API PublicKey : public IceUtil::Shared { public: ~PublicKey(); EVP_PKEY* key() const; private: PublicKey(EVP_PKEY*); friend class Certificate; EVP_PKEY* _key; }; typedef IceUtil::Handle PublicKeyPtr; // // This class represents a DistinguishedName, similar to the Java // type X500Principal and the .NET type X500DistinguishedName. // // For comparison purposes, the value of a relative distinguished // name (RDN) component is always unescaped before matching, // therefore "ZeroC, Inc." will match ZeroC\, Inc. // // toString() always returns exactly the same information as was // provided in the constructor (i.e., "ZeroC, Inc." will not turn // into ZeroC\, Inc.). // class ICE_SSL_API DistinguishedName { public: // // Create a DistinguishedName using an OpenSSL value. // DistinguishedName(X509NAME*); // // Create a DistinguishedName from a string encoded using // the rules in RFC2253. // // Throws ParseException if parsing fails. // DistinguishedName(const std::string&); // // Create a DistinguishedName from a list of RDN pairs, // where each pair consists of the RDN's type and value. // For example, the RDN "O=ZeroC" is represented by the // pair ("O", "ZeroC"). // DistinguishedName(const std::list >&); // // This is an exact match. The order of the RDN components is // important. // bool operator==(const DistinguishedName&) const; bool operator!=(const DistinguishedName&) const; bool operator<(const DistinguishedName&) const; // // Perform a partial match with another DistinguishedName. The function // returns true if all of the RDNs in the argument are present in this // DistinguishedName and they have the same values. // bool match(const DistinguishedName&) const; // // Encode the DN in RFC2253 format. // operator std::string() const; private: void unescape(); std::list > _rdns; std::list > _unescaped; }; // // This convenience class is a wrapper around OpenSSL's X509 type. // The interface is inspired by java.security.cert.X509Certificate. // class ICE_SSL_API Certificate : public IceUtil::Shared { public: // // Construct a certificate using a X509*. The Certificate assumes // ownership of the X509* struct. // Certificate(X509*); ~Certificate(); // // Load the certificate from a file. The certificate must use the // PEM encoding format. Raises CertificateReadException if the // file cannot be read. // static CertificatePtr load(const std::string&); // // Decode a certificate from a string that uses the PEM encoding format. // Raises CertificateEncodingException if an error occurs. // static CertificatePtr decode(const std::string&); bool operator==(const Certificate&) const; bool operator!=(const Certificate&) const; // // Get the certificate's public key. // PublicKeyPtr getPublicKey() const; // // Verify that this certificate was signed by the given public // key. Returns true if signed, false otherwise. // bool verify(const PublicKeyPtr&) const; // // Return a string encoding of the certificate in PEM format. // Raises CertificateEncodingException if an error occurs. // std::string encode() const; // // Checks that the certificate is currently valid, that is, the current // date falls between the validity period given in the certificate. // bool checkValidity() const; // // Checks that the certificate is valid at the given time. // bool checkValidity(const IceUtil::Time&) const; // // Get the not-after validity time. // IceUtil::Time getNotAfter() const; // // Get the not-before validity time. // IceUtil::Time getNotBefore() const; // // Get the serial number. This is an arbitrarily large number. // std::string getSerialNumber() const; // // Get the signature algorithm name used to sign the certificate. // //std::string getSigAlgName() const; // // Get the signature algorithm OID string from the certificate. // //std::string getSigAlgOID() const; // // Get the issuer's distinguished name (DN). // DistinguishedName getIssuerDN() const; // // Get the values in the issuer's alternative names extension. // // The returned list contains a pair of int, string. // // otherName [0] OtherName // rfc822Name [1] IA5String // dNSName [2] IA5String // x400Address [3] ORAddress // directoryName [4] Name // ediPartyName [5] EDIPartyName // uniformResourceIdentifier [6] IA5String // iPAddress [7] OCTET STRING // registeredID [8] OBJECT IDENTIFIER // // rfc822Name, dNSName, directoryName and // uniformResourceIdentifier data is returned as a string. // // iPAddress is returned in dotted quad notation. IPv6 is not // currently supported. // // All distinguished names are encoded in RFC2253 format. // // The remainder of the data will result in an empty string. Use the raw // X509* certificate to obtain these values. // std::vector > getIssuerAlternativeNames(); // // Get the subject's distinguished name (DN). // DistinguishedName getSubjectDN() const; // // See the comment for getIssuerAlternativeNames. // std::vector > getSubjectAlternativeNames(); // // Retrieve the certificate version number. // int getVersion() const; // // Stringify the certificate. This is a human readable version of // the certificate, not a DER or PEM encoding. // std::string toString() const; // // Retrieve the X509 value wrapped by this object. The reference count // of the X509 value is not incremented, therefore it is only valid // for the lifetime of this object unless the caller increments its // reference count explicitly using X509_dup. // X509* getCert() const; private: X509* _cert; }; // // NativeConnectionInfo is an extension of IceSSL::ConnectionInfo that // provides access to native certificates. // class NativeConnectionInfo : public ConnectionInfo { public: // // The certificate chain. This may be empty if the peer did not // supply a certificate. The peer's certificate (if any) is the // first one in the chain. // std::vector nativeCerts; }; typedef IceUtil::Handle NativeConnectionInfoPtr; // // An application can customize the certificate verification process // by implementing the CertificateVerifier interface. // class CertificateVerifier : public IceUtil::Shared { public: // // Return false if the connection should be rejected, or true to // allow it. // virtual bool verify(const NativeConnectionInfoPtr&) = 0; }; typedef IceUtil::Handle CertificateVerifierPtr; // // In order to read an encrypted file, such as one containing a // private key, OpenSSL requests a password from IceSSL. The password // can be defined using an IceSSL configuration property, but a // plain-text password is a security risk. If a password is not // supplied via configuration, IceSSL allows OpenSSL to prompt the // user interactively. This may not be desirable (or even possible), // so the application can supply an implementation of PasswordPrompt // to take responsibility for obtaining the password. // // Note that the password is needed during plug-in initialization, so // in general you will need to delay initialization (by defining // IceSSL.DelayInit=1), configure the PasswordPrompt, then manually // initialize the plug-in. // class PasswordPrompt : public IceUtil::Shared { public: // // The getPassword method may be invoked repeatedly, such as when // several encrypted files are opened, or when multiple password // attempts are allowed. // virtual std::string getPassword() = 0; }; typedef IceUtil::Handle PasswordPromptPtr; class Plugin : public Ice::Plugin { public: // // Establish the OpenSSL context. This must be done before the // plug-in is initialized, therefore the application must define // the property Ice.InitPlugins=0, set the context, and finally // invoke initializePlugins on the PluginManager. // // When the application supplies its own OpenSSL context, the // plug-in ignores configuration properties related to certificates, // keys, and passwords. // // Note that the plugin assumes ownership of the given context. // virtual void setContext(SSL_CTX*) = 0; // // Obtain the SSL context. Use caution when modifying this value. // Changes made to this value have no effect on existing connections. // virtual SSL_CTX* getContext() = 0; // // Establish the certificate verifier object. This should be done // before any connections are established. // virtual void setCertificateVerifier(const CertificateVerifierPtr&) = 0; // // Establish the password prompt object. This must be done before // the plug-in is initialized. // virtual void setPasswordPrompt(const PasswordPromptPtr&) = 0; }; typedef IceUtil::Handle PluginPtr; } #endif Ice-3.5.1/cpp/include/IceSSL/IceSSL.h0000644000076400007640000000105412223561476015114 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_ICE_SSL_H #define ICE_SSL_ICE_SSL_H #include #ifndef ICE_OS_WINRT # include #endif #include #include #endif Ice-3.5.1/cpp/include/IceSSL/.headers0000644000076400007640000000033212223561476015273 0ustar mesmesSDK_HEADERS = \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionInfo.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\EndpointInfo.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IceSSL.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Plugin.h \ Ice-3.5.1/cpp/include/IceSSL/Makefile0000644000076400007640000000144012223561476015320 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/IceSSL ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/IceSSL..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/IceSSL) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceSSL/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/IceSSL/$$i ; \ done Ice-3.5.1/cpp/include/IceUtil/0000755000076400007640000000000012223561476014135 5ustar mesmesIce-3.5.1/cpp/include/IceUtil/Thread.h0000644000076400007640000001006612223561476015520 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_THREAD_H #define ICE_UTIL_THREAD_H #include #include #include #include #ifdef ICE_OS_WINRT # include # include #endif namespace IceUtil { class Time; class ICE_UTIL_API ThreadControl { public: // // Constructs a ThreadControl representing the current thread. // join and detach cannot be called on such ThreadControl object. // ThreadControl(); #ifdef ICE_OS_WINRT ThreadControl(const std::shared_ptr&); #elif defined(_WIN32) ThreadControl(HANDLE, DWORD); #else explicit ThreadControl(pthread_t); #endif // // Default copy destructor, assignment operator and destructor OK // // // == and != are meaningful only before the thread is joined/detached, // or while the thread is still running. // bool operator==(const ThreadControl&) const; bool operator!=(const ThreadControl&) const; // // Wait until the controlled thread terminates. The call has POSIX // semantics. // // At most one thread can wait for the termination of a given // thread. Calling join on a thread on which another thread is // already waiting for termination results in undefined behaviour, // as does joining with a thread after having joined with it // previously, or joining with a detached thread. // void join(); // // Detach a thread. Once a thread is detached, it cannot be // detached again, nor can it be joined with. Every thread that // was created using the IceUtil::Thread class must either be // joined with or detached exactly once. Detaching a thread a // second time, or detaching a thread that was previously joined // with results in undefined behavior. // void detach(); // // id() returns the Thread ID on Windows and the underlying pthread_t // on POSIX platforms. // #ifdef ICE_OS_WINRT typedef std::thread::id ID; #elif defined(_WIN32) typedef DWORD ID; #else typedef pthread_t ID; #endif ID id() const; static void sleep(const Time&); static void yield(); private: #ifdef ICE_OS_WINRT std::shared_ptr _thread; std::thread::id _id; #elif defined(_WIN32) HANDLE _handle; DWORD _id; #else pthread_t _thread; // // Used to prevent joining/detaching a ThreadControl constructed // with the default constructor. Only needed to enforce our // portable join/detach behavior. // bool _detachable; #endif }; class ICE_UTIL_API Thread : virtual public IceUtil::Shared { public: Thread(); Thread(const std::string&); virtual ~Thread(); virtual void run() = 0; ThreadControl start(size_t = 0); ThreadControl start(size_t, int priority); ThreadControl getThreadControl() const; bool operator==(const Thread&) const; bool operator!=(const Thread&) const; bool operator<(const Thread&) const; // // Check whether a thread is still alive. // bool isAlive() const; // // This function is an implementation detail; // do not call it. // void _done(); // // Get the thread name // const std::string& name() const; protected: const std::string _name; Mutex _stateMutex; bool _started; bool _running; #ifdef ICE_OS_WINRT std::shared_ptr _thread; #elif defined(_WIN32) HANDLE _handle; DWORD _id; #else pthread_t _thread; #endif private: #ifdef _WIN32 #else ThreadControl start(size_t, bool, int); #endif Thread(const Thread&); // Copying is forbidden void operator=(const Thread&); // Assignment is forbidden }; typedef Handle ThreadPtr; } #endif Ice-3.5.1/cpp/include/IceUtil/Unicode.h0000644000076400007640000000524612223561476015703 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_UNICODE_H #define ICE_UTIL_UNICODE_H #include #include namespace IceUtil { enum ConversionFlags { strictConversion = 0, lenientConversion }; ICE_UTIL_API std::string wstringToString(const std::wstring&, ConversionFlags = lenientConversion); ICE_UTIL_API std::wstring stringToWstring(const std::string&, ConversionFlags = lenientConversion); typedef unsigned char Byte; ICE_UTIL_API bool isLegalUTF8Sequence(const Byte* source, const Byte* end); enum ConversionError { partialCharacter, badEncoding }; // // UTFConversionException is raised by wstringToString() or stringToWstring() // to report a conversion error // class ICE_UTIL_API UTFConversionException : public Exception { public: UTFConversionException(const char*, int, ConversionError); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual UTFConversionException* ice_clone() const; virtual void ice_throw() const; ConversionError conversionError() const; private: const ConversionError _conversionError; static const char* _name; }; } namespace IceUtilInternal { // // Converts UTF-8 byte-sequences to and from UTF-16 or UTF-32 (with native // endianness) depending on sizeof(wchar_t). // // These are thin wrappers over the UTF8/16/32 converters provided by // unicode.org // enum ConversionResult { conversionOK, /* conversion successful */ sourceExhausted, /* partial character in source, but hit end */ targetExhausted, /* insuff. room in target for conversion */ sourceIllegal /* source sequence is illegal/malformed */ }; ICE_UTIL_API ConversionResult convertUTFWstringToUTF8(const wchar_t*& sourceStart, const wchar_t* sourceEnd, IceUtil::Byte*& targetStart, IceUtil::Byte* targetEnd, IceUtil::ConversionFlags flags); ICE_UTIL_API ConversionResult convertUTF8ToUTFWstring(const IceUtil::Byte*& sourceStart, const IceUtil::Byte* sourceEnd, wchar_t*& targetStart, wchar_t* targetEnd, IceUtil::ConversionFlags flags); ICE_UTIL_API ConversionResult convertUTF8ToUTFWstring(const IceUtil::Byte*& sourceStart, const IceUtil::Byte* sourceEnd, std::wstring& target, IceUtil::ConversionFlags flags); } #endif Ice-3.5.1/cpp/include/IceUtil/Cond.h0000644000076400007640000001612712223561476015200 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_COND_H #define ICE_UTIL_COND_H #include #include #include #if defined(_WIN32) && !defined(ICE_HAS_WIN32_CONDVAR) # include namespace IceUtilInternal { // // Needed for implementation. // class Semaphore { public: Semaphore(long = 0); ICE_UTIL_API ~Semaphore(); void wait() const; bool timedWait(const IceUtil::Time&) const; void post(int = 1) const; private: mutable HANDLE _sem; }; } #endif namespace IceUtil { // // Forward declaration (for friend declarations). // template class Monitor; class RecMutex; class Mutex; // // Condition variable implementation. Conforms to the same semantics // as a POSIX threads condition variable. // class ICE_UTIL_API Cond : private noncopyable { public: Cond(); ~Cond(); // // signal restarts one of the threads that are waiting on the // condition variable cond. If no threads are waiting on cond, // nothing happens. If several threads are waiting on cond, // exactly one is restarted, but it is not specified which. // void signal(); // // broadcast restarts all the threads that are waiting on the // condition variable cond. Nothing happens if no threads are // waiting on cond. // void broadcast(); // // MSVC doesn't support out-of-class definitions of member // templates. See KB Article Q241949 for details. // // // wait atomically unlocks the mutex and waits for the condition // variable to be signaled. Before returning to the calling thread // the mutex is reaquired. // template inline void wait(const Lock& lock) const { if(!lock.acquired()) { throw ThreadLockedException(__FILE__, __LINE__); } waitImpl(lock._mutex); } // // wait atomically unlocks the mutex and waits for the condition // variable to be signaled for up to the given timeout. Before // returning to the calling thread the mutex is reaquired. Returns // true if the condition variable was signaled, false on a // timeout. // template inline bool timedWait(const Lock& lock, const Time& timeout) const { if(!lock.acquired()) { throw ThreadLockedException(__FILE__, __LINE__); } return timedWaitImpl(lock._mutex, timeout); } private: friend class Monitor; friend class Monitor; // // The Monitor implementation uses waitImpl & timedWaitImpl. // #if defined(_WIN32) && !defined(ICE_HAS_WIN32_CONDVAR) template void waitImpl(const M& mutex) const { preWait(); typedef typename M::LockState LockState; LockState state; mutex.unlock(state); try { dowait(); mutex.lock(state); } catch(...) { mutex.lock(state); throw; } } template bool timedWaitImpl(const M& mutex, const Time& timeout) const { preWait(); typedef typename M::LockState LockState; LockState state; mutex.unlock(state); try { bool rc = timedDowait(timeout); mutex.lock(state); return rc; } catch(...) { mutex.lock(state); throw; } } #else template void waitImpl(const M&) const; template bool timedWaitImpl(const M&, const Time&) const; #endif #ifdef _WIN32 # ifdef ICE_HAS_WIN32_CONDVAR mutable CONDITION_VARIABLE _cond; # else void wake(bool); void preWait() const; void postWait(bool) const; bool timedDowait(const Time&) const; void dowait() const; Mutex _internal; IceUtilInternal::Semaphore _gate; IceUtilInternal::Semaphore _queue; mutable long _blocked; mutable long _unblocked; enum State { StateIdle, StateSignal, StateBroadcast }; mutable State _state; # endif #else mutable pthread_cond_t _cond; #endif }; #ifdef _WIN32 # ifdef ICE_HAS_WIN32_CONDVAR template inline void Cond::waitImpl(const M& mutex) const { typedef typename M::LockState LockState; LockState state; mutex.unlock(state); BOOL ok = SleepConditionVariableCS(&_cond, state.mutex, INFINITE); mutex.lock(state); if(!ok) { throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } template inline bool Cond::timedWaitImpl(const M& mutex, const Time& timeout) const { IceUtil::Int64 msTimeout = timeout.toMilliSeconds(); if(msTimeout < 0 || msTimeout > 0x7FFFFFFF) { throw IceUtil::InvalidTimeoutException(__FILE__, __LINE__, timeout); } typedef typename M::LockState LockState; LockState state; mutex.unlock(state); BOOL ok = SleepConditionVariableCS(&_cond, state.mutex, static_cast(msTimeout)); mutex.lock(state); if(!ok) { DWORD err = GetLastError(); if(err != ERROR_TIMEOUT) { throw ThreadSyscallException(__FILE__, __LINE__, err); } return false; } return true; } # endif #else template inline void Cond::waitImpl(const M& mutex) const { typedef typename M::LockState LockState; LockState state; mutex.unlock(state); int rc = pthread_cond_wait(&_cond, state.mutex); mutex.lock(state); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } template inline bool Cond::timedWaitImpl(const M& mutex, const Time& timeout) const { if(timeout < Time::microSeconds(0)) { throw InvalidTimeoutException(__FILE__, __LINE__, timeout); } typedef typename M::LockState LockState; LockState state; mutex.unlock(state); # ifdef __APPLE__ // // The monotonic time is based on mach_absolute_time and pthread // condition variables require time from gettimeofday so we get // the realtime time. // timeval tv = Time::now(Time::Realtime) + timeout; # else timeval tv = Time::now(Time::Monotonic) + timeout; # endif timespec ts; ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000; int rc = pthread_cond_timedwait(&_cond, state.mutex, &ts); mutex.lock(state); if(rc != 0) { // // pthread_cond_timedwait returns ETIMEOUT in the event of a // timeout. // if(rc != ETIMEDOUT) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } return false; } return true; } #endif } // End namespace IceUtil #endif Ice-3.5.1/cpp/include/IceUtil/Shared.h0000644000076400007640000000564112223561476015522 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_SHARED_H #define ICE_UTIL_SHARED_H #include #if defined(ICE_USE_MUTEX_SHARED) # include // Using the gcc builtins requires gcc 4.1 or better. For Linux, i386 // doesn't work. Apple is supported for all architectures. Sun only // supports sparc (32 and 64 bit). #elif ((defined(__GNUC__) && (((__GNUC__* 100) + __GNUC_MINOR__) >= 401)) || __clang__) && \ ((defined(__sun) && (defined(__sparc) || defined(__sparcv9))) || \ defined(__APPLE__) || \ (defined(__linux) && \ (defined(__i486) || defined(__i586) || \ defined(__i686) || defined(__x86_64)))) # define ICE_HAS_GCC_BUILTINS #elif (defined(__APPLE__) || defined(__linux) || defined(__FreeBSD__)) && (defined(__i386) || defined(__x86_64)) && !defined(__ICC) # define ICE_HAS_ATOMIC_FUNCTIONS #elif defined(_WIN32) // Nothing to include #else // Use a simple mutex # include #endif // // Base classes for reference counted types. The IceUtil::Handle // template can be used for smart pointers to types derived from these // bases. // // IceUtil::SimpleShared // ===================== // // A non thread-safe base class for reference-counted types. // // IceUtil::Shared // =============== // // A thread-safe base class for reference-counted types. // namespace IceUtil { class ICE_UTIL_API SimpleShared { public: SimpleShared(); SimpleShared(const SimpleShared&); virtual ~SimpleShared() { } SimpleShared& operator=(const SimpleShared&) { return *this; } void __incRef() { assert(_ref >= 0); ++_ref; } void __decRef() { assert(_ref > 0); if(--_ref == 0) { if(!_noDelete) { _noDelete = true; delete this; } } } int __getRef() const { return _ref; } void __setNoDelete(bool b) { _noDelete = b; } private: int _ref; bool _noDelete; }; class ICE_UTIL_API Shared { public: Shared(); Shared(const Shared&); virtual ~Shared() { } Shared& operator=(const Shared&) { return *this; } virtual void __incRef(); virtual void __decRef(); virtual int __getRef() const; virtual void __setNoDelete(bool); protected: #if defined(_WIN32) LONG _ref; #elif defined(ICE_HAS_ATOMIC_FUNCTIONS) || defined(ICE_HAS_GCC_BUILTINS) volatile int _ref; #else int _ref; Mutex _mutex; #endif bool _noDelete; }; } #endif Ice-3.5.1/cpp/include/IceUtil/Options.h0000644000076400007640000001023112223561476015736 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_OPTIONS_H #define ICE_UTIL_OPTIONS_H #include #include #include #include #include #include #include #include namespace IceUtilInternal { class ICE_UTIL_API APIException : public IceUtil::Exception { public: APIException(const char*, int, const ::std::string&); virtual ~APIException() throw(); virtual ::std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual APIException* ice_clone() const; virtual void ice_throw() const; ::std::string reason; private: static const char* _name; }; ICE_UTIL_API ::std::ostream& operator<<(::std::ostream&, const APIException&); class ICE_UTIL_API BadOptException : public IceUtil::Exception { public: BadOptException(const char*, int, const ::std::string&); virtual ~BadOptException() throw(); virtual ::std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual BadOptException* ice_clone() const; virtual void ice_throw() const; ::std::string reason; private: static const char* _name; }; ICE_UTIL_API ::std::ostream& operator<<(::std::ostream&, const BadOptException&); class ICE_UTIL_API Options { public: enum LengthType { ShortOpt, LongOpt }; enum RepeatType { Repeat, NoRepeat }; enum ArgType { NeedArg, NoArg }; Options(); void addOpt(const ::std::string&, const ::std::string& = "", ArgType = NoArg, ::std::string = "", RepeatType = NoRepeat); typedef ::std::vector< ::std::string> StringVector; static StringVector split(const ::std::string&); StringVector parse(const StringVector&); StringVector parse(int, const char* const []); bool isSet(const ::std::string&) const; ::std::string optArg(const ::std::string&) const; StringVector argVec(const ::std::string&) const; private: struct OptionDetails : public IceUtil::Shared { LengthType length; ArgType arg; RepeatType repeat; bool hasDefault; }; typedef IceUtil::Handle ODPtr; struct OptionValue : public IceUtil::Shared { ::std::string val; }; typedef IceUtil::Handle OValPtr; struct OptionValueVector : public IceUtil::Shared { ::std::vector< ::std::string> vals; }; typedef IceUtil::Handle OVecPtr; typedef ::std::map< ::std::string, ODPtr> ValidOpts; // Valid options and their details. typedef ::std::map< ::std::string, OValPtr> Opts; // Value of non-repeating options. typedef ::std::map< ::std::string, OVecPtr> ROpts; // Value of repeating options. typedef ::std::map< ::std::string, ::std::string> Synonyms; // Map from short to long option and vice versa. void addValidOpt(const ::std::string&, const ::std::string&, ArgType, const ::std::string&, RepeatType); ValidOpts::iterator checkOpt(const ::std::string&, LengthType); void setOpt(const ::std::string&, const ::std::string&, const ::std::string&, RepeatType); void setNonRepeatingOpt(const ::std::string&, const ::std::string&); void setRepeatingOpt(const ::std::string&, const ::std::string&); ValidOpts::const_iterator checkOptIsValid(const ::std::string&) const; ValidOpts::const_iterator checkOptHasArg(const ::std::string&) const; void updateSynonyms(const ::std::string&, const ::std::string&); ::std::string getSynonym(const ::std::string&) const; ValidOpts _validOpts; Opts _opts; ROpts _ropts; Synonyms _synonyms; bool parseCalled; IceUtil::RecMutex _m; Options(const Options&); // Not allowed. void operator=(const Options&); // Not allowed. static void checkArgs(const ::std::string&, const ::std::string&, bool, const ::std::string&); }; } #endif Ice-3.5.1/cpp/include/IceUtil/ScannerConfig.h0000644000076400007640000000161212223561476017025 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_SCANNER_CONFIG_H #define ICE_UTIL_SCANNER_CONFIG_H #include // Required by generated Scanners. // // COMPILERFIX: VC compilers does not provide stdint.h header until VC100 // the header must be included before that macros for integral types // in flex generated Scanners are defined. // // in C99 conformant compilers we don't need to include it because the // header is included by inttypes.h, that is included by the gernated // Scanners. // #if defined(_MSC_VER) && (_MSC_VER >= 1600) # include #endif #endif Ice-3.5.1/cpp/include/IceUtil/StopWatch.h0000644000076400007640000000210412223561476016217 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_STOPWATCH_H #define ICE_UTIL_STOPWATCH_H #include namespace IceUtilInternal { class StopWatch { public: StopWatch() { } void start() { _s = IceUtil::Time::now(IceUtil::Time::Monotonic); } IceUtil::Int64 stop() { assert(isStarted()); IceUtil::Int64 d = (IceUtil::Time::now(IceUtil::Time::Monotonic) - _s).toMicroSeconds(); _s = IceUtil::Time(); return d; } bool isStarted() const { return _s != IceUtil::Time(); } IceUtil::Int64 delay() { return (IceUtil::Time::now(IceUtil::Time::Monotonic) - _s).toMicroSeconds(); } private: IceUtil::Time _s; }; } // End namespace IceUtilInternal #endif Ice-3.5.1/cpp/include/IceUtil/UUID.h0000644000076400007640000000075412223561476015062 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_UUID_H #define ICE_UTIL_UUID_H #include namespace IceUtil { ICE_UTIL_API std::string generateUUID(); } #endif Ice-3.5.1/cpp/include/IceUtil/MutexPtrTryLock.h0000644000076400007640000000311212223561476017403 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_MUTEX_PTR_TRY_LOCK_H #define ICE_UTIL_MUTEX_PTR_TRY_LOCK_H #include #include namespace IceUtilInternal { template class MutexPtrTryLock { public: MutexPtrTryLock(const T* mutex) : _mutex(mutex), _acquired(false) { if(_mutex) { _acquired = _mutex->tryLock(); } } ~MutexPtrTryLock() { if(_mutex && _acquired) { _mutex->unlock(); } } void acquire() const { if(_mutex) { _mutex->lock(); _acquired = true; } } void release() const { if(_mutex) { if(!_acquired) { throw IceUtil::ThreadLockedException(__FILE__, __LINE__); } _mutex->unlock(); _acquired = false; } } bool acquired() const { return _acquired; } private: // Not implemented; prevents accidental use. // MutexPtrTryLock(const MutexPtrTryLock&); MutexPtrTryLock& operator=(const MutexPtrTryLock&); const T* _mutex; mutable bool _acquired; }; } // End namespace IceUtilInternal #endif Ice-3.5.1/cpp/include/IceUtil/Config.h0000644000076400007640000001362312223561476015520 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_CONFIG_H #define ICE_UTIL_CONFIG_H // // Endianness // // Most CPUs support only one endianness, with the notable exceptions // of Itanium (IA64) and MIPS. // #ifdef __GLIBC__ # include #endif #if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || \ defined(_M_X64) || defined(_M_IA64) || defined(__alpha__) || \ defined(__ARMEL__) || defined(_M_ARM_FP) || \ defined(__MIPSEL__) || (defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN)) # define ICE_LITTLE_ENDIAN #elif defined(__sparc) || defined(__sparc__) || defined(__hppa) || \ defined(__ppc__) || defined(__powerpc) || defined(_ARCH_COM) || \ defined(__MIPSEB__) || (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) # define ICE_BIG_ENDIAN #else # error "Unknown architecture" #endif // // 32 or 64 bit mode? // #if defined(__sun) && (defined(__sparcv9) || defined(__x86_64)) || \ defined(__linux) && defined(__x86_64) || \ defined(__hppa) && defined(__LP64__) || \ defined(_ARCH_COM) && defined(__64BIT__) || \ defined(__alpha__) || \ defined(_WIN64) # define ICE_64 #else # define ICE_32 #endif // // Check for C++ 11 support // // We cannot just check for C++11 mode as some features were not // implemented in first versions of the compilers. // // The require compiler version should be equal or greater than // VC100, G++ 4.5, Clang Apple 4.2 or Clang 3.2 (Unsupported). // #if (defined(__GNUC__) && (((__GNUC__* 100) + __GNUC_MINOR__) >= 405) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || \ (defined(__clang__) && \ ((defined(__apple_build_version__) && (((__clang_major__ * 100) + __clang_minor__) >= 402)) || \ (!defined(__apple_build_version__) && (((__clang_major__ * 100) + __clang_minor__) >= 302))) && \ __cplusplus >= 201103) || \ (defined(_MSC_VER) && (_MSC_VER >= 1600)) # define ICE_CPP11 #elif __cplusplus >= 201103 || defined(__GXX_EXPERIMENTAL_CXX0X__) # error Unsupported C++11 compiler #endif #if defined(ICE_CPP11) && !defined(_MSC_VER) // Visual Studio does not support noexcept yet # define ICE_NOEXCEPT noexcept # define ICE_NOEXCEPT_FALSE noexcept(false) #else # define ICE_NOEXCEPT throw() # define ICE_NOEXCEPT_FALSE /**/ #endif // // Visual Studio 2012 or later, without Windows XP/2003 support // #if defined(_MSC_VER) && (_MSC_VER >= 1700) && !defined(_USING_V110_SDK71_) // // Check if building for WinRT // # include # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) # define ICE_OS_WINRT # define ICE_STATIC_LIBS # endif // // Windows provides native condition variables on Vista and later, // and Visual Studio 2012 with the default Platform Toolset (vc100) no // longer supports Windows XP or Windows Server 2003. // // You can "switch-on" this macro to use native condition variables with // other C++ compilers on Windows. // # define ICE_HAS_WIN32_CONDVAR #endif // // Compiler extensions to export and import symbols: see the documentation // for Visual C++, Solaris Studio and HP aC++. // #if (defined(_MSC_VER) && !defined(ICE_STATIC_LIBS)) || \ (defined(__HP_aCC) && defined(__HP_WINDLL)) # define ICE_DECLSPEC_EXPORT __declspec(dllexport) # define ICE_DECLSPEC_IMPORT __declspec(dllimport) # define ICE_HAS_DECLSPEC_IMPORT_EXPORT #elif defined(__SUNPRO_CC) # define ICE_DECLSPEC_EXPORT __global # define ICE_DECLSPEC_IMPORT /**/ #else # define ICE_DECLSPEC_EXPORT /**/ # define ICE_DECLSPEC_IMPORT /**/ #endif // // Let's use these extensions with IceUtil: // #ifdef ICE_UTIL_API_EXPORTS # define ICE_UTIL_API ICE_DECLSPEC_EXPORT #else # define ICE_UTIL_API ICE_DECLSPEC_IMPORT #endif #if defined(_MSC_VER) # define ICE_DEPRECATED_API __declspec(deprecated) #elif defined(__GNUC__) # define ICE_DEPRECATED_API __attribute__((deprecated)) #else # define ICE_DEPRECATED_API /**/ #endif #ifdef _WIN32 # if !defined(ICE_STATIC_LIBS) && defined(_MSC_VER) && (!defined(_DLL) || !defined(_MT)) # error "Only multi-threaded DLL libraries can be used with Ice!" # endif # include #endif // // Some include files we need almost everywhere. // #include #include #include #ifndef _WIN32 # include # include #endif #ifdef _MSC_VER // // Move some warnings to level 4 // # pragma warning( 4 : 4250 ) // ... : inherits ... via dominance # pragma warning( 4 : 4251 ) // class ... needs to have dll-interface to be used by clients of class .. #endif namespace IceUtil { // // By deriving from this class, other classes are made non-copyable. // class ICE_UTIL_API noncopyable { protected: noncopyable() { } ~noncopyable() { } // May not be virtual! Classes without virtual // operations also derive from noncopyable. private: noncopyable(const noncopyable&); const noncopyable& operator=(const noncopyable&); }; // // Int64 typedef // #ifdef _MSC_VER // // With Visual C++, long is always 32-bit // typedef __int64 Int64; #elif defined(ICE_64) typedef long Int64; #else typedef long long Int64; #endif } // // ICE_INT64: macro for Int64 literal values // #if defined(_MSC_VER) # define ICE_INT64(n) n##i64 #elif defined(ICE_64) # define ICE_INT64(n) n##L #else # define ICE_INT64(n) n##LL #endif // // The Ice version. // #define ICE_STRING_VERSION "3.5.1" // "A.B.C", with A=major, B=minor, C=patch #define ICE_INT_VERSION 30501 // AABBCC, with AA=major, BB=minor, CC=patch #endif Ice-3.5.1/cpp/include/IceUtil/Iterator.h0000644000076400007640000000164112223561476016101 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_ITERATOR_H #define ICE_UTIL_ITERATOR_H #include namespace IceUtilInternal { template inline typename ForwardIterator::difference_type distance(ForwardIterator first, ForwardIterator last) { // // Work-around for a limitation in the standard library provided // with the Sun C++ 5.x compilers #if defined(__SUNPRO_CC) && defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) ForwardIterator::difference_type result = 0; std::distance(first, last, result); return result; #else return ::std::distance(first, last); #endif } } #endif Ice-3.5.1/cpp/include/IceUtil/CtrlCHandler.h0000644000076400007640000000436612223561476016624 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_CTRL_C_HANDLER_H #define ICE_UTIL_CTRL_C_HANDLER_H #include #include namespace IceUtil { // The CtrlCHandler provides a portable way to handle CTRL+C and // CTRL+C like signals // On Unix/POSIX, the CtrlCHandler handles SIGHUP, SIGINT and SIGTERM. // On Windows, it is essentially a wrapper for SetConsoleCtrlHandler(). // // In a process, only one CtrlCHandler can exist at a given time: // the CtrlCHandler constructor raises CtrlCHandlerException if // you attempt to create a second CtrlCHandler. // On Unix/POSIX, it is essential to create the CtrlCHandler before // creating any thread, as the CtrlCHandler constructor masks (blocks) // SIGHUP, SIGINT and SIGTERM; by default, threads created later will // inherit this signal mask. // // When a CTRL+C or CTRL+C like signal is sent to the process, the // user-registered callback is called in a separate thread; it is // given the signal number. The callback must not raise exceptions. // On Unix/POSIX, the callback is NOT a signal handler and can call // functions that are not async-signal safe. // // The CtrCHandler destructor "unregisters" the callback. However // on Unix/POSIX it does not restore the old signal mask in any // thread, so SIGHUP, SIGINT and SIGTERM remain blocked. // // TODO: Maybe the behavior on Windows should be the same? Now we // just restore the default behavior (TerminateProcess). typedef void (*CtrlCHandlerCallback)(int); class ICE_UTIL_API CtrlCHandler { public: CtrlCHandler(CtrlCHandlerCallback = 0); ~CtrlCHandler(); void setCallback(CtrlCHandlerCallback); CtrlCHandlerCallback getCallback() const; }; class ICE_UTIL_API CtrlCHandlerException : public Exception { public: CtrlCHandlerException(const char*, int); virtual std::string ice_name() const; virtual CtrlCHandlerException* ice_clone() const; virtual void ice_throw() const; }; } #endif Ice-3.5.1/cpp/include/IceUtil/UniquePtr.h0000644000076400007640000000303112223561476016237 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_UNIQUE_PTR_H #define ICE_UTIL_UNIQUE_PTR_H #include namespace IceUtil { // // This is temporary and very partial placeholder for std::unique_ptr, // which is not yet widely available. // template class UniquePtr { public: explicit UniquePtr(T* ptr = 0) : _ptr(ptr) { } UniquePtr(UniquePtr& o) : _ptr(o.release()) { } UniquePtr& operator=(UniquePtr& o) { reset(o.release()); return *this; } ~UniquePtr() { if(_ptr != 0) { delete _ptr; } } T* release() { T* r = _ptr; _ptr = 0; return r; } void reset(T* ptr = 0) { assert(ptr == 0 || ptr != _ptr); if(_ptr != 0) { delete _ptr; } _ptr = ptr; } T& operator*() const { return *_ptr; } T* operator->() const { return _ptr; } T* get() const { return _ptr; } void swap(UniquePtr& a) { T* tmp = a._ptr; a._ptr = _ptr; _ptr = tmp; } private: T* _ptr; }; } // End of namespace IceUtil #endif Ice-3.5.1/cpp/include/IceUtil/Functional.h0000644000076400007640000002244312223561476016415 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_FUNCTIONAL_H #define ICE_UTIL_FUNCTIONAL_H #include #include namespace IceUtilInternal { // ---------------------------------------------------------------------- // Various function objects that work with handles instead of plain // pointers. // ---------------------------------------------------------------------- template class MemFun : public std::unary_function { typedef R (T::*MemberFN)(void); MemberFN _mfn; public: explicit MemFun(MemberFN p) : _mfn(p) { } R operator()(H handle) const { return (handle.get() ->* _mfn)(); } }; template class MemFun1 : public std::binary_function { typedef R (T::*MemberFN)(A); MemberFN _mfn; public: explicit MemFun1(MemberFN p) : _mfn(p) { } R operator()(H handle, A arg) const { return (handle.get() ->* _mfn)(arg); } }; template class VoidMemFun : public std::unary_function { typedef void (T::*MemberFN)(void); MemberFN _mfn; public: explicit VoidMemFun(MemberFN p) : _mfn(p) { } void operator()(H handle) const { (handle.get() ->* _mfn)(); } }; template class VoidMemFun1 : public std::binary_function { typedef void (T::*MemberFN)(A); MemberFN _mfn; public: explicit VoidMemFun1(MemberFN p) : _mfn(p) { } void operator()(H handle, A arg) const { (handle.get() ->* _mfn)(arg); } }; template class SecondMemFun : public std::unary_function, R> { typedef R (T::*MemberFN)(void); MemberFN _mfn; public: explicit SecondMemFun(MemberFN p) : _mfn(p) { } R operator()(std::pair pair) const { return (pair.second.get() ->* _mfn)(); } }; template class SecondMemFun1 : public std::binary_function, A, R> { typedef R (T::*MemberFN)(A); MemberFN _mfn; public: explicit SecondMemFun1(MemberFN p) : _mfn(p) { } R operator()(std::pair pair, A arg) const { return (pair.second.get() ->* _mfn)(arg); } }; template class SecondVoidMemFun : public std::unary_function, void> { typedef void (T::*MemberFN)(void); MemberFN _mfn; public: explicit SecondVoidMemFun(MemberFN p) : _mfn(p) { } void operator()(std::pair pair) const { (pair.second.get() ->* _mfn)(); } }; template class SecondVoidMemFun1 : public std::binary_function, A, void> { typedef void (T::*MemberFN)(A); MemberFN _mfn; public: explicit SecondVoidMemFun1(MemberFN p) : _mfn(p) { } void operator()(std::pair pair, A arg) const { (pair.second.get() ->* _mfn)(arg); } }; template class ConstMemFun : public std::unary_function { typedef R (T::*MemberFN)(void) const; MemberFN _mfn; public: explicit ConstMemFun(MemberFN p) : _mfn(p) { } R operator()(H handle) const { return (handle.get() ->* _mfn)(); } }; template class ConstMemFun1 : public std::binary_function { typedef R (T::*MemberFN)(A) const; MemberFN _mfn; public: explicit ConstMemFun1(MemberFN p) : _mfn(p) { } R operator()(H handle, A arg) const { return (handle.get() ->* _mfn)(arg); } }; template class ConstVoidMemFun : public std::unary_function { typedef void (T::*MemberFN)(void) const; MemberFN _mfn; public: explicit ConstVoidMemFun(MemberFN p) : _mfn(p) { } void operator()(H handle) const { (handle.get() ->* _mfn)(); } }; template class ConstVoidMemFun1 : public std::binary_function { typedef void (T::*MemberFN)(A) const; MemberFN _mfn; public: explicit ConstVoidMemFun1(MemberFN p) : _mfn(p) { } void operator()(H handle, A arg) const { (handle.get() ->* _mfn)(arg); } }; template class SecondConstMemFun : public std::unary_function, R> { typedef R (T::*MemberFN)(void) const; MemberFN _mfn; public: explicit SecondConstMemFun(MemberFN p) : _mfn(p) { } R operator()(std::pair pair) const { return (pair.second.get() ->* _mfn)(); } }; template class SecondConstMemFun1 : public std::binary_function, A, R> { typedef R (T::*MemberFN)(A) const; MemberFN _mfn; public: explicit SecondConstMemFun1(MemberFN p) : _mfn(p) { } R operator()(std::pair pair, A arg) const { return (pair.second.get() ->* _mfn)(arg); } }; template class SecondConstVoidMemFun : public std::unary_function, void> { typedef void (T::*MemberFN)(void) const; MemberFN _mfn; public: explicit SecondConstVoidMemFun(MemberFN p) : _mfn(p) { } void operator()(std::pair pair) const { (pair.second.get() ->* _mfn)(); } }; template class SecondConstVoidMemFun1 : public std::binary_function, A, void> { typedef void (T::*MemberFN)(A) const; MemberFN _mfn; public: explicit SecondConstVoidMemFun1(MemberFN p) : _mfn(p) { } void operator()(std::pair pair, A arg) const { (pair.second.get() ->* _mfn)(arg); } }; } // ---------------------------------------------------------------------- // Inline functions that return function objects that work with // IceUtil::Handle // ---------------------------------------------------------------------- namespace IceUtil { template inline ::IceUtilInternal::MemFun > memFun(R (T::*p)(void)) { return ::IceUtilInternal::MemFun >(p); } template inline ::IceUtilInternal::MemFun1, A> memFun1(R (T::*p)(A)) { return ::IceUtilInternal::MemFun1, A>(p); } template inline ::IceUtilInternal::VoidMemFun > voidMemFun(void (T::*p)(void)) { return ::IceUtilInternal::VoidMemFun >(p); } template inline ::IceUtilInternal::VoidMemFun1, A> voidMemFun1(void (T::*p)(A)) { return ::IceUtilInternal::VoidMemFun1, A>(p); } template inline ::IceUtilInternal::SecondMemFun > secondMemFun(R (T::*p)(void)) { return ::IceUtilInternal::SecondMemFun >(p); } template inline ::IceUtilInternal::SecondMemFun1, A> secondMemFun1(R (T::*p)(A)) { return ::IceUtilInternal::SecondMemFun1, A>(p); } template inline ::IceUtilInternal::SecondVoidMemFun > secondVoidMemFun(void (T::*p)(void)) { return ::IceUtilInternal::SecondVoidMemFun >(p); } template inline ::IceUtilInternal::SecondVoidMemFun1, A> secondVoidMemFun1(void (T::*p)(A)) { return ::IceUtilInternal::SecondVoidMemFun1, A>(p); } template inline ::IceUtilInternal::ConstMemFun > constMemFun(R (T::*p)(void) const) { return ::IceUtilInternal::ConstMemFun >(p); } template inline ::IceUtilInternal::ConstMemFun1, A> constMemFun1(R (T::*p)(A) const) { return ::IceUtilInternal::ConstMemFun1, A>(p); } template inline ::IceUtilInternal::ConstVoidMemFun > constVoidMemFun(void (T::*p)(void) const) { return ::IceUtilInternal::ConstVoidMemFun >(p); } template inline ::IceUtilInternal::ConstVoidMemFun1, A> constVoidMemFun1(void (T::*p)(A) const) { return ::IceUtilInternal::ConstVoidMemFun1, A>(p); } template inline ::IceUtilInternal::SecondConstMemFun > secondConstMemFun(R (T::*p)(void) const) { return ::IceUtilInternal::SecondConstMemFun >(p); } template inline ::IceUtilInternal::SecondConstMemFun1, A> secondConstMemFun1(R (T::*p)(A) const) { return ::IceUtilInternal::SecondConstMemFun1, A>(p); } template inline ::IceUtilInternal::SecondConstVoidMemFun > secondConstVoidMemFun(void (T::*p)(void) const) { return ::IceUtilInternal::SecondConstVoidMemFun >(p); } template inline ::IceUtilInternal::SecondConstVoidMemFun1, A> secondConstVoidMemFun1(void (T::*p)(A) const) { return ::IceUtilInternal::SecondConstVoidMemFun1, A>(p); } } #endif Ice-3.5.1/cpp/include/IceUtil/Random.h0000644000076400007640000000110712223561476015525 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_RANDOM_H #define ICE_UTIL_RANDOM_H #include #include namespace IceUtilInternal { ICE_UTIL_API void generateRandom(char*, int); ICE_UTIL_API unsigned int random(int = 0); } #endif Ice-3.5.1/cpp/include/IceUtil/Cache.h0000644000076400007640000002005112223561476015307 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_CACHE_H #define ICE_UTIL_CACHE_H #include #include #include #include namespace IceUtil { // // An abstraction to efficiently populate a Cache, without holding // a lock while loading from a database. // template class Cache { public: // // Latch and CacheValue are implementation details; // application code should not use them. // struct Latch : public IceUtilInternal::CountDownLatch { Latch() : IceUtilInternal::CountDownLatch(1), useCount(0) { } int useCount; }; struct CacheValue { CacheValue(const Handle& o) : obj(o), latch(0) { } Handle obj; Latch* latch; }; typedef typename std::map::iterator Position; Handle getIfPinned(const Key&, bool = false) const; void unpin(Position); void clear(); size_t size() const; bool pin(const Key&, const Handle&); Handle pin(const Key&); Handle putIfAbsent(const Key&, const Handle&); protected: virtual Handle load(const Key&) = 0; virtual void pinned(const Handle&, Position) { } virtual ~Cache() { } private: Handle pinImpl(const Key&, const Handle&); typedef std::map CacheMap; Mutex _mutex; CacheMap _map; }; template Handle Cache::getIfPinned(const Key& key, bool wait) const { Mutex::Lock sync(_mutex); for(;;) { typename CacheMap::const_iterator p = _map.find(key); if(p != _map.end()) { Handle result = (*p).second.obj; if(result != 0 || wait == false) { return result; } // // The object is being loaded: we wait // if(p->second.latch == 0) { const_cast(p->second).latch = new Latch; } Latch* latch = p->second.latch; ++latch->useCount; sync.release(); latch->await(); sync.acquire(); if(--latch->useCount == 0) { delete latch; } // // Try again // } else { return 0; } } } template void Cache::unpin(typename Cache::Position p) { // // There is no risk to erase a 'being loaded' position, // since such position never got outside yet! // Mutex::Lock sync(_mutex); _map.erase(p); } template void Cache::clear() { // // Not safe during a pin! // Mutex::Lock sync(_mutex); _map.clear(); } template size_t Cache::size() const { Mutex::Lock sync(_mutex); return _map.size(); } template bool Cache::pin(const Key& key, const Handle& obj) { Mutex::Lock sync(_mutex); std::pair ir = #ifdef _MSC_VER _map.insert(CacheMap::value_type(key, CacheValue(obj))); #else _map.insert(typename CacheMap::value_type(key, CacheValue(obj))); #endif if(ir.second) { pinned(obj, ir.first); } return ir.second; } template Handle Cache::pin(const Key& key) { return pinImpl(key, 0); } template Handle Cache::putIfAbsent(const Key& key, const Handle& obj) { return pinImpl(key, obj); } template Handle Cache::pinImpl(const Key& key, const Handle& newObj) { Latch* latch = 0; Position p; do { { Mutex::Lock sync(_mutex); // // Clean up latch from previous loop // if(latch != 0) { if(--latch->useCount == 0) { delete latch; } latch = 0; } std::pair ir = #if defined(_MSC_VER) _map.insert(CacheMap::value_type(key, CacheValue(0))); #else _map.insert(typename CacheMap::value_type(key, CacheValue(0))); #endif if(ir.second == false) { CacheValue& val = ir.first->second; if(val.obj != 0) { return val.obj; } // // Otherwise wait // if(val.latch == 0) { // // The first queued thread creates the latch // val.latch = new Latch; } latch = val.latch; latch->useCount++; } p = ir.first; } if(latch != 0) { // // Note: only the threads owning a "useCount" wait; upon wake-up, // they loop back, release this useCount and possibly delete the latch // latch->await(); // // p could be stale now, e.g. some other thread pinned and unpinned the // object while we were waiting. // So start over. } } while(latch != 0); // // Load // Handle obj; try { obj = load(key); } catch(...) { Mutex::Lock sync(_mutex); latch = p->second.latch; p->second.latch = 0; _map.erase(p); if(latch != 0) { // // It is necessary to call countDown() within the sync // because countDown may not be atomic, and we don't // want the "await" thread to delete the latch while // this thread is still in countDown(). // assert(latch->getCount() == 1); latch->countDown(); } throw; } Mutex::Lock sync(_mutex); // // p is still valid here -- nobody knows about it. See also unpin(). // latch = p->second.latch; p->second.latch = 0; try { if(obj != 0) { p->second.obj = obj; pinned(obj, p); } else { if(newObj == 0) { // // pin() did not find the object // // // The waiting threads will have to call load() to see by themselves. // _map.erase(p); } else { // // putIfAbsent() inserts key/newObj // p->second.obj = newObj; pinned(newObj, p); } } } catch(...) { if(latch != 0) { // // Must be called within sync; see ->countDown() note above. // assert(latch->getCount() == 1); latch->countDown(); } throw; } if(latch != 0) { // // Must be called within sync; see ->countDown() note above. // assert(latch->getCount() == 1); latch->countDown(); } return obj; } } #endif Ice-3.5.1/cpp/include/IceUtil/RecMutex.h0000644000076400007640000000461712223561476016052 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_RMUTEX_H #define ICE_UTIL_RMUTEX_H #include #include #include #include namespace IceUtil { // // Forward declarations for friend. // class Cond; // // Recursive Mutex implementation. // class ICE_UTIL_API RecMutex { public: // // Lock & TryLock typedefs. // typedef LockT Lock; typedef TryLockT TryLock; RecMutex(); RecMutex(const MutexProtocol); ~RecMutex(); // // Note that lock/tryLock & unlock in general should not be used // directly. Instead use Lock & TryLock. // void lock() const; // // Returns true if the lock was acquired or was already acquired // by the calling thread, and false otherwise. // bool tryLock() const; void unlock() const; // // Returns true if the mutex will unlock when calling unlock() // (false otherwise). For non-recursive mutexes, this will always // return true. // This function is used by the Monitor implementation to know whether // the Mutex has been locked for the first time, or unlocked for the // last time (that is another thread is able to acquire the mutex). // Pre-condition: the mutex must be locked. // bool willUnlock() const; private: void init(const MutexProtocol); // noncopyable RecMutex(const RecMutex&); void operator=(const RecMutex&); // // LockState and the lock/unlock variations are for use by the // Condition variable implementation. // #ifdef _WIN32 struct LockState { # ifdef ICE_HAS_WIN32_CONDVAR CRITICAL_SECTION* mutex; # endif int count; }; #else struct LockState { pthread_mutex_t* mutex; int count; }; #endif void unlock(LockState&) const; void lock(LockState&) const; friend class Cond; #ifdef _WIN32 mutable CRITICAL_SECTION _mutex; #else mutable pthread_mutex_t _mutex; #endif mutable int _count; }; } // End namespace IceUtil #endif Ice-3.5.1/cpp/include/IceUtil/MutexPtrLock.h0000644000076400007640000000311112223561476016703 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_MUTEX_PTR_LOCK_H #define ICE_UTIL_MUTEX_PTR_LOCK_H #include #include namespace IceUtilInternal { template class MutexPtrLock { public: MutexPtrLock(const T* mutex) : _mutex(mutex), _acquired(false) { if(_mutex) { _mutex->lock(); _acquired = true; } } ~MutexPtrLock() { if(_mutex && _acquired) { _mutex->unlock(); } } void acquire() const { if(_mutex) { _mutex->lock(); _acquired = true; } } void release() const { if(_mutex) { if(!_acquired) { throw IceUtil::ThreadLockedException(__FILE__, __LINE__); } _mutex->unlock(); _acquired = false; } } bool acquired() const { return _acquired; } private: // Not implemented; prevents accidental use. // MutexPtrLock(const MutexPtrLock&); MutexPtrLock& operator=(const MutexPtrLock&); const T* _mutex; mutable bool _acquired; }; } // End namespace IceUtilInternal #endif Ice-3.5.1/cpp/include/IceUtil/Timer.h0000644000076400007640000000654012223561476015373 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_TIMER_H #define ICE_UTIL_TIMER_H #include #include #include #include #include #include namespace IceUtil { class Timer; typedef IceUtil::Handle TimerPtr; // // Extend the TimerTask class and override the runTimerTask() method to execute // code at a specific time or repeatedly. // class ICE_UTIL_API TimerTask : virtual public IceUtil::Shared { public: virtual ~TimerTask() { } virtual void runTimerTask() = 0; }; typedef IceUtil::Handle TimerTaskPtr; // // The timer class is used to schedule tasks for one-time execution or // repeated execution. Tasks are executed by the dedicated timer thread // sequentially. // class ICE_UTIL_API Timer : public virtual IceUtil::Shared, private virtual IceUtil::Thread { public: // // Construct a timer and starts its execution thread. // Timer(); // // Construct a timer and starts its execution thread with the priority. // Timer(int priority); // // Destroy the timer and detach its execution thread if the calling thread // is the timer thread, join the timer execution thread otherwise. // void destroy(); // // Schedule a task for execution after a given delay. // void schedule(const TimerTaskPtr&, const IceUtil::Time&); // // Schedule a task for repeated execution with the given delay // between each execution. // void scheduleRepeated(const TimerTaskPtr&, const IceUtil::Time&); // // Cancel a task. Returns true if the task has not yet run or if // it's a task scheduled for repeated execution. Returns false if // the task has already run, was already cancelled or was never // schedulded. // bool cancel(const TimerTaskPtr&); private: struct Token { IceUtil::Time scheduledTime; IceUtil::Time delay; TimerTaskPtr task; inline Token(const IceUtil::Time&, const IceUtil::Time&, const TimerTaskPtr&); inline bool operator<(const Token& r) const; }; virtual void run(); IceUtil::Monitor _monitor; bool _destroyed; std::set _tokens; class TimerTaskCompare : public std::binary_function { public: bool operator()(const TimerTaskPtr& lhs, const TimerTaskPtr& rhs) const { return lhs.get() < rhs.get(); } }; std::map _tasks; IceUtil::Time _wakeUpTime; }; typedef IceUtil::Handle TimerPtr; inline Timer::Token::Token(const IceUtil::Time& st, const IceUtil::Time& d, const TimerTaskPtr& t) : scheduledTime(st), delay(d), task(t) { } inline bool Timer::Token::operator<(const Timer::Token& r) const { if(scheduledTime < r.scheduledTime) { return true; } else if(scheduledTime > r.scheduledTime) { return false; } return task.get() < r.task.get(); } } #endif Ice-3.5.1/cpp/include/IceUtil/Handle.h0000644000076400007640000001263612223561476015511 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_HANDLE_H #define ICE_UTIL_HANDLE_H #include #include // // "Handle" or "smart pointer" class for classes derived from // IceUtil::Shared, IceUtil::SimpleShared, or IceInternal::GCShared. // namespace IceUtil { template class HandleBase { public: typedef T element_type; T* get() const { return _ptr; } T* operator->() const { if(!_ptr) { // // We don't throw directly NullHandleException here to // keep the code size of this method to a minimun (the // assembly code for throwing an exception is much bigger // than just a function call). This maximises the chances // of inlining by compiler optimization. // throwNullHandleException(__FILE__, __LINE__); } return _ptr; } T& operator*() const { if(!_ptr) { // // We don't throw directly NullHandleException here to // keep the code size of this method to a minimun (the // assembly code for throwing an exception is much bigger // than just a function call). This maximises the chances // of inlining by compiler optimization. // throwNullHandleException(__FILE__, __LINE__); } return *_ptr; } operator bool() const { return _ptr ? true : false; } void swap(HandleBase& other) { std::swap(_ptr, other._ptr); } T* _ptr; private: void throwNullHandleException(const char *, int) const; }; template inline void HandleBase::throwNullHandleException(const char* file, int line) const { throw NullHandleException(file, line); } template inline bool operator==(const HandleBase& lhs, const HandleBase& rhs) { T* l = lhs.get(); U* r = rhs.get(); if(l && r) { return *l == *r; } // Note: don't use if { } else { }. This causes lots warnings when // compiling with GCC and optimization enabled. See bug 2330. return !l && !r; } template inline bool operator!=(const HandleBase& lhs, const HandleBase& rhs) { return !operator==(lhs, rhs); } template inline bool operator<(const HandleBase& lhs, const HandleBase& rhs) { T* l = lhs.get(); U* r = rhs.get(); if(l && r) { return *l < *r; } // Note: don't use if { } else { }. This causes lots warnings when // compiling with GCC and optimization enabled. See bug 2330. return !l && r; } template inline bool operator<=(const HandleBase& lhs, const HandleBase& rhs) { return lhs < rhs || lhs == rhs; } template inline bool operator>(const HandleBase& lhs, const HandleBase& rhs) { return !(lhs < rhs || lhs == rhs); } template inline bool operator>=(const HandleBase& lhs, const HandleBase& rhs) { return !(lhs < rhs); } template class Handle : public HandleBase { public: Handle(T* p = 0) { this->_ptr = p; if(this->_ptr) { this->_ptr->__incRef(); } } template Handle(const Handle& r) { this->_ptr = r._ptr; if(this->_ptr) { this->_ptr->__incRef(); } } Handle(const Handle& r) { this->_ptr = r._ptr; if(this->_ptr) { this->_ptr->__incRef(); } } ~Handle() { if(this->_ptr) { this->_ptr->__decRef(); } } Handle& operator=(T* p) { if(this->_ptr != p) { if(p) { p->__incRef(); } T* ptr = this->_ptr; this->_ptr = p; if(ptr) { ptr->__decRef(); } } return *this; } template Handle& operator=(const Handle& r) { if(this->_ptr != r._ptr) { if(r._ptr) { r._ptr->__incRef(); } T* ptr = this->_ptr; this->_ptr = r._ptr; if(ptr) { ptr->__decRef(); } } return *this; } Handle& operator=(const Handle& r) { if(this->_ptr != r._ptr) { if(r._ptr) { r._ptr->__incRef(); } T* ptr = this->_ptr; this->_ptr = r._ptr; if(ptr) { ptr->__decRef(); } } return *this; } template static Handle dynamicCast(const HandleBase& r) { return Handle(dynamic_cast(r._ptr)); } template static Handle dynamicCast(Y* p) { return Handle(dynamic_cast(p)); } }; } #endif Ice-3.5.1/cpp/include/IceUtil/OutputUtil.h0000644000076400007640000001561512223561476016454 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_OUTPUT_UTIL_H #define ICE_UTIL_OUTPUT_UTIL_H #include #include #include #include namespace IceUtilInternal { ICE_UTIL_API std::string int64ToString(IceUtil::Int64); // ---------------------------------------------------------------------- // OutputBase // ---------------------------------------------------------------------- // // Technically it's not necessary to have print() & newline() as virtual // since the opeator<< functions are specific to each OutputBase // derivative. However, since it's possible to call print() & newline() // manually I've decided to leave them as virtual. // class ICE_UTIL_API OutputBase : private ::IceUtil::noncopyable { public: OutputBase(); OutputBase(std::ostream&); OutputBase(const char*); virtual ~OutputBase(); void setIndent(int); // What is the indent level? void setUseTab(bool); // Should we output tabs? void open(const char*); // Open output stream. void close(); // Close output stream. bool isOpen(); // Is a file stream open? virtual void print(const char*); // Print a string. void inc(); // Increment indentation level. void dec(); // Decrement indentation level. void useCurrentPosAsIndent(); // Save the current position as indentation. void zeroIndent(); // Use zero identation. void restoreIndent(); // Restore indentation. int currIndent(); // Return current indent value. virtual void newline(); // Print newline. void separator(); // Print separator. bool operator!() const; // Check whether the output state is ok. protected: std::ofstream _fout; std::ostream& _out; int _pos; int _indent; int _indentSize; std::stack _indentSave; bool _useTab; bool _separator; }; class ICE_UTIL_API NextLine { }; extern ICE_UTIL_API NextLine nl; class ICE_UTIL_API Separator { }; extern ICE_UTIL_API Separator sp; // ---------------------------------------------------------------------- // Output // ---------------------------------------------------------------------- class ICE_UTIL_API Output : public OutputBase { public: Output(); Output(std::ostream&); Output(const char*); virtual void print(const char*); // Print a string. void setBeginBlock(const char *); // what do we use at block starts? void setEndBlock(const char *); // what do we use the block end? void sb(); // Start a block. void eb(); // End a block. void spar(); // Start a paramater list. void epar(); // End a paramater list. private: std::string _blockStart; std::string _blockEnd; int _par; // If >= 0, we are writing a parameter list. }; template inline Output& operator<<(Output& out, const T& val) { std::ostringstream s; s << val; out.print(s.str().c_str()); return out; } template inline Output& operator<<(Output& out, const std::vector& val) { for(typename std::vector::const_iterator p = val.begin(); p != val.end(); ++p) { out << *p; } return out; } template<> inline Output& operator<<(Output& o, const NextLine&) { o.newline(); return o; } template<> inline Output& operator<<(Output& o, const Separator&) { o.separator(); return o; } class ICE_UTIL_API StartBlock { }; extern ICE_UTIL_API StartBlock sb; template<> inline Output& operator<<(Output& o, const StartBlock&) { o.sb(); return o; } class ICE_UTIL_API EndBlock { }; extern ICE_UTIL_API EndBlock eb; template<> inline Output& operator<<(Output& o, const EndBlock&) { o.eb(); return o; } class ICE_UTIL_API StartPar { }; extern ICE_UTIL_API StartPar spar; template<> inline Output& operator<<(Output& o, const StartPar&) { o.spar(); return o; } class ICE_UTIL_API EndPar { }; extern ICE_UTIL_API EndPar epar; template<> inline Output& operator<<(Output& o, const EndPar&) { o.epar(); return o; } ICE_UTIL_API Output& operator<<(Output&, std::ios_base& (*)(std::ios_base&)); // ---------------------------------------------------------------------- // XMLOutput // ---------------------------------------------------------------------- class ICE_UTIL_API XMLOutput : public OutputBase { public: XMLOutput(); XMLOutput(std::ostream&); XMLOutput(const char*); virtual void print(const char*); // Print a string. virtual void newline(); // Print newline. void startElement(const std::string&); // Start an element. void endElement(); // End an element. void attr(const std::string&, const std::string&); // Add an attribute to an element. void startEscapes(); void endEscapes(); std::string currentElement() const; private: ::std::string escape(const ::std::string&) const; std::stack _elementStack; bool _se; bool _text; bool _escape; }; template inline XMLOutput& operator<<(XMLOutput& out, const T& val) { std::ostringstream s; s << val; out.print(s.str().c_str()); return out; } template<> inline XMLOutput& operator<<(XMLOutput& o, const NextLine&) { o.newline(); return o; } template<> inline XMLOutput& operator<<(XMLOutput& o, const Separator&) { o.separator(); return o; } class ICE_UTIL_API EndElement { }; extern ICE_UTIL_API EndElement ee; template<> inline XMLOutput& operator<<(XMLOutput& o, const EndElement&) { o.endElement(); return o; } class ICE_UTIL_API StartElement { public: StartElement(const std::string&); const std::string& getName() const; private: const std::string _name; }; typedef StartElement se; template<> inline XMLOutput& operator<<(XMLOutput& o, const StartElement& e) { o.startElement(e.getName()); return o; } class ICE_UTIL_API Attribute { public: Attribute(const ::std::string&, const ::std::string&); const ::std::string& getName() const; const ::std::string& getValue() const; private: const ::std::string _name; const ::std::string _value; }; typedef Attribute attr; template<> inline XMLOutput& operator<<(XMLOutput& o, const Attribute& e) { o.attr(e.getName(), e.getValue()); return o; } class ICE_UTIL_API StartEscapes { }; extern ICE_UTIL_API StartEscapes startEscapes; class ICE_UTIL_API EndEscapes { }; extern ICE_UTIL_API EndEscapes endEscapes; template<> inline XMLOutput& operator<<(XMLOutput& o, const StartEscapes&) { o.startEscapes(); return o; } template<> inline XMLOutput& operator<<(XMLOutput& o, const EndEscapes&) { o.endEscapes(); return o; } ICE_UTIL_API XMLOutput& operator<<(XMLOutput&, std::ios_base& (*)(std::ios_base&)); } #endif Ice-3.5.1/cpp/include/IceUtil/Mutex.h0000644000076400007640000001533612223561476015420 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_MUTEX_H #define ICE_UTIL_MUTEX_H #include #include #include #include namespace IceUtil { // // Forward declaration for friend. // class Cond; // // Simple non-recursive Mutex implementation. // // Don't use noncopyable otherwise you end up with warnings like this: // // In file included from Connection.cpp:20: // ../../include/Ice/Outgoing.h:88: warning: direct base // `IceUtil::noncopyable' inaccessible in `IceInternal::Outgoing' due // to ambiguity // class ICE_UTIL_API Mutex { public: // // Lock & TryLock typedefs. // typedef LockT Lock; typedef TryLockT TryLock; inline Mutex(); inline Mutex(MutexProtocol); ~Mutex(); // // Note that lock/tryLock & unlock in general should not be used // directly. Instead use Lock & TryLock. // void lock() const; // // Returns true if the lock was acquired, and false otherwise. // bool tryLock() const; void unlock() const; // // Returns true if the mutex will unlock when calling unlock() // (false otherwise). For non-recursive mutexes, this will always // return true. // This function is used by the Monitor implementation to know whether // the Mutex has been locked for the first time, or unlocked for the // last time (that is another thread is able to acquire the mutex). // Pre-condition: the mutex must be locked. // bool willUnlock() const; private: inline void init(MutexProtocol); // noncopyable Mutex(const Mutex&); void operator=(const Mutex&); // // LockState and the lock/unlock variations are for use by the // Condition variable implementation. // #ifdef _WIN32 struct LockState { # ifdef ICE_HAS_WIN32_CONDVAR CRITICAL_SECTION* mutex; # endif }; #else struct LockState { pthread_mutex_t* mutex; }; #endif void unlock(LockState&) const; void lock(LockState&) const; friend class Cond; #ifdef _WIN32 mutable CRITICAL_SECTION _mutex; #else mutable pthread_mutex_t _mutex; #endif }; // // For performance reasons the following functions are inlined. // inline Mutex::Mutex() { #ifdef _WIN32 init(PrioNone); #else init(getDefaultMutexProtocol()); #endif } #ifdef _WIN32 inline Mutex::Mutex(MutexProtocol) { init(PrioNone); } #else inline Mutex::Mutex(MutexProtocol protocol) { init(protocol); } #endif #ifdef _WIN32 inline void Mutex::init(MutexProtocol) { #ifdef ICE_OS_WINRT InitializeCriticalSectionEx(&_mutex, 0, 0); #else InitializeCriticalSection(&_mutex); #endif } inline Mutex::~Mutex() { DeleteCriticalSection(&_mutex); } inline void Mutex::lock() const { EnterCriticalSection(&_mutex); assert(_mutex.RecursionCount == 1); } inline bool Mutex::tryLock() const { if(!TryEnterCriticalSection(&_mutex)) { return false; } if(_mutex.RecursionCount > 1) { LeaveCriticalSection(&_mutex); throw ThreadLockedException(__FILE__, __LINE__); } return true; } inline void Mutex::unlock() const { assert(_mutex.RecursionCount == 1); LeaveCriticalSection(&_mutex); } # ifdef ICE_HAS_WIN32_CONDVAR inline void Mutex::unlock(LockState& state) const { state.mutex = &_mutex; } inline void Mutex::lock(LockState&) const { } # else inline void Mutex::unlock(LockState&) const { LeaveCriticalSection(&_mutex); } inline void Mutex::lock(LockState&) const { EnterCriticalSection(&_mutex); } # endif #else inline void Mutex::init(MutexProtocol #if defined(_POSIX_THREAD_PRIO_INHERIT) && _POSIX_THREAD_PRIO_INHERIT > 0 protocol #endif ) { int rc; pthread_mutexattr_t attr; rc = pthread_mutexattr_init(&attr); assert(rc == 0); if(rc != 0) { pthread_mutexattr_destroy(&attr); throw ThreadSyscallException(__FILE__, __LINE__, rc); } // // Enable mutex error checking in debug builds // #ifndef NDEBUG #if defined(__linux) && !defined(__USE_UNIX98) rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP); #else rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); #endif assert(rc == 0); if(rc != 0) { pthread_mutexattr_destroy(&attr); throw ThreadSyscallException(__FILE__, __LINE__, rc); } #endif // // If system has support for priority inheritance we set the protocol // attribute of the mutex // #if defined(_POSIX_THREAD_PRIO_INHERIT) && _POSIX_THREAD_PRIO_INHERIT > 0 if(PrioInherit == protocol) { rc = pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); if(rc != 0) { pthread_mutexattr_destroy(&attr); throw ThreadSyscallException(__FILE__, __LINE__, rc); } } #endif rc = pthread_mutex_init(&_mutex, &attr); assert(rc == 0); if(rc != 0) { pthread_mutexattr_destroy(&attr); throw ThreadSyscallException(__FILE__, __LINE__, rc); } rc = pthread_mutexattr_destroy(&attr); assert(rc == 0); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } inline Mutex::~Mutex() { #ifndef NDEBUG int rc = 0; rc = pthread_mutex_destroy(&_mutex); assert(rc == 0); #else pthread_mutex_destroy(&_mutex); #endif } inline void Mutex::lock() const { int rc = pthread_mutex_lock(&_mutex); if(rc != 0) { if(rc == EDEADLK) { throw ThreadLockedException(__FILE__, __LINE__); } else { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } } inline bool Mutex::tryLock() const { int rc = pthread_mutex_trylock(&_mutex); if(rc != 0 && rc != EBUSY) { if(rc == EDEADLK) { throw ThreadLockedException(__FILE__, __LINE__); } else { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } return (rc == 0); } inline void Mutex::unlock() const { int rc = pthread_mutex_unlock(&_mutex); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } inline void Mutex::unlock(LockState& state) const { state.mutex = &_mutex; } inline void Mutex::lock(LockState&) const { } #endif inline bool Mutex::willUnlock() const { return true; } } // End namespace IceUtil #endif Ice-3.5.1/cpp/include/IceUtil/Exception.h0000644000076400007640000000635412223561476016254 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_EXCEPTION_H #define ICE_UTIL_EXCEPTION_H #include #include namespace IceUtil { class ICE_UTIL_API Exception : public std::exception { public: Exception(); Exception(const char*, int); virtual ~Exception() throw(); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual const char* what() const throw(); virtual Exception* ice_clone() const; virtual void ice_throw() const; const char* ice_file() const; int ice_line() const; const std::string& ice_stackTrace() const; private: const char* _file; int _line; static const char* _name; const std::string _stackTrace; mutable ::std::string _str; // Initialized lazily in what(). }; ICE_UTIL_API std::ostream& operator<<(std::ostream&, const Exception&); class ICE_UTIL_API NullHandleException : public Exception { public: NullHandleException(const char*, int); virtual ~NullHandleException() throw(); virtual std::string ice_name() const; virtual NullHandleException* ice_clone() const; virtual void ice_throw() const; private: static const char* _name; }; class ICE_UTIL_API IllegalArgumentException : public Exception { public: IllegalArgumentException(const char*, int); IllegalArgumentException(const char*, int, const std::string&); virtual ~IllegalArgumentException() throw(); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual IllegalArgumentException* ice_clone() const; virtual void ice_throw() const; std::string reason() const; private: static const char* _name; std::string _reason; }; class ICE_UTIL_API SyscallException : public Exception { public: SyscallException(const char*, int, int); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual SyscallException* ice_clone() const; virtual void ice_throw() const; int error() const; private: const int _error; static const char* _name; }; class ICE_UTIL_API FileLockException : public Exception { public: FileLockException(const char*, int, int, const std::string&); virtual ~FileLockException() throw(); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual FileLockException* ice_clone() const; virtual void ice_throw() const; std::string path() const; int error() const; private: const int _error; static const char* _name; std::string _path; }; class ICE_UTIL_API OptionalNotSetException : public Exception { public: OptionalNotSetException(const char*, int); virtual ~OptionalNotSetException() throw(); virtual std::string ice_name() const; virtual OptionalNotSetException* ice_clone() const; virtual void ice_throw() const; private: static const char* _name; }; } #endif Ice-3.5.1/cpp/include/IceUtil/.headers0000644000076400007640000000355712223561476015563 0ustar mesmesSDK_HEADERS = \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\AbstractMutex.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ArgVector.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Cache.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Cond.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Config.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\CountDownLatch.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\CtrlCHandler.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\DisableWarnings.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Exception.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\FileUtil.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Functional.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Handle.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IceUtil.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\InputUtil.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Iterator.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Lock.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Monitor.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Mutex.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MutexProtocol.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MutexPtrLock.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MutexPtrTryLock.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Optional.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Options.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\OutputUtil.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Random.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\RecMutex.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ScannerConfig.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ScopedArray.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Shared.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\StopWatch.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\StringUtil.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Thread.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ThreadException.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Time.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Timer.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Unicode.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\UniquePtr.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\UUID.h \ Ice-3.5.1/cpp/include/IceUtil/Optional.h0000644000076400007640000001300712223561476016074 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_OPTIONAL_H #define ICE_UTIL_OPTIONAL_H #include namespace IceUtilInternal { struct NoneType { }; } namespace IceUtil { const IceUtilInternal::NoneType None = {}; template class Optional { public: typedef T element_type; Optional() : _isSet(false) { } Optional(IceUtilInternal::NoneType) : _isSet(false) { } template Optional(Y p) : _value(p), _isSet(true) { } template Optional(const Optional& r) : _value(r._value), _isSet(r._isSet) { } ~Optional() { } Optional& operator=(IceUtilInternal::NoneType) { _value = T(); _isSet = false; return *this; } template Optional& operator=(Y p) { _value = p; _isSet = true; return *this; } template Optional& operator=(const Optional& r) { _value = r._value; _isSet = r._isSet; return *this; } Optional& operator=(const Optional& r) { _value = r._value; _isSet = r._isSet; return *this; } const T& get() const { checkIsSet(); return _value; } T& get() { checkIsSet(); return _value; } const T* operator->() const { return &get(); } T* operator->() { return &get(); } const T& operator*() const { return get(); } T& operator*() { return get(); } operator bool() const { return _isSet; } bool operator!() const { return !_isSet; } void swap(Optional& other) { std::swap(_isSet, other._isSet); std::swap(_value, other._value); } void __setIsSet() { _isSet = true; } private: void checkIsSet() const { if(!_isSet) { throwOptionalNotSetException(__FILE__, __LINE__); } } void throwOptionalNotSetException(const char *, int) const; T _value; bool _isSet; }; template inline Optional makeOptional(const T& v) { return Optional(v); } template inline void Optional::throwOptionalNotSetException(const char* file, int line) const { throw OptionalNotSetException(file, line); } template inline bool operator==(const Optional& lhs, const Optional& rhs) { if(lhs && rhs) { return *lhs == *rhs; } else { return !lhs && !rhs; } } template inline bool operator!=(const Optional& lhs, const Optional& rhs) { return !operator==(lhs, rhs); } template inline bool operator<(const Optional& lhs, const Optional& rhs) { if(lhs && rhs) { return *lhs < *rhs; } else { return !lhs && rhs; } } template inline bool operator<=(const Optional& lhs, const Optional& rhs) { return lhs < rhs || lhs == rhs; } template inline bool operator>(const Optional& lhs, const Optional& rhs) { return !(lhs < rhs || lhs == rhs); } template inline bool operator>=(const Optional& lhs, const Optional& rhs) { return !(lhs < rhs); } // Optional vs Y template inline bool operator==(const Optional& lhs, const Y& rhs) { if(!lhs) { return false; } else { return *lhs == rhs; } } template inline bool operator!=(const Optional& lhs, const Y& rhs) { return !operator==(lhs, rhs); } template inline bool operator<(const Optional& lhs, const Y& rhs) { if(lhs) { return *lhs < rhs; } else { return true; } } template inline bool operator<=(const Optional& lhs, const Y& rhs) { return lhs < rhs || lhs == rhs; } template inline bool operator>(const Optional& lhs, const Y& rhs) { return !(lhs < rhs || lhs == rhs); } template inline bool operator>=(const Optional& lhs, const Y& rhs) { return !(lhs < rhs); } // Y vs Optional template inline bool operator==(const Y& lhs, const Optional& rhs) { if(!rhs) { return false; } else { return lhs == *rhs; } } template inline bool operator!=(const Y& lhs, const Optional& rhs) { return !operator==(lhs, rhs); } template inline bool operator<(const Y& lhs, const Optional& rhs) { if(rhs) { return lhs < *rhs; } else { return false; } } template inline bool operator<=(const Y& lhs, const Optional& rhs) { return lhs < rhs || lhs == rhs; } template inline bool operator>(const Y& lhs, const Optional& rhs) { return !(lhs < rhs || lhs == rhs); } template inline bool operator>=(const Y& lhs, const Optional& rhs) { return !(lhs < rhs); } } #endif Ice-3.5.1/cpp/include/IceUtil/CountDownLatch.h0000644000076400007640000000167312223561476017211 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_COUNT_DOWN_LATCH_H #define ICE_UTIL_COUNT_DOWN_LATCH_H #include namespace IceUtilInternal { // // See java.util.concurrent.CountDownLatch in Java 1.5 // class ICE_UTIL_API CountDownLatch { public: CountDownLatch(int); ~CountDownLatch(); void await() const; void countDown(); int getCount() const; private: #ifdef _WIN32 mutable LONG _count; HANDLE _event; #else int _count; mutable pthread_mutex_t _mutex; mutable pthread_cond_t _cond; inline void lock() const; inline void unlock() const; #endif }; } #endif Ice-3.5.1/cpp/include/IceUtil/MutexProtocol.h0000644000076400007640000000113512223561476017132 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_MUTEX_PROTOCOL_H #define ICE_UTIL_MUTEX_PROTOCOL_H #include namespace IceUtil { enum MutexProtocol { PrioInherit, PrioNone }; ICE_UTIL_API MutexProtocol getDefaultMutexProtocol(); } // End namespace IceUtil #endif Ice-3.5.1/cpp/include/IceUtil/InputUtil.h0000644000076400007640000000245212223561476016246 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_INPUT_UTIL_H #define ICE_UTIL_INPUT_UTIL_H #include #include namespace IceUtilInternal { // // Portable strtoll/_strtoi64 // ICE_UTIL_API IceUtil::Int64 strToInt64(const char*, char**, int); // // stringToInt64 converts a string into a signed 64-bit integer. // It's a simple wrapper around strToInt64. // // Semantics: // // - Ignore leading whitespace // // - If the string starts with '0', parse as octal // // - If the string starts with "0x" or "0X", parse as hexadecimal // // - Otherwise, parse as decimal // // - return value == true indicates a successful conversion and result contains the converted value // - return value == false indicates an unsuccessful conversion: // - result == 0 indicates that no digits were available for conversion // - result == "Int64 Min" or result == "Int64 Max" indicate underflow or overflow. // ICE_UTIL_API bool stringToInt64(const std::string&, IceUtil::Int64&); } #endif Ice-3.5.1/cpp/include/IceUtil/DisableWarnings.h0000644000076400007640000000253712223561476017371 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_DISABLEWARNINGS_H #define ICE_UTIL_DISABLEWARNINGS_H // // This header file disables or makes non-fatal various compiler warnings that // we don't want. // // IMPORTANT: Do *not* include this header file in another public header file! // Doing this may potentially disable the warnings in the source // code of our customers, which would be bad. Only include this // header file in Ice *source* files! // // // Microsoft Visual C++ // #if defined(_MSC_VER) # define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '' was declared deprecated/ # pragma warning( 4 : 4996 ) // C4996 'std::' was declared deprecated # pragma warning( 4 : 4800 ) // C4800 forcing value to bool 'true' or 'false' (performance warning) # if (_MSC_VER < 1700) # pragma warning( 4 : 4355 ) // C4355 'this' : used in base member initializer list # endif #endif // // GCC // #if defined(__GNUC__) # pragma GCC diagnostic warning "-Wdeprecated-declarations" #endif #endif Ice-3.5.1/cpp/include/IceUtil/Time.h0000644000076400007640000000766612223561476015223 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_TIME_H #define ICE_UTIL_TIME_H #include #ifndef _WIN32 # include #endif namespace IceUtil { class ICE_UTIL_API Time { public: Time(); // No copy constructor and assignment operator necessary. The // automatically generated copy constructor and assignment // operator do the right thing. enum Clock { Realtime, Monotonic }; static Time now(Clock = Realtime); static Time seconds(Int64); static Time milliSeconds(Int64); static Time microSeconds(Int64); static Time secondsDouble(double); static Time milliSecondsDouble(double); static Time microSecondsDouble(double); #ifndef _WIN32 operator timeval() const; #endif Int64 toSeconds() const; Int64 toMilliSeconds() const; Int64 toMicroSeconds() const; double toSecondsDouble() const; double toMilliSecondsDouble() const; double toMicroSecondsDouble() const; std::string toDateTime() const; std::string toDuration() const; Time operator-() const { return Time(-_usec); } Time operator-(const Time& rhs) const { return Time(_usec - rhs._usec); } Time operator+(const Time& rhs) const { return Time(_usec + rhs._usec); } Time& operator+=(const Time& rhs) { _usec += rhs._usec; return *this; } Time& operator-=(const Time& rhs) { _usec -= rhs._usec; return *this; } bool operator<(const Time& rhs) const { return _usec < rhs._usec; } bool operator<=(const Time& rhs) const { return _usec <= rhs._usec; } bool operator>(const Time& rhs) const { return _usec > rhs._usec; } bool operator>=(const Time& rhs) const { return _usec >= rhs._usec; } bool operator==(const Time& rhs) const { return _usec == rhs._usec; } bool operator!=(const Time& rhs) const { return _usec != rhs._usec; } double operator/(const Time& rhs) const { return (double)_usec / (double)rhs._usec; } Time& operator*=(int rhs) { _usec *= rhs; return *this; } Time operator*(int rhs) const { Time t; t._usec = _usec * rhs; return t; } Time& operator/=(int rhs) { _usec /= rhs; return *this; } Time operator/(int rhs) const { Time t; t._usec = _usec / rhs; return t; } Time& operator*=(Int64 rhs) { _usec *= rhs; return *this; } Time operator*(Int64 rhs) const { Time t; t._usec = _usec * rhs; return t; } Time& operator/=(Int64 rhs) { _usec /= rhs; return *this; } Time operator/(Int64 rhs) const { Time t; t._usec = _usec / rhs; return t; } Time& operator*=(double rhs) { _usec = static_cast(static_cast(_usec) * rhs); return *this; } Time operator*(double rhs) const { Time t; t._usec = static_cast(static_cast(_usec) * rhs); return t; } Time& operator/=(double rhs) { _usec = static_cast(static_cast(_usec) / rhs); return *this; } Time operator/(double rhs) const { Time t; t._usec = static_cast(static_cast(_usec) / rhs); return t; } private: Time(Int64); Int64 _usec; }; ICE_UTIL_API std::ostream& operator<<(std::ostream&, const Time&); } // End namespace IceUtil #endif Ice-3.5.1/cpp/include/IceUtil/ThreadException.h0000644000076400007640000000453712223561476017405 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_THREAD_EXCEPTION_H #define ICE_UTIL_THREAD_EXCEPTION_H #include #include namespace IceUtil { class ICE_UTIL_API ThreadSyscallException : public SyscallException { public: ThreadSyscallException(const char*, int, int); virtual std::string ice_name() const; virtual ThreadSyscallException* ice_clone() const; virtual void ice_throw() const; private: static const char* _name; }; class ICE_UTIL_API ThreadLockedException : public Exception { public: ThreadLockedException(const char*, int); virtual std::string ice_name() const; virtual ThreadLockedException* ice_clone() const; virtual void ice_throw() const; private: static const char* _name; }; class ICE_UTIL_API ThreadStartedException : public Exception { public: ThreadStartedException(const char*, int); virtual std::string ice_name() const; virtual ThreadStartedException* ice_clone() const; virtual void ice_throw() const; private: static const char* _name; }; class ICE_UTIL_API ThreadNotStartedException : public Exception { public: ThreadNotStartedException(const char*, int); virtual std::string ice_name() const; virtual ThreadNotStartedException* ice_clone() const; virtual void ice_throw() const; private: static const char* _name; }; class ICE_UTIL_API BadThreadControlException : public Exception { public: BadThreadControlException(const char*, int); virtual std::string ice_name() const; virtual BadThreadControlException* ice_clone() const; virtual void ice_throw() const; private: static const char* _name; }; class ICE_UTIL_API InvalidTimeoutException : public Exception { public: InvalidTimeoutException(const char*, int, const Time&); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual InvalidTimeoutException* ice_clone() const; virtual void ice_throw() const; private: Time _timeout; static const char* _name; }; } #endif Ice-3.5.1/cpp/include/IceUtil/IceUtil.h0000644000076400007640000000236312223561476015650 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_ICE_UTIL_H #define ICE_UTIL_ICE_UTIL_H // // This file must include *all* other headers of IceUtil, except // for DisableWarnings.h and headers with only IceUtilInternal symbols // #include #include #include #include #ifndef ICE_OS_WINRT # include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #endif Ice-3.5.1/cpp/include/IceUtil/FileUtil.h0000644000076400007640000000676112223561476016035 0ustar mesmes// ********************************************************************** // // 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 ICE_FILE_UTIL_H #define ICE_FILE_UTIL_H #include #include #include #include #include #include #include namespace IceUtilInternal { // // Detemine if path is an absolute path. // ICE_UTIL_API bool isAbsolutePath(const std::string&); // // Determine if a file exists. // ICE_UTIL_API bool fileExists(const std::string&); // // Determine if a directory exists. // ICE_UTIL_API bool directoryExists(const std::string&); #ifdef _WIN32 #if defined(__MINGW32__) typedef struct _stat structstat; #else typedef struct _stat64i32 structstat; #endif #ifdef _MSC_VER # define O_RDONLY _O_RDONLY # define O_BINARY _O_BINARY # define S_ISDIR(mode) ((mode) & _S_IFDIR) # define S_ISREG(mode) ((mode) & _S_IFREG) #endif #else typedef struct stat structstat; # define O_BINARY 0 #endif // // OS stat // ICE_UTIL_API int stat(const std::string&, structstat*); ICE_UTIL_API int remove(const std::string&); ICE_UTIL_API int rename(const std::string&, const std::string&); ICE_UTIL_API int rmdir(const std::string&); ICE_UTIL_API int mkdir(const std::string&, int); ICE_UTIL_API FILE* fopen(const std::string&, const std::string&); ICE_UTIL_API int open(const std::string&, int); #ifndef ICE_OS_WINRT ICE_UTIL_API int getcwd(std::string&); #endif ICE_UTIL_API int unlink(const std::string&); ICE_UTIL_API int close(int); // // This class is used to implement process file locking. This class // is not intended to do file locking within the same process. // class ICE_UTIL_API FileLock : public IceUtil::Shared, public IceUtil::noncopyable { public: // // The constructor opens the given file (eventually creating it) // and acquires a lock on the file or throws FileLockException if // the file couldn't be locked. // // If the lock can be acquired, the process pid is written to the // file. // FileLock(const std::string&); // // The destructor releases the lock and removes the file. // virtual ~FileLock(); private: #ifdef _WIN32 HANDLE _fd; #else int _fd; #endif std::string _path; }; typedef IceUtil::Handle FileLockPtr; class ICE_UTIL_API ifstream : public std::ifstream { public: ifstream(); ifstream(const std::string&, std::ios_base::openmode mode = std::ios_base::in); void open(const std::string&, std::ios_base::openmode mode = std::ios_base::in); #ifdef __SUNPRO_CC using std::ifstream::open; #endif private: // Hide const char* definitions since they shouldn't be used. ifstream(const char*); void open(const char*, std::ios_base::openmode mode = std::ios_base::in); }; class ICE_UTIL_API ofstream : public std::ofstream { public: ofstream(); ofstream(const std::string&, std::ios_base::openmode mode = std::ios_base::out); void open(const std::string&, std::ios_base::openmode mode = std::ios_base::out); #ifdef __SUNPRO_CC using std::ofstream::open; #endif private: // Hide const char* definitions since they shouldn't be used. ofstream(const char*); void open(const char*, std::ios_base::openmode mode = std::ios_base::out); }; } #endif Ice-3.5.1/cpp/include/IceUtil/AbstractMutex.h0000644000076400007640000000403512223561476017076 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_ABSTRACT_MUTEX_H #define ICE_UTIL_ABSTRACT_MUTEX_H #include #include namespace IceUtil { class AbstractMutex { public: typedef LockT Lock; typedef TryLockT TryLock; virtual ~AbstractMutex() {}; virtual void lock() const = 0; virtual void unlock() const = 0; virtual bool tryLock() const = 0; }; template class AbstractMutexI : public AbstractMutex, public T { public: typedef LockT Lock; typedef TryLockT TryLock; virtual void lock() const { T::lock(); } virtual void unlock() const { T::unlock(); } virtual bool tryLock() const { return T::tryLock(); } virtual ~AbstractMutexI() {} }; template class AbstractMutexReadI : public AbstractMutex, public T { public: typedef LockT Lock; typedef TryLockT TryLock; virtual void lock() const { T::readLock(); } virtual void unlock() const { T::unlock(); } virtual bool tryLock() const { return T::tryReadLock(); } virtual ~AbstractMutexReadI() {} }; template class AbstractMutexWriteI : public AbstractMutex, public T { public: typedef LockT Lock; typedef TryLockT TryLock; virtual void lock() const { T::writeLock(); } virtual void unlock() const { T::unlock(); } virtual bool tryLock() const { return T::tryWriteLock(); } virtual ~AbstractMutexWriteI() {} }; } #endif Ice-3.5.1/cpp/include/IceUtil/Lock.h0000644000076400007640000000506312223561476015202 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_LOCK_H #define ICE_UTIL_LOCK_H #include #include namespace IceUtil { // // Forward declarations. // class Cond; // LockT and TryLockT are the preferred construct to lock/tryLock/unlock // simple and recursive mutexes. You typically allocate them on the // stack to hold a lock on a mutex. // LockT and TryLockT are not recursive: you cannot acquire several times // in a row a lock with the same Lock or TryLock object. // // We must name this LockT instead of Lock, because otherwise some // compilers (such as Sun C++ 5.4) have problems with constructs // such as: // // class Foo // { // // ... // typedef Lock Lock; // } // template class LockT { public: LockT(const T& mutex) : _mutex(mutex) { _mutex.lock(); _acquired = true; } ~LockT() { if (_acquired) { _mutex.unlock(); } } void acquire() const { if (_acquired) { throw ThreadLockedException(__FILE__, __LINE__); } _mutex.lock(); _acquired = true; } bool tryAcquire() const { if (_acquired) { throw ThreadLockedException(__FILE__, __LINE__); } _acquired = _mutex.tryLock(); return _acquired; } void release() const { if (!_acquired) { throw ThreadLockedException(__FILE__, __LINE__); } _mutex.unlock(); _acquired = false; } bool acquired() const { return _acquired; } protected: // TryLockT's contructor LockT(const T& mutex, bool) : _mutex(mutex) { _acquired = _mutex.tryLock(); } private: // Not implemented; prevents accidental use. // LockT(const LockT&); LockT& operator=(const LockT&); const T& _mutex; mutable bool _acquired; friend class Cond; }; // // Must be named TryLockT, not TryLock. See the comment for LockT for // an explanation. // template class TryLockT : public LockT { public: TryLockT(const T& mutex) : LockT(mutex, true) {} }; } // End namespace IceUtil #endif Ice-3.5.1/cpp/include/IceUtil/ScopedArray.h0000644000076400007640000000317012223561476016523 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_SCOPED_ARRAY_H #define ICE_UTIL_SCOPED_ARRAY_H #include namespace IceUtil { template class ScopedArray { public: explicit ScopedArray(T* ptr = 0) : _ptr(ptr) { } ScopedArray(const ScopedArray& other) { _ptr = other._ptr; const_cast(other)._ptr = 0; } ~ScopedArray() { if(_ptr != 0) { delete[] _ptr; } } void reset(T* ptr = 0) { assert(ptr == 0 || ptr != _ptr); if(_ptr != 0) { delete[] _ptr; } _ptr = ptr; } ScopedArray& operator=(const ScopedArray& other) { if(_ptr != 0) { delete[] _ptr; } _ptr = other._ptr; const_cast(other)._ptr = 0; return *this; } T& operator[](size_t i) const { assert(_ptr != 0); assert(i >= 0); return _ptr[i]; } T* get() const { return _ptr; } void swap(ScopedArray& a) { T* tmp = a._ptr; a._ptr = _ptr; _ptr = tmp; } T* release() { T* tmp = _ptr; _ptr = 0; return tmp; } private: T* _ptr; }; } // End of namespace IceUtil #endif Ice-3.5.1/cpp/include/IceUtil/Monitor.h0000644000076400007640000001124612223561476015741 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_MONITOR_H #define ICE_UTIL_MONITOR_H #include #include #include namespace IceUtil { // // This monitor implements the Mesa monitor semantics. That is any // calls to notify() or notifyAll() are delayed until the monitor is // unlocked. // template class Monitor { public: typedef LockT > Lock; typedef TryLockT > TryLock; Monitor(); ~Monitor(); // // Note that lock/tryLock & unlock in general should not be used // directly. Instead use Lock & TryLock. // void lock() const; void unlock() const; bool tryLock() const; void wait() const; bool timedWait(const Time&) const; void notify(); void notifyAll(); private: // noncopyable Monitor(const Monitor&); void operator=(const Monitor&); void notifyImpl(int) const; mutable Cond _cond; T _mutex; mutable int _nnotify; }; } // End namespace IceUtil // // Since this monitor implements the Mesa monitor semantics calls to // notify() or notifyAll() are delayed until the monitor is // unlocked. This can happen either due to a call to unlock(), or a // call to wait(). The _nnotify flag keeps track of the number of // pending notification calls. -1 indicates a broadcast, a positive // number indicates calls to notify(). The _nnotify flag is reset // upon initial acquisition of the monitor lock (either through a call // to lock(), or a return from wait(). // template inline IceUtil::Monitor::Monitor() : _nnotify(0) { } template inline IceUtil::Monitor::~Monitor() { } template inline void IceUtil::Monitor::lock() const { _mutex.lock(); if(_mutex.willUnlock()) { // // On the first mutex acquisition reset the number pending // notifications. // _nnotify = 0; } } template inline void IceUtil::Monitor::unlock() const { if(_mutex.willUnlock()) { // // Perform any pending notifications. // notifyImpl(_nnotify); } _mutex.unlock(); /* int nnotify = _nnotify; if(_mutex.unlock()) { // // Perform any pending notifications. // notifyImpl(nnotify); } */ } template inline bool IceUtil::Monitor::tryLock() const { bool result = _mutex.tryLock(); if(result && _mutex.willUnlock()) { // // On the first mutex acquisition reset the number pending // notifications. // _nnotify = 0; } return result; } template inline void IceUtil::Monitor::wait() const { // // Perform any pending notifies // notifyImpl(_nnotify); // // Wait for a notification // try { _cond.waitImpl(_mutex); // // Reset the nnotify count once wait() returns. // } catch(...) { _nnotify = 0; throw; } _nnotify = 0; } template inline bool IceUtil::Monitor::timedWait(const Time& timeout) const { // // Perform any pending notifies. // notifyImpl(_nnotify); bool rc; // // Wait for a notification. // try { rc = _cond.timedWaitImpl(_mutex, timeout); // // Reset the nnotify count once wait() returns. // } catch(...) { _nnotify = 0; throw; } _nnotify = 0; return rc; } template inline void IceUtil::Monitor::notify() { // // Increment the _nnotify flag, unless a broadcast has already // been requested. // if(_nnotify != -1) { ++_nnotify; } } template inline void IceUtil::Monitor::notifyAll() { // // -1 (indicates broadcast) // _nnotify = -1; } template inline void IceUtil::Monitor::notifyImpl(int nnotify) const { // // Zero indicates no notifies. // if(nnotify != 0) { // // -1 means notifyAll. // if(nnotify == -1) { _cond.broadcast(); return; } else { // // Otherwise notify n times. // while(nnotify > 0) { _cond.signal(); --nnotify; } } } } #endif Ice-3.5.1/cpp/include/IceUtil/StringUtil.h0000644000076400007640000000540712223561476016420 0ustar mesmes// ********************************************************************** // // 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 ICE_STRING_UTIL_H #define ICE_STRING_UTIL_H #include #include namespace IceUtilInternal { // // Add escape sequences (like "\n", or "\0xxx") to make a string // readable in ASCII. // ICE_UTIL_API std::string escapeString(const std::string&, const std::string&); // // Remove escape sequences added by escapeString. Throws IllegalArgumentException // for an invalid input string. // ICE_UTIL_API std::string unescapeString(const std::string&, std::string::size_type, std::string::size_type); // // Split a string using the given delimiters. Considers single and double quotes; // returns false for unbalanced quote, true otherwise. // ICE_UTIL_API bool splitString(const std::string&, const std::string&, std::vector&); // // Join a list of strings using the given delimiter. // ICE_UTIL_API std::string joinString(const std::vector&, const std::string&); // // Trim white space // ICE_UTIL_API std::string trim(const std::string&); // // If a single or double quotation mark is found at the start // position, then the position of the matching closing quote is // returned. If no quotation mark is found at the start position, then // 0 is returned. If no matching closing quote is found, then // std::string::npos is returned. // ICE_UTIL_API std::string::size_type checkQuote(const std::string&, std::string::size_type = 0); // // Match `s' against the pattern `pat'. A * in the pattern acts // as a wildcard: it matches any non-empty sequence of characters // other than a period (`.'). We match by hand here because // it's portable across platforms (whereas regex() isn't). // ICE_UTIL_API bool match(const std::string&, const std::string&, bool = false); // // Get the error message for the last error code or given error code. // ICE_UTIL_API std::string lastErrorToString(); #ifdef _WIN32 ICE_UTIL_API std::string errorToString(int, LPCVOID = NULL); #else ICE_UTIL_API std::string errorToString(int); #endif // // Functions to convert to lower/upper case. These functions accept // UTF8 string/characters but ignore non ASCII characters. Unlike, the // C methods, these methods are not local dependent. // ICE_UTIL_API std::string toLower(const std::string&); ICE_UTIL_API std::string toUpper(const std::string&); ICE_UTIL_API bool isAlpha(char); ICE_UTIL_API bool isDigit(char); // // Remove all whitespace from a string // ICE_UTIL_API std::string removeWhitespace(const std::string&); } #endif Ice-3.5.1/cpp/include/IceUtil/Makefile0000644000076400007640000000144512223561476015601 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/IceUtil ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/IceUtil..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/IceUtil) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceUtil/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/IceUtil/$$i ; \ done Ice-3.5.1/cpp/include/IceUtil/ArgVector.h0000644000076400007640000000152312223561476016203 0ustar mesmes// ********************************************************************** // // 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 ICE_UTIL_ARGVECTOR_H #define ICE_UTIL_ARGVECTOR_H #include #include #include namespace IceUtilInternal { class ICE_UTIL_API ArgVector { public: ArgVector(int argc, char* const argv[]); ArgVector(const ::std::vector< ::std::string>&); ArgVector(const ArgVector&); ArgVector& operator=(const ArgVector&); ~ArgVector(); int argc; char** argv; private: ::std::vector< ::std::string> _args; void setupArgcArgv(); }; } #endif Ice-3.5.1/cpp/include/IceGrid/0000755000076400007640000000000012223561476014105 5ustar mesmesIce-3.5.1/cpp/include/IceGrid/IceGrid.h0000644000076400007640000000126412223561476015567 0ustar mesmes// ********************************************************************** // // 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 ICEGRID_H #define ICEGRID_H #include #include #include #include #include #include #include #include #include #include #endif Ice-3.5.1/cpp/include/IceGrid/.headers0000644000076400007640000000106012223561476015516 0ustar mesmesSDK_HEADERS = \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Admin.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Descriptor.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Exception.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\FileParser.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IceGrid.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Locator.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Observer.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Query.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Registry.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Session.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\UserAccountMapper.h \ Ice-3.5.1/cpp/include/IceGrid/Makefile0000644000076400007640000000144512223561476015551 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/IceGrid ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/IceGrid..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/IceGrid) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceGrid/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/IceGrid/$$i ; \ done Ice-3.5.1/cpp/include/IceBox/0000755000076400007640000000000012223561476013750 5ustar mesmesIce-3.5.1/cpp/include/IceBox/Makefile0000644000076400007640000000144012223561476015407 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/IceBox ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/IceBox..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/IceBox) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceBox/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/IceBox/$$i ; \ done Ice-3.5.1/cpp/include/IceXML/0000755000076400007640000000000012223561476013660 5ustar mesmesIce-3.5.1/cpp/include/IceXML/Parser.h0000644000076400007640000000674412223561476015300 0ustar mesmes// ********************************************************************** // // 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 ICE_XML_PARSER_H #define ICE_XML_PARSER_H #include #include #include #include #include #ifndef ICE_XML_API # ifdef ICE_XML_API_EXPORTS # define ICE_XML_API ICE_DECLSPEC_EXPORT # else # define ICE_XML_API ICE_DECLSPEC_IMPORT # endif #endif namespace IceXML { class ICE_XML_API ParserException : public IceUtil::Exception { public: ParserException(const std::string&); ParserException(const char*, int, const std::string&); virtual ~ParserException() throw(); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual ParserException* ice_clone() const; virtual void ice_throw() const; std::string reason() const; private: std::string _reason; static const char* _name; }; class Node; typedef IceUtil::Handle< Node > NodePtr; typedef std::vector NodeList; class Element; typedef IceUtil::Handle< Element > ElementPtr; class Text; typedef IceUtil::Handle< Text > TextPtr; class Document; typedef IceUtil::Handle< Document > DocumentPtr; typedef std::map Attributes; class ICE_XML_API Node : public IceUtil::Shared { public: virtual ~Node(); virtual NodePtr getParent() const; virtual std::string getName() const; virtual std::string getValue() const; virtual NodeList getChildren() const; virtual Attributes getAttributes() const; virtual std::string getAttribute(const std::string&) const; virtual bool addChild(const NodePtr&); int getLine() const; int getColumn() const; protected: Node(const NodePtr&, const std::string&, const std::string&, int, int); NodePtr _parent; std::string _name; std::string _value; int _line; int _column; }; class ICE_XML_API Element : public Node { public: Element(const NodePtr&, const std::string&, const Attributes&, int, int); virtual ~Element(); virtual NodeList getChildren() const; virtual Attributes getAttributes() const; virtual std::string getAttribute(const std::string&) const; virtual bool addChild(const NodePtr&); private: NodeList _children; Attributes _attributes; }; class ICE_XML_API Text : public Node { public: Text(const NodePtr&, const std::string&, int, int); virtual ~Text(); }; class ICE_XML_API Document : public Node { public: Document(); virtual ~Document(); virtual NodeList getChildren() const; virtual bool addChild(const NodePtr&); private: NodeList _children; }; class ICE_XML_API Handler { public: virtual ~Handler(); virtual void startElement(const std::string&, const Attributes&, int, int) = 0; virtual void endElement(const std::string&, int, int) = 0; virtual void characters(const std::string&, int, int) = 0; virtual void error(const std::string&, int, int); }; class ICE_XML_API Parser { public: static DocumentPtr parse(const std::string&); // The given filename must be UTF-8 encoded static DocumentPtr parse(std::istream&); static void parse(const std::string&, Handler&); static void parse(std::istream&, Handler&); }; } #endif Ice-3.5.1/cpp/include/IceXML/Makefile0000644000076400007640000000144012223561476015317 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/IceXML ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/IceXML..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/IceXML) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceXML/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/IceXML/$$i ; \ done Ice-3.5.1/cpp/include/Glacier2/0000755000076400007640000000000012223561476014227 5ustar mesmesIce-3.5.1/cpp/include/Glacier2/SessionHelper.h0000644000076400007640000000625512223561476017173 0ustar mesmes// ********************************************************************** // // 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 GLACIER2_SESSION_HELPER_H #define GLACIER2_SESSION_HELPER_H #include #include #include #include #include #include #include #include #include #include #include #include #include namespace Glacier2 { const int GLACIER2_SSL_PORT = 4064; const int GLACIER2_TCP_PORT = 4063; class GLACIER2_API SessionHelper : public IceUtil::Shared { public: virtual void destroy() = 0; virtual Ice::CommunicatorPtr communicator() const = 0; virtual std::string categoryForClient() const = 0; virtual Ice::ObjectPrx addWithUUID(const Ice::ObjectPtr&) = 0; virtual Glacier2::SessionPrx session() const = 0; virtual bool isConnected() const = 0; virtual Ice::ObjectAdapterPtr objectAdapter() = 0; bool operator==(const Glacier2::SessionHelper&) const; bool operator!=(const Glacier2::SessionHelper&) const; }; typedef IceUtil::Handle SessionHelperPtr; class GLACIER2_API SessionCallback : virtual public IceUtil::Shared { public: virtual void createdCommunicator(const SessionHelperPtr& session) = 0; virtual void connected(const SessionHelperPtr&) = 0; virtual void disconnected(const SessionHelperPtr&) = 0; virtual void connectFailed(const SessionHelperPtr&, const Ice::Exception&) = 0; }; typedef IceUtil::Handle SessionCallbackPtr; class GLACIER2_API SessionFactoryHelper : public IceUtil::Shared { public: SessionFactoryHelper(const SessionCallbackPtr& callback); SessionFactoryHelper(const Ice::InitializationData&, const SessionCallbackPtr&); SessionFactoryHelper(const Ice::PropertiesPtr&, const SessionCallbackPtr&); void setRouterIdentity(const Ice::Identity&); Ice::Identity getRouterIdentity() const; void setRouterHost(const std::string&); std::string getRouterHost() const; void setSecure(bool); bool getSecure() const; void setTimeout(int); int getTimeout() const; void setPort(int port); int getPort() const; Ice::InitializationData getInitializationData() const; void setConnectContext(std::map context); SessionHelperPtr connect(); SessionHelperPtr connect(const std::string&, const std::string&); private: Ice::InitializationData createInitData(); void setDefaultProperties(); IceUtil::Mutex _mutex; std::string _routerHost; Ice::Identity _identity; bool _secure; int _port; int _timeout; Ice::InitializationData _initData; SessionCallbackPtr _callback; std::map< std::string, std::string> _context; }; typedef IceUtil::Handle SessionFactoryHelperPtr; } #endif Ice-3.5.1/cpp/include/Glacier2/.headers0000644000076400007640000000102312223561476015637 0ustar mesmesSDK_HEADERS = \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Application.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Glacier2.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Metrics.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PermissionsVerifier.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PermissionsVerifierF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Router.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\RouterF.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Session.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SessionHelper.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SSLInfo.h \ Ice-3.5.1/cpp/include/Glacier2/Glacier2.h0000644000076400007640000000120712223561476016030 0ustar mesmes// ********************************************************************** // // 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 GLACIER2_H #define GLACIER2_H #include #include #include #include #include #ifndef ICE_OS_WINRT # include #endif #include #endif Ice-3.5.1/cpp/include/Glacier2/Application.h0000644000076400007640000001476512223561476016660 0ustar mesmes// ********************************************************************** // // 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 GLACIER2_APPLICATION_H #define GLACIER2_APPLICATION_H #include #include #include namespace Glacier2 { /** * * This exception is raised if the session should be restarted. * **/ class GLACIER2_API RestartSessionException : public IceUtil::Exception { public: virtual std::string ice_name() const; virtual RestartSessionException* ice_clone() const; virtual void ice_throw() const; }; /** * An extension of Ice.Application that makes it easy to write * Glacier2 applications. * *

          Applications must create a derived class that implements the * {@link #createSession} and {@link #runWithSession} methods.

          * * The base class invokes {@link #createSession} to create a new * Glacier2 session and then invokes {@link #runWithSession} in * which the subclass performs its application logic. The base class * automatically destroys the session when {@link #runWithSession} * returns. * * If {@link #runWithSession} calls {@link #restart} or raises any of * the exceptions Ice.ConnectionRefusedException, * Ice.ConnectionLostException, Ice.UnknownLocalException, * Ice.RequestFailedException, or Ice.TimeoutException, the base * class destroys the current session and restarts the application * with another call to {@link #createSession} followed by * {@link #runWithSession}. * * The application can optionally override the {@link #sessionDestroyed} * callback method if it needs to take action when connectivity with * the Glacier2 router is lost. * * A program can contain only one instance of this class. * * @see Ice.Application * @see Glacier2.Router * @see Glacier2.Session * @see Ice.Communicator * @see Ice.Logger * @see #runWithSession **/ class GLACIER2_API Application : public Ice::Application { /** * Initializes an instance that calls {@link Communicator#shutdown} if * a signal is received. **/ public: Application() { } /** * Initializes an instance that handles signals according to the signal * policy. * * @param signalPolicy Determines how to respond to signals. * * @see SignalPolicy **/ Application(Ice::SignalPolicy signalPolicy) : Ice::Application(signalPolicy) { } /** * Called once the communicator has been initialized and the Glacier2 session * has been established. A derived class must implement runWithSession, * which is the application's starting method. * * @param argc The number of elements in argv. * * @param argv The argument vector for the application. Application * scans the argument vector passed to main for options that are * specific to the Ice run time and removes them; therefore, the vector passed * to run is free from Ice-related options and contains only options * and arguments that are application-specific. * * @return The runWithSession method should return zero for successful * termination, and non-zero otherwise. Application.main returns the * value returned by runWithSession. **/ virtual int runWithSession(int argc, char* argv[]) = 0; /** * Creates a new Glacier2 session. A call to * createSession always precedes a call to * runWithSession. If Ice.LocalException * is thrown from this method, the application is terminated. * @return The Glacier2 session. **/ virtual Glacier2::SessionPrx createSession() = 0; /** * Called to restart the application's Glacier2 session. This * method never returns. The exception produce an application restart * when called from the Application main thread. * * @throws RestartSessionException This exception is always thrown. **/ void restart() { RestartSessionException ex; throw ex; } /** * Called when the session refresh thread detects that the session has been * destroyed. A subclass can override this method to take action after the * loss of connectivity with the Glacier2 router. This method is always * called from the session refresh thread. **/ virtual void sessionDestroyed() { } /** * Returns the Glacier2 router proxy * @return The router proxy. **/ static Glacier2::RouterPrx router() { return _router; } /** * Returns the Glacier2 session proxy * @return The session proxy. **/ static Glacier2::SessionPrx session() { return _session; } /** * Returns the category to be used in the identities of all of the client's * callback objects. Clients must use this category for the router to * forward callback requests to the intended client. * @return The category. * @throws SessionNotExistException No session exists. **/ std::string categoryForClient(); /** * Create a new Ice identity for callback objects with the given * identity name field. * @return The identity. **/ Ice::Identity createCallbackIdentity(const std::string&); /** * Adds a servant to the callback object adapter's Active Servant Map with a UUID. * @param servant The servant to add. * @return The proxy for the servant. **/ Ice::ObjectPrx addWithUUID(const Ice::ObjectPtr& servant); /** * Creates an object adapter for callback objects. * @return The object adapter. */ Ice::ObjectAdapterPtr objectAdapter(); protected: virtual int doMain(int, char*[], const Ice::InitializationData& initData); private: bool doMain(Ice::StringSeq&, const Ice::InitializationData&, int&); /** * Run should not be overridden for Glacier2.Application. Instead * runWithSession should be used. */ int run(int, char*[]) { // This shouldn't be called. assert(false); return 0; } static Ice::ObjectAdapterPtr _adapter; static Glacier2::RouterPrx _router; static Glacier2::SessionPrx _session; static bool _createdSession; static std::string _category; }; } #endif Ice-3.5.1/cpp/include/Glacier2/Makefile0000644000076400007640000000145212223561476015671 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/Glacier2 ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/Glacier2..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/Glacier2) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/Glacier2/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/Glacier2/$$i ; \ done Ice-3.5.1/cpp/include/IceStorm/0000755000076400007640000000000012223561476014324 5ustar mesmesIce-3.5.1/cpp/include/IceStorm/.headers0000644000076400007640000000016112223561476015736 0ustar mesmesSDK_HEADERS = \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IceStorm.h \ $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Metrics.h \ Ice-3.5.1/cpp/include/IceStorm/Makefile0000644000076400007640000000145212223561476015766 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/IceStorm ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/IceStorm..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/IceStorm) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceStorm/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/IceStorm/$$i ; \ done Ice-3.5.1/cpp/include/IcePatch2/0000755000076400007640000000000012223561476014341 5ustar mesmesIce-3.5.1/cpp/include/IcePatch2/ClientUtil.h0000644000076400007640000001210712223561476016567 0ustar mesmes// ********************************************************************** // // 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 ICE_PATCH2_CLIENT_UTIL_H #define ICE_PATCH2_CLIENT_UTIL_H #include #include #include #include namespace IcePatch2 { // // The IcePatch2::PatcherFeedback class is implemented by IcePatch2 clients to // allow the user to interact with the patching and report progress // on the patching. // class ICE_PATCH2_API PatcherFeedback : public IceUtil::Shared { public: // // The summary file can't be loaded for the given reason. This // should return true to accept doing a thorough patch, false // otherwise. // virtual bool noFileSummary(const std::string& reason) = 0; // // If no summary file is found and/or a thorough patch was // specified, the following checksum methods are called to report // the progression of the checksum computation for the local data // directory. These methods should return false to interrupt the // checksum, false otherwise. // virtual bool checksumStart() = 0; virtual bool checksumProgress(const std::string&) = 0; virtual bool checksumEnd() = 0; // // These methods are called to report on the progression of the // computation of the list of files to patch. This involves // comparing the local checksums with the server checksums. These // methods should return false to interrupt the computation, false // otherwise. // virtual bool fileListStart() = 0; virtual bool fileListProgress(Ice::Int) = 0; virtual bool fileListEnd() = 0; // // These methods are called to report on the progression of the // file patching. Files to be updated are downloaded from the // server, uncompressed and written to the local data directory. // These methods should return false to interrupt the patching, // false otherwise. // virtual bool patchStart(const std::string&, Ice::Long, Ice::Long, Ice::Long) = 0; virtual bool patchProgress(Ice::Long, Ice::Long, Ice::Long, Ice::Long) = 0; virtual bool patchEnd() = 0; }; typedef IceUtil::Handle PatcherFeedbackPtr; class Decompressor; typedef IceUtil::Handle DecompressorPtr; // // IcePatch2 clients instantiate the IcePatch2::Patcher class to patch // a given local data directory. // class ICE_PATCH2_API Patcher : public IceUtil::Shared { public: // // Create a patcher using configuration properties. The following // properties are used to configure the patcher: // // - IcePatch2.InstanceName // - IcePatch2.Endpoints // - IcePatch2.Directory // - IcePatch2.Thorough // - IcePatch2.ChunkSize // - IcePatch2.Remove // // See the Ice manual for more information on these properties. // Patcher(const Ice::CommunicatorPtr&, const PatcherFeedbackPtr&); // // Create a patcher with the given parameters. These parameters // are equivalent to the configuration properties described above. // Patcher(const FileServerPrx&, const PatcherFeedbackPtr&, const std::string&, bool, Ice::Int, Ice::Int); virtual ~Patcher(); // // Prepare the patching. This involves creating the local checksum // files if no summary file exists or if a thorough patch was // specified. This method also computes the list of files to be // patched. This should be called once before any call to patch(). // // Returns true if the patch preparation was successful, false if // preparation failed (for example, because a thorough patch is // necessary, but the user chose not to patch thorough), or raises // std::string as an exception if there was an error. // bool prepare(); // // Patch the files from the given path. // // Returns true if patching was successful, false if patching was // aborted by the user, or raises std::string as an exception if // there was an error. // bool patch(const std::string&); // // Finish the patching. This needs to be called once when the // patching is finished to write the local checksum files to the // disk. // void finish(); private: void init(const FileServerPrx&); bool removeFiles(const FileInfoSeq&); bool updateFiles(const FileInfoSeq&); bool updateFilesInternal(const FileInfoSeq&, const DecompressorPtr&); bool updateFlags(const FileInfoSeq&); const PatcherFeedbackPtr _feedback; const std::string _dataDir; const bool _thorough; const Ice::Int _chunkSize; const Ice::Int _remove; const FileServerPrx _serverCompress; const FileServerPrx _serverNoCompress; FileInfoSeq _localFiles; FileInfoSeq _updateFiles; FileInfoSeq _updateFlags; FileInfoSeq _removeFiles; FILE* _log; }; typedef IceUtil::Handle PatcherPtr; } #endif Ice-3.5.1/cpp/include/IcePatch2/Util.h0000644000076400007640000001203612223561476015431 0ustar mesmes// ********************************************************************** // // 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 ICE_PATCH2_UTIL_H #define ICE_PATCH2_UTIL_H #include #include #include namespace IcePatch2 { ICE_PATCH2_API extern const char* checksumFile; ICE_PATCH2_API extern const char* logFile; ICE_PATCH2_API std::string lastError(); ICE_PATCH2_API std::string bytesToString(const Ice::ByteSeq&); ICE_PATCH2_API Ice::ByteSeq stringToBytes(const std::string&); ICE_PATCH2_API std::string simplify(const std::string&); ICE_PATCH2_API bool isRoot(const std::string&); ICE_PATCH2_API std::string getSuffix(const std::string&); ICE_PATCH2_API std::string getWithoutSuffix(const std::string&); ICE_PATCH2_API bool ignoreSuffix(const std::string&); ICE_PATCH2_API std::string getBasename(const std::string&); ICE_PATCH2_API std::string getDirname(const std::string&); ICE_PATCH2_API void rename(const std::string&, const std::string&); ICE_PATCH2_API void remove(const std::string&); ICE_PATCH2_API void removeRecursive(const std::string&); ICE_PATCH2_API Ice::StringSeq readDirectory(const std::string&); ICE_PATCH2_API void createDirectory(const std::string&); ICE_PATCH2_API void createDirectoryRecursive(const std::string&); ICE_PATCH2_API void compressBytesToFile(const std::string&, const Ice::ByteSeq&, Ice::Int); ICE_PATCH2_API void decompressFile(const std::string&); ICE_PATCH2_API void setFileFlags(const std::string&, const FileInfo&); struct FileInfoEqual: public std::binary_function { bool operator()(const FileInfo& lhs, const FileInfo& rhs) { if(lhs.path != rhs.path) { return false; } // // For the size portion of the comparison, we only distinquish // between file (size >= 0) and directory (size == -1). We do // not take the actual size into account, as it might be set // to 0 if no compressed file is available. // Ice::Int lsz = lhs.size > 0 ? 0 : lhs.size; Ice::Int rsz = rhs.size > 0 ? 0 : rhs.size; if(lsz != rsz) { return false; } if(lhs.executable != rhs.executable) { return false; } return lhs.checksum == rhs.checksum; } }; struct FileInfoWithoutFlagsLess: public std::binary_function { bool operator()(const FileInfo& lhs, const FileInfo& rhs) { return compareWithoutFlags(lhs, rhs) < 0; } int compareWithoutFlags(const FileInfo& lhs, const FileInfo& rhs) { if(lhs.path < rhs.path) { return -1; } else if(rhs.path < lhs.path) { return 1; } // // For the size portion of the comparison, we only distinquish // between file (size >= 0) and directory (size == -1). We do // not take the actual size into account, as it might be set // to 0 if no compressed file is available. // Ice::Int lsz = lhs.size > 0 ? 0 : lhs.size; Ice::Int rsz = rhs.size > 0 ? 0 : rhs.size; if(lsz < rsz) { return -1; } else if(rsz < lsz) { return 1; } if(lhs.checksum < rhs.checksum) { return -1; } else if(rhs.checksum < lhs.checksum) { return 1; } return 0; } }; struct FileInfoLess : public FileInfoWithoutFlagsLess { bool operator()(const FileInfo& lhs, const FileInfo& rhs) { int rc = compareWithoutFlags(lhs, rhs); if(rc < 0) { return true; } else if(rc > 0) { return false; } return lhs.executable < rhs.executable; } }; class ICE_PATCH2_API GetFileInfoSeqCB { public: virtual ~GetFileInfoSeqCB() { } virtual bool remove(const std::string&) = 0; virtual bool checksum(const std::string&) = 0; virtual bool compress(const std::string&) = 0; }; ICE_PATCH2_API bool getFileInfoSeq(const std::string&, int, GetFileInfoSeqCB*, FileInfoSeq&); ICE_PATCH2_API bool getFileInfoSeqSubDir(const std::string&, const std::string&, int, GetFileInfoSeqCB*, FileInfoSeq&); ICE_PATCH2_API void saveFileInfoSeq(const std::string&, const FileInfoSeq&); ICE_PATCH2_API void loadFileInfoSeq(const std::string&, FileInfoSeq&); ICE_PATCH2_API bool readFileInfo(FILE*, FileInfo&); ICE_PATCH2_API bool writeFileInfo(FILE*, const FileInfo&); struct FileTree1 { FileInfoSeq files; Ice::ByteSeq checksum; }; typedef std::vector FileTree1Seq; struct FileTree0 { FileTree1Seq nodes; Ice::ByteSeq checksum; }; ICE_PATCH2_API void getFileTree0(const FileInfoSeq&, FileTree0&); } #endif Ice-3.5.1/cpp/include/IcePatch2/Makefile0000644000076400007640000000145712223561476016010 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/IcePatch2 ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/IcePatch2..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/IcePatch2) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IcePatch2/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/IcePatch2/$$i ; \ done Ice-3.5.1/cpp/include/Makefile0000644000076400007640000000134612223561476014243 0ustar mesmes# ********************************************************************** # # 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 = .. include $(top_srcdir)/config/Make.rules SUBDIRS = Ice \ IceSSL \ IceUtil \ Slice ifeq ($(findstring MINGW,$(UNAME)),) SUBDIRS := $(SUBDIRS) \ Freeze \ Glacier2 \ IceBox \ IceGrid \ IcePatch2 \ IceStorm \ IceXML endif $(EVERYTHING):: @for subdir in $(SUBDIRS); \ do \ echo "making $@ in $$subdir"; \ ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ done Ice-3.5.1/cpp/include/Slice/0000755000076400007640000000000012223561476013636 5ustar mesmesIce-3.5.1/cpp/include/Slice/Checksum.h0000644000076400007640000000114212223561476015547 0ustar mesmes// ********************************************************************** // // 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 SLICE_CHECKSUM_H #define SLICE_CHECKSUM_H #include #include #include namespace Slice { typedef std::map > ChecksumMap; SLICE_API ChecksumMap createChecksums(const UnitPtr&); } #endif Ice-3.5.1/cpp/include/Slice/PHPUtil.h0000644000076400007640000000270712223561476015302 0ustar mesmes// ********************************************************************** // // 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 SLICE_PHP_UTIL_H #define SLICE_PHP_UTIL_H #include namespace Slice { namespace PHP { // // Convert a scoped name into a PHP name. // SLICE_API std::string scopedToName(const std::string&, bool); // // Check the given identifier against PHP's list of reserved words. If it matches // a reserved word, then an escaped version is returned with a leading underscore. // SLICE_API std::string fixIdent(const std::string&); // // Get the fully-qualified name of the given definition. If a suffix is provided, // it is prepended to the definition's unqualified name. If the nameSuffix // is provided, it is appended to the container's name. // // COMPILERFIX: MSVC 6 seems to have a problem with const std::string // = std::string(), const std::string = std::string(). // SLICE_API std::string getAbsolute(const Slice::ContainedPtr&, bool, const std::string& = "", const std::string& = ""); // // Since PHP uses the backslash character as the namespace separator, we have // to escape backslash characters when they appear in a string literal. // SLICE_API std::string escapeName(const std::string&); } } #endif Ice-3.5.1/cpp/include/Slice/CPlusPlusUtil.h0000644000076400007640000000524312223561476016543 0ustar mesmes// ********************************************************************** // // 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 C_PLUS_PLUS_UTIL_H #define C_PLUS_PLUS_UTIL_H #include #include namespace Slice { SLICE_API extern FeatureProfile featureProfile; struct ToIfdef { SLICE_API char operator()(char); }; SLICE_API void printHeader(::IceUtilInternal::Output&); SLICE_API void printVersionCheck(::IceUtilInternal::Output&); SLICE_API void printDllExportStuff(::IceUtilInternal::Output&, const std::string&); const int TypeContextInParam = 1; const int TypeContextAMIEnd = 2; const int TypeContextAMIPrivateEnd = 4; const int TypeContextAMICallPrivateEnd = 8; const int TypeContextUseWstring = 16; SLICE_API std::string typeToString(const TypePtr&, const StringList& = StringList(), int = 0); SLICE_API std::string typeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0); SLICE_API std::string returnTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0); SLICE_API std::string inputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0); SLICE_API std::string outputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0); SLICE_API std::string operationModeToString(Operation::Mode); SLICE_API std::string opFormatTypeToString(const OperationPtr&); SLICE_API std::string fixKwd(const std::string&); SLICE_API void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, bool, int, const std::string&, bool, const StringList& = StringList(), int = 0, const std::string& = "", bool = true); SLICE_API void writeMarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, int = 0); SLICE_API void writeUnmarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, int = 0); SLICE_API void writeAllocateCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, int = 0); SLICE_API std::string getEndArg(const TypePtr&, const StringList&, const std::string&); SLICE_API void writeEndCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&); SLICE_API std::string findMetaData(const StringList&, int = 0); SLICE_API bool inWstringModule(const SequencePtr&); SLICE_API std::string getDataMemberRef(const DataMemberPtr&); } #endif Ice-3.5.1/cpp/include/Slice/CsUtil.h0000644000076400007640000000610212223561476015211 0ustar mesmes// ********************************************************************** // // 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 CS_UTIL_H #define CS_UTIL_H #include #include namespace Slice { class SLICE_API CsGenerator : private ::IceUtil::noncopyable { public: virtual ~CsGenerator() {}; // // Convert a dimension-less array declaration to one with a dimension. // static std::string toArrayAlloc(const std::string& decl, const std::string& sz); // // Validate all metadata in the unit with a "cs:" prefix. // static void validateMetaData(const UnitPtr&); protected: static std::string fixId(const std::string&, int = 0, bool = false); static std::string fixId(const ContainedPtr&, int = 0, bool = false); static std::string getOptionalFormat(const TypePtr&); static std::string getStaticId(const TypePtr&); static std::string typeToString(const TypePtr&, bool = false); static bool isValueType(const TypePtr&); // // Generate code to marshal or unmarshal a type // void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, bool); void writeOptionalMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int, bool, bool); void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&, bool, bool, bool); void writeOptionalSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&, int, bool, bool); private: class MetaDataVisitor : public ParserVisitor { public: virtual bool visitUnitStart(const UnitPtr&); virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); virtual void visitClassDecl(const ClassDeclPtr&); virtual bool visitClassDefStart(const ClassDefPtr&); virtual void visitClassDefEnd(const ClassDefPtr&); virtual bool visitExceptionStart(const ExceptionPtr&); virtual void visitExceptionEnd(const ExceptionPtr&); virtual bool visitStructStart(const StructPtr&); virtual void visitStructEnd(const StructPtr&); virtual void visitOperation(const OperationPtr&); virtual void visitParamDecl(const ParamDeclPtr&); virtual void visitDataMember(const DataMemberPtr&); virtual void visitSequence(const SequencePtr&); virtual void visitDictionary(const DictionaryPtr&); virtual void visitEnum(const EnumPtr&); virtual void visitConst(const ConstPtr&); private: void validate(const ContainedPtr&); std::string _fileName; StringSet _history; }; }; } #endif Ice-3.5.1/cpp/include/Slice/DotNetNames.h0000644000076400007640000000115712223561476016174 0ustar mesmes// ********************************************************************** // // 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 DOTNETNAMES_H #define DOTNETNAMES_H #include namespace Slice { namespace DotNet { enum BaseType { Object=1, ICloneable=2, Exception=4, END=8 }; extern const char * manglePrefix; std::string mangleName(const std::string&, int baseTypes = 0); } } #endif Ice-3.5.1/cpp/include/Slice/Parser.h0000644000076400007640000010224312223561476015245 0ustar mesmes// ********************************************************************** // // 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 SLICE_PARSER_H #define SLICE_PARSER_H #include #include #include #include #include #include #include #include #include #ifndef SLICE_API # ifdef SLICE_API_EXPORTS # define SLICE_API ICE_DECLSPEC_EXPORT # else # define SLICE_API ICE_DECLSPEC_IMPORT # endif #endif namespace Slice { #if defined(_WIN32) && !defined(__MINGW32__) const IceUtil::Int64 Int32Max = 0x7fffffffi64; const IceUtil::Int64 Int32Min = -Int32Max - 1i64; #else # if defined(INT32_MIN) && defined(INT32_MAX) const IceUtil::Int64 Int32Max = INT32_MAX; const IceUtil::Int64 Int32Min = INT32_MIN; # else const IceUtil::Int64 Int32Max = 0x7fffffffLL; const IceUtil::Int64 Int32Min = -Int32Max - 1LL; # endif #endif const IceUtil::Int64 Int16Max = 0x7fff; const IceUtil::Int64 Int16Min = -Int16Max - 1; const IceUtil::Int64 ByteMax = 0xff; const IceUtil::Int64 ByteMin = 0x00; SLICE_API enum FeatureProfile { Ice, IceE }; SLICE_API enum NodeType { Dummy, Real }; // // Format preference for classes and exceptions. // SLICE_API enum FormatType { DefaultFormat, // No preference was specified. CompactFormat, // Minimal format. SlicedFormat // Full format. }; class GrammarBase; class SyntaxTreeBase; class Type; class Builtin; class Contained; class Container; class Module; class Constructed; class ClassDecl; class ClassDef; class Proxy; class Exception; class Struct; class Operation; class ParamDecl; class DataMember; class Sequence; class Dictionary; class Enum; class Enumerator; class Const; class Unit; class CICompare; class DerivedToBaseCompare; class ModulePartialCompare; typedef ::IceUtil::Handle GrammarBasePtr; typedef ::IceUtil::Handle SyntaxTreeBasePtr; typedef ::IceUtil::Handle TypePtr; typedef ::IceUtil::Handle BuiltinPtr; typedef ::IceUtil::Handle ContainedPtr; typedef ::IceUtil::Handle ContainerPtr; typedef ::IceUtil::Handle ModulePtr; typedef ::IceUtil::Handle ConstructedPtr; typedef ::IceUtil::Handle ClassDeclPtr; typedef ::IceUtil::Handle ClassDefPtr; typedef ::IceUtil::Handle ProxyPtr; typedef ::IceUtil::Handle ExceptionPtr; typedef ::IceUtil::Handle StructPtr; typedef ::IceUtil::Handle OperationPtr; typedef ::IceUtil::Handle ParamDeclPtr; typedef ::IceUtil::Handle DataMemberPtr; typedef ::IceUtil::Handle SequencePtr; typedef ::IceUtil::Handle DictionaryPtr; typedef ::IceUtil::Handle EnumPtr; typedef ::IceUtil::Handle EnumeratorPtr; typedef ::IceUtil::Handle ConstPtr; typedef ::IceUtil::Handle UnitPtr; typedef std::list TypeList; typedef std::list ExceptionList; typedef std::set StringSet; typedef std::list StringList; typedef std::pair TypeString; typedef std::list TypeStringList; typedef std::list ContainedList; typedef std::list ModuleList; typedef std::list ConstructedList; typedef std::list ClassList; typedef std::list ExceptionList; typedef std::list StructList; typedef std::list SequenceList; typedef std::list DictionaryList; typedef std::list EnumList; typedef std::list ConstList; typedef std::list OperationList; typedef std::list DataMemberList; typedef std::list ParamDeclList; typedef std::list EnumeratorList; struct ConstDef { TypePtr type; SyntaxTreeBasePtr value; std::string valueAsString; std::string valueAsLiteral; }; struct OptionalDef { TypePtr type; std::string name; bool optional; int tag; }; // ---------------------------------------------------------------------- // CICompare -- function object to do case-insensitive string comparison. // ---------------------------------------------------------------------- class SLICE_API CICompare : public std::binary_function { public: bool operator()(const std::string&, const std::string&) const; }; #if defined(__SUNPRO_CC) SLICE_API bool cICompare(const std::string&, const std::string&); #endif // ---------------------------------------------------------------------- // DerivedToBaseCompare -- function object to do sort exceptions into // most-derived to least-derived order. // ---------------------------------------------------------------------- class SLICE_API DerivedToBaseCompare : public std::binary_function { public: bool operator()(const ExceptionPtr&, const ExceptionPtr&) const; }; #if defined(__SUNPRO_CC) SLICE_API bool derivedToBaseCompare(const ExceptionPtr&, const ExceptionPtr&); #endif // ---------------------------------------------------------------------- // ParserVisitor // ---------------------------------------------------------------------- class SLICE_API ParserVisitor { public: virtual ~ParserVisitor() { } virtual bool visitUnitStart(const UnitPtr&) { return true; } virtual void visitUnitEnd(const UnitPtr&) { } virtual bool visitModuleStart(const ModulePtr&) { return true; } virtual void visitModuleEnd(const ModulePtr&) { } virtual void visitClassDecl(const ClassDeclPtr&) { } virtual bool visitClassDefStart(const ClassDefPtr&) { return true; } virtual void visitClassDefEnd(const ClassDefPtr&) { } virtual bool visitExceptionStart(const ExceptionPtr&) { return true; } virtual void visitExceptionEnd(const ExceptionPtr&) { } virtual bool visitStructStart(const StructPtr&) { return true; } virtual void visitStructEnd(const StructPtr&) { } virtual void visitOperation(const OperationPtr&) { } virtual void visitParamDecl(const ParamDeclPtr&) { } virtual void visitDataMember(const DataMemberPtr&) { } virtual void visitSequence(const SequencePtr&) { } virtual void visitDictionary(const DictionaryPtr&) { } virtual void visitEnum(const EnumPtr&) { } virtual void visitConst(const ConstPtr&) { } }; // ---------------------------------------------------------------------- // DefinitionContext // ---------------------------------------------------------------------- class SLICE_API DefinitionContext : public ::IceUtil::SimpleShared { public: DefinitionContext(int, const StringList&); std::string filename() const; int includeLevel() const; bool seenDefinition() const; void setFilename(const std::string&); void setSeenDefinition(); bool hasMetaData() const; void setMetaData(const StringList&); std::string findMetaData(const std::string&) const; StringList getMetaData() const; private: int _includeLevel; StringList _metaData; std::string _filename; bool _seenDefinition; }; typedef ::IceUtil::Handle DefinitionContextPtr; // ---------------------------------------------------------------------- // GrammarBase // ---------------------------------------------------------------------- class SLICE_API GrammarBase : public ::IceUtil::SimpleShared { }; // ---------------------------------------------------------------------- // SyntaxTreeBase // ---------------------------------------------------------------------- class SLICE_API SyntaxTreeBase : public GrammarBase { public: virtual void destroy(); UnitPtr unit() const; DefinitionContextPtr definitionContext() const; // May be nil virtual void visit(ParserVisitor*, bool); protected: SyntaxTreeBase(const UnitPtr&); UnitPtr _unit; DefinitionContextPtr _definitionContext; }; // ---------------------------------------------------------------------- // Type // ---------------------------------------------------------------------- class SLICE_API Type : virtual public SyntaxTreeBase { public: virtual bool isLocal() const = 0; virtual std::string typeId() const = 0; virtual bool usesClasses() const = 0; virtual size_t minWireSize() const = 0; virtual bool isVariableLength() const = 0; protected: Type(const UnitPtr&); }; // ---------------------------------------------------------------------- // Builtin // ---------------------------------------------------------------------- class SLICE_API Builtin : virtual public Type { public: enum Kind { KindByte, KindBool, KindShort, KindInt, KindLong, KindFloat, KindDouble, KindString, KindObject, KindObjectProxy, KindLocalObject }; virtual bool isLocal() const; virtual std::string typeId() const; virtual bool usesClasses() const; virtual size_t minWireSize() const; virtual bool isVariableLength() const; Kind kind() const; std::string kindAsString() const; static const char* builtinTable[]; protected: Builtin(const UnitPtr&, Kind); friend class Unit; Kind _kind; }; // ---------------------------------------------------------------------- // Contained // ---------------------------------------------------------------------- class SLICE_API Contained : virtual public SyntaxTreeBase { public: ContainerPtr container() const; std::string name() const; std::string scoped() const; std::string scope() const; std::string flattenedScope() const; std::string file() const; std::string line() const; std::string comment() const; int includeLevel() const; void updateIncludeLevel(); bool hasMetaData(const std::string&) const; bool findMetaData(const std::string&, std::string&) const; std::list getMetaData() const; void setMetaData(const std::list&); void addMetaData(const std::string&); // TODO: remove this method once "cs:" and "vb:" are hard errors. static FormatType parseFormatMetaData(const std::list&); enum ContainedType { ContainedTypeSequence, ContainedTypeDictionary, ContainedTypeEnum, ContainedTypeEnumerator, ContainedTypeModule, ContainedTypeClass, ContainedTypeException, ContainedTypeStruct, ContainedTypeOperation, ContainedTypeParamDecl, ContainedTypeDataMember, ContainedTypeConstant }; virtual ContainedType containedType() const = 0; virtual bool uses(const ContainedPtr&) const = 0; virtual std::string kindOf() const = 0; bool operator<(const Contained&) const; bool operator==(const Contained&) const; bool operator!=(const Contained&) const; protected: Contained(const ContainerPtr&, const std::string&); friend class Container; ContainerPtr _container; std::string _name; std::string _scoped; std::string _file; std::string _line; std::string _comment; int _includeLevel; std::list _metaData; }; // ---------------------------------------------------------------------- // Container // ---------------------------------------------------------------------- class SLICE_API Container : virtual public SyntaxTreeBase { public: virtual void destroy(); ModulePtr createModule(const std::string&); ClassDefPtr createClassDef(const std::string&, int, bool, const ClassList&, bool); ClassDeclPtr createClassDecl(const std::string&, bool, bool); ExceptionPtr createException(const std::string&, const ExceptionPtr&, bool, NodeType = Real); StructPtr createStruct(const std::string&, bool, NodeType = Real); SequencePtr createSequence(const std::string&, const TypePtr&, const StringList&, bool, NodeType = Real); DictionaryPtr createDictionary(const std::string&, const TypePtr&, const StringList&, const TypePtr&, const StringList&, bool, NodeType = Real); EnumPtr createEnum(const std::string&, bool, NodeType = Real); EnumeratorPtr createEnumerator(const std::string&); EnumeratorPtr createEnumerator(const std::string&, int); ConstPtr createConst(const std::string, const TypePtr&, const StringList&, const SyntaxTreeBasePtr&, const std::string&, const std::string&, NodeType = Real); TypeList lookupType(const std::string&, bool = true); TypeList lookupTypeNoBuiltin(const std::string&, bool = true); ContainedList lookupContained(const std::string&, bool = true); ExceptionPtr lookupException(const std::string&, bool = true); UnitPtr unit() const; ModuleList modules() const; ClassList classes() const; ExceptionList exceptions() const; StructList structs() const; SequenceList sequences() const; DictionaryList dictionaries() const; EnumList enums() const; ConstList consts() const; ContainedList contents() const; bool hasNonLocalClassDecls() const; bool hasNonLocalClassDefs() const; bool hasLocalClassDefsWithAsync() const; bool hasNonLocalSequences() const; bool hasNonLocalExceptions() const; bool hasDictionaries() const; bool hasOnlyDictionaries(DictionaryList&) const; bool hasClassDecls() const; bool hasClassDefs() const; bool hasAbstractClassDefs() const; bool hasNonLocalDataOnlyClasses() const; bool hasOtherConstructedOrExceptions() const; // Exceptions or constructed types other than classes. bool hasContentsWithMetaData(const std::string&) const; bool hasAsyncOps() const; bool hasNonLocalContained(Contained::ContainedType) const; std::string thisScope() const; void mergeModules(); void sort(); void sortContents(bool); virtual void visit(ParserVisitor*, bool); void containerRecDependencies(std::set&); // Internal operation, don't use directly. bool checkIntroduced(const std::string&, ContainedPtr = 0); bool nameIsLegal(const std::string&, const char *); bool checkForGlobalDef(const std::string&, const char *); protected: Container(const UnitPtr&); void checkIdentifier(const std::string&) const; bool checkInterfaceAndLocal(const std::string&, bool, bool, bool, bool, bool); bool checkGlobalMetaData(const StringList&, const StringList&); bool validateConstant(const std::string&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&, bool); EnumeratorPtr validateEnumerator(const std::string&); ContainedList _contents; std::map _introducedMap; }; // ---------------------------------------------------------------------- // Module // ---------------------------------------------------------------------- class SLICE_API Module : virtual public Container, virtual public Contained { public: virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); protected: Module(const ContainerPtr&, const std::string&); friend class Container; }; // ---------------------------------------------------------------------- // Constructed // ---------------------------------------------------------------------- class SLICE_API Constructed : virtual public Type, virtual public Contained { public: virtual bool isLocal() const; virtual std::string typeId() const; virtual bool isVariableLength() const = 0; ConstructedList dependencies(); virtual void recDependencies(std::set&) = 0; // Internal operation, don't use directly. protected: Constructed(const ContainerPtr&, const std::string&, bool); bool _local; }; // ---------------------------------------------------------------------- // ClassDecl // ---------------------------------------------------------------------- class SLICE_API ClassDecl : virtual public Constructed { public: virtual void destroy(); ClassDefPtr definition() const; bool isInterface() const; virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; virtual bool usesClasses() const; virtual size_t minWireSize() const; virtual bool isVariableLength() const; virtual void visit(ParserVisitor*, bool); virtual std::string kindOf() const; virtual void recDependencies(std::set&); // Internal operation, don't use directly. static void checkBasesAreLegal(const std::string&, bool, bool, const ClassList&, const UnitPtr&); protected: ClassDecl(const ContainerPtr&, const std::string&, bool, bool); friend class Container; friend class ClassDef; ClassDefPtr _definition; bool _interface; private: typedef std::list GraphPartitionList; typedef std::list StringPartitionList; static bool isInList(const GraphPartitionList&, const ClassDefPtr); static void addPartition(GraphPartitionList&, GraphPartitionList::reverse_iterator, const ClassDefPtr); static StringPartitionList toStringPartitionList(const GraphPartitionList&); static void checkPairIntersections(const StringPartitionList&, const std::string&, const UnitPtr&); }; // ---------------------------------------------------------------------- // Operation // ---------------------------------------------------------------------- class SLICE_API Operation : virtual public Contained, virtual public Container { public: // // Note: The order of definitions here *must* match the order of // definitions of ::Ice::OperationMode in slice/Ice/Current.ice! // enum Mode { Normal, Nonmutating, Idempotent }; TypePtr returnType() const; bool returnIsOptional() const; int returnTag() const; Mode mode() const; Mode sendMode() const; ParamDeclPtr createParamDecl(const std::string&, const TypePtr&, bool, bool, int); ParamDeclList parameters() const; ExceptionList throws() const; void setExceptionList(const ExceptionList&); virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; bool sendsClasses(bool) const; bool returnsClasses(bool) const; bool returnsData() const; bool sendsOptionals() const; int attributes() const; FormatType format() const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); protected: Operation(const ContainerPtr&, const std::string&, const TypePtr&, bool, int, Mode); friend class ClassDef; TypePtr _returnType; bool _returnIsOptional; int _returnTag; ExceptionList _throws; Mode _mode; }; // ---------------------------------------------------------------------- // ClassDef // ---------------------------------------------------------------------- // // Note: For the purpose of this parser, a class definition is not // considered to be a type, but a class declaration is. And each class // definition has at least one class declaration (but not vice versa), // so if you need the class as a "constructed type", use the // declaration() operation to navigate to the class declaration. // class SLICE_API ClassDef : virtual public Container, virtual public Contained { public: virtual void destroy(); OperationPtr createOperation(const std::string&, const TypePtr&, bool, int, Operation::Mode = Operation::Normal); DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, const std::string&, const std::string&); ClassDeclPtr declaration() const; ClassList bases() const; ClassList allBases() const; OperationList operations() const; OperationList allOperations() const; DataMemberList dataMembers() const; DataMemberList orderedOptionalDataMembers() const; DataMemberList allDataMembers() const; DataMemberList classDataMembers() const; DataMemberList allClassDataMembers() const; bool canBeCyclic() const; bool isAbstract() const; bool isInterface() const; bool isA(const std::string&) const; virtual bool isLocal() const; bool hasDataMembers() const; bool hasOperations() const; bool hasDefaultValues() const; bool inheritsMetaData(const std::string&) const; virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); int compactId() const; protected: ClassDef(const ContainerPtr&, const std::string&, int, bool, const ClassList&, bool); friend class Container; ClassDeclPtr _declaration; bool _interface; bool _hasDataMembers; bool _hasOperations; ClassList _bases; bool _local; int _compactId; }; // ---------------------------------------------------------------------- // Proxy // ---------------------------------------------------------------------- class SLICE_API Proxy : virtual public Type { public: virtual bool isLocal() const; virtual std::string typeId() const; virtual bool usesClasses() const; virtual size_t minWireSize() const; virtual bool isVariableLength() const; ClassDeclPtr _class() const; Proxy(const ClassDeclPtr&); protected: ClassDeclPtr __class; }; // ---------------------------------------------------------------------- // Exception // ---------------------------------------------------------------------- // No inheritance from Constructed, as this is not a Type class SLICE_API Exception : virtual public Container, virtual public Contained { public: virtual void destroy(); DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, const std::string&, const std::string&); DataMemberList dataMembers() const; DataMemberList orderedOptionalDataMembers() const; DataMemberList allDataMembers() const; DataMemberList classDataMembers() const; DataMemberList allClassDataMembers() const; ExceptionPtr base() const; ExceptionList allBases() const; virtual bool isBaseOf(const ExceptionPtr&) const; virtual bool isLocal() const; virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; bool usesClasses(bool) const; bool hasDefaultValues() const; bool inheritsMetaData(const std::string&) const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); protected: Exception(const ContainerPtr&, const std::string&, const ExceptionPtr&, bool); friend class Container; ExceptionPtr _base; bool _local; }; // ---------------------------------------------------------------------- // Struct // ---------------------------------------------------------------------- class SLICE_API Struct : virtual public Container, virtual public Constructed { public: DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, const std::string&, const std::string&); DataMemberList dataMembers() const; DataMemberList classDataMembers() const; virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; virtual bool usesClasses() const; virtual size_t minWireSize() const; virtual bool isVariableLength() const; bool hasDefaultValues() const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); virtual void recDependencies(std::set&); // Internal operation, don't use directly. protected: Struct(const ContainerPtr&, const std::string&, bool); friend class Container; }; // ---------------------------------------------------------------------- // Sequence // ---------------------------------------------------------------------- class SLICE_API Sequence : virtual public Constructed { public: TypePtr type() const; StringList typeMetaData() const; virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; virtual bool usesClasses() const; virtual size_t minWireSize() const; virtual bool isVariableLength() const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); virtual void recDependencies(std::set&); // Internal operation, don't use directly. protected: Sequence(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, bool); friend class Container; TypePtr _type; StringList _typeMetaData; }; // ---------------------------------------------------------------------- // Dictionary // ---------------------------------------------------------------------- class SLICE_API Dictionary : virtual public Constructed { public: TypePtr keyType() const; TypePtr valueType() const; StringList keyMetaData() const; StringList valueMetaData() const; virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; virtual bool usesClasses() const; virtual size_t minWireSize() const; virtual bool isVariableLength() const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); virtual void recDependencies(std::set&); // Internal operation, don't use directly. static bool legalKeyType(const TypePtr&, bool&); protected: Dictionary(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, const TypePtr&, const StringList&, bool); friend class Container; TypePtr _keyType; TypePtr _valueType; StringList _keyMetaData; StringList _valueMetaData; }; // ---------------------------------------------------------------------- // Enum // ---------------------------------------------------------------------- class SLICE_API Enum : virtual public Constructed { public: virtual void destroy(); EnumeratorList getEnumerators(); void setEnumerators(const EnumeratorList&); bool explicitValue() const; int minValue() const; int maxValue() const; virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; virtual bool usesClasses() const; virtual size_t minWireSize() const; virtual bool isVariableLength() const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); virtual void recDependencies(std::set&); // Internal operation, don't use directly. protected: Enum(const ContainerPtr&, const std::string&, bool); friend class Container; EnumeratorList _enumerators; bool _explicitValue; IceUtil::Int64 _minValue; IceUtil::Int64 _maxValue; }; // ---------------------------------------------------------------------- // Enumerator // ---------------------------------------------------------------------- class SLICE_API Enumerator : virtual public Contained { public: EnumPtr type() const; virtual bool uses(const ContainedPtr&) const; virtual ContainedType containedType() const; virtual std::string kindOf() const; bool explicitValue() const; int value() const; protected: Enumerator(const ContainerPtr&, const std::string&); Enumerator(const ContainerPtr&, const std::string&, int); friend class Container; friend class Enum; EnumPtr _type; bool _explicitValue; int _value; }; // ---------------------------------------------------------------------- // Const // ---------------------------------------------------------------------- class SLICE_API Const : virtual public Contained { public: TypePtr type() const; StringList typeMetaData() const; SyntaxTreeBasePtr valueType() const; std::string value() const; std::string literal() const; virtual bool uses(const ContainedPtr&) const; virtual ContainedType containedType() const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); protected: Const(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, const SyntaxTreeBasePtr&, const std::string&, const std::string&); friend class Container; TypePtr _type; StringList _typeMetaData; SyntaxTreeBasePtr _valueType; std::string _value; std::string _literal; }; // ---------------------------------------------------------------------- // ParamDecl // ---------------------------------------------------------------------- class SLICE_API ParamDecl : virtual public Contained { public: TypePtr type() const; bool isOutParam() const; bool optional() const; int tag() const; virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); protected: ParamDecl(const ContainerPtr&, const std::string&, const TypePtr&, bool, bool, int); friend class Operation; TypePtr _type; bool _isOutParam; bool _optional; int _tag; }; // ---------------------------------------------------------------------- // DataMember // ---------------------------------------------------------------------- class SLICE_API DataMember : virtual public Contained { public: TypePtr type() const; bool optional() const; int tag() const; std::string defaultValue() const; std::string defaultLiteral() const; SyntaxTreeBasePtr defaultValueType() const; virtual ContainedType containedType() const; virtual bool uses(const ContainedPtr&) const; virtual std::string kindOf() const; virtual void visit(ParserVisitor*, bool); protected: DataMember(const ContainerPtr&, const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, const std::string&, const std::string&); friend class ClassDef; friend class Struct; friend class Exception; TypePtr _type; bool _optional; int _tag; SyntaxTreeBasePtr _defaultValueType; std::string _defaultValue; std::string _defaultLiteral; }; // ---------------------------------------------------------------------- // Unit // ---------------------------------------------------------------------- class SLICE_API Unit : virtual public Container { public: static UnitPtr createUnit(bool, bool, bool, bool, const StringList& = StringList()); bool ignRedefs() const; bool allowIcePrefix() const; bool allowUnderscore() const; void setComment(const std::string&); std::string currentComment(); // Not const, as this function removes the current comment. std::string currentFile() const; std::string topLevelFile() const; int currentLine() const; void nextLine(); bool scanPosition(const char*); int currentIncludeLevel() const; void addGlobalMetaData(const StringList&); void setSeenDefinition(); void error(const char*); // Not const, because error count is increased. void error(const std::string&); // Ditto. void warning(const char*) const; void warning(const std::string&) const; ContainerPtr currentContainer() const; void pushContainer(const ContainerPtr&); void popContainer(); DefinitionContextPtr currentDefinitionContext() const; void pushDefinitionContext(); void popDefinitionContext(); DefinitionContextPtr findDefinitionContext(const std::string&) const; void addContent(const ContainedPtr&); void removeContent(const ContainedPtr&); ContainedList findContents(const std::string&) const; ClassList findDerivedClasses(const ClassDefPtr&) const; ExceptionList findDerivedExceptions(const ExceptionPtr&) const; ContainedList findUsedBy(const ContainedPtr&) const; void addTypeId(int, const std::string&); std::string getTypeId(int); bool usesNonLocals() const; bool usesConsts() const; FeatureProfile profile() const; // // Returns the path names of the files included directly by the top-level file. // StringList includeFiles() const; // // Returns the path names of all files parsed by this unit. // StringList allFiles() const; int parse(const std::string&, FILE*, bool, FeatureProfile profile = Ice); virtual void destroy(); virtual void visit(ParserVisitor*, bool); BuiltinPtr builtin(Builtin::Kind); // Not const, as builtins are created on the fly. (Lazy initialization.) private: Unit(bool, bool, bool, bool, const StringList&); static void eraseWhiteSpace(::std::string&); bool _ignRedefs; bool _all; bool _allowIcePrefix; bool _allowUnderscore; StringList _defaultGlobalMetaData; int _errors; std::string _currentComment; int _currentLine; int _currentIncludeLevel; std::string _currentFile; std::string _topLevelFile; std::stack _definitionContextStack; StringList _includeFiles; std::stack _containerStack; std::map _builtins; std::map _contentMap; FeatureProfile _featureProfile; std::map _definitionContextMap; std::map _typeIds; }; extern SLICE_API Unit* unit; // The current parser for bison/flex } #endif Ice-3.5.1/cpp/include/Slice/RubyUtil.h0000644000076400007640000000264512223561476015575 0ustar mesmes// ********************************************************************** // // 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 SLICE_RUBY_UTIL_H #define SLICE_RUBY_UTIL_H #include #include namespace Slice { namespace Ruby { // // Generate Ruby code for a translation unit. // SLICE_API void generate(const Slice::UnitPtr&, bool, bool, const std::vector&, IceUtilInternal::Output&); // // Check the given identifier against Ruby's list of reserved words. If it matches // a reserved word, then an escaped version is returned with a leading underscore. // enum IdentStyle { IdentNormal, IdentToUpper, // Mapped identifier must begin with an upper-case letter. IdentToLower // Mapped identifier must begin with a lower-case letter. }; SLICE_API std::string fixIdent(const std::string&, IdentStyle); // // Get the fully-qualified name of the given definition. If a prefix is provided, // it is prepended to the definition's unqualified name. // SLICE_API std::string getAbsolute(const Slice::ContainedPtr&, IdentStyle, const std::string& = std::string()); // // Emit a comment header. // SLICE_API void printHeader(IceUtilInternal::Output&); } } #endif Ice-3.5.1/cpp/include/Slice/Preprocessor.h0000644000076400007640000000332612223561476016501 0ustar mesmes// ********************************************************************** // // 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 PREPROCESSOR_H #define PREPROCESSOR_H #include #include #include #ifndef SLICE_API # ifdef SLICE_API_EXPORTS # define SLICE_API ICE_DECLSPEC_EXPORT # else # define SLICE_API ICE_DECLSPEC_IMPORT # endif #endif namespace Slice { class Preprocessor; typedef IceUtil::Handle PreprocessorPtr; class SLICE_API Preprocessor : public IceUtil::SimpleShared { public: static PreprocessorPtr create(const std::string&, const std::string&, const std::vector&); ~Preprocessor(); FILE* preprocess(bool, const std::string& = ""); bool close(); enum Language { CPlusPlus, Java, JavaXML, CSharp, Python, Ruby, PHP }; bool printMakefileDependencies(Language, const std::vector&, const std::string& = "", const std::string& = "cpp", const std::string& = ""); std::string getBaseName(); static std::string addQuotes(const std::string&); static std::string normalizeIncludePath(const std::string&); private: Preprocessor(const std::string&, const std::string&, const std::vector&); bool checkInputFile(); const std::string _path; const std::string _fileName; const std::string _shortFileName; const std::vector _args; std::string _cppFile; FILE* _cppHandle; }; } #endif Ice-3.5.1/cpp/include/Slice/FileTracker.h0000644000076400007640000000320412223561476016201 0ustar mesmes// ********************************************************************** // // 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 FILE_TRACKER_H #define FILE_TRACKER_H #include #include namespace Slice { class SLICE_API FileException : public ::IceUtil::Exception { public: FileException(const char*, int, const std::string&); ~FileException() throw(); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual FileException* ice_clone() const; virtual void ice_throw() const; std::string reason() const; private: static const char* _name; const std::string _reason; }; class FileTracker; typedef IceUtil::Handle FileTrackerPtr; class SLICE_API FileTracker : public ::IceUtil::SimpleShared { public: FileTracker(); ~FileTracker(); static FileTrackerPtr instance(); void setSource(const std::string&); void setOutput(const std::string&, bool); void addFile(const std::string&); void addDirectory(const std::string&); void cleanup(); void dumpxml(); private: std::string escape(const std::string&) const; std::list > _files; std::string _source; std::map _errors; std::map > _generated; std::map >::iterator _curr; }; } #endif Ice-3.5.1/cpp/include/Slice/JavaUtil.h0000644000076400007640000002272712223561476015540 0ustar mesmes// ********************************************************************** // // 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 JAVA_UTIL_H #define JAVA_UTIL_H #include #include namespace Slice { // // Compute Java serialVersionUID for a Slice class // SLICE_API long computeSerialVersionUUID(const ClassDefPtr&); // // Compute Java serialVersionUID for a Slice class // SLICE_API long computeSerialVersionUUID(const ExceptionPtr&); // // Compute Java serialVersionUID for a Slice struct // SLICE_API long computeSerialVersionUUID(const StructPtr&); class SLICE_API JavaOutput : public ::IceUtilInternal::Output { public: JavaOutput(); JavaOutput(std::ostream&); JavaOutput(const char*); // // Open a file to hold the source for a Java class. The first // argument is the class name (including an optional leading // package). Intermediate directories will be created as // necessary to open the file in the package. The second // argument specifies a directory prefix in which to locate // the class. // // After successfully opening the file, the function invokes // printHeader() and then emits a "package" statement if // necessary. // void openClass(const std::string&, const std::string&, const std::string& = std::string()); virtual void printHeader(); }; class SLICE_API JavaGenerator : private ::IceUtil::noncopyable { public: virtual ~JavaGenerator(); // // Validate all metadata in the unit with a "java:" prefix. // static void validateMetaData(const UnitPtr&); void close(); protected: JavaGenerator(const std::string&); // // Given the fully-scoped Java class name, create any intermediate // package directories and open the class file, // void open(const std::string&, const std::string&); ::IceUtilInternal::Output& output() const; // // Check a symbol against any of the Java keywords. If a // match is found, return the symbol with a leading underscore. // std::string fixKwd(const std::string&) const; // // Convert a Slice scoped name into a Java name. // std::string convertScopedName(const std::string&, const std::string& = std::string(), const std::string& = std::string()) const; // // Returns the package prefix for a give Slice file. // std::string getPackagePrefix(const ContainedPtr&) const; // // Returns the Java package of a Contained entity. // std::string getPackage(const ContainedPtr&) const; // // Returns the Java name for a Contained entity. If the optional // package argument matches the entity's package name, then the // package is removed from the result. // std::string getAbsolute(const ContainedPtr&, const std::string& = std::string(), const std::string& = std::string(), const std::string& = std::string()) const; // // Return the method call necessary to obtain the static type ID for an object type. // std::string getStaticId(const TypePtr&, const std::string&) const; // // Determines whether an operation should use the optional mapping. // bool useOptionalMapping(const OperationPtr&); // // Returns the optional type corresponding to the given Slice type. // std::string getOptionalFormat(const TypePtr&); // // Get the Java name for a type. If an optional scope is provided, // the scope will be removed from the result if possible. // enum TypeMode { TypeModeIn, TypeModeOut, TypeModeMember, TypeModeReturn }; std::string typeToString(const TypePtr&, TypeMode, const std::string& = std::string(), const StringList& = StringList(), bool = true, bool = false) const; // // Get the Java object name for a type. For primitive types, this returns the // Java class type (e.g., Integer). For all other types, this function delegates // to typeToString. // std::string typeToObjectString(const TypePtr&, TypeMode, const std::string& = std::string(), const StringList& = StringList(), bool = true) const; // // Generate code to marshal or unmarshal a type. // enum OptionalMode { OptionalNone, OptionalInParam, OptionalOutParam, OptionalReturnParam, OptionalMember }; void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const TypePtr&, OptionalMode, bool, int, const std::string&, bool, int&, bool = false, const StringList& = StringList(), const std::string& patchParams = ""); // // Generate code to marshal or unmarshal a dictionary type. // void writeDictionaryMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const DictionaryPtr&, const std::string&, bool, int&, bool, const StringList& = StringList()); // // Generate code to marshal or unmarshal a sequence type. // void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const SequencePtr&, const std::string&, bool, int&, bool, const StringList& = StringList()); // // Generate code to marshal or unmarshal a type using the public stream API. // void writeStreamMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const TypePtr&, bool, int, const std::string&, bool, int&, bool = false, const StringList& = StringList(), const std::string& patchParams = ""); // // Generate code to marshal or unmarshal a dictionary type using the public stream API. // void writeStreamDictionaryMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const DictionaryPtr&, const std::string&, bool, int&, bool, const StringList& = StringList()); // // Generate code to marshal or unmarshal a sequence type using the public stream API. // void writeStreamSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const SequencePtr&, const std::string&, bool, int&, bool, const StringList& = StringList()); // // Search metadata for an entry with the given prefix and return the entire string. // static bool findMetaData(const std::string&, const StringList&, std::string&); // // Get custom type metadata. If metadata is found, the abstract and // concrete types are extracted and the function returns true. If an // abstract type is not specified, it is set to an empty string. // static bool getTypeMetaData(const StringList&, std::string&, std::string&); // // Determine whether a custom type is defined. The function checks the // metadata of the type's original definition, as well as any optional // metadata that typically represents a data member or parameter. // static bool hasTypeMetaData(const TypePtr&, const StringList& = StringList()); // // Obtain the concrete and abstract types for a dictionary or sequence type. // The functions return true if a custom type was defined and false to indicate // the default mapping was used. // bool getDictionaryTypes(const DictionaryPtr&, const std::string&, const StringList&, std::string&, std::string&) const; bool getSequenceTypes(const SequencePtr&, const std::string&, const StringList&, std::string&, std::string&) const; virtual JavaOutput* createOutput(); static const std::string _getSetMetaData; private: class MetaDataVisitor : public ParserVisitor { public: virtual bool visitUnitStart(const UnitPtr&); virtual bool visitModuleStart(const ModulePtr&); virtual void visitClassDecl(const ClassDeclPtr&); virtual bool visitClassDefStart(const ClassDefPtr&); virtual bool visitExceptionStart(const ExceptionPtr&); virtual bool visitStructStart(const StructPtr&); virtual void visitOperation(const OperationPtr&); virtual void visitDataMember(const DataMemberPtr&); virtual void visitSequence(const SequencePtr&); virtual void visitDictionary(const DictionaryPtr&); virtual void visitEnum(const EnumPtr&); virtual void visitConst(const ConstPtr&); private: StringList getMetaData(const ContainedPtr&); void validateType(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&); void validateGetSet(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&); StringSet _history; }; friend class JavaGenerator::MetaDataVisitor; std::string _dir; ::IceUtilInternal::Output* _out; mutable std::map _filePackagePrefix; }; } #endif Ice-3.5.1/cpp/include/Slice/Util.h0000644000076400007640000000235412223561476014730 0ustar mesmes// ********************************************************************** // // 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 SLICE_UTIL_H #define SLICE_UTIL_H #include #include namespace Slice { SLICE_API std::string fullPath(const std::string&); SLICE_API std::string changeInclude(const std::string&, const std::vector&); SLICE_API void setErrorStream(std::ostream&); SLICE_API std::ostream& getErrorStream(); SLICE_API void emitError(const std::string&, int, const std::string&); SLICE_API void emitWarning(const std::string&, int, const std::string&); SLICE_API void emitError(const std::string&, const std::string&, const std::string&); SLICE_API void emitWarning(const std::string&, const std::string&, const std::string&); SLICE_API void emitRaw(const char*); SLICE_API std::vector filterMcppWarnings(const std::string&); SLICE_API void printGeneratedHeader(IceUtilInternal::Output& out, const std::string&, const std::string& commentStyle = "//"); } #endif Ice-3.5.1/cpp/include/Slice/Makefile0000644000076400007640000000143312223561476015277 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/Slice ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/Slice..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/Slice) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/Slice/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/Slice/$$i ; \ done Ice-3.5.1/cpp/include/Slice/PythonUtil.h0000644000076400007640000000343012223561476016126 0ustar mesmes// ********************************************************************** // // 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 SLICE_PYTHON_UTIL_H #define SLICE_PYTHON_UTIL_H #include #include namespace Slice { namespace Python { // // Generate Python code for a translation unit. // SLICE_API void generate(const Slice::UnitPtr&, bool, bool, const std::vector&, IceUtilInternal::Output&); // // Convert a scoped name into a Python name. // SLICE_API std::string scopedToName(const std::string&); // // Check the given identifier against Python's list of reserved words. If it matches // a reserved word, then an escaped version is returned with a leading underscore. // SLICE_API std::string fixIdent(const std::string&); // // Return the package specified in the global metadata for the given definition, // or an empty string if no metadata was found. // SLICE_API std::string getPackageMetadata(const Slice::ContainedPtr&); // // Get the fully-qualified name of the given definition, including any // package defined via metadata. If a suffix is provided, it is // prepended to the definition's unqualified name. If the nameSuffix // is provided, it is appended to the containers name. // // COMPILERFIX: MSVC 6 seems to have a problem with const std::string // = std::string(), const std::string = std::string(). // SLICE_API std::string getAbsolute(const Slice::ContainedPtr&, const std::string& = "", const std::string& = ""); // // Emit a comment header. // SLICE_API void printHeader(IceUtilInternal::Output&); } } #endif Ice-3.5.1/cpp/include/Freeze/0000755000076400007640000000000012223561476014017 5ustar mesmesIce-3.5.1/cpp/include/Freeze/Index.h0000644000076400007640000000244612223561476015245 0ustar mesmes// ********************************************************************** // // 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 FREEZE_INDEX_H #define FREEZE_INDEX_H #include #include #include namespace Freeze { class IndexI; class ObjectStoreBase; class FREEZE_API Index : public IceUtil::Shared { public: virtual ~Index(); const std::string& name() const; const std::string& facet() const; protected: Index(const std::string&, const std::string&); virtual bool marshalKey(const Ice::ObjectPtr&, Freeze::Key&) const = 0; std::vector untypedFindFirst(const Freeze::Key&, Ice::Int) const; std::vector untypedFind(const Freeze::Key&) const; Ice::Int untypedCount(const Freeze::Key&) const; Ice::CommunicatorPtr _communicator; Ice::EncodingVersion _encoding; private: friend class IndexI; friend class ObjectStoreBase; std::string _name; std::string _facet; IndexI* _impl; }; typedef IceUtil::Handle IndexPtr; } #endif Ice-3.5.1/cpp/include/Freeze/TransactionHolder.h0000644000076400007640000000157112223561476017617 0ustar mesmes// ********************************************************************** // // 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 FREEZE_TRANSACTION_HOLDER_H #define FREEZE_TRANSACTION_HOLDER_H #include #include namespace Freeze { class FREEZE_API TransactionHolder { public: TransactionHolder(const ConnectionPtr&); ~TransactionHolder(); void commit(); void rollback(); private: // // Not implemented // TransactionHolder(const TransactionHolder&); TransactionHolder& operator=(const TransactionHolder&); TransactionPtr _transaction; }; } #endif Ice-3.5.1/cpp/include/Freeze/Freeze.h0000644000076400007640000000113212223561476015405 0ustar mesmes// ********************************************************************** // // 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 FREEZE_FREEZE_H #define FREEZE_FREEZE_H #include #include #include #include #include #include #endif Ice-3.5.1/cpp/include/Freeze/Initialize.h0000644000076400007640000000755112223561476016301 0ustar mesmes// ********************************************************************** // // 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 FREEZE_INITIALIZE_H #define FREEZE_INITIALIZE_H #include #include #include #include #include // // Berkeley DB's DbEnv and DbTxn // class DbEnv; class DbTxn; namespace Freeze { typedef std::map FacetTypeMap; FREEZE_API Freeze::BackgroundSaveEvictorPtr createBackgroundSaveEvictor(const Ice::ObjectAdapterPtr& adapter, const std::string& envName, const std::string& filename, const ServantInitializerPtr& initializer = 0, const std::vector& indices = std::vector(), bool createDb = true); FREEZE_API BackgroundSaveEvictorPtr createBackgroundSaveEvictor(const Ice::ObjectAdapterPtr& adapter, const std::string& envName, DbEnv& dbEnv, const std::string& filename, const ServantInitializerPtr& initializer = 0, const std::vector& indices = std::vector(), bool createDb = true); FREEZE_API TransactionalEvictorPtr createTransactionalEvictor(const Ice::ObjectAdapterPtr& adapter, const std::string& envName, const std::string& filename, const FacetTypeMap& facetTypes = FacetTypeMap(), const ServantInitializerPtr& initializer = 0, const std::vector& indices = std::vector(), bool createDb = true); FREEZE_API TransactionalEvictorPtr createTransactionalEvictor(const Ice::ObjectAdapterPtr& adapter, const std::string& envName, DbEnv& dbEnv, const std::string& filename, const FacetTypeMap& facetTypes = FacetTypeMap(), const ServantInitializerPtr& initializer = 0, const std::vector& indices = std::vector(), bool createDb = true); // // TransactionalEvictorDeadlockException propagates through collocation-optimized calls // The TransactionalEvictor catches and retries on this exception // class FREEZE_API TransactionalEvictorDeadlockException : public Ice::SystemException { public: TransactionalEvictorDeadlockException(const char*, int, const TransactionPtr& = 0); virtual ~TransactionalEvictorDeadlockException() throw(); virtual std::string ice_name() const; virtual TransactionalEvictorDeadlockException* ice_clone() const; virtual void ice_throw() const; TransactionPtr tx; }; FREEZE_API ConnectionPtr createConnection(const Ice::CommunicatorPtr& communicator, const std::string& envName); FREEZE_API ConnectionPtr createConnection(const Ice::CommunicatorPtr& communicator, const std::string& envName, DbEnv& dbEnv); FREEZE_API const std::string& catalogName(); FREEZE_API const std::string& catalogIndexListName(); FREEZE_API DbTxn* getTxn(const TransactionPtr&); typedef void (*FatalErrorCallback)(const BackgroundSaveEvictorPtr&, const Ice::CommunicatorPtr&); FREEZE_API FatalErrorCallback registerFatalErrorCallback(FatalErrorCallback); } #endif Ice-3.5.1/cpp/include/Freeze/Map.h0000644000076400007640000006673712223561476014730 0ustar mesmes// ********************************************************************** // // 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 FREEZE_MAP_H #define FREEZE_MAP_H #include #include #include #include #include // // Berkeley DB's DbEnv // class DbEnv; namespace Freeze { class IteratorHelper; class MapHelper; class MapIndexI; class MapHelperI; class IteratorHelperI; class SharedDb; class FREEZE_API KeyCompareBase : public IceUtil::Shared { public: KeyCompareBase(bool); bool compareEnabled() const; virtual int compare(const Key&, const Key&) = 0; private: const bool _enabled; }; typedef IceUtil::Handle KeyCompareBasePtr; class FREEZE_API MapIndexBase : public KeyCompareBase { public: virtual ~MapIndexBase(); const std::string& name() const; IteratorHelper* begin(bool) const; IteratorHelper* untypedFind(const Key&, bool, bool) const; IteratorHelper* untypedLowerBound(const Key&, bool) const; IteratorHelper* untypedUpperBound(const Key&, bool) const; int untypedCount(const Key&) const; // // Implemented by the generated code // virtual void marshalKey(const Value&, Key&) const = 0; protected: MapIndexBase(const std::string&, bool); Ice::CommunicatorPtr _communicator; Ice::EncodingVersion _encoding; private: friend class MapHelperI; friend class IteratorHelperI; friend class SharedDb; friend class MapDb; std::string _name; MapIndexI* _impl; const MapHelperI* _map; }; typedef IceUtil::Handle MapIndexBasePtr; class FREEZE_API MapHelper { public: static MapHelper* create(const ConnectionPtr& connection, const std::string& dbName, const std::string& key, const std::string& value, const KeyCompareBasePtr&, const std::vector&, bool createDb); static void recreate(const ConnectionPtr& connection, const std::string& dbName, const std::string& key, const std::string& value, const KeyCompareBasePtr&, const std::vector&); virtual ~MapHelper() = 0; virtual IteratorHelper* find(const Key&, bool) const = 0; virtual IteratorHelper* lowerBound(const Key&, bool) const = 0; virtual IteratorHelper* upperBound(const Key&, bool) const = 0; virtual void put(const Key&, const Value&) = 0; virtual size_t erase(const Key&) = 0; virtual size_t count(const Key&) const = 0; virtual void clear() = 0; virtual void destroy() = 0; virtual size_t size() const = 0; virtual void closeAllIterators() = 0; virtual const MapIndexBasePtr& index(const std::string&) const = 0; virtual void closeDb() = 0; virtual ConnectionPtr getConnection() const = 0; }; class FREEZE_API IteratorHelper { public: static IteratorHelper* create(const MapHelper& m, bool readOnly); virtual ~IteratorHelper() ICE_NOEXCEPT_FALSE = 0; virtual IteratorHelper* clone() const = 0; virtual const Key* get() const = 0; virtual void get(const Key*&, const Value*&) const = 0; virtual void set(const Value&) = 0; virtual void erase() = 0; virtual bool next() const = 0; }; // // Forward declaration // template class Map; template class ConstIterator; // // This is necessary for MSVC support. // struct IteratorBase { typedef std::forward_iterator_tag iterator_category; }; // // Database iterator. This implements a forward iterator with the // restriction that it's only possible to explicitely write back into // the database. // // Two iterators are equal if they use the same database and their // current records have the same key. // // TODO: It's possible to implement bidirectional iterators, if // necessary. // template class Iterator : public IteratorBase { public: typedef ptrdiff_t difference_type; typedef std::pair value_type; typedef value_type* pointer; typedef value_type& reference; Iterator(IteratorHelper* helper, const Ice::CommunicatorPtr& communicator, const Ice::EncodingVersion& encoding) : _helper(helper), _communicator(communicator), _encoding(encoding), _refValid(false) { } Iterator() : _encoding(Ice::Encoding_1_0), _refValid(false) { } Iterator(const Iterator& rhs) : _communicator(rhs._communicator), _encoding(rhs._encoding), _refValid(false) { if(rhs._helper.get() != 0) { _helper.reset(rhs._helper->clone()); } } Iterator& operator=(const Iterator& rhs) { if(this != &rhs) { if(rhs._helper.get() != 0) { _helper.reset(rhs._helper->clone()); } else { _helper.reset(); } _communicator = rhs._communicator; _encoding = rhs._encoding; _refValid = false; } return *this; } ~Iterator() ICE_NOEXCEPT_FALSE { } bool operator==(const Iterator& rhs) const { if(_helper.get() == rhs._helper.get()) { return true; } if(_helper.get() != 0 && rhs._helper.get() != 0) { const Key* lhsKey = _helper->get(); const Key* rhsKey = rhs._helper->get(); if(lhsKey != 0 && rhsKey != 0) { return *lhsKey == *rhsKey; } } return false; } bool operator!=(const Iterator& rhs) const { return !(*this == rhs); } Iterator& operator++() { incr(); return *this; } Iterator operator++(int) { Iterator tmp = *this; incr(); return tmp; } // // Note that this doesn't follow the regular iterator mapping: // // value_type& operator*(), value_type operator*() const // value_type& operator*() const { if(!_refValid) { key_type key; mapped_type value; getCurrentValue(key, value); // // !IMPORTANT! // // This method has to cache the returned value to implement // operator->(). // const_cast(_ref.first) = key; const_cast(_ref.second) = value; _refValid = true; } return _ref; } value_type* operator->() { return &(operator*()); } // // This special method allows writing back into the database. // void set(const mapped_type& value) { assert(_helper.get()); Value v; ValueCodec::write(value, v, _communicator, _encoding); _helper->set(v); _refValid = false; } private: void incr() { assert(_helper.get() != 0); if(!_helper->next()) { // // The iterator has been moved past the end, and is now // invalid. // _helper.reset(); } _refValid = false; } void getCurrentValue(key_type& key, mapped_type& value) const { assert(_helper.get() != 0); const Key* k = 0; const Value* v = 0; _helper->get(k, v); assert(k != 0); assert(v != 0); KeyCodec::read(key, *k, _communicator, _encoding); ValueCodec::read(value, *v, _communicator, _encoding); } friend class ConstIterator; friend class Map; IceUtil::UniquePtr _helper; Ice::CommunicatorPtr _communicator; Ice::EncodingVersion _encoding; // // Cached last return value. This is so that operator->() can // actually return a pointer. The cached value is reused across // multiple calls to operator->() if _refValid is true, which // avoids problems in certain situations. For example, if // _ref.second is an STL container and you use an STL algorithm // such as transform, STLport (debug build) asserts that the // addresses of the containers are the same. This would fail if // the same value was not returned on subsequent calls to // operator->(). // mutable value_type _ref; mutable bool _refValid; }; // // See Iterator comments for design notes // template class ConstIterator : public IteratorBase { public: typedef ptrdiff_t difference_type; typedef std::pair value_type; typedef value_type* pointer; typedef value_type& reference; ConstIterator(IteratorHelper* helper, const Ice::CommunicatorPtr& communicator, const Ice::EncodingVersion& encoding) : _helper(helper), _communicator(communicator), _encoding(encoding), _refValid(false) { } ConstIterator() : _encoding(Ice::Encoding_1_0), _refValid(false) { } ConstIterator(const ConstIterator& rhs) : _communicator(rhs._communicator), _encoding(rhs._encoding), _refValid(false) { if(rhs._helper.get() != 0) { _helper.reset(rhs._helper->clone()); } } // // A Iterator can be converted to a ConstIterator (but not // vice versa) - same for operator=. // ConstIterator(const Iterator& rhs) : _communicator(rhs._communicator), _encoding(rhs._encoding), _refValid(false) { if(rhs._helper.get() != 0) { _helper.reset(rhs._helper->clone()); } } ConstIterator& operator=(const ConstIterator& rhs) { if(this != &rhs) { if(rhs._helper.get() != 0) { _helper.reset(rhs._helper->clone()); } else { _helper.reset(); } _communicator = rhs._communicator; _encoding = rhs._encoding; _refValid = false; } return *this; } // // Create const_iterator from iterator. // ConstIterator& operator=(const Iterator& rhs) { if(rhs._helper.get() != 0) { _helper.reset(rhs._helper->clone()); } else { _helper.reset(); } _communicator = rhs._communicator; _encoding = rhs._encoding; _refValid = false; return *this; } ~ConstIterator() { } bool operator==(const ConstIterator& rhs) { if(_helper.get() == rhs._helper.get()) { return true; } if(_helper.get() != 0 && rhs._helper.get() != 0) { const Key* lhsKey = _helper->get(); const Key* rhsKey = rhs._helper->get(); if(lhsKey != 0 && rhsKey != 0) { return *lhsKey == *rhsKey; } } return false; } bool operator!=(const ConstIterator& rhs) { return !(*this == rhs); } ConstIterator& operator++() { incr(); return *this; } ConstIterator operator++(int) { ConstIterator tmp = *this; incr(); return tmp; } // // Note that this doesn't follow the regular iterator mapping: // // value_type operator*() const // value_type& operator*() const { if(!_refValid) { key_type key; mapped_type value; getCurrentValue(key, value); // // !IMPORTANT! // // This method has to cache the returned value to implement // operator->(). // const_cast(_ref.first) = key; const_cast(_ref.second) = value; _refValid = true; } return _ref; } pointer operator->() const { return &(operator*()); } private: void incr() { assert(_helper.get() != 0); if(!_helper->next()) { // // The iterator has been moved past the end, and is now // invalid. // _helper.reset(); } _refValid = false; } void getCurrentValue(key_type& key, mapped_type& value) const { assert(_helper.get() != 0); const Key* k = 0; const Value* v = 0; _helper->get(k, v); assert(k != 0); assert(v != 0); KeyCodec::read(key, *k, _communicator, _encoding); ValueCodec::read(value, *v, _communicator, _encoding); } friend class Map; IceUtil::UniquePtr _helper; Ice::CommunicatorPtr _communicator; Ice::EncodingVersion _encoding; // // Cached last return value. This is so that operator->() can // actually return a pointer. The cached value is reused across // multiple calls to operator->() if _refValid is true, which // avoids problems in certain situations. For example, if // _ref.second is an STL container and you use an STL algorithm // such as transform, STLport (debug build) asserts that the // addresses of the containers are the same. This would fail // if the same value was not returned on subsequent calls // to operator->(). // mutable value_type _ref; mutable bool _refValid; }; struct IceEncodingCompare {}; template class KeyCompare : public KeyCompareBase { public: KeyCompare(const Compare& mapCompare, const Ice::CommunicatorPtr& communicator, const Ice::EncodingVersion& encoding) : KeyCompareBase(true), _compare(mapCompare), _communicator(communicator), _encoding(encoding) {} virtual int compare(const Key& dbKey1, const Key& dbKey2) { key_type key1; KeyCodec::read(key1, dbKey1, _communicator, _encoding); key_type key2; KeyCodec::read(key2, dbKey2, _communicator, _encoding); if(_compare(key1, key2)) { return -1; } else if(_compare(key2, key1)) { return 1; } else { return 0; } } private: Compare _compare; const Ice::CommunicatorPtr _communicator; const Ice::EncodingVersion _encoding; }; // // Partial template specialization: // do nothing for the IceEncodingCompare comparator // template class KeyCompare : public KeyCompareBase { public: KeyCompare(const IceEncodingCompare&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&): KeyCompareBase(false) {} virtual int compare(const Key&, const Key&) { assert(0); return 0; } }; // // Need to separate MapIndex template class because _communicator is // set later // template class MapIndex : public MapIndexBase { public: virtual int compare(const Key& dbKey1, const Key& dbKey2) { key_type key1; KeyCodec::read(key1, dbKey1, _communicator, _encoding); key_type key2; KeyCodec::read(key2, dbKey2, _communicator, _encoding); if(_compare(key1, key2)) { return -1; } else if(_compare(key2, key1)) { return 1; } else { return 0; } } protected: MapIndex(const std::string& mapName, const Compare& mapCompare) : MapIndexBase(mapName, true), _compare(mapCompare) {} private: Compare _compare; }; // // Partial template specialization: // do nothing for the IceEncodingCompare comparator // template class MapIndex : public MapIndexBase { public: virtual int compare(const Key&, const Key&) { assert(0); return 0; } protected: MapIndex(const std::string& mapName, const IceEncodingCompare&): MapIndexBase(mapName, false) {} }; // // A sorted map, similar to a std::map, with one notable difference: // operator[] is not provided. // // // TODO: implement bidirectional iterators. // template class Map { public: typedef std::pair value_type; typedef Iterator iterator; typedef ConstIterator const_iterator; // // No definition for reference, const_reference, pointer or // const_pointer. // typedef size_t size_type; typedef ptrdiff_t difference_type; // // Allocators are not supported. // // allocator_type // // // Constructors // Map(const Freeze::ConnectionPtr& connection, const std::string& dbName, bool createDb = true, const Compare& compare = Compare()) : _communicator(connection->getCommunicator()), _encoding(connection->getEncoding()) { KeyCompareBasePtr keyCompare = new KeyCompare(compare, _communicator, _encoding); std::vector indices; _helper.reset(MapHelper::create(connection, dbName, KeyCodec::typeId(), ValueCodec::typeId(), keyCompare, indices, createDb)); } template Map(const Freeze::ConnectionPtr& connection, const std::string& dbName, bool createDb, _InputIterator first, _InputIterator last, const Compare& compare = Compare()) : _communicator(connection->getCommunicator()), _encoding(connection->getEncoding()) { KeyCompareBasePtr keyCompare = new KeyCompare(compare, _communicator, _encoding); std::vector indices; _helper.reset(MapHelper::create(connection, dbName, KeyCodec::typeId(), ValueCodec::typeId(), keyCompare, indices, createDb)); while(first != last) { put(*first); ++first; } } ~Map() { } // static void recreate(const Freeze::ConnectionPtr& connection, // const std::string& dbName, // const Compare& compare = Compare()) // { // KeyCompareBasePtr keyCompare = new KeyCompare(compare, // connection->getCommunicator(), // connection->getEncoding()); // std::vector indices; // MapHelper::recreate(connection, dbName, KeyCodec::typeId(), ValueCodec::typeId(), keyCompare, indices); // } bool operator==(const Map& rhs) const { // // This does a memberwise equality for the entire contents of // the database. While slow this is always correct. Database // equality is not necessarily correct in the context of a // transaction. // if(size() != rhs.size()) { return false; } for(const_iterator p = rhs.begin() ; p != rhs.end() ; ++p) { const_iterator q = rhs.find(p->first); if(q == rhs.end()) { return false; } if(p->second != q->second) { return false; } } return true; } bool operator!=(const Map& rhs) const { return !(*this == rhs); } void swap(Map& rhs) { MapHelper* tmp = _helper.release(); _helper.reset(rhs._helper.release()); rhs._helper.reset(tmp); Ice::CommunicatorPtr tmpCom = _communicator; Ice::EncodingVersion tmpEnc = _encoding; _communicator = rhs._communicator; _encoding = rhs._encoding; rhs._communicator = tmpCom; rhs._encoding = tmpEnc; } iterator begin() { try { return iterator(IteratorHelper::create(*_helper.get(), false), _communicator, _encoding); } catch(const NotFoundException&) { return iterator(); } } const_iterator begin() const { try { return const_iterator(IteratorHelper::create(*_helper.get(), true), _communicator, _encoding); } catch(const NotFoundException&) { return const_iterator(); } } iterator end() { return iterator(); } const_iterator end() const { return const_iterator(); } bool empty() const { return size() == 0; } size_type size() const { return _helper->size(); } size_type max_size() const { return 0xffffffff; // TODO: is this the max? } // // This method isn't implemented. // // mapped_type& operator[](const key_type& key) // // // This method isn't in the STLport library - but it's referenced // in "STL Tutorial and Reference Guide, Second Edition". It's not // currently implemented. // // const mapped_type& operator[](const key_type& key) const; // // // No allocators. // //allocator_type get_allocator() const; // iterator insert(iterator /*position*/, const value_type& key) { // // position is ignored. // Key k; KeyCodec::write(key.first, k, _communicator, _encoding); iterator r = iterator(_helper->find(k, false), _communicator, _encoding); if(r == end()) { Value v; ValueCodec::write(key.second, v, _communicator, _encoding); _helper->put(k, v); r = iterator(_helper->find(k, false), _communicator, _encoding); } return r; } std::pair insert(const value_type& key) { Key k; KeyCodec::write(key.first, k, _communicator, _encoding); iterator r = iterator(_helper->find(k, false), _communicator, _encoding); bool inserted = false; if(r == end()) { Value v; ValueCodec::write(key.second, v, _communicator, _encoding); _helper->put(k, v); inserted = true; r = iterator(_helper->find(k, false), _communicator, _encoding); } return std::pair(r, inserted); } template void insert(InputIterator first, InputIterator last) { while(first != last) { insert(*first); ++first; } } void put(const value_type& key) { // // insert or replace // Key k; Value v; KeyCodec::write(key.first, k, _communicator, _encoding); ValueCodec::write(key.second, v, _communicator, _encoding); _helper->put(k, v); } template void put(InputIterator first, InputIterator last) { while(first != last) { put(*first); ++first; } } void erase(iterator position) { assert(position._helper.get() != 0); position._helper->erase(); } size_type erase(const key_type& key) { Key k; KeyCodec::write(key, k, _communicator, _encoding); return _helper->erase(k); } void erase(iterator first, iterator last) { while(first != last) { first._helper->erase(); ++first; } } void clear() { _helper->clear(); } // // destroy is not a standard function // void destroy() { _helper->destroy(); } // // closeDb closes the underlying Berkeley DB database // void closeDb() { _helper->closeDb(); } iterator find(const key_type& key) { Key k; KeyCodec::write(key, k, _communicator, _encoding); return iterator(_helper->find(k, false), _communicator, _encoding); } const_iterator find(const key_type& key) const { Key k; KeyCodec::write(key, k, _communicator, _encoding); return const_iterator(_helper->find(k, true), _communicator, _encoding); } size_type count(const key_type& key) const { Key k; KeyCodec::write(key, k, _communicator, _encoding); return _helper->count(k); } iterator lower_bound(const key_type& key) { Key k; KeyCodec::write(key, k, _communicator, _encoding); return iterator(_helper->lowerBound(k, false), _communicator, _encoding); } const_iterator lower_bound(const key_type& key) const { Key k; KeyCodec::write(key, k, _communicator, _encoding); return iterator(_helper->lowerBound(k, true), _communicator, _encoding); } iterator upper_bound(const key_type& key) { Key k; KeyCodec::write(key, k, _communicator, _encoding); return iterator(_helper->upperBound(k, false), _communicator, _encoding); } const_iterator upper_bound(const key_type& key) const { Key k; KeyCodec::write(key, k, _communicator, _encoding); return iterator(_helper->upperBound(k, true), _communicator, _encoding); } std::pair equal_range(const key_type& key) { return std::make_pair(lower_bound(key), upper_bound(key)); } std::pair equal_range(const key_type& key) const { return std::make_pair(lower_bound(key), upper_bound(key)); } const Ice::CommunicatorPtr& communicator() const { return _communicator; } // // getConnection returns the associated connection // ConnectionPtr getConnection() const { return _helper->getConnection(); } protected: Map(const Ice::CommunicatorPtr& mapCommunicator, const Ice::EncodingVersion& encoding) : _communicator(mapCommunicator), _encoding(encoding) { } IceUtil::UniquePtr _helper; Ice::CommunicatorPtr _communicator; Ice::EncodingVersion _encoding; }; } #endif Ice-3.5.1/cpp/include/Freeze/Makefile0000644000076400007640000000144012223561476015456 0ustar mesmes# ********************************************************************** # # 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 = ../.. include $(top_srcdir)/config/Make.rules install:: @if test ! -d $(DESTDIR)$(install_includedir)/Freeze ; \ then \ echo "Creating $(DESTDIR)$(install_includedir)/Freeze..." ; \ $(call mkdir,$(DESTDIR)$(install_includedir)/Freeze) ; \ fi @for i in *.h ; \ do \ echo "Installing $$i" ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/Freeze/$$i ; \ chmod a+r $(DESTDIR)$(install_includedir)/Freeze/$$i ; \ done Ice-3.5.1/cpp/src/0000755000076400007640000000000012223561476011743 5ustar mesmesIce-3.5.1/cpp/src/Ice/0000755000076400007640000000000012223561476012443 5ustar mesmesIce-3.5.1/cpp/src/Ice/PropertiesI.cpp0000644000076400007640000005231212223561476015417 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; string Ice::PropertiesI::getProperty(const string& key) { IceUtil::Mutex::Lock sync(*this); map::iterator p = _properties.find(key); if(p != _properties.end()) { p->second.used = true; return p->second.value; } else { return string(); } } string Ice::PropertiesI::getPropertyWithDefault(const string& key, const string& value) { IceUtil::Mutex::Lock sync(*this); map::iterator p = _properties.find(key); if(p != _properties.end()) { p->second.used = true; return p->second.value; } else { return value; } } Int Ice::PropertiesI::getPropertyAsInt(const string& key) { return getPropertyAsIntWithDefault(key, 0); } Int Ice::PropertiesI::getPropertyAsIntWithDefault(const string& key, Int value) { IceUtil::Mutex::Lock sync(*this); map::iterator p = _properties.find(key); if(p != _properties.end()) { Int val = value; p->second.used = true; istringstream v(p->second.value); if(!(v >> value) || !v.eof()) { Warning out(getProcessLogger()); out << "numeric property " << key << " set to non-numeric value, defaulting to " << val; return val; } } return value; } Ice::StringSeq Ice::PropertiesI::getPropertyAsList(const string& key) { return getPropertyAsListWithDefault(key, StringSeq()); } Ice::StringSeq Ice::PropertiesI::getPropertyAsListWithDefault(const string& key, const StringSeq& value) { IceUtil::Mutex::Lock sync(*this); map::iterator p = _properties.find(key); if(p != _properties.end()) { p->second.used = true; StringSeq result; if(!IceUtilInternal::splitString(p->second.value, ", \t\r\n", result)) { Warning out(getProcessLogger()); out << "mismatched quotes in property " << key << "'s value, returning default value"; } if(result.size() == 0) { result = value; } return result; } else { return value; } } PropertyDict Ice::PropertiesI::getPropertiesForPrefix(const string& prefix) { IceUtil::Mutex::Lock sync(*this); PropertyDict result; for(map::iterator p = _properties.begin(); p != _properties.end(); ++p) { if(prefix.empty() || p->first.compare(0, prefix.size(), prefix) == 0) { p->second.used = true; result[p->first] = p->second.value; } } return result; } void Ice::PropertiesI::setProperty(const string& key, const string& value) { // // Trim whitespace // string currentKey = IceUtilInternal::trim(key); if(currentKey.empty()) { throw InitializationException(__FILE__, __LINE__, "Attempt to set property with empty key"); } // // Check if the property is legal. // LoggerPtr logger = getProcessLogger(); string::size_type dotPos = currentKey.find('.'); if(dotPos != string::npos) { string prefix = currentKey.substr(0, dotPos); for(int i = 0 ; IceInternal::PropertyNames::validProps[i].properties != 0; ++i) { string pattern(IceInternal::PropertyNames::validProps[i].properties[0].pattern); dotPos = pattern.find('.'); // // Each top level prefix describes a non-empty // namespace. Having a string without a prefix followed by a // dot is an error. // assert(dotPos != string::npos); bool mismatchCase = false; string otherKey; string propPrefix = pattern.substr(0, dotPos); if(IceUtilInternal::toUpper(propPrefix) != IceUtilInternal::toUpper(prefix)) { continue; } bool found = false; for(int j = 0; j < IceInternal::PropertyNames::validProps[i].length && !found; ++j) { const IceInternal::Property& prop = IceInternal::PropertyNames::validProps[i].properties[j]; found = IceUtilInternal::match(currentKey, prop.pattern); if(found && prop.deprecated) { logger->warning("deprecated property: " + currentKey); if(prop.deprecatedBy != 0) { currentKey = prop.deprecatedBy; } } if(!found && IceUtilInternal::match(IceUtilInternal::toUpper(currentKey), IceUtilInternal::toUpper(prop.pattern))) { found = true; mismatchCase = true; otherKey = prop.pattern; break; } } if(!found) { logger->warning("unknown property: `" + currentKey + "'"); } else if(mismatchCase) { logger->warning("unknown property: `" + currentKey + "'; did you mean `" + otherKey + "'"); } } } IceUtil::Mutex::Lock sync(*this); // // Set or clear the property. // if(!value.empty()) { PropertyValue pv(value, false); map::const_iterator p = _properties.find(currentKey); if(p != _properties.end()) { pv.used = p->second.used; } _properties[currentKey] = pv; } else { _properties.erase(currentKey); } } StringSeq Ice::PropertiesI::getCommandLineOptions() { IceUtil::Mutex::Lock sync(*this); StringSeq result; result.reserve(_properties.size()); for(map::const_iterator p = _properties.begin(); p != _properties.end(); ++p) { result.push_back("--" + p->first + "=" + p->second.value); } return result; } StringSeq Ice::PropertiesI::parseCommandLineOptions(const string& prefix, const StringSeq& options) { string pfx = prefix; if(!pfx.empty() && pfx[pfx.size() - 1] != '.') { pfx += '.'; } pfx = "--" + pfx; StringSeq result; for(StringSeq::size_type i = 0; i < options.size(); i++) { string opt = options[i]; if(opt.find(pfx) == 0) { if(opt.find('=') == string::npos) { opt += "=1"; } parseLine(opt.substr(2), 0); } else { result.push_back(opt); } } return result; } StringSeq Ice::PropertiesI::parseIceCommandLineOptions(const StringSeq& options) { StringSeq args = options; for(const char** i = IceInternal::PropertyNames::clPropNames; *i != 0; ++i) { args = parseCommandLineOptions(*i, args); } return args; } void Ice::PropertiesI::load(const std::string& file) { // // Metro style applications cannot access Windows registry. // #if defined (_WIN32) && !defined(ICE_OS_WINRT) if(file.find("HKLM\\") == 0) { HKEY iceKey; const wstring keyName = IceUtil::stringToWstring(Ice::nativeToUTF8(_converter, file).substr(5)).c_str(); LONG err; if((err = RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyName.c_str(), 0, KEY_QUERY_VALUE, &iceKey)) != ERROR_SUCCESS) { InitializationException ex(__FILE__, __LINE__); ex.reason = "could not open Windows registry key `" + file + "':\n" + IceUtilInternal::errorToString(err); throw ex; } DWORD maxNameSize; // Size in characters not including terminating null character. DWORD maxDataSize; // Size in bytes DWORD numValues; try { err = RegQueryInfoKey(iceKey, NULL, NULL, NULL, NULL, NULL, NULL, &numValues, &maxNameSize, &maxDataSize, NULL, NULL); if(err != ERROR_SUCCESS) { InitializationException ex(__FILE__, __LINE__); ex.reason = "could not open Windows registry key `" + file + "':\n"; ex.reason += IceUtilInternal::errorToString(err); throw ex; } for(DWORD i = 0; i < numValues; ++i) { vector nameBuf(maxNameSize + 1); vector dataBuf(maxDataSize); DWORD keyType; DWORD nameBufSize = static_cast(nameBuf.size()); DWORD dataBufSize = static_cast(dataBuf.size()); err = RegEnumValueW(iceKey, i, &nameBuf[0], &nameBufSize, NULL, &keyType, &dataBuf[0], &dataBufSize); if(err != ERROR_SUCCESS || nameBufSize == 0) { ostringstream os; os << "could not read Windows registry property name, key: `" + file + "', index: " << i << ":\n"; if(nameBufSize == 0) { os << "property name can't be the empty string"; } else { os << IceUtilInternal::errorToString(err); } getProcessLogger()->warning(os.str()); continue; } string name = IceUtil::wstringToString(wstring(reinterpret_cast(&nameBuf[0]), nameBufSize)); name = Ice::UTF8ToNative(_converter, name); if(keyType != REG_SZ && keyType != REG_EXPAND_SZ) { ostringstream os; os << "unsupported type for Windows registry property `" + name + "' key: `" + file + "'"; getProcessLogger()->warning(os.str()); continue; } string value; wstring valueW = wstring(reinterpret_cast(&dataBuf[0]), (dataBufSize / sizeof(wchar_t)) - 1); if(keyType == REG_SZ) { value = IceUtil::wstringToString(valueW); } else // keyType == REG_EXPAND_SZ { vector expandedValue(1024); DWORD sz = ExpandEnvironmentStringsW(valueW.c_str(), &expandedValue[0], static_cast(expandedValue.size())); if(sz >= expandedValue.size()) { expandedValue.resize(sz + 1); if(ExpandEnvironmentStringsW(valueW.c_str(), &expandedValue[0], static_cast(expandedValue.size())) == 0) { ostringstream os; os << "could not expand variable in property `" << name << "', key: `" + file + "':\n"; os << IceUtilInternal::lastErrorToString(); getProcessLogger()->warning(os.str()); continue; } } value = IceUtil::wstringToString(wstring(&expandedValue[0], sz -1)); } value = Ice::UTF8ToNative(_converter, value); setProperty(name, value); } } catch(...) { RegCloseKey(iceKey); throw; } RegCloseKey(iceKey); } else #endif { IceUtilInternal::ifstream in(Ice::nativeToUTF8(_converter, file)); if(!in) { FileException ex(__FILE__, __LINE__); ex.path = file; ex.error = getSystemErrno(); throw ex; } string line; bool firstLine = true; while(getline(in, line)) { // // Skip UTF8 BOM if present. // if(firstLine) { const unsigned char UTF8_BOM[3] = {0xEF, 0xBB, 0xBF}; if(line.size() >= 3 && static_cast(line[0]) == UTF8_BOM[0] && static_cast(line[1]) == UTF8_BOM[1] && static_cast(line[2]) == UTF8_BOM[2]) { line = line.substr(3); } firstLine = false; } parseLine(line, _converter); } } } PropertiesPtr Ice::PropertiesI::clone() { IceUtil::Mutex::Lock sync(*this); return new PropertiesI(this); } set Ice::PropertiesI::getUnusedProperties() { IceUtil::Mutex::Lock sync(*this); set unusedProperties; for(map::const_iterator p = _properties.begin(); p != _properties.end(); ++p) { if(!p->second.used) { unusedProperties.insert(p->first); } } return unusedProperties; } Ice::PropertiesI::PropertiesI(const PropertiesI* p) : _properties(p->_properties), _converter(p->_converter) { } Ice::PropertiesI::PropertiesI(const StringConverterPtr& converter) : _converter(converter) { } Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, const StringConverterPtr& converter) : _converter(converter) { if(defaults != 0) { _properties = static_cast(defaults.get())->_properties; } StringSeq::iterator q = args.begin(); map::iterator p = _properties.find("Ice.ProgramName"); if(p == _properties.end()) { if(q != args.end()) { // // Use the first argument as the value for Ice.ProgramName. Replace // any backslashes in this value with forward slashes, in case this // value is used by the event logger. // string name = *q; replace(name.begin(), name.end(), '\\', '/'); PropertyValue pv(name, true); _properties["Ice.ProgramName"] = pv; } } else { p->second.used = true; } StringSeq tmp; bool loadConfigFiles = false; while(q != args.end()) { string s = *q; if(s.find("--Ice.Config") == 0) { if(s.find('=') == string::npos) { s += "=1"; } parseLine(s.substr(2), 0); loadConfigFiles = true; } else { tmp.push_back(s); } ++q; } args = tmp; if(!loadConfigFiles) { // // If Ice.Config is not set, load from ICE_CONFIG (if set) // loadConfigFiles = (_properties.find("Ice.Config") == _properties.end()); } if(loadConfigFiles) { loadConfig(); } args = parseIceCommandLineOptions(args); } void Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& converter) { string key; string value; enum ParseState { Key , Value }; ParseState state = Key; string whitespace; string escapedspace; bool finished = false; for(string::size_type i = 0; i < line.size(); ++i) { char c = line[i]; switch(state) { case Key: { switch(c) { case '\\': if(i < line.length() - 1) { c = line[++i]; switch(c) { case '\\': case '#': case '=': key += whitespace; whitespace.clear(); key += c; break; case ' ': if(key.length() != 0) { whitespace += c; } break; default: key += whitespace; whitespace.clear(); key += '\\'; key += c; break; } } else { key += whitespace; key += c; } break; case ' ': case '\t': case '\r': case '\n': if(key.length() != 0) { whitespace += c; } break; case '=': whitespace.clear(); state = Value; break; case '#': finished = true; break; default: key += whitespace; whitespace.clear(); key += c; break; } break; } case Value: { switch(c) { case '\\': if(i < line.length() - 1) { c = line[++i]; switch(c) { case '\\': case '#': case '=': value += value.length() == 0 ? escapedspace : whitespace; whitespace.clear(); escapedspace.clear(); value += c; break; case ' ': whitespace += c; escapedspace += c; break; default: value += value.length() == 0 ? escapedspace : whitespace; whitespace.clear(); escapedspace.clear(); value += '\\'; value += c; break; } } else { value += value.length() == 0 ? escapedspace : whitespace; value += c; } break; case ' ': case '\t': case '\r': case '\n': if(value.length() != 0) { whitespace += c; } break; case '#': value += escapedspace; finished = true; break; default: value += value.length() == 0 ? escapedspace : whitespace; whitespace.clear(); escapedspace.clear(); value += c; break; } break; } } if(finished) { break; } } value += escapedspace; if((state == Key && key.length() != 0) || (state == Value && key.length() == 0)) { getProcessLogger()->warning("invalid config file entry: \"" + line + "\""); return; } else if(key.length() == 0) { return; } key = Ice::UTF8ToNative(converter, key); value = Ice::UTF8ToNative(converter, value); setProperty(key, value); } void Ice::PropertiesI::loadConfig() { string value = getProperty("Ice.Config"); #ifndef ICE_OS_WINRT // // WinRT cannot access environment variables if(value.empty() || value == "1") { # ifdef _WIN32 vector v(256); DWORD ret = GetEnvironmentVariableW(L"ICE_CONFIG", &v[0], static_cast(v.size())); if(ret >= v.size()) { v.resize(ret + 1); ret = GetEnvironmentVariableW(L"ICE_CONFIG", &v[0], static_cast(v.size())); } if(ret > 0) { value = Ice::UTF8ToNative(_converter, IceUtil::wstringToString(wstring(&v[0], ret))); } else { value = ""; } # else const char* s = getenv("ICE_CONFIG"); if(s && *s != '\0') { value = s; } # endif } #endif if(!value.empty()) { vector files; IceUtilInternal::splitString(value, ",", files); for(vector::const_iterator i = files.begin(); i != files.end(); ++i) { load(IceUtilInternal::trim(*i)); } } PropertyValue pv(value, true); _properties["Ice.Config"] = pv; } Ice-3.5.1/cpp/src/Ice/CommunicatorI.cpp0000644000076400007640000002700512223561476015724 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; namespace IceInternal { IceUtil::Handle theCollector = 0; } namespace { struct GarbageCollectorStats { GarbageCollectorStats() : runs(0), examined(0), collected(0) { } int runs; int examined; int collected; IceUtil::Time time; }; int communicatorCount = 0; IceUtil::Mutex* gcMutex = 0; GarbageCollectorStats gcStats; int gcTraceLevel; string gcTraceCat; int gcInterval; bool gcHasPriority; int gcThreadPriority; class Init { public: Init() { gcMutex = new IceUtil::Mutex; } ~Init() { delete gcMutex; gcMutex = 0; } }; Init init; void printGCStats(const IceInternal::GCStats& stats) { if(gcTraceLevel) { if(gcTraceLevel > 1) { Trace out(getProcessLogger(), gcTraceCat); out << stats.collected << "/" << stats.examined << ", " << stats.time * 1000 << "ms"; } ++gcStats.runs; gcStats.examined += stats.examined; gcStats.collected += stats.collected; gcStats.time += stats.time; } } } void Ice::CommunicatorI::destroy() { if(_instance && _instance->destroy()) { IceUtilInternal::MutexPtrLock sync(gcMutex); // // Wait for the collector thread to stop if this is the last communicator // to be destroyed. // bool last = (--communicatorCount == 0); if(last && gcInterval > 0 && theCollector) { theCollector->stop(); } if(theCollector) { theCollector->collectGarbage(); // Collect whenever a communicator is destroyed. } if(last) { if(gcTraceLevel) { Trace out(getProcessLogger(), gcTraceCat); out << "totals: " << gcStats.collected << "/" << gcStats.examined << ", " << gcStats.time * 1000 << "ms" << ", " << gcStats.runs << " run"; if(gcStats.runs != 1) { out << "s"; } } theCollector = 0; // Force destruction of the collector. } } } void Ice::CommunicatorI::shutdown() { _instance->objectAdapterFactory()->shutdown(); } void Ice::CommunicatorI::waitForShutdown() { _instance->objectAdapterFactory()->waitForShutdown(); } bool Ice::CommunicatorI::isShutdown() const { return _instance->objectAdapterFactory()->isShutdown(); } ObjectPrx Ice::CommunicatorI::stringToProxy(const string& s) const { return _instance->proxyFactory()->stringToProxy(s); } string Ice::CommunicatorI::proxyToString(const ObjectPrx& proxy) const { return _instance->proxyFactory()->proxyToString(proxy); } ObjectPrx Ice::CommunicatorI::propertyToProxy(const string& p) const { return _instance->proxyFactory()->propertyToProxy(p); } PropertyDict Ice::CommunicatorI::proxyToProperty(const ObjectPrx& proxy, const string& property) const { return _instance->proxyFactory()->proxyToProperty(proxy, property); } Identity Ice::CommunicatorI::stringToIdentity(const string& s) const { return _instance->stringToIdentity(s); } string Ice::CommunicatorI::identityToString(const Identity& ident) const { return _instance->identityToString(ident); } ObjectAdapterPtr Ice::CommunicatorI::createObjectAdapter(const string& name) { return _instance->objectAdapterFactory()->createObjectAdapter(name, 0); } ObjectAdapterPtr Ice::CommunicatorI::createObjectAdapterWithEndpoints(const string& name, const string& endpoints) { string oaName = name; if(oaName.empty()) { oaName = IceUtil::generateUUID(); } getProperties()->setProperty(oaName + ".Endpoints", endpoints); return _instance->objectAdapterFactory()->createObjectAdapter(oaName, 0); } ObjectAdapterPtr Ice::CommunicatorI::createObjectAdapterWithRouter(const string& name, const RouterPrx& router) { string oaName = name; if(oaName.empty()) { oaName = IceUtil::generateUUID(); } PropertyDict properties = proxyToProperty(router, oaName + ".Router"); for(PropertyDict::const_iterator p = properties.begin(); p != properties.end(); ++p) { getProperties()->setProperty(p->first, p->second); } return _instance->objectAdapterFactory()->createObjectAdapter(oaName, router); } void Ice::CommunicatorI::addObjectFactory(const ObjectFactoryPtr& factory, const string& id) { _instance->servantFactoryManager()->add(factory, id); } ObjectFactoryPtr Ice::CommunicatorI::findObjectFactory(const string& id) const { return _instance->servantFactoryManager()->find(id); } PropertiesPtr Ice::CommunicatorI::getProperties() const { return _instance->initializationData().properties; } LoggerPtr Ice::CommunicatorI::getLogger() const { return _instance->initializationData().logger; } StatsPtr Ice::CommunicatorI::getStats() const { return _instance->initializationData().stats; } Ice::Instrumentation::CommunicatorObserverPtr Ice::CommunicatorI::getObserver() const { return _instance->getObserver(); } RouterPrx Ice::CommunicatorI::getDefaultRouter() const { return _instance->referenceFactory()->getDefaultRouter(); } void Ice::CommunicatorI::setDefaultRouter(const RouterPrx& router) { _instance->setDefaultRouter(router); } LocatorPrx Ice::CommunicatorI::getDefaultLocator() const { return _instance->referenceFactory()->getDefaultLocator(); } void Ice::CommunicatorI::setDefaultLocator(const LocatorPrx& locator) { _instance->setDefaultLocator(locator); } Ice::ImplicitContextPtr Ice::CommunicatorI::getImplicitContext() const { return _instance->getImplicitContext(); } PluginManagerPtr Ice::CommunicatorI::getPluginManager() const { return _instance->pluginManager(); } void Ice::CommunicatorI::flushBatchRequests() { AsyncResultPtr r = begin_flushBatchRequests(); end_flushBatchRequests(r); } AsyncResultPtr Ice::CommunicatorI::begin_flushBatchRequests() { return __begin_flushBatchRequests(::IceInternal::__dummyCallback, 0); } AsyncResultPtr Ice::CommunicatorI::begin_flushBatchRequests(const CallbackPtr& cb, const LocalObjectPtr& cookie) { return __begin_flushBatchRequests(cb, cookie); } AsyncResultPtr Ice::CommunicatorI::begin_flushBatchRequests(const Callback_Communicator_flushBatchRequestsPtr& cb, const LocalObjectPtr& cookie) { return __begin_flushBatchRequests(cb, cookie); } namespace { const ::std::string __flushBatchRequests_name = "flushBatchRequests"; } AsyncResultPtr Ice::CommunicatorI::__begin_flushBatchRequests(const IceInternal::CallbackBasePtr& cb, const LocalObjectPtr& cookie) { OutgoingConnectionFactoryPtr connectionFactory = _instance->outgoingConnectionFactory(); ObjectAdapterFactoryPtr adapterFactory = _instance->objectAdapterFactory(); // // This callback object receives the results of all invocations // of Connection::begin_flushBatchRequests. // CommunicatorBatchOutgoingAsyncPtr result = new CommunicatorBatchOutgoingAsync(this, _instance, __flushBatchRequests_name, cb, cookie); connectionFactory->flushAsyncBatchRequests(result); adapterFactory->flushAsyncBatchRequests(result); // // Inform the callback that we have finished initiating all of the // flush requests. // result->ready(); return result; } void Ice::CommunicatorI::end_flushBatchRequests(const AsyncResultPtr& r) { AsyncResult::__check(r, this, __flushBatchRequests_name); r->__wait(); } ObjectPrx Ice::CommunicatorI::getAdmin() const { return _instance->getAdmin(); } void Ice::CommunicatorI::addAdminFacet(const Ice::ObjectPtr& servant, const string& facet) { _instance->addAdminFacet(servant, facet); } Ice::ObjectPtr Ice::CommunicatorI::removeAdminFacet(const string& facet) { return _instance->removeAdminFacet(facet); } Ice::ObjectPtr Ice::CommunicatorI::findAdminFacet(const string& facet) { return _instance->findAdminFacet(facet); } Ice::CommunicatorI::CommunicatorI(const InitializationData& initData) { __setNoDelete(true); try { const_cast(_instance) = new Instance(this, initData); // // Keep a reference to the dynamic library list to ensure // the libraries are not unloaded until this Communicator's // destructor is invoked. // const_cast(_dynamicLibraryList) = _instance->dynamicLibraryList(); // // If this is the first communicator that is created, use that communicator's // property settings to determine whether to start the garbage collector. // We remember that communicator's trace and logger settings so the garbage // collector can continue to log messages even if the first communicator that // is created isn't the last communicator to be destroyed. // IceUtilInternal::MutexPtrLock sync(gcMutex); static bool gcOnce = true; if(gcOnce) { gcTraceLevel = _instance->traceLevels()->gc; gcTraceCat = _instance->traceLevels()->gcCat; gcInterval = _instance->initializationData().properties->getPropertyAsInt("Ice.GC.Interval"); gcHasPriority = _instance->initializationData().properties->getProperty("Ice.ThreadPriority") != ""; gcThreadPriority = _instance->initializationData().properties->getPropertyAsInt("Ice.ThreadPriority"); gcOnce = false; } if(++communicatorCount == 1) { IceUtil::Handle collector = new IceInternal::GC(gcInterval, printGCStats); if(gcInterval > 0) { if(gcHasPriority) { collector->start(0, gcThreadPriority); } else { collector->start(); } } // // Assign only if start() succeeds, if it fails this makes sure stop isn't called in destroy(). // theCollector = collector; } } catch(...) { destroy(); __setNoDelete(false); throw; } __setNoDelete(false); } Ice::CommunicatorI::~CommunicatorI() { if(!_instance->destroyed()) { Warning out(_instance->initializationData().logger); out << "Ice::Communicator::destroy() has not been called"; } } void Ice::CommunicatorI::finishSetup(int& argc, char* argv[]) { try { _instance->finishSetup(argc, argv); } catch(...) { destroy(); throw; } } Ice-3.5.1/cpp/src/Ice/ConnectionFactory.h0000644000076400007640000001633512223561476016253 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECTION_FACTORY_H #define ICE_CONNECTION_FACTORY_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace Ice { class LocalException; class ObjectAdapterI; } namespace IceInternal { class OutgoingConnectionFactory : virtual public IceUtil::Shared, public IceUtil::Monitor { public: class CreateConnectionCallback : virtual public IceUtil::Shared { public: virtual void setConnection(const Ice::ConnectionIPtr&, bool) = 0; virtual void setException(const Ice::LocalException&) = 0; }; typedef IceUtil::Handle CreateConnectionCallbackPtr; void destroy(); void updateConnectionObservers(); void waitUntilFinished(); Ice::ConnectionIPtr create(const std::vector&, bool, Ice::EndpointSelectionType, bool&); void create(const std::vector&, bool, Ice::EndpointSelectionType, const CreateConnectionCallbackPtr&); void setRouterInfo(const RouterInfoPtr&); void removeAdapter(const Ice::ObjectAdapterPtr&); void flushAsyncBatchRequests(const CommunicatorBatchOutgoingAsyncPtr&); private: OutgoingConnectionFactory(const Ice::CommunicatorPtr&, const InstancePtr&); virtual ~OutgoingConnectionFactory(); friend class Instance; struct ConnectorInfo { ConnectorInfo(const ConnectorPtr& c, const EndpointIPtr& e) : connector(c), endpoint(e) { } bool operator==(const ConnectorInfo& other) const; ConnectorPtr connector; EndpointIPtr endpoint; }; class ConnectCallback : public Ice::ConnectionI::StartCallback, public IceInternal::EndpointI_connectors { public: ConnectCallback(const OutgoingConnectionFactoryPtr&, const std::vector&, bool, const CreateConnectionCallbackPtr&, Ice::EndpointSelectionType); virtual void connectionStartCompleted(const Ice::ConnectionIPtr&); virtual void connectionStartFailed(const Ice::ConnectionIPtr&, const Ice::LocalException&); virtual void connectors(const std::vector&); virtual void exception(const Ice::LocalException&); void getConnectors(); void nextEndpoint(); void getConnection(); void nextConnector(); void setConnection(const Ice::ConnectionIPtr&, bool); void setException(const Ice::LocalException&); bool hasConnector(const ConnectorInfo&); bool removeConnectors(const std::vector&); void removeFromPending(); bool operator<(const ConnectCallback&) const; private: const OutgoingConnectionFactoryPtr _factory; const std::vector _endpoints; const bool _hasMore; const CreateConnectionCallbackPtr _callback; const Ice::EndpointSelectionType _selType; Ice::Instrumentation::ObserverPtr _observer; std::vector::const_iterator _endpointsIter; std::vector _connectors; std::vector::const_iterator _iter; }; typedef IceUtil::Handle ConnectCallbackPtr; friend class ConnectCallback; std::vector applyOverrides(const std::vector&); Ice::ConnectionIPtr findConnection(const std::vector&, bool&); void incPendingConnectCount(); void decPendingConnectCount(); Ice::ConnectionIPtr getConnection(const std::vector&, const ConnectCallbackPtr&, bool&); void finishGetConnection(const std::vector&, const ConnectorInfo&, const Ice::ConnectionIPtr&, const ConnectCallbackPtr&); void finishGetConnection(const std::vector&, const Ice::LocalException&, const ConnectCallbackPtr&); bool addToPending(const ConnectCallbackPtr&, const std::vector&); void removeFromPending(const ConnectCallbackPtr&, const std::vector&); Ice::ConnectionIPtr findConnection(const std::vector&, bool&); Ice::ConnectionIPtr createConnection(const TransceiverPtr&, const ConnectorInfo&); void handleException(const Ice::LocalException&, bool); void handleConnectionException(const Ice::LocalException&, bool); Ice::CommunicatorPtr _communicator; const InstancePtr _instance; const ConnectionReaperPtr _reaper; bool _destroyed; std::multimap _connections; std::map > _pending; std::multimap _connectionsByEndpoint; int _pendingConnectCount; }; class IncomingConnectionFactory : public EventHandler, public Ice::ConnectionI::StartCallback, public IceUtil::Monitor { public: void activate(); void hold(); void destroy(); void updateConnectionObservers(); void waitUntilHolding() const; void waitUntilFinished(); EndpointIPtr endpoint() const; std::list connections() const; void flushAsyncBatchRequests(const CommunicatorBatchOutgoingAsyncPtr&); // // Operations from EventHandler // #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) virtual bool startAsync(SocketOperation); virtual bool finishAsync(SocketOperation); #endif virtual void message(ThreadPoolCurrent&); virtual void finished(ThreadPoolCurrent&); virtual std::string toString() const; virtual NativeInfoPtr getNativeInfo(); virtual void connectionStartCompleted(const Ice::ConnectionIPtr&); virtual void connectionStartFailed(const Ice::ConnectionIPtr&, const Ice::LocalException&); private: IncomingConnectionFactory(const InstancePtr&, const EndpointIPtr&, const Ice::ObjectAdapterPtr&); void initialize(const std::string&); virtual ~IncomingConnectionFactory(); friend class Ice::ObjectAdapterI; enum State { StateActive, StateHolding, StateClosed, StateFinished }; void setState(State); const InstancePtr _instance; const ConnectionReaperPtr _reaper; const AcceptorPtr _acceptor; const TransceiverPtr _transceiver; const EndpointIPtr _endpoint; Ice::ObjectAdapterPtr _adapter; const bool _warn; std::set _connections; State _state; }; } #endif Ice-3.5.1/cpp/src/Ice/IncomingRequest.h0000644000076400007640000000150312223561476015727 0ustar mesmes// ********************************************************************** // // 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 ICE_INCOMING_REQUEST_H #define ICE_INCOMING_REQUEST_H #include #include namespace IceInternal { // // Adapts Incoming to Ice::Request // (the goal here is to avoid adding any virtual function to Incoming) // class ICE_API IncomingRequest : public Ice::Request { public: IncomingRequest(Incoming& in) : _in(in) { } virtual bool isCollocated(); virtual const Ice::Current& getCurrent(); Incoming& _in; }; } #endif Ice-3.5.1/cpp/src/Ice/AcceptorF.h0000644000076400007640000000110412223561476014456 0ustar mesmes// ********************************************************************** // // 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 ICE_ACCEPTOR_F_H #define ICE_ACCEPTOR_F_H #include #include namespace IceInternal { class Acceptor; ICE_API IceUtil::Shared* upCast(Acceptor*); typedef Handle AcceptorPtr; } #endif Ice-3.5.1/cpp/src/Ice/LocatorInfo.h0000644000076400007640000001325412223561476015040 0ustar mesmes// ********************************************************************** // // 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 ICE_LOCATOR_INFO_H #define ICE_LOCATOR_INFO_H #include #include #include #include #include #include #include #include #include #include #include #include namespace IceInternal { class LocatorManager : public IceUtil::Shared, public IceUtil::Mutex { public: LocatorManager(const Ice::PropertiesPtr&); void destroy(); // // Returns locator info for a given locator. Automatically creates // the locator info if it doesn't exist yet. // LocatorInfoPtr get(const Ice::LocatorPrx&); private: const bool _background; std::map _table; std::map::iterator _tableHint; std::map, LocatorTablePtr> _locatorTables; }; class LocatorTable : public IceUtil::Shared, public IceUtil::Mutex { public: LocatorTable(); void clear(); bool getAdapterEndpoints(const std::string&, int, ::std::vector&); void addAdapterEndpoints(const std::string&, const ::std::vector&); ::std::vector removeAdapterEndpoints(const std::string&); bool getObjectReference(const Ice::Identity&, int, ReferencePtr&); void addObjectReference(const Ice::Identity&, const ReferencePtr&); ReferencePtr removeObjectReference(const Ice::Identity&); private: bool checkTTL(const IceUtil::Time&, int) const; std::map > > _adapterEndpointsMap; std::map > _objectMap; }; class LocatorInfo : public IceUtil::Shared, public IceUtil::Mutex { public: class GetEndpointsCallback : virtual public IceUtil::Shared { public: virtual void setEndpoints(const std::vector&, bool) = 0; virtual void setException(const Ice::LocalException&) = 0; }; typedef IceUtil::Handle GetEndpointsCallbackPtr; class RequestCallback : virtual public IceUtil::Shared { public: RequestCallback(const ReferencePtr&, int, const GetEndpointsCallbackPtr&); void response(const LocatorInfoPtr&, const Ice::ObjectPrx&); void exception(const LocatorInfoPtr&, const Ice::Exception&); private: const ReferencePtr _ref; const int _ttl; const GetEndpointsCallbackPtr _callback; }; typedef IceUtil::Handle RequestCallbackPtr; class Request : virtual public IceUtil::Shared { public: void addCallback(const ReferencePtr&, const ReferencePtr&, int, const GetEndpointsCallbackPtr&); std::vector getEndpoints(const ReferencePtr&, const ReferencePtr&, int, bool&); void response(const Ice::ObjectPrx&); void exception(const Ice::Exception&); protected: Request(const LocatorInfoPtr&, const ReferencePtr&); virtual void send(bool) = 0; const LocatorInfoPtr _locatorInfo; const ReferencePtr _ref; private: IceUtil::Monitor _monitor; std::vector _callbacks; std::vector _wellKnownRefs; bool _sent; bool _response; Ice::ObjectPrx _proxy; IceUtil::UniquePtr _exception; }; typedef IceUtil::Handle RequestPtr; LocatorInfo(const Ice::LocatorPrx&, const LocatorTablePtr&, bool); void destroy(); bool operator==(const LocatorInfo&) const; bool operator!=(const LocatorInfo&) const; bool operator<(const LocatorInfo&) const; const Ice::LocatorPrx& getLocator() const { // // No mutex lock necessary, _locator is immutable. // return _locator; } Ice::LocatorRegistryPrx getLocatorRegistry(); std::vector getEndpoints(const ReferencePtr& ref, int ttl, bool& cached) { return getEndpoints(ref, 0, ttl, cached); } void getEndpoints(const ReferencePtr& ref, int ttl, const GetEndpointsCallbackPtr& cb) { getEndpoints(ref, 0, ttl, cb); } std::vector getEndpoints(const ReferencePtr&, const ReferencePtr&, int, bool&); void getEndpoints(const ReferencePtr&, const ReferencePtr&, int, const GetEndpointsCallbackPtr&); void clearCache(const ReferencePtr&); private: void getEndpointsException(const ReferencePtr&, const Ice::Exception&); void getEndpointsTrace(const ReferencePtr&, const std::vector&, bool); void trace(const std::string&, const ReferencePtr&, const std::vector&); RequestPtr getAdapterRequest(const ReferencePtr&); RequestPtr getObjectRequest(const ReferencePtr&); void finishRequest(const ReferencePtr&, const std::vector&, const Ice::ObjectPrx&, bool); friend class Request; friend class RequestCallback; const Ice::LocatorPrx _locator; Ice::LocatorRegistryPrx _locatorRegistry; const LocatorTablePtr _table; const bool _background; std::map _adapterRequests; std::map _objectRequests; }; } #endif Ice-3.5.1/cpp/src/Ice/ImplicitContextI.cpp0000644000076400007640000003237612223561476016412 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace Ice; namespace { class SharedImplicitContext : public ImplicitContextI { public: virtual Context getContext() const; virtual void setContext(const Context&); virtual bool containsKey(const string&) const; virtual string get(const string&) const; virtual string put(const string&, const string&); virtual string remove(const string&); virtual void write(const Context&, ::IceInternal::BasicStream*) const; virtual void combine(const Context&, Context&) const; private: Context _context; IceUtil::Mutex _mutex; }; #ifndef ICE_OS_WINRT class PerThreadImplicitContext : public ImplicitContextI { public: PerThreadImplicitContext(); virtual ~PerThreadImplicitContext(); virtual Context getContext() const; virtual void setContext(const Context&); virtual bool containsKey(const string&) const; virtual string get(const string&) const; virtual string put(const string&, const string&); virtual string remove(const string&); virtual void write(const Context&, ::IceInternal::BasicStream*) const; virtual void combine(const Context&, Context&) const; struct Slot { Slot() : context(0), owner(-1) // just to avoid UMR; a random value would work as well { } Context* context; long owner; }; // // Each thread maintains a SlotVector. Each PerThreadImplicitContext instance // is assigned a slot in this vector. // typedef std::vector SlotVector; // // We remember which slot-indices are in use (to be able to reuse indices) // typedef std::vector IndexInUse; static IndexInUse* _indexInUse; static IceUtil::Mutex* _mutex; static long _nextId; #ifdef _WIN32 static DWORD _key; #else static pthread_key_t _key; #endif private: Context* getThreadContext(bool) const; void clearThreadContext() const; size_t _index; // index in all SlotVector long _id; // corresponds to owner in the Slot }; #endif } extern "C" void iceImplicitContextThreadDestructor(void*); /*static*/ ImplicitContextI* ImplicitContextI::create(const std::string& kind) { if(kind == "None" || kind == "") { return 0; } else if(kind == "Shared") { return new SharedImplicitContext; } else if(kind == "PerThread") { #ifndef ICE_OS_WINRT return new PerThreadImplicitContext; #else throw InitializationException(__FILE__, __LINE__, "'PerThread' Ice.ImplicitContext isn't supported for WinRT."); return 0; // Keep the compiler happy. #endif } else { throw Ice::InitializationException( __FILE__, __LINE__, "'" + kind + "' is not a valid value for Ice.ImplicitContext"); return 0; // Keep the compiler happy. } } #if defined(_WIN32) && !defined(ICE_OS_WINRT) void ImplicitContextI::cleanupThread() { if(PerThreadImplicitContext::_nextId > 0) { iceImplicitContextThreadDestructor(TlsGetValue(PerThreadImplicitContext::_key)); } } #endif // // SharedImplicitContext implementation // Context SharedImplicitContext::getContext() const { IceUtil::Mutex::Lock lock(_mutex); return _context; } void SharedImplicitContext::setContext(const Context& newContext) { IceUtil::Mutex::Lock lock(_mutex); _context = newContext; } bool SharedImplicitContext::containsKey(const string& k) const { IceUtil::Mutex::Lock lock(_mutex); Context::const_iterator p = _context.find(k); return p != _context.end(); } string SharedImplicitContext::get(const string& k) const { IceUtil::Mutex::Lock lock(_mutex); Context::const_iterator p = _context.find(k); if(p == _context.end()) { return ""; } return p->second; } string SharedImplicitContext::put(const string& k, const string& v) { IceUtil::Mutex::Lock lock(_mutex); string& val = _context[k]; string oldVal = val; val = v; return oldVal; } string SharedImplicitContext::remove(const string& k) { IceUtil::Mutex::Lock lock(_mutex); Context::iterator p = _context.find(k); if(p == _context.end()) { return ""; } else { string oldVal = p->second; _context.erase(p); return oldVal; } } void SharedImplicitContext::write(const Context& proxyCtx, ::IceInternal::BasicStream* s) const { IceUtil::Mutex::Lock lock(_mutex); if(proxyCtx.size() == 0) { s->write(_context); } else if(_context.size() == 0) { lock.release(); s->write(proxyCtx); } else { Context combined = proxyCtx; combined.insert(_context.begin(), _context.end()); lock.release(); s->write(combined); } } void SharedImplicitContext::combine(const Context& proxyCtx, Context& ctx) const { IceUtil::Mutex::Lock lock(_mutex); if(proxyCtx.size() == 0) { ctx = _context; } else if(_context.size() == 0) { ctx = proxyCtx; } else { ctx = proxyCtx; ctx.insert(_context.begin(), _context.end()); } } // // PerThreadImplicitContext implementation // #ifndef ICE_OS_WINRT long PerThreadImplicitContext::_nextId; PerThreadImplicitContext::IndexInUse* PerThreadImplicitContext::_indexInUse; IceUtil::Mutex* PerThreadImplicitContext::_mutex = 0; namespace { class Init { public: Init() { PerThreadImplicitContext::_mutex = new IceUtil::Mutex; } ~Init() { delete PerThreadImplicitContext::_mutex; PerThreadImplicitContext::_mutex = 0; } }; Init init; } # ifdef _WIN32 DWORD PerThreadImplicitContext::_key; # else pthread_key_t PerThreadImplicitContext::_key; # endif PerThreadImplicitContext::PerThreadImplicitContext() { IceUtilInternal::MutexPtrLock lock(_mutex); _id = _nextId++; if(_id == 0) { // // Initialize; note that we never dealloc this key (it would be // complex, and since it's a static variable, it's not really a leak) // # ifdef _WIN32 _key = TlsAlloc(); if(_key == TLS_OUT_OF_INDEXES) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } # else int err = pthread_key_create(&_key, &iceImplicitContextThreadDestructor); if(err != 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err); } # endif } // // Now grabs an index // if(_indexInUse == 0) { _indexInUse = new IndexInUse(1); } size_t i = 0; while(i < _indexInUse->size() && (*_indexInUse)[i]) { i++; } if(i == _indexInUse->size()) { _indexInUse->resize(i + 1); } (*_indexInUse)[i] = true; _index = i; } PerThreadImplicitContext::~PerThreadImplicitContext() { IceUtilInternal::MutexPtrLock lock(_mutex); (*_indexInUse)[_index] = false; if(find(_indexInUse->begin(), _indexInUse->end(), true) == _indexInUse->end()) { delete _indexInUse; _indexInUse = 0; } } Context* PerThreadImplicitContext::getThreadContext(bool allocate) const { # ifdef _WIN32 SlotVector* sv = static_cast(TlsGetValue(_key)); # else SlotVector* sv = static_cast(pthread_getspecific(_key)); # endif if(sv == 0) { if(!allocate) { return 0; } sv = new SlotVector(_index + 1); # ifdef _WIN32 if(TlsSetValue(_key, sv) == 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } # else if(int err = pthread_setspecific(_key, sv)) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err); } # endif } else { if(sv->size() <= _index) { if(!allocate) { return 0; } else { sv->resize(_index + 1); } } } Slot& slot = (*sv)[_index]; if(slot.context != 0) { if(slot.owner != _id) { // // Reuse the slot from another (dead) communicator // slot.context->clear(); slot.owner = _id; } // // else keep this slot.context // } else { if(allocate) { slot.context = new Context; slot.owner = _id; } // // else keep null slot.context // } return slot.context; } void PerThreadImplicitContext::clearThreadContext() const { # ifdef _WIN32 SlotVector* sv = static_cast(TlsGetValue(_key)); # else SlotVector* sv = static_cast(pthread_getspecific(_key)); # endif if(sv != 0 && _index < sv->size()) { delete (*sv)[_index].context; (*sv)[_index].context = 0; // // Trim tailing empty contexts. // size_t i = sv->size(); bool clear = true; while(i != 0) { i--; if((*sv)[i].context != 0) { clear = false; break; } } // // If we did not find any contexts, delete the SlotVector. // if(clear) { delete sv; # ifdef _WIN32 if(TlsSetValue(_key, 0) == 0) { IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } # else if(int err = pthread_setspecific(_key, 0)) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err); } # endif } else { sv->resize(i + 1); } } } Context PerThreadImplicitContext::getContext() const { Context* ctx = getThreadContext(false); if(ctx == 0) { return Context(); } else { return *ctx; } } void PerThreadImplicitContext::setContext(const Context& newContext) { if(newContext.size() == 0) { clearThreadContext(); } else { Context* ctx = getThreadContext(true); assert(ctx != 0); *ctx = newContext; } } bool PerThreadImplicitContext::containsKey(const string& k) const { const Context* ctx = getThreadContext(false); if(ctx == 0) { return false; } Context::const_iterator p = ctx->find(k); return p != ctx->end(); } string PerThreadImplicitContext::get(const string& k) const { const Context* ctx = getThreadContext(false); if(ctx == 0) { return ""; } Context::const_iterator p = ctx->find(k); if(p == ctx->end()) { return ""; } return p->second; } string PerThreadImplicitContext::put(const string& k, const string& v) { Context* ctx = getThreadContext(true); string& val = (*ctx)[k]; string oldVal = val; val = v; return oldVal; } string PerThreadImplicitContext::remove(const string& k) { Context* ctx = getThreadContext(false); if(ctx == 0) { return ""; } Context::iterator p = ctx->find(k); if(p == ctx->end()) { return ""; } else { string oldVal = p->second; ctx->erase(p); if(ctx->size() == 0) { clearThreadContext(); } return oldVal; } } void PerThreadImplicitContext::write(const Context& proxyCtx, ::IceInternal::BasicStream* s) const { const Context* threadCtx = getThreadContext(false); if(threadCtx == 0 || threadCtx->size() == 0) { s->write(proxyCtx); } else if(proxyCtx.size() == 0) { s->write(*threadCtx); } else { Context combined = proxyCtx; combined.insert(threadCtx->begin(), threadCtx->end()); s->write(combined); } } void PerThreadImplicitContext::combine(const Context& proxyCtx, Context& ctx) const { const Context* threadCtx = getThreadContext(false); if(threadCtx == 0 || threadCtx->size() == 0) { ctx = proxyCtx; } else if(proxyCtx.size() == 0) { ctx = *threadCtx; } else { ctx = proxyCtx; ctx.insert(threadCtx->begin(), threadCtx->end()); } } extern "C" void iceImplicitContextThreadDestructor(void* v) { PerThreadImplicitContext::SlotVector* sv = static_cast(v); if(sv != 0) { // // Cleanup each slot // for(PerThreadImplicitContext::SlotVector::iterator p = sv->begin(); p != sv->end(); ++p) { delete p->context; } // // Then the vector // delete sv; } } #endif Ice-3.5.1/cpp/src/Ice/HashUtil.h0000644000076400007640000000254512223561476014343 0ustar mesmes// ********************************************************************** // // 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 ICE_HASH_UTIL_H #define ICE_HASH_UTIL_H namespace IceInternal { inline void hashAdd(Ice::Int& hashCode, Ice::Int value) { hashCode = ((hashCode << 5) + hashCode) ^ (2654435761u * value); } inline void hashAdd(Ice::Int& hashCode, bool value) { hashCode = ((hashCode << 5) + hashCode) ^ (value ? 1 : 0); } inline void hashAdd(Ice::Int& hashCode, const std::string& value) { for(std::string::const_iterator p = value.begin(); p != value.end(); ++p) { hashCode = ((hashCode << 5) + hashCode) ^ *p; } } template void hashAdd(Ice::Int& hashCode, const std::vector& seq) { for(typename std::vector::const_iterator p = seq.begin(); p != seq.end(); ++p) { hashAdd(hashCode, *p); } } template void hashAdd(Ice::Int& hashCode, const std::map& map) { for(typename std::map::const_iterator p = map.begin(); p != map.end(); ++p) { hashAdd(hashCode, p->first); hashAdd(hashCode, p->second); } } } #endif Ice-3.5.1/cpp/src/Ice/Direct.cpp0000644000076400007640000000701012223561476014357 0ustar mesmes// ********************************************************************** // // 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 #include // For inc/decDirectCount(). #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceInternal::Direct::Direct(const Current& current) : _current(current) { ObjectAdapterI* adapter = dynamic_cast(_current.adapter.get()); assert(adapter); // // Must call incDirectCount() first, because it checks for adapter // deactivation, and prevents deactivation completion until // decDirectCount() is called. This is important, because // getServantManager() may not be called afer deactivation // completion. // adapter->incDirectCount(); ServantManagerPtr servantManager = adapter->getServantManager(); assert(servantManager); _servant = servantManager->findServant(_current.id, _current.facet); if(!_servant) { _locator = servantManager->findServantLocator(_current.id.category); if(!_locator && !_current.id.category.empty()) { _locator = servantManager->findServantLocator(""); } if(_locator) { try { _servant = _locator->locate(_current, _cookie); } catch(...) { adapter->decDirectCount(); throw; } } } if(!_servant) { adapter->decDirectCount(); if(servantManager && servantManager->hasServant(_current.id)) { FacetNotExistException ex(__FILE__, __LINE__); ex.id = _current.id; ex.facet = _current.facet; ex.operation = _current.operation; throw ex; } else { ObjectNotExistException ex(__FILE__, __LINE__); ex.id = _current.id; ex.facet = _current.facet; ex.operation = _current.operation; throw ex; } } } bool IceInternal::Direct::isCollocated() { return true; } const Current& IceInternal::Direct::getCurrent() { return _current; } void IceInternal::Direct::throwUserException() { if(_userException.get() == 0) { assert(0); // should never happen throw Ice::UnknownUserException(__FILE__, __LINE__); } _userException->ice_throw(); } void IceInternal::Direct::setUserException(const Ice::UserException& ue) { _userException.reset(ue.ice_clone()); } void IceInternal::Direct::destroy() { // // NOTE: we can't do the following in the destructor because it // might throw. // ObjectAdapterI* adapter = dynamic_cast(_current.adapter.get()); assert(adapter); if(_locator && _servant) { try { _locator->finished(_current, _servant, _cookie); } catch(...) { adapter->decDirectCount(); throw; } } adapter->decDirectCount(); if(_userException.get()) { _userException->ice_throw(); } } const ObjectPtr& IceInternal::Direct::getServant() { return _servant; } Ice-3.5.1/cpp/src/Ice/EventHandlerF.h0000644000076400007640000000113612223561476015302 0ustar mesmes// ********************************************************************** // // 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 ICE_EVENT_HANDLER_F_H #define ICE_EVENT_HANDLER_F_H #include #include namespace IceInternal { class EventHandler; ICE_API IceUtil::Shared* upCast(EventHandler*); typedef Handle EventHandlerPtr; } #endif Ice-3.5.1/cpp/src/Ice/ConnectRequestHandler.cpp0000644000076400007640000003421412223561476017413 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace IceInternal; namespace { class FlushRequestsWithException : public DispatchWorkItem { public: FlushRequestsWithException(const InstancePtr& instance, const ConnectRequestHandlerPtr& handler, const Ice::LocalException& ex) : DispatchWorkItem(instance), _handler(handler), _exception(ex.ice_clone()) { } virtual void run() { _handler->flushRequestsWithException(*_exception.get()); } private: const ConnectRequestHandlerPtr _handler; const IceUtil::UniquePtr _exception; }; class FlushRequestsWithExceptionWrapper : public DispatchWorkItem { public: FlushRequestsWithExceptionWrapper(const InstancePtr& instance, const ConnectRequestHandlerPtr& handler, const LocalExceptionWrapper& ex) : DispatchWorkItem(instance), _handler(handler), _exception(ex) { } virtual void run() { _handler->flushRequestsWithException(_exception); } private: const ConnectRequestHandlerPtr _handler; const LocalExceptionWrapper _exception; }; class FlushSentRequests : public DispatchWorkItem { public: FlushSentRequests(const InstancePtr& instance, const vector& callbacks) : DispatchWorkItem(instance), _callbacks(callbacks) { } virtual void run() { for(vector::const_iterator p = _callbacks.begin(); p != _callbacks.end(); ++p) { (*p)->__sent(); } } private: vector _callbacks; }; }; ConnectRequestHandler::ConnectRequestHandler(const ReferencePtr& ref, const Ice::ObjectPrx& proxy, const Handle< ::IceDelegate::Ice::Object>& delegate) : RequestHandler(ref), _proxy(proxy), _delegate(delegate), _batchAutoFlush( ref->getInstance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.BatchAutoFlush", 1) > 0), _initialized(false), _flushing(false), _batchRequestInProgress(false), _batchRequestsSize(sizeof(requestBatchHdr)), _batchStream(ref->getInstance().get(), Ice::currentProtocolEncoding, _batchAutoFlush), _updateRequestHandler(false) { } ConnectRequestHandler::~ConnectRequestHandler() { } RequestHandlerPtr ConnectRequestHandler::connect() { _reference->getConnection(this); Lock sync(*this); if(initialized()) { assert(_connection); return new ConnectionRequestHandler(_reference, _connection, _compress); } else { _updateRequestHandler = true; // The proxy request handler will be updated when the connection is set. return this; } } void ConnectRequestHandler::prepareBatchRequest(BasicStream* os) { { Lock sync(*this); while(_batchRequestInProgress) { wait(); } if(!initialized()) { _batchRequestInProgress = true; _batchStream.swap(*os); return; } } _connection->prepareBatchRequest(os); } void ConnectRequestHandler::finishBatchRequest(BasicStream* os) { { Lock sync(*this); if(!initialized()) { assert(_batchRequestInProgress); _batchRequestInProgress = false; notifyAll(); _batchStream.swap(*os); if(!_batchAutoFlush && _batchStream.b.size() + _batchRequestsSize > _reference->getInstance()->messageSizeMax()) { Ex::throwMemoryLimitException(__FILE__, __LINE__, _batchStream.b.size() + _batchRequestsSize, _reference->getInstance()->messageSizeMax()); } _batchRequestsSize += _batchStream.b.size(); Request req; req.os = new BasicStream(_reference->getInstance().get(), Ice::currentProtocolEncoding, _batchAutoFlush); req.os->swap(_batchStream); _requests.push_back(req); return; } } _connection->finishBatchRequest(os, _compress); } void ConnectRequestHandler::abortBatchRequest() { { Lock sync(*this); if(!initialized()) { assert(_batchRequestInProgress); _batchRequestInProgress = false; notifyAll(); BasicStream dummy(_reference->getInstance().get(), Ice::currentProtocolEncoding, _batchAutoFlush); _batchStream.swap(dummy); _batchRequestsSize = sizeof(requestBatchHdr); return; } } _connection->abortBatchRequest(); } Ice::ConnectionI* ConnectRequestHandler::sendRequest(Outgoing* out) { // Must be called first, _compress might not be initialized before this returns. Ice::ConnectionIPtr connection = getConnection(true); assert(connection); if(!connection->sendRequest(out, _compress, _response) || _response) { return _connection.get(); // The request hasn't been sent or we're expecting a response. } else { return 0; // The request has been sent. } } AsyncStatus ConnectRequestHandler::sendAsyncRequest(const OutgoingAsyncPtr& out) { { Lock sync(*this); if(!initialized()) { Request req; req.out = out; _requests.push_back(req); return AsyncStatusQueued; } } return _connection->sendAsyncRequest(out, _compress, _response); } bool ConnectRequestHandler::flushBatchRequests(BatchOutgoing* out) { return getConnection(true)->flushBatchRequests(out); } AsyncStatus ConnectRequestHandler::flushAsyncBatchRequests(const BatchOutgoingAsyncPtr& out) { { Lock sync(*this); if(!initialized()) { Request req; req.batchOut = out; _requests.push_back(req); return AsyncStatusQueued; } } return _connection->flushAsyncBatchRequests(out); } Ice::ConnectionIPtr ConnectRequestHandler::getConnection(bool waitInit) { if(waitInit) { // // Wait for the connection establishment to complete or fail. // Lock sync(*this); while(!_initialized && !_exception.get()) { wait(); } } if(_exception.get()) { _exception->ice_throw(); return 0; // Keep the compiler happy. } else { assert(!waitInit || _initialized); return _connection; } } void ConnectRequestHandler::setConnection(const Ice::ConnectionIPtr& connection, bool compress) { { Lock sync(*this); assert(!_exception.get() && !_connection); assert(_updateRequestHandler || _requests.empty()); _connection = connection; _compress = compress; } // // If this proxy is for a non-local object, and we are using a router, then // add this proxy to the router info object. // RouterInfoPtr ri = _reference->getRouterInfo(); if(ri && !ri->addProxy(_proxy, this)) { return; // The request handler will be initialized once addProxy returns. } // // We can now send the queued requests. // flushRequests(); } void ConnectRequestHandler::setException(const Ice::LocalException& ex) { Lock sync(*this); assert(!_initialized && !_exception.get()); assert(_updateRequestHandler || _requests.empty()); _exception.reset(ex.ice_clone()); _proxy = 0; // Break cyclic reference count. _delegate = 0; // Break cyclic reference count. // // If some requests were queued, we notify them of the failure. This is done from a thread // from the client thread pool since this will result in ice_exception callbacks to be // called. // if(!_requests.empty()) { const InstancePtr instance = _reference->getInstance(); instance->clientThreadPool()->execute(new FlushRequestsWithException(instance, this, ex)); } notifyAll(); } void ConnectRequestHandler::addedProxy() { // // The proxy was added to the router info, we're now ready to send the // queued requests. // flushRequests(); } bool ConnectRequestHandler::initialized() { // Must be called with the mutex locked. if(_initialized) { assert(_connection); return true; } else { while(_flushing && !_exception.get()) { wait(); } if(_exception.get()) { _exception->ice_throw(); return false; // Keep the compiler happy. } else { return _initialized; } } } void ConnectRequestHandler::flushRequests() { { Lock sync(*this); assert(_connection && !_initialized); while(_batchRequestInProgress) { wait(); } // // We set the _flushing flag to true to prevent any additional queuing. Callers // might block for a little while as the queued requests are being sent but this // shouldn't be an issue as the request sends are non-blocking. // _flushing = true; } vector sentCallbacks; try { while(!_requests.empty()) // _requests is immutable when _flushing = true { Request& req = _requests.front(); if(req.out) { if(_connection->sendAsyncRequest(req.out, _compress, _response) & AsyncStatusInvokeSentCallback) { sentCallbacks.push_back(req.out); } } else if(req.batchOut) { if(_connection->flushAsyncBatchRequests(req.batchOut) & AsyncStatusInvokeSentCallback) { sentCallbacks.push_back(req.batchOut); } } else { BasicStream os(req.os->instance(), Ice::currentProtocolEncoding); _connection->prepareBatchRequest(&os); try { const Ice::Byte* bytes; req.os->i = req.os->b.begin(); req.os->readBlob(bytes, req.os->b.size()); os.writeBlob(bytes, req.os->b.size()); } catch(const Ice::LocalException&) { _connection->abortBatchRequest(); throw; } _connection->finishBatchRequest(&os, _compress); delete req.os; } _requests.pop_front(); } } catch(const LocalExceptionWrapper& ex) { Lock sync(*this); assert(!_exception.get() && !_requests.empty()); _exception.reset(ex.get()->ice_clone()); const InstancePtr instance = _reference->getInstance(); instance->clientThreadPool()->execute(new FlushRequestsWithExceptionWrapper(instance, this, ex)); } catch(const Ice::LocalException& ex) { Lock sync(*this); assert(!_exception.get() && !_requests.empty()); _exception.reset(ex.ice_clone()); const InstancePtr instance = _reference->getInstance(); instance->clientThreadPool()->execute(new FlushRequestsWithException(instance, this, ex)); } if(!sentCallbacks.empty()) { const InstancePtr instance = _reference->getInstance(); instance->clientThreadPool()->execute(new FlushSentRequests(instance, sentCallbacks)); } // // We've finished sending the queued requests and the request handler now send // the requests over the connection directly. It's time to substitute the // request handler of the proxy with the more efficient connection request // handler which does not have any synchronization. This also breaks the cyclic // reference count with the proxy. // if(_updateRequestHandler && !_exception.get()) { _proxy->__setRequestHandler(_delegate, new ConnectionRequestHandler(_reference, _connection, _compress)); } { Lock sync(*this); assert(!_initialized); if(!_exception.get()) { _initialized = true; _flushing = false; } _proxy = 0; // Break cyclic reference count. _delegate = 0; // Break cyclic reference count. notifyAll(); } } void ConnectRequestHandler::flushRequestsWithException(const Ice::LocalException& ex) { for(deque::const_iterator p = _requests.begin(); p != _requests.end(); ++p) { if(p->out) { p->out->__finished(ex, false); } else if(p->batchOut) { p->batchOut->__finished(ex, false); } else { assert(p->os); delete p->os; } } _requests.clear(); } void ConnectRequestHandler::flushRequestsWithException(const LocalExceptionWrapper& ex) { for(deque::const_iterator p = _requests.begin(); p != _requests.end(); ++p) { if(p->out) { p->out->__finished(ex); } else if(p->batchOut) { p->batchOut->__finished(*ex.get(), false); } else { assert(p->os); delete p->os; } } _requests.clear(); } Ice-3.5.1/cpp/src/Ice/Acceptor.cpp0000644000076400007640000000077012223561476014713 0ustar mesmes// ********************************************************************** // // 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 using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(Acceptor* p) { return p; } Ice-3.5.1/cpp/src/Ice/ServantManager.cpp0000644000076400007640000003143612223561476016073 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; ICE_DECLSPEC_EXPORT IceUtil::Shared* IceInternal::upCast(ServantManager* p) { return p; } void IceInternal::ServantManager::addServant(const ObjectPtr& object, const Identity& ident, const string& facet) { IceUtil::Mutex::Lock sync(*this); assert(_instance); // Must not be called after destruction. ServantMapMap::iterator p = _servantMapMapHint; if(p == _servantMapMap.end() || p->first != ident) { p = _servantMapMap.find(ident); } if(p == _servantMapMap.end()) { p = _servantMapMap.insert(_servantMapMapHint, pair(ident, FacetMap())); } else { if(p->second.find(facet) != p->second.end()) { AlreadyRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "servant"; ex.id = _instance->identityToString(ident); if(!facet.empty()) { string fs = nativeToUTF8(_instance->initializationData().stringConverter, facet); ex.id += " -f " + IceUtilInternal::escapeString(fs, ""); } throw ex; } } _servantMapMapHint = p; p->second.insert(pair(facet, object)); } void IceInternal::ServantManager::addDefaultServant(const ObjectPtr& object, const string& category) { IceUtil::Mutex::Lock sync(*this); assert(_instance); // Must not be called after destruction. DefaultServantMap::iterator p = _defaultServantMap.find(category); if(p != _defaultServantMap.end()) { AlreadyRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "default servant"; ex.id = category; throw ex; } _defaultServantMap.insert(pair(category, object)); } ObjectPtr IceInternal::ServantManager::removeServant(const Identity& ident, const string& facet) { // // We return the removed servant to avoid releasing the last reference count // with *this locked. We don't want to run user code, such as the servant // destructor, with an internal Ice mutex locked. // ObjectPtr servant = 0; IceUtil::Mutex::Lock sync(*this); assert(_instance); // Must not be called after destruction. ServantMapMap::iterator p = _servantMapMapHint; FacetMap::iterator q; if(p == _servantMapMap.end() || p->first != ident) { p = _servantMapMap.find(ident); } if(p == _servantMapMap.end() || (q = p->second.find(facet)) == p->second.end()) { NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "servant"; ex.id = _instance->identityToString(ident); if(!facet.empty()) { string fs = nativeToUTF8(_instance->initializationData().stringConverter, facet); ex.id += " -f " + IceUtilInternal::escapeString(fs, ""); } throw ex; } servant = q->second; p->second.erase(q); if(p->second.empty()) { if(p == _servantMapMapHint) { _servantMapMap.erase(p++); _servantMapMapHint = p; } else { _servantMapMap.erase(p); } } return servant; } ObjectPtr IceInternal::ServantManager::removeDefaultServant(const string& category) { // // We return the removed servant to avoid releasing the last reference count // with *this locked. We don't want to run user code, such as the servant // destructor, with an internal Ice mutex locked. // ObjectPtr servant = 0; IceUtil::Mutex::Lock sync(*this); assert(_instance); // Must not be called after destruction. DefaultServantMap::iterator p = _defaultServantMap.find(category); if(p == _defaultServantMap.end()) { NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "default servant"; ex.id = category; throw ex; } servant = p->second; _defaultServantMap.erase(p); return servant; } FacetMap IceInternal::ServantManager::removeAllFacets(const Identity& ident) { IceUtil::Mutex::Lock sync(*this); assert(_instance); // Must not be called after destruction. ServantMapMap::iterator p = _servantMapMapHint; if(p == _servantMapMap.end() || p->first != ident) { p = _servantMapMap.find(ident); } if(p == _servantMapMap.end()) { NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "servant"; ex.id = _instance->identityToString(ident); throw ex; } FacetMap result = p->second; if(p == _servantMapMapHint) { _servantMapMap.erase(p++); _servantMapMapHint = p; } else { _servantMapMap.erase(p); } return result; } ObjectPtr IceInternal::ServantManager::findServant(const Identity& ident, const string& facet) const { IceUtil::Mutex::Lock sync(*this); // // This assert is not valid if the adapter dispatch incoming // requests from bidir connections. This method might be called if // requests are received over the bidir connection after the // adapter was deactivated. // //assert(_instance); // Must not be called after destruction. ServantMapMap::iterator p = _servantMapMapHint; FacetMap::iterator q; ServantMapMap& servantMapMap = const_cast(_servantMapMap); if(p == servantMapMap.end() || p->first != ident) { p = servantMapMap.find(ident); } if(p == servantMapMap.end() || (q = p->second.find(facet)) == p->second.end()) { DefaultServantMap::const_iterator p = _defaultServantMap.find(ident.category); if(p == _defaultServantMap.end()) { p = _defaultServantMap.find(""); if(p == _defaultServantMap.end()) { return 0; } else { return p->second; } } else { return p->second; } } else { _servantMapMapHint = p; return q->second; } } ObjectPtr IceInternal::ServantManager::findDefaultServant(const string& category) const { IceUtil::Mutex::Lock sync(*this); DefaultServantMap::const_iterator p = _defaultServantMap.find(category); if(p == _defaultServantMap.end()) { return 0; } else { return p->second; } } FacetMap IceInternal::ServantManager::findAllFacets(const Identity& ident) const { IceUtil::Mutex::Lock sync(*this); assert(_instance); // Must not be called after destruction. ServantMapMap::iterator p = _servantMapMapHint; ServantMapMap& servantMapMap = const_cast(_servantMapMap); if(p == servantMapMap.end() || p->first != ident) { p = servantMapMap.find(ident); } if(p == servantMapMap.end()) { return FacetMap(); } else { _servantMapMapHint = p; return p->second; } } bool IceInternal::ServantManager::hasServant(const Identity& ident) const { IceUtil::Mutex::Lock sync(*this); // // This assert is not valid if the adapter dispatch incoming // requests from bidir connections. This method might be called if // requests are received over the bidir connection after the // adapter was deactivated. // //assert(_instance); // Must not be called after destruction. ServantMapMap::iterator p = _servantMapMapHint; ServantMapMap& servantMapMap = const_cast(_servantMapMap); if(p == servantMapMap.end() || p->first != ident) { p = servantMapMap.find(ident); } if(p == servantMapMap.end()) { return false; } else { _servantMapMapHint = p; assert(!p->second.empty()); return true; } } void IceInternal::ServantManager::addServantLocator(const ServantLocatorPtr& locator, const string& category) { IceUtil::Mutex::Lock sync(*this); assert(_instance); // Must not be called after destruction. if((_locatorMapHint != _locatorMap.end() && _locatorMapHint->first == category) || _locatorMap.find(category) != _locatorMap.end()) { AlreadyRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "servant locator"; ex.id = category; throw ex; } _locatorMapHint = _locatorMap.insert(_locatorMapHint, pair(category, locator)); } ServantLocatorPtr IceInternal::ServantManager::removeServantLocator(const string& category) { IceUtil::Mutex::Lock sync(*this); assert(_instance); // Must not be called after destruction. map::iterator p = _locatorMap.end(); if(_locatorMapHint != p) { if(_locatorMapHint->first == category) { p = _locatorMapHint; } } if(p == _locatorMap.end()) { p = _locatorMap.find(category); } if(p == _locatorMap.end()) { NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "servant locator"; ex.id = category; throw ex; } ServantLocatorPtr locator = p->second; _locatorMap.erase(p); _locatorMapHint = _locatorMap.begin(); return locator; } ServantLocatorPtr IceInternal::ServantManager::findServantLocator(const string& category) const { IceUtil::Mutex::Lock sync(*this); // // This assert is not valid if the adapter dispatch incoming // requests from bidir connections. This method might be called if // requests are received over the bidir connection after the // adapter was deactivated. // //assert(_instance); // Must not be called after destruction. map& locatorMap = const_cast&>(_locatorMap); map::iterator p = locatorMap.end(); if(_locatorMapHint != locatorMap.end()) { if(_locatorMapHint->first == category) { p = _locatorMapHint; } } if(p == locatorMap.end()) { p = locatorMap.find(category); } if(p != locatorMap.end()) { _locatorMapHint = p; return p->second; } else { return 0; } } IceInternal::ServantManager::ServantManager(const InstancePtr& instance, const string& adapterName) : _instance(instance), _adapterName(adapterName), _servantMapMapHint(_servantMapMap.end()), _locatorMapHint(_locatorMap.end()) { } IceInternal::ServantManager::~ServantManager() { // // Don't check whether destroy() has been called. It might have // not been called if the associated object adapter was not // properly deactivated. // //assert(!_instance); } void IceInternal::ServantManager::destroy() { ServantMapMap servantMapMap; map locatorMap; Ice::LoggerPtr logger; { IceUtil::Mutex::Lock sync(*this); assert(_instance); // Must not be called after destruction. logger = _instance->initializationData().logger; servantMapMap.swap(_servantMapMap); _servantMapMapHint = _servantMapMap.end(); locatorMap.swap(_locatorMap); _locatorMapHint = _locatorMap.end(); _instance = 0; } for(map::const_iterator p = locatorMap.begin(); p != locatorMap.end(); ++p) { try { p->second->deactivate(p->first); } catch(const Exception& ex) { Error out(logger); out << "exception during locator deactivation:\n" << "object adapter: `" << _adapterName << "'\n" << "locator category: `" << p->first << "'\n" << ex; } catch(...) { Error out(logger); out << "unknown exception during locator deactivation:\n" << "object adapter: `" << _adapterName << "'\n" << "locator category: `" << p->first << "'"; } } // // We clear the maps outside the synchronization as we don't want to // hold any internal Ice mutex while running user code (such as servant // or servant locator destructors). // servantMapMap.clear(); locatorMap.clear(); } Ice-3.5.1/cpp/src/Ice/LoggerI.cpp0000644000076400007640000000516212223561476014503 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; namespace { IceUtil::Mutex* outputMutex = 0; class Init { public: Init() { outputMutex = new IceUtil::Mutex; } ~Init() { delete outputMutex; outputMutex = 0; } }; Init init; } Ice::LoggerI::LoggerI(const string& prefix, const string& file) { if(!prefix.empty()) { _prefix = prefix + ": "; } if(!file.empty()) { // // The given file string is execpted to be encoded as UTF8 by // the caller, so no need to convert it here. // _file = file; _out.open(file, fstream::out | fstream::app); if(!_out.is_open()) { throw InitializationException(__FILE__, __LINE__, "FileLogger: cannot open " + _file); } } } Ice::LoggerI::~LoggerI() { if(_out.is_open()) { _out.close(); } } void Ice::LoggerI::print(const string& message) { write(message, false); } void Ice::LoggerI::trace(const string& category, const string& message) { string s = "-- " + IceUtil::Time::now().toDateTime() + " " + _prefix; if(!category.empty()) { s += category + ": "; } s += message; write(s, true); } void Ice::LoggerI::warning(const string& message) { write("-! " + IceUtil::Time::now().toDateTime() + " " + _prefix + "warning: " + message, true); } void Ice::LoggerI::error(const string& message) { write("!! " + IceUtil::Time::now().toDateTime() + " " + _prefix + "error: " + message, true); } LoggerPtr Ice::LoggerI::cloneWithPrefix(const std::string& prefix) { return new LoggerI(prefix, _file); } void Ice::LoggerI::write(const string& message, bool indent) { IceUtilInternal::MutexPtrLock sync(outputMutex); string s = message; if(indent) { string::size_type idx = 0; while((idx = s.find("\n", idx)) != string::npos) { s.insert(idx + 1, " "); ++idx; } } if(_out.is_open()) { _out << s << endl; } else { cerr << s << endl; } } Ice-3.5.1/cpp/src/Ice/RetryQueueF.h0000644000076400007640000000105512223561476015035 0ustar mesmes// ********************************************************************** // // 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 ICE_RETRY_QUEUE_F_H #define ICE_RETRY_QUEUE_F_H #include namespace IceInternal { class RetryQueue; IceUtil::Shared* upCast(RetryQueue*); typedef Handle RetryQueuePtr; } #endif Ice-3.5.1/cpp/src/Ice/UdpConnector.cpp0000644000076400007640000000477112223561476015563 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; TransceiverPtr IceInternal::UdpConnector::connect() { return new UdpTransceiver(_instance, _addr, _mcastInterface, _mcastTtl); } Short IceInternal::UdpConnector::type() const { return UDPEndpointType; } string IceInternal::UdpConnector::toString() const { return addrToString(_addr); } bool IceInternal::UdpConnector::operator==(const Connector& r) const { const UdpConnector* p = dynamic_cast(&r); if(!p) { return false; } if(compareAddress(_addr, p->_addr) != 0) { return false; } if(_connectionId != p->_connectionId) { return false; } if(_mcastTtl != p->_mcastTtl) { return false; } if(_mcastInterface != p->_mcastInterface) { return false; } return true; } bool IceInternal::UdpConnector::operator!=(const Connector& r) const { return !operator==(r); } bool IceInternal::UdpConnector::operator<(const Connector& r) const { const UdpConnector* p = dynamic_cast(&r); if(!p) { return type() < r.type(); } if(_connectionId < p->_connectionId) { return true; } else if(p->_connectionId < _connectionId) { return false; } if(_mcastTtl < p->_mcastTtl) { return true; } else if(p->_mcastTtl < _mcastTtl) { return false; } if(_mcastInterface < p->_mcastInterface) { return true; } else if(p->_mcastInterface < _mcastInterface) { return false; } return compareAddress(_addr, p->_addr) == -1; } IceInternal::UdpConnector::UdpConnector(const InstancePtr& instance, const Address& addr, const string& mcastInterface, int mcastTtl, const std::string& connectionId) : _instance(instance), _addr(addr), _mcastInterface(mcastInterface), _mcastTtl(mcastTtl), _connectionId(connectionId) { } IceInternal::UdpConnector::~UdpConnector() { } Ice-3.5.1/cpp/src/Ice/ReferenceFactory.cpp0000644000076400007640000006711512223561476016407 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(::IceInternal::ReferenceFactory* p) { return p; } ReferencePtr IceInternal::ReferenceFactory::copy(const Reference* r) const { const Ice::Identity& ident = r->getIdentity(); if(ident.name.empty() && ident.category.empty()) { return 0; } return r->clone(); } ReferencePtr IceInternal::ReferenceFactory::create(const Identity& ident, const string& facet, const ReferencePtr& tmpl, const vector& endpoints) { if(ident.name.empty() && ident.category.empty()) { return 0; } return create(ident, facet, tmpl->getMode(), tmpl->getSecure(), tmpl->getProtocol(), tmpl->getEncoding(), endpoints, "", ""); } ReferencePtr IceInternal::ReferenceFactory::create(const Identity& ident, const string& facet, const ReferencePtr& tmpl, const string& adapterId) { if(ident.name.empty() && ident.category.empty()) { return 0; } return create(ident, facet, tmpl->getMode(), tmpl->getSecure(), tmpl->getProtocol(), tmpl->getEncoding(), vector(), adapterId, ""); } ReferencePtr IceInternal::ReferenceFactory::create(const Identity& ident, const Ice::ConnectionIPtr& connection) { if(ident.name.empty() && ident.category.empty()) { return 0; } // // Create new reference // return new FixedReference(_instance, _communicator, ident, "", // Facet connection->endpoint()->datagram() ? Reference::ModeDatagram : Reference::ModeTwoway, connection->endpoint()->secure(), _instance->defaultsAndOverrides()->defaultEncoding, connection); } ReferencePtr IceInternal::ReferenceFactory::create(const string& str, const string& propertyPrefix) { if(str.empty()) { return 0; } const string delim = " \t\r\n"; string s(str); string::size_type beg; string::size_type end = 0; beg = s.find_first_not_of(delim, end); if(beg == string::npos) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "no non-whitespace characters found in `" + s + "'"; throw ex; } // // Extract the identity, which may be enclosed in single // or double quotation marks. // string idstr; end = IceUtilInternal::checkQuote(s, beg); if(end == string::npos) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "mismatched quotes around identity in `" + s + "'"; throw ex; } else if(end == 0) { end = s.find_first_of(delim + ":@", beg); if(end == string::npos) { end = s.size(); } idstr = s.substr(beg, end - beg); } else { beg++; // Skip leading quote idstr = s.substr(beg, end - beg); end++; // Skip trailing quote } if(beg == end) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "no identity in `" + s + "'"; throw ex; } // // Parsing the identity may raise IdentityParseException. // Identity ident = _instance->stringToIdentity(idstr); if(ident.name.empty()) { // // An identity with an empty name and a non-empty // category is illegal. // if(!ident.category.empty()) { IllegalIdentityException e(__FILE__, __LINE__); e.id = ident; throw e; } // // Treat a stringified proxy containing two double // quotes ("") the same as an empty string, i.e., // a null proxy, but only if nothing follows the // quotes. // else if(s.find_first_not_of(delim, end) != string::npos) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "invalid characters after identity in `" + s + "'"; throw ex; } else { return 0; } } string facet; Reference::Mode mode = Reference::ModeTwoway; bool secure = false; Ice::EncodingVersion encoding = _instance->defaultsAndOverrides()->defaultEncoding; Ice::ProtocolVersion protocol = Protocol_1_0; string adapter; while(true) { beg = s.find_first_not_of(delim, end); if(beg == string::npos) { break; } if(s[beg] == ':' || s[beg] == '@') { break; } end = s.find_first_of(delim + ":@", beg); if(end == string::npos) { end = s.length(); } if(beg == end) { break; } string option = s.substr(beg, end - beg); if(option.length() != 2 || option[0] != '-') { ProxyParseException ex(__FILE__, __LINE__); ex.str = "expected a proxy option but found `" + option + "' in `" + s + "'"; throw ex; } // // Check for the presence of an option argument. The // argument may be enclosed in single or double // quotation marks. // string argument; string::size_type argumentBeg = s.find_first_not_of(delim, end); if(argumentBeg != string::npos) { if(s[argumentBeg] != '@' && s[argumentBeg] != ':' && s[argumentBeg] != '-') { beg = argumentBeg; end = IceUtilInternal::checkQuote(s, beg); if(end == string::npos) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "mismatched quotes around value for " + option + " option in `" + s + "'"; throw ex; } else if(end == 0) { end = s.find_first_of(delim + ":@", beg); if(end == string::npos) { end = s.size(); } argument = s.substr(beg, end - beg); } else { beg++; // Skip leading quote argument = s.substr(beg, end - beg); end++; // Skip trailing quote } } } // // If any new options are added here, // IceInternal::Reference::toString() and its derived classes must be updated as well. // switch(option[1]) { case 'f': { if(argument.empty()) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -f option in `" + s + "'"; throw ex; } try { facet = IceUtilInternal::unescapeString(argument, 0, argument.size()); } catch(const IceUtil::IllegalArgumentException& e) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "invalid facet in `" + s + "': " + e.reason(); throw ex; } facet = Ice::UTF8ToNative(_instance->initializationData().stringConverter, facet); break; } case 't': { if(!argument.empty()) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "unexpected argument `" + argument + "' provided for -t option in `" + s + "'"; throw ex; } mode = Reference::ModeTwoway; break; } case 'o': { if(!argument.empty()) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "unexpected argument `" + argument + "' provided for -o option in `" + s + "'"; throw ex; } mode = Reference::ModeOneway; break; } case 'O': { if(!argument.empty()) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "unexpected argument `" + argument + "' provided for -O option in `" + s + "'"; throw ex; } mode = Reference::ModeBatchOneway; break; } case 'd': { if(!argument.empty()) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "unexpected argument `" + argument + "' provided for -d option in `" + s + "'"; throw ex; } mode = Reference::ModeDatagram; break; } case 'D': { if(!argument.empty()) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "unexpected argument `" + argument + "' provided for -D option in `" + s + "'"; throw ex; } mode = Reference::ModeBatchDatagram; break; } case 's': { if(!argument.empty()) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "unexpected argument `" + argument + "' provided for -s option in `" + s + "'"; throw ex; } secure = true; break; } case 'e': { if(argument.empty()) { Ice::ProxyParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -e option in `" + s + "'"; throw ex; } try { encoding = Ice::stringToEncodingVersion(argument); } catch(const Ice::VersionParseException& e) { Ice::ProxyParseException ex(__FILE__, __LINE__); ex.str = "invalid encoding version `" + argument + "' in `" + s + "':\n" + e.str; throw ex; } break; } case 'p': { if(argument.empty()) { Ice::ProxyParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -p option in `" + s + "'"; throw ex; } try { protocol = Ice::stringToProtocolVersion(argument); } catch(const Ice::VersionParseException& e) { Ice::ProxyParseException ex(__FILE__, __LINE__); ex.str = "invalid protocol version `" + argument + "' in `" + s + "':\n" + e.str; throw ex; } break; } default: { ProxyParseException ex(__FILE__, __LINE__); ex.str = "unknown option `" + option + "' in `" + s + "'"; throw ex; } } } if(beg == string::npos) { return create(ident, facet, mode, secure, protocol, encoding, vector(), "", propertyPrefix); } vector endpoints; switch(s[beg]) { case ':': { vector unknownEndpoints; end = beg; while(end < s.length() && s[end] == ':') { beg = end + 1; end = beg; while(true) { end = s.find(':', end); if(end == string::npos) { end = s.length(); break; } else { bool quoted = false; string::size_type quote = beg; while(true) { quote = s.find('\"', quote); if(quote == string::npos || end < quote) { break; } else { quote = s.find('\"', ++quote); if(quote == string::npos) { break; } else if(end < quote) { quoted = true; break; } ++quote; } } if(!quoted) { break; } ++end; } } string es = s.substr(beg, end - beg); EndpointIPtr endp = _instance->endpointFactoryManager()->create(es, false); if(endp != 0) { endpoints.push_back(endp); } else { unknownEndpoints.push_back(es); } } if(endpoints.size() == 0) { assert(!unknownEndpoints.empty()); EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid endpoint `" + unknownEndpoints.front() + "' in `" + s + "'"; throw ex; } else if(unknownEndpoints.size() != 0 && _instance->initializationData().properties-> getPropertyAsIntWithDefault("Ice.Warn.Endpoints", 1) > 0) { Warning out(_instance->initializationData().logger); out << "Proxy contains unknown endpoints:"; for(unsigned int idx = 0; idx < unknownEndpoints.size(); ++idx) { out << " `" << unknownEndpoints[idx] << "'"; } } return create(ident, facet, mode, secure, protocol, encoding, endpoints, "", propertyPrefix); break; } case '@': { beg = s.find_first_not_of(delim, beg + 1); if(beg == string::npos) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "missing adapter id in `" + s + "'"; throw ex; } string adapterstr; end = IceUtilInternal::checkQuote(s, beg); if(end == string::npos) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "mismatched quotes around adapter id in `" + s + "'"; throw ex; } else if(end == 0) { end = s.find_first_of(delim, beg); if(end == string::npos) { end = s.size(); } adapterstr = s.substr(beg, end - beg); } else { beg++; // Skip leading quote adapterstr = s.substr(beg, end - beg); end++; // Skip trailing quote. } // Check for trailing whitespace. if(end != string::npos && s.find_first_not_of(delim, end) != string::npos) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "invalid trailing characters after `" + s.substr(0, end + 1) + "' in `" + s + "'"; throw ex; } try { adapter = IceUtilInternal::unescapeString(adapterstr, 0, adapterstr.size()); } catch(const IceUtil::IllegalArgumentException& e) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "invalid adapter id in `" + s + "': " + e.reason(); throw ex; } if(adapter.size() == 0) { ProxyParseException ex(__FILE__, __LINE__); ex.str = "empty adapter id in `" + s + "'"; throw ex; } adapter = Ice::UTF8ToNative(_instance->initializationData().stringConverter, adapter); return create(ident, facet, mode, secure, protocol, encoding, endpoints, adapter, propertyPrefix); break; } default: { ProxyParseException ex(__FILE__, __LINE__); ex.str = "malformed proxy `" + s + "'"; throw ex; } } return 0; // Unreachable, prevents compiler warning. } ReferencePtr IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s) { // // Don't read the identity here. Operations calling this // constructor read the identity, and pass it as a parameter. // if(ident.name.empty() && ident.category.empty()) { return 0; } // // For compatibility with the old FacetPath. // vector facetPath; s->read(facetPath); string facet; if(!facetPath.empty()) { if(facetPath.size() > 1) { throw ProxyUnmarshalException(__FILE__, __LINE__); } facet.swap(facetPath[0]); } Byte modeAsByte; s->read(modeAsByte); Reference::Mode mode = static_cast(modeAsByte); if(mode < 0 || mode > Reference::ModeLast) { throw ProxyUnmarshalException(__FILE__, __LINE__); } bool secure; s->read(secure); Ice::ProtocolVersion protocol; Ice::EncodingVersion encoding; if(s->getReadEncoding() != Ice::Encoding_1_0) { s->read(protocol); s->read(encoding); } else { protocol = Ice::Protocol_1_0; encoding = Ice::Encoding_1_0; } vector endpoints; string adapterId; Ice::Int sz = s->readSize(); if(sz > 0) { endpoints.reserve(sz); while(sz--) { EndpointIPtr endpoint = _instance->endpointFactoryManager()->read(s); endpoints.push_back(endpoint); } } else { s->read(adapterId); } return create(ident, facet, mode, secure, protocol, encoding, endpoints, adapterId, ""); } ReferenceFactoryPtr IceInternal::ReferenceFactory::setDefaultRouter(const RouterPrx& defaultRouter) { if(defaultRouter == _defaultRouter) { return this; } ReferenceFactoryPtr factory = new ReferenceFactory(_instance, _communicator); factory->_defaultLocator = _defaultLocator; factory->_defaultRouter = defaultRouter; return factory; } RouterPrx IceInternal::ReferenceFactory::getDefaultRouter() const { return _defaultRouter; } ReferenceFactoryPtr IceInternal::ReferenceFactory::setDefaultLocator(const LocatorPrx& defaultLocator) { if(defaultLocator == _defaultLocator) { return this; } ReferenceFactoryPtr factory = new ReferenceFactory(_instance, _communicator); factory->_defaultRouter = _defaultRouter; factory->_defaultLocator = defaultLocator; return factory; } LocatorPrx IceInternal::ReferenceFactory::getDefaultLocator() const { return _defaultLocator; } IceInternal::ReferenceFactory::ReferenceFactory(const InstancePtr& instance, const CommunicatorPtr& communicator) : _instance(instance), _communicator(communicator) { } void IceInternal::ReferenceFactory::checkForUnknownProperties(const string& prefix) { static const string suffixes[] = { "EndpointSelection", "ConnectionCached", "PreferSecure", "LocatorCacheTimeout", "Locator", "Router", "CollocationOptimized" }; // // Do not warn about unknown properties list if Ice prefix, ie Ice, Glacier2, etc // for(const char** i = IceInternal::PropertyNames::clPropNames; *i != 0; ++i) { if(prefix.find(*i) == 0) { return; } } StringSeq unknownProps; PropertyDict props = _instance->initializationData().properties->getPropertiesForPrefix(prefix + "."); for(PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p) { bool valid = false; for(unsigned int i = 0; i < sizeof(suffixes)/sizeof(*suffixes); ++i) { string prop = prefix + "." + suffixes[i]; if(p->first == prop) { valid = true; break; } } if(!valid) { unknownProps.push_back(p->first); } } if(unknownProps.size()) { Warning out(_instance->initializationData().logger); out << "found unknown properties for proxy '" << prefix << "':"; for(unsigned int i = 0; i < unknownProps.size(); ++i) { out << "\n " << unknownProps[i]; } } } RoutableReferencePtr IceInternal::ReferenceFactory::create(const Identity& ident, const string& facet, Reference::Mode mode, bool secure, const Ice::ProtocolVersion& protocol, const Ice::EncodingVersion& encoding, const vector& endpoints, const string& adapterId, const string& propertyPrefix) { DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); // // Default local proxy options. // LocatorInfoPtr locatorInfo; if(_defaultLocator) { if(_defaultLocator->ice_getEncodingVersion() != encoding) { locatorInfo = _instance->locatorManager()->get(_defaultLocator->ice_encodingVersion(encoding)); } else { locatorInfo = _instance->locatorManager()->get(_defaultLocator); } } RouterInfoPtr routerInfo = _instance->routerManager()->get(_defaultRouter); bool collocationOptimized = defaultsAndOverrides->defaultCollocationOptimization; bool cacheConnection = true; bool preferSecure = defaultsAndOverrides->defaultPreferSecure; Ice::EndpointSelectionType endpointSelection = defaultsAndOverrides->defaultEndpointSelection; int locatorCacheTimeout = defaultsAndOverrides->defaultLocatorCacheTimeout; // // Override the defaults with the proxy properties if a property prefix is defined. // if(!propertyPrefix.empty()) { PropertiesPtr properties = _instance->initializationData().properties; if(properties->getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0) { checkForUnknownProperties(propertyPrefix); } string property; property = propertyPrefix + ".Locator"; LocatorPrx locator = LocatorPrx::uncheckedCast(_communicator->propertyToProxy(property)); if(locator) { if(locator->ice_getEncodingVersion() != encoding) { locatorInfo = _instance->locatorManager()->get(locator->ice_encodingVersion(encoding)); } else { locatorInfo = _instance->locatorManager()->get(locator); } } property = propertyPrefix + ".Router"; RouterPrx router = RouterPrx::uncheckedCast(_communicator->propertyToProxy(property)); if(router) { if(propertyPrefix.size() > 7 && propertyPrefix.substr(propertyPrefix.size() - 7, 7) == ".Router") { Warning out(_instance->initializationData().logger); out << "`" << property << "=" << properties->getProperty(property) << "': cannot set a router on a router; setting ignored"; } else { routerInfo = _instance->routerManager()->get(router); } } property = propertyPrefix + ".CollocationOptimized"; collocationOptimized = properties->getPropertyAsIntWithDefault(property, collocationOptimized) > 0; property = propertyPrefix + ".ConnectionCached"; cacheConnection = properties->getPropertyAsIntWithDefault(property, cacheConnection) > 0; property = propertyPrefix + ".PreferSecure"; preferSecure = properties->getPropertyAsIntWithDefault(property, preferSecure) > 0; property = propertyPrefix + ".EndpointSelection"; if(!properties->getProperty(property).empty()) { string type = properties->getProperty(property); if(type == "Random") { endpointSelection = Random; } else if(type == "Ordered") { endpointSelection = Ordered; } else { EndpointSelectionTypeParseException ex(__FILE__, __LINE__); ex.str = "illegal value `" + type + "'; expected `Random' or `Ordered'"; throw ex; } } property = propertyPrefix + ".LocatorCacheTimeout"; locatorCacheTimeout = properties->getPropertyAsIntWithDefault(property, locatorCacheTimeout); } // // Create new reference // return new RoutableReference(_instance, _communicator, ident, facet, mode, secure, protocol, encoding, endpoints, adapterId, locatorInfo, routerInfo, collocationOptimized, cacheConnection, preferSecure, endpointSelection, locatorCacheTimeout); } Ice-3.5.1/cpp/src/Ice/TcpTransceiver.h0000644000076400007640000000413612223561476015554 0ustar mesmes// ********************************************************************** // // 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 ICE_TCP_TRANSCEIVER_H #define ICE_TCP_TRANSCEIVER_H #include #include #include #include #include #include namespace IceInternal { class TcpConnector; class TcpAcceptor; class TcpTransceiver : public Transceiver, public NativeInfo { enum State { StateNeedConnect, StateConnectPending, StateProxyConnectRequest, StateProxyConnectRequestPending, StateConnected }; public: virtual NativeInfoPtr getNativeInfo(); #ifdef ICE_USE_IOCP virtual AsyncInfo* getAsyncInfo(SocketOperation); #endif virtual SocketOperation initialize(Buffer&, Buffer&); virtual void close(); virtual bool write(Buffer&); virtual bool read(Buffer&); #ifdef ICE_USE_IOCP virtual bool startWrite(Buffer&); virtual void finishWrite(Buffer&); virtual void startRead(Buffer&); virtual void finishRead(Buffer&); #endif virtual std::string type() const; virtual std::string toString() const; virtual Ice::ConnectionInfoPtr getInfo() const; virtual void checkSendSize(const Buffer&, size_t); private: TcpTransceiver(const InstancePtr&, SOCKET, const NetworkProxyPtr&, const Address&); TcpTransceiver(const InstancePtr&, SOCKET); virtual ~TcpTransceiver(); void connect(); friend class TcpConnector; friend class TcpAcceptor; const NetworkProxyPtr _proxy; const Address _addr; const TraceLevelsPtr _traceLevels; const Ice::LoggerPtr _logger; const Ice::StatsPtr _stats; State _state; std::string _desc; #ifdef ICE_USE_IOCP AsyncInfo _read; AsyncInfo _write; int _maxSendPacketSize; int _maxReceivePacketSize; #endif }; } #endif Ice-3.5.1/cpp/src/Ice/ObjectAdapterI.cpp0000644000076400007640000012676512223561476016010 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef _WIN32 # include #else # include #endif #include using namespace std; using namespace Ice; using namespace IceInternal; string Ice::ObjectAdapterI::getName() const { // // No mutex lock necessary, _name is immutable. // return _noConfig ? string("") : _name; } CommunicatorPtr Ice::ObjectAdapterI::getCommunicator() const { return _communicator; } void Ice::ObjectAdapterI::activate() { LocatorInfoPtr locatorInfo; bool registerProcess = false; bool printAdapterReady = false; { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); // // If some threads are waiting on waitForHold(), we set this // flag to ensure the threads will start again the wait for // all the incoming connection factories. // _waitForHoldRetry = _waitForHold > 0; // // If the one off initializations of the adapter are already // done, we just need to activate the incoming connection // factories and we're done. // if(_activateOneOffDone) { for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), Ice::voidMemFun(&IncomingConnectionFactory::activate)); return; } // // One off initializations of the adapter: update the locator // registry and print the "adapter ready" message. We set the // _waitForActivate flag to prevent deactivation from other // threads while these one off initializations are done. // _waitForActivate = true; locatorInfo = _locatorInfo; if(!_noConfig) { PropertiesPtr properties = _instance->initializationData().properties; printAdapterReady = properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0; registerProcess = properties->getPropertyAsInt(_name + ".RegisterProcess") > 0; } } try { Ice::Identity dummy; dummy.name = "dummy"; updateLocatorRegistry(locatorInfo, createDirectProxy(dummy), registerProcess); } catch(const Ice::LocalException&) { // // If we couldn't update the locator registry, we let the // exception go through and don't activate the adapter to // allow to user code to retry activating the adapter // later. // { IceUtil::Monitor::Lock sync(*this); _waitForActivate = false; notifyAll(); } throw; } if(printAdapterReady) { cout << _name << " ready" << endl; } { IceUtil::Monitor::Lock sync(*this); assert(!_deactivated); // Not possible if _waitForActivate = true; // // Signal threads waiting for the activation. // _waitForActivate = false; notifyAll(); _activateOneOffDone = true; for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), Ice::voidMemFun(&IncomingConnectionFactory::activate)); } } void Ice::ObjectAdapterI::hold() { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), Ice::voidMemFun(&IncomingConnectionFactory::hold)); } void Ice::ObjectAdapterI::waitForHold() { while(true) { vector incomingConnectionFactories; { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); incomingConnectionFactories = _incomingConnectionFactories; ++_waitForHold; } for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(), Ice::constVoidMemFun(&IncomingConnectionFactory::waitUntilHolding)); { IceUtil::Monitor::Lock sync(*this); if(--_waitForHold == 0) { notifyAll(); } // // If we don't need to retry, we're done. Otherwise, we wait until // all the waiters finish waiting on the connections and we try // again waiting on all the conncetions. This is necessary in the // case activate() is called by another thread while waitForHold() // waits on the some connection, if we didn't retry, waitForHold() // could return only after waiting on a subset of the connections. // if(!_waitForHoldRetry) { return; } else { while(_waitForHold > 0) { checkForDeactivation(); wait(); } _waitForHoldRetry = false; } } } } void Ice::ObjectAdapterI::deactivate() { vector incomingConnectionFactories; OutgoingConnectionFactoryPtr outgoingConnectionFactory; LocatorInfoPtr locatorInfo; { IceUtil::Monitor::Lock sync(*this); // // Ignore deactivation requests if the object adapter has already // been deactivated. // if(_deactivated) { return; } // // Wait for activation to complete. This is necessary to not // get out of order locator updates. // while(_waitForActivate) { wait(); } if(_routerInfo) { // // Remove entry from the router manager. // _instance->routerManager()->erase(_routerInfo->getRouter()); // // Clear this object adapter with the router. // _routerInfo->setAdapter(0); } incomingConnectionFactories = _incomingConnectionFactories; outgoingConnectionFactory = _instance->outgoingConnectionFactory(); locatorInfo = _locatorInfo; _deactivated = true; notifyAll(); } try { updateLocatorRegistry(locatorInfo, 0, false); } catch(const Ice::LocalException&) { // // We can't throw exceptions in deactivate so we ignore // failures to update the locator registry. // } // // Must be called outside the thread synchronization, because // Connection::destroy() might block when sending a CloseConnection // message. // for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(), Ice::voidMemFun(&IncomingConnectionFactory::destroy)); // // Must be called outside the thread synchronization, because // changing the object adapter might block if there are still // requests being dispatched. // outgoingConnectionFactory->removeAdapter(this); } void Ice::ObjectAdapterI::waitForDeactivate() { vector incomingConnectionFactories; { IceUtil::Monitor::Lock sync(*this); if(_destroyed) { return; } // // Wait for deactivation of the adapter itself, and for // the return of all direct method calls using this adapter. // while(!_deactivated || _directCount > 0) { wait(); } incomingConnectionFactories = _incomingConnectionFactories; } // // Now we wait until all incoming connection factories are // finished. // for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(), Ice::voidMemFun(&IncomingConnectionFactory::waitUntilFinished)); } bool Ice::ObjectAdapterI::isDeactivated() const { IceUtil::Monitor::Lock sync(*this); return _deactivated; } void Ice::ObjectAdapterI::destroy() { { IceUtil::Monitor::Lock sync(*this); // // Another thread is in the process of destroying the object // adapter. Wait for it to finish. // while(_destroying) { wait(); } // // Object adapter is already destroyed. // if(_destroyed) { return; } _destroying = true; } // // Deactivate and wait for completion. // deactivate(); waitForDeactivate(); // // Now it's also time to clean up our servants and servant // locators. // _servantManager->destroy(); // // Destroy the thread pool. // if(_threadPool) { _threadPool->destroy(); _threadPool->joinWithAllThreads(); } ObjectAdapterFactoryPtr objectAdapterFactory; { IceUtil::Monitor::Lock sync(*this); // // Signal that destroy is complete. // _destroying = false; _destroyed = true; notifyAll(); // // We're done, now we can throw away all incoming connection // factories. // _incomingConnectionFactories.clear(); // // Remove object references (some of them cyclic). // _instance = 0; _threadPool = 0; _routerEndpoints.clear(); _routerInfo = 0; _publishedEndpoints.clear(); _locatorInfo = 0; _reference = 0; objectAdapterFactory = _objectAdapterFactory; _objectAdapterFactory = 0; } if(objectAdapterFactory) { objectAdapterFactory->removeObjectAdapter(this); } } ObjectPrx Ice::ObjectAdapterI::add(const ObjectPtr& object, const Identity& ident) { return addFacet(object, ident, ""); } ObjectPrx Ice::ObjectAdapterI::addFacet(const ObjectPtr& object, const Identity& ident, const string& facet) { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); checkIdentity(ident); _servantManager->addServant(object, ident, facet); return newProxy(ident, facet); } ObjectPrx Ice::ObjectAdapterI::addWithUUID(const ObjectPtr& object) { return addFacetWithUUID(object, ""); } ObjectPrx Ice::ObjectAdapterI::addFacetWithUUID(const ObjectPtr& object, const string& facet) { Identity ident; ident.name = IceUtil::generateUUID(); return addFacet(object, ident, facet); } void Ice::ObjectAdapterI::addDefaultServant(const ObjectPtr& servant, const string& category) { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); _servantManager->addDefaultServant(servant, category); } ObjectPtr Ice::ObjectAdapterI::remove(const Identity& ident) { return removeFacet(ident, ""); } ObjectPtr Ice::ObjectAdapterI::removeFacet(const Identity& ident, const string& facet) { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); checkIdentity(ident); return _servantManager->removeServant(ident, facet); } FacetMap Ice::ObjectAdapterI::removeAllFacets(const Identity& ident) { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); checkIdentity(ident); return _servantManager->removeAllFacets(ident); } ObjectPtr Ice::ObjectAdapterI::removeDefaultServant(const string& category) { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); return _servantManager->removeDefaultServant(category); } ObjectPtr Ice::ObjectAdapterI::find(const Identity& ident) const { return findFacet(ident, ""); } ObjectPtr Ice::ObjectAdapterI::findFacet(const Identity& ident, const string& facet) const { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); checkIdentity(ident); return _servantManager->findServant(ident, facet); } FacetMap Ice::ObjectAdapterI::findAllFacets(const Identity& ident) const { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); checkIdentity(ident); return _servantManager->findAllFacets(ident); } ObjectPtr Ice::ObjectAdapterI::findByProxy(const ObjectPrx& proxy) const { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); ReferencePtr ref = proxy->__reference(); return findFacet(ref->getIdentity(), ref->getFacet()); } ObjectPtr Ice::ObjectAdapterI::findDefaultServant(const string& category) const { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); return _servantManager->findDefaultServant(category); } void Ice::ObjectAdapterI::addServantLocator(const ServantLocatorPtr& locator, const string& prefix) { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); _servantManager->addServantLocator(locator, prefix); } ServantLocatorPtr Ice::ObjectAdapterI::removeServantLocator(const string& prefix) { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); return _servantManager->removeServantLocator(prefix); } ServantLocatorPtr Ice::ObjectAdapterI::findServantLocator(const string& prefix) const { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); return _servantManager->findServantLocator(prefix); } ObjectPrx Ice::ObjectAdapterI::createProxy(const Identity& ident) const { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); checkIdentity(ident); return newProxy(ident, ""); } ObjectPrx Ice::ObjectAdapterI::createDirectProxy(const Identity& ident) const { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); checkIdentity(ident); return newDirectProxy(ident, ""); } ObjectPrx Ice::ObjectAdapterI::createIndirectProxy(const Identity& ident) const { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); checkIdentity(ident); return newIndirectProxy(ident, "", _id); } void Ice::ObjectAdapterI::setLocator(const LocatorPrx& locator) { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); _locatorInfo = _instance->locatorManager()->get(locator); } void Ice::ObjectAdapterI::refreshPublishedEndpoints() { LocatorInfoPtr locatorInfo; bool registerProcess = false; vector oldPublishedEndpoints; { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); oldPublishedEndpoints = _publishedEndpoints; _publishedEndpoints = parsePublishedEndpoints(); locatorInfo = _locatorInfo; if(!_noConfig) { registerProcess = _instance->initializationData().properties->getPropertyAsInt(_name + ".RegisterProcess") > 0; } } try { Ice::Identity dummy; dummy.name = "dummy"; updateLocatorRegistry(locatorInfo, createDirectProxy(dummy), registerProcess); } catch(const Ice::LocalException&) { IceUtil::Monitor::Lock sync(*this); // // Restore the old published endpoints. // _publishedEndpoints = oldPublishedEndpoints; throw; } } EndpointSeq Ice::ObjectAdapterI::getEndpoints() const { IceUtil::Monitor::Lock sync(*this); EndpointSeq endpoints; transform(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), back_inserter(endpoints), Ice::constMemFun(&IncomingConnectionFactory::endpoint)); return endpoints; } EndpointSeq Ice::ObjectAdapterI::getPublishedEndpoints() const { IceUtil::Monitor::Lock sync(*this); EndpointSeq endpoints; copy(_publishedEndpoints.begin(), _publishedEndpoints.end(), back_inserter(endpoints)); return endpoints; } bool Ice::ObjectAdapterI::isLocal(const ObjectPrx& proxy) const { // // NOTE: it's important that isLocal() doesn't perform any blocking operations as // it can be called for AMI invocations if the proxy has no delegate set yet. // ReferencePtr ref = proxy->__reference(); if(ref->isWellKnown()) { // // Check the active servant map to see if the well-known // proxy is for a local object. // return _servantManager->hasServant(ref->getIdentity()); } else if(ref->isIndirect()) { // // Proxy is local if the reference adapter id matches this // adapter id or replica group id. // return ref->getAdapterId() == _id || ref->getAdapterId() == _replicaGroupId; } else { vector endpoints = ref->getEndpoints(); IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); // // Proxies which have at least one endpoint in common with the // endpoints used by this object adapter are considered local. // for(vector::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { for(vector::const_iterator q = _incomingConnectionFactories.begin(); q != _incomingConnectionFactories.end(); ++q) { if((*p)->equivalent((*q)->endpoint())) { return true; } } for(vector::const_iterator r = _publishedEndpoints.begin(); r != _publishedEndpoints.end(); ++r) { if((*p)->equivalent(*r)) { return true; } } } // // Proxies which have at least one endpoint in common with the // router's server proxy endpoints (if any), are also considered // local. // if(_routerInfo && _routerInfo->getRouter() == proxy->ice_getRouter()) { for(vector::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { for(vector::const_iterator r = _routerEndpoints.begin(); r != _routerEndpoints.end(); ++r) { if((*p)->equivalent(*r)) { return true; } } } } } return false; } void Ice::ObjectAdapterI::flushAsyncBatchRequests(const CommunicatorBatchOutgoingAsyncPtr& outAsync) { vector f; { IceUtil::Monitor::Lock sync(*this); f = _incomingConnectionFactories; } for(vector::const_iterator p = f.begin(); p != f.end(); ++p) { (*p)->flushAsyncBatchRequests(outAsync); } } void Ice::ObjectAdapterI::updateConnectionObservers() { vector f; { IceUtil::Monitor::Lock sync(*this); f = _incomingConnectionFactories; } for_each(f.begin(), f.end(), Ice::voidMemFun(&IncomingConnectionFactory::updateConnectionObservers)); } void Ice::ObjectAdapterI::updateThreadObservers() { ThreadPoolPtr threadPool; { IceUtil::Monitor::Lock sync(*this); threadPool = _threadPool; } if(threadPool) { threadPool->updateObservers(); } } void Ice::ObjectAdapterI::incDirectCount() { IceUtil::Monitor::Lock sync(*this); checkForDeactivation(); assert(_directCount >= 0); ++_directCount; } void Ice::ObjectAdapterI::decDirectCount() { IceUtil::Monitor::Lock sync(*this); // Not check for deactivation here! assert(_instance); // Must not be called after destroy(). assert(_directCount > 0); if(--_directCount == 0) { notifyAll(); } } ThreadPoolPtr Ice::ObjectAdapterI::getThreadPool() const { // No mutex lock necessary, _threadPool and _instance are // immutable after creation until they are removed in // destroy(). // Not check for deactivation here! assert(_instance); // Must not be called after destroy(). if(_threadPool) { return _threadPool; } else { return _instance->serverThreadPool(); } } ServantManagerPtr Ice::ObjectAdapterI::getServantManager() const { // // No mutex lock necessary, _servantManager is immutable. // return _servantManager; } Ice::Int Ice::ObjectAdapterI::getACM() const { // Not check for deactivation here! assert(_instance); // Must not be called after destroy(). if(_hasAcmTimeout) { return _acmTimeout; } else { return _instance->serverACM(); } } // // COMPILERFIX: The ObjectAdapterI setup is broken out into a separate initialize // function because when it was part of the constructor C++Builder 2010 apps would // crash if an execption was thrown from any calls within the constructor. // Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const CommunicatorPtr& communicator, const ObjectAdapterFactoryPtr& objectAdapterFactory, const string& name, /*const RouterPrx& router,*/ bool noConfig) : _deactivated(false), _instance(instance), _communicator(communicator), _objectAdapterFactory(objectAdapterFactory), _hasAcmTimeout(false), _acmTimeout(0), _servantManager(new ServantManager(instance, name)), _activateOneOffDone(false), _name(name), _directCount(0), _waitForActivate(false), _waitForHold(0), _waitForHoldRetry(false), _destroying(false), _destroyed(false), _noConfig(noConfig) { } void Ice::ObjectAdapterI::initialize(const RouterPrx& router) { if(_noConfig) { _reference = _instance->referenceFactory()->create("dummy -t", ""); return; } PropertiesPtr properties = _instance->initializationData().properties; StringSeq unknownProps; bool noProps = filterProperties(unknownProps); // // Warn about unknown object adapter properties. // if(unknownProps.size() != 0 && properties->getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0) { Warning out(_instance->initializationData().logger); out << "found unknown properties for object adapter `" << _name << "':"; for(unsigned int i = 0; i < unknownProps.size(); ++i) { out << "\n " << unknownProps[i]; } } try { // // Make sure named adapter has some configuration // if(router == 0 && noProps) { InitializationException ex(__FILE__, __LINE__); ex.reason = "object adapter `" + _name + "' requires configuration"; throw ex; } const_cast(_id) = properties->getProperty(_name + ".AdapterId"); const_cast(_replicaGroupId) = properties->getProperty(_name + ".ReplicaGroupId"); // // Setup a reference to be used to get the default proxy options // when creating new proxies. By default, create twoway proxies. // string proxyOptions = properties->getPropertyWithDefault(_name + ".ProxyOptions", "-t"); try { _reference = _instance->referenceFactory()->create("dummy " + proxyOptions, ""); } catch(const ProxyParseException&) { InitializationException ex(__FILE__, __LINE__); ex.reason = "invalid proxy options `" + proxyOptions + "' for object adapter `" + _name + "'"; throw ex; } int threadPoolSize = properties->getPropertyAsInt(_name + ".ThreadPool.Size"); int threadPoolSizeMax = properties->getPropertyAsInt(_name + ".ThreadPool.SizeMax"); bool hasPriority = properties->getProperty(_name + ".ThreadPool.ThreadPriority") != ""; // // Create the per-adapter thread pool, if necessary. This is done before the creation of the incoming // connection factory as the thread pool is needed during creation for the call to incFdsInUse. // if(threadPoolSize > 0 || threadPoolSizeMax > 0 || hasPriority) { _threadPool = new ThreadPool(_instance, _name + ".ThreadPool", 0); } _hasAcmTimeout = properties->getProperty(_name + ".ACM") != ""; if(_hasAcmTimeout) { _acmTimeout = properties->getPropertyAsInt(_name + ".ACM"); _instance->connectionMonitor()->checkIntervalForACM(_acmTimeout); } if(!router) { const_cast(router) = RouterPrx::uncheckedCast( _instance->proxyFactory()->propertyToProxy(_name + ".Router")); } if(router) { _routerInfo = _instance->routerManager()->get(router); if(_routerInfo) { // // Make sure this router is not already registered with another adapter. // if(_routerInfo->getAdapter()) { throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter with router", _instance->identityToString(router->ice_getIdentity())); } // // Add the router's server proxy endpoints to this object // adapter. // vector endpoints = _routerInfo->getServerEndpoints(); copy(endpoints.begin(), endpoints.end(), back_inserter(_routerEndpoints)); sort(_routerEndpoints.begin(), _routerEndpoints.end()); // Must be sorted. _routerEndpoints.erase(unique(_routerEndpoints.begin(), _routerEndpoints.end()), _routerEndpoints.end()); // // Associate this object adapter with the router. This way, // new outgoing connections to the router's client proxy will // use this object adapter for callbacks. // _routerInfo->setAdapter(this); // // Also modify all existing outgoing connections to the // router's client proxy to use this object adapter for // callbacks. // _instance->outgoingConnectionFactory()->setRouterInfo(_routerInfo); } } else { // // Parse the endpoints, but don't store them in the adapter. // The connection factory might change it, for example, to // fill in the real port number. // vector endpoints = parseEndpoints(properties->getProperty(_name + ".Endpoints"), true); for(vector::iterator p = endpoints.begin(); p != endpoints.end(); ++p) { IncomingConnectionFactoryPtr factory = new IncomingConnectionFactory(_instance, *p, this); factory->initialize(_name); _incomingConnectionFactories.push_back(factory); } if(endpoints.empty()) { TraceLevelsPtr tl = _instance->traceLevels(); if(tl->network >= 2) { Trace out(_instance->initializationData().logger, tl->networkCat); out << "created adapter `" << _name << "' without endpoints"; } } // // Parse the published endpoints. // _publishedEndpoints = parsePublishedEndpoints(); } if(!properties->getProperty(_name + ".Locator").empty()) { setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(_name + ".Locator"))); } else { setLocator(_instance->referenceFactory()->getDefaultLocator()); } } catch(...) { destroy(); throw; } } Ice::ObjectAdapterI::~ObjectAdapterI() { if(!_deactivated) { Warning out(_instance->initializationData().logger); out << "object adapter `" << getName() << "' has not been deactivated"; } else if(!_destroyed) { Warning out(_instance->initializationData().logger); out << "object adapter `" << getName() << "' has not been destroyed"; } else { //assert(!_servantManager); // We don't clear this reference, it needs to be immutable. assert(!_threadPool); assert(_incomingConnectionFactories.empty()); assert(_directCount == 0); assert(!_waitForActivate); } } ObjectPrx Ice::ObjectAdapterI::newProxy(const Identity& ident, const string& facet) const { if(_id.empty()) { return newDirectProxy(ident, facet); } else if(_replicaGroupId.empty()) { return newIndirectProxy(ident, facet, _id); } else { return newIndirectProxy(ident, facet, _replicaGroupId); } } ObjectPrx Ice::ObjectAdapterI::newDirectProxy(const Identity& ident, const string& facet) const { vector endpoints = _publishedEndpoints; // // Now we also add the endpoints of the router's server proxy, if // any. This way, object references created by this object adapter // will also point to the router's server proxy endpoints. // copy(_routerEndpoints.begin(), _routerEndpoints.end(), back_inserter(endpoints)); // // Create a reference and return a proxy for this reference. // ReferencePtr ref = _instance->referenceFactory()->create(ident, facet, _reference, endpoints); return _instance->proxyFactory()->referenceToProxy(ref); } ObjectPrx Ice::ObjectAdapterI::newIndirectProxy(const Identity& ident, const string& facet, const string& id) const { // // Create an indirect reference with the given adapter id. // ReferencePtr ref = _instance->referenceFactory()->create(ident, facet, _reference, id); // // Return a proxy for the reference. // return _instance->proxyFactory()->referenceToProxy(ref); } void Ice::ObjectAdapterI::checkForDeactivation() const { if(_deactivated) { ObjectAdapterDeactivatedException ex(__FILE__, __LINE__); ex.name = getName(); throw ex; } } void Ice::ObjectAdapterI::checkIdentity(const Identity& ident) { if(ident.name.size() == 0) { IllegalIdentityException e(__FILE__, __LINE__); e.id = ident; throw e; } } vector Ice::ObjectAdapterI::parseEndpoints(const string& endpts, bool oaEndpoints) const { string::size_type beg; string::size_type end = 0; vector endpoints; while(end < endpts.length()) { const string delim = " \t\n\r"; beg = endpts.find_first_not_of(delim, end); if(beg == string::npos) { break; } end = beg; while(true) { end = endpts.find(':', end); if(end == string::npos) { end = endpts.length(); break; } else { bool quoted = false; string::size_type quote = beg; while(true) { quote = endpts.find('\"', quote); if(quote == string::npos || end < quote) { break; } else { quote = endpts.find('\"', ++quote); if(quote == string::npos) { break; } else if(end < quote) { quoted = true; break; } ++quote; } } if(!quoted) { break; } ++end; } } if(end == beg) { ++end; continue; } string s = endpts.substr(beg, end - beg); EndpointIPtr endp = _instance->endpointFactoryManager()->create(s, oaEndpoints); if(endp == 0) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid object adapter endpoint `" + s + "'"; throw ex; } endpoints.push_back(endp); ++end; } return endpoints; } std::vector ObjectAdapterI::parsePublishedEndpoints() { // // Parse published endpoints. If set, these are used in proxies // instead of the connection factory endpoints. // string endpts = _communicator->getProperties()->getProperty(_name + ".PublishedEndpoints"); vector endpoints = parseEndpoints(endpts, false); if(endpoints.empty()) { // // If the PublishedEndpoints property isn't set, we compute the published enpdoints // from the OA endpoints, expanding any endpoints that may be listening on INADDR_ANY // to include actual addresses in the published endpoints. // for(unsigned int i = 0; i < _incomingConnectionFactories.size(); ++i) { vector endps = _incomingConnectionFactories[i]->endpoint()->expand(); endpoints.insert(endpoints.end(), endps.begin(), endps.end()); } } if(_instance->traceLevels()->network >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); out << "published endpoints for object adapter `" << getName() << "':\n"; for(unsigned int i = 0; i < endpoints.size(); ++i) { if(i > 0) { out << ":"; } out << endpoints[i]->toString(); } } return endpoints; } void ObjectAdapterI::updateLocatorRegistry(const IceInternal::LocatorInfoPtr& locatorInfo, const Ice::ObjectPrx& proxy, bool registerProcess) { if(!registerProcess && _id.empty()) { return; // Nothing to update. } // // Call on the locator registry outside the synchronization to // blocking other threads that need to lock this OA. // LocatorRegistryPrx locatorRegistry = locatorInfo ? locatorInfo->getLocatorRegistry() : LocatorRegistryPrx(); string serverId; if(registerProcess) { assert(_instance); serverId = _instance->initializationData().properties->getProperty("Ice.ServerId"); if(!locatorRegistry) { Warning out(_instance->initializationData().logger); out << "object adapter `" << getName() << "' cannot register the process without a locator registry"; } else if(serverId.empty()) { Warning out(_instance->initializationData().logger); out << "object adapter `" << getName() << "' cannot register the process without a value for Ice.ServerId"; } } if(!locatorRegistry) { return; } if(!_id.empty()) { try { if(_replicaGroupId.empty()) { locatorRegistry->setAdapterDirectProxy(_id, proxy); } else { locatorRegistry->setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy); } } catch(const AdapterNotFoundException&) { if(_instance->traceLevels()->location >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->locationCat); out << "couldn't update object adapter `" + _id + "' endpoints with the locator registry:\n"; out << "the object adapter is not known to the locator registry"; } NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "object adapter"; ex.id = _id; throw ex; } catch(const InvalidReplicaGroupIdException&) { if(_instance->traceLevels()->location >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->locationCat); out << "couldn't update object adapter `" + _id + "' endpoints with the locator registry:\n"; out << "the replica group `" << _replicaGroupId << "' is not known to the locator registry"; } NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "replica group"; ex.id = _replicaGroupId; throw ex; } catch(const AdapterAlreadyActiveException&) { if(_instance->traceLevels()->location >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->locationCat); out << "couldn't update object adapter `" + _id + "' endpoints with the locator registry:\n"; out << "the object adapter endpoints are already set"; } ObjectAdapterIdInUseException ex(__FILE__, __LINE__); ex.id = _id; throw ex; } catch(const LocalException& ex) { if(_instance->traceLevels()->location >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->locationCat); out << "couldn't update object adapter `" + _id + "' endpoints with the locator registry:\n" << ex; } throw; // TODO: Shall we raise a special exception instead of a non obvious local exception? } if(_instance->traceLevels()->location >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->locationCat); out << "updated object adapter `" + _id + "' endpoints with the locator registry\n"; out << "endpoints = "; if(proxy) { EndpointSeq endpts = proxy ? proxy->ice_getEndpoints() : EndpointSeq(); ostringstream o; transform(endpts.begin(), endpts.end(), ostream_iterator(o, endpts.size() > 1 ? ":" : ""), Ice::constMemFun(&Endpoint::toString)); out << o.str(); } } } if(registerProcess && !serverId.empty()) { { IceUtil::Monitor::Lock sync(*this); if(_processId.name == "") { ProcessPtr servant = new ProcessI(_communicator); _processId = addWithUUID(servant)->ice_getIdentity(); } } try { locatorRegistry->setServerProcessProxy(serverId, ProcessPrx::uncheckedCast(createDirectProxy(_processId))); } catch(const ServerNotFoundException&) { if(_instance->traceLevels()->location >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->locationCat); out << "couldn't register server `" + serverId + "' with the locator registry:\n"; out << "the server is not known to the locator registry"; } NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "server"; ex.id = serverId; throw ex; } catch(const Ice::LocalException& ex) { if(_instance->traceLevels()->location >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->locationCat); out << "couldn't register server `" + serverId + "' with the locator registry:\n" << ex; } throw; // TODO: Shall we raise a special exception instead of a non obvious local exception? } if(_instance->traceLevels()->location >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->locationCat); out << "registered server `" + serverId + "' with the locator registry"; } } } bool Ice::ObjectAdapterI::filterProperties(StringSeq& unknownProps) { static const string suffixes[] = { "ACM", "AdapterId", "Endpoints", "Locator", "Locator.EncodingVersion", "Locator.EndpointSelection", "Locator.ConnectionCached", "Locator.PreferSecure", "Locator.CollocationOptimized", "Locator.Router", "PublishedEndpoints", "RegisterProcess", "ReplicaGroupId", "Router", "Router.EncodingVersion", "Router.EndpointSelection", "Router.ConnectionCached", "Router.PreferSecure", "Router.CollocationOptimized", "Router.Locator", "Router.Locator.EndpointSelection", "Router.Locator.ConnectionCached", "Router.Locator.PreferSecure", "Router.Locator.CollocationOptimized", "Router.Locator.LocatorCacheTimeout", "Router.LocatorCacheTimeout", "ProxyOptions", "ThreadPool.Size", "ThreadPool.SizeMax", "ThreadPool.SizeWarn", "ThreadPool.StackSize", "ThreadPool.Serialize", "ThreadPool.ThreadPriority" }; // // Do not create unknown properties list if Ice prefix, ie Ice, Glacier2, etc // bool addUnknown = true; string prefix = _name + "."; for(const char** i = IceInternal::PropertyNames::clPropNames; *i != 0; ++i) { string icePrefix = string(*i) + "."; if(prefix.find(icePrefix) == 0) { addUnknown = false; break; } } bool noProps = true; PropertyDict props = _instance->initializationData().properties->getPropertiesForPrefix(prefix); for(PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p) { bool valid = false; for(unsigned int i = 0; i < sizeof(suffixes)/sizeof(*suffixes); ++i) { string prop = prefix + suffixes[i]; if(p->first == prop) { noProps = false; valid = true; break; } else { } } if(!valid && addUnknown) { unknownProps.push_back(p->first); } } return noProps; } Ice-3.5.1/cpp/src/Ice/ObjectAdapterI.h0000644000076400007640000001257712223561476015450 0ustar mesmes// ********************************************************************** // // 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 ICE_OBJECT_ADAPTER_I_H #define ICE_OBJECT_ADAPTER_I_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace Ice { class ObjectAdapterI; typedef IceUtil::Handle ObjectAdapterIPtr; class ObjectAdapterI : public ObjectAdapter, public IceUtil::Monitor { public: virtual std::string getName() const; virtual CommunicatorPtr getCommunicator() const; virtual void activate(); virtual void hold(); virtual void waitForHold(); virtual void deactivate(); virtual void waitForDeactivate(); virtual bool isDeactivated() const; virtual void destroy(); virtual ObjectPrx add(const ObjectPtr&, const Identity&); virtual ObjectPrx addFacet(const ObjectPtr&, const Identity&, const std::string&); virtual ObjectPrx addWithUUID(const ObjectPtr&); virtual ObjectPrx addFacetWithUUID(const ObjectPtr&, const std::string&); virtual void addDefaultServant(const ObjectPtr&, const std::string&); virtual ObjectPtr remove(const Identity&); virtual ObjectPtr removeFacet(const Identity&, const std::string&); virtual FacetMap removeAllFacets(const Identity&); virtual ObjectPtr removeDefaultServant(const std::string&); virtual ObjectPtr find(const Identity&) const; virtual ObjectPtr findFacet(const Identity&, const std::string&) const; virtual FacetMap findAllFacets(const Identity&) const; virtual ObjectPtr findByProxy(const ObjectPrx&) const; virtual ObjectPtr findDefaultServant(const std::string&) const; virtual void addServantLocator(const ServantLocatorPtr&, const std::string&); virtual ServantLocatorPtr removeServantLocator(const std::string&); virtual ServantLocatorPtr findServantLocator(const std::string&) const; virtual ObjectPrx createProxy(const Identity&) const; virtual ObjectPrx createDirectProxy(const Identity&) const; virtual ObjectPrx createIndirectProxy(const Identity&) const; virtual void setLocator(const LocatorPrx&); virtual void refreshPublishedEndpoints(); virtual EndpointSeq getEndpoints() const; virtual EndpointSeq getPublishedEndpoints() const; bool isLocal(const ObjectPrx&) const; void flushAsyncBatchRequests(const IceInternal::CommunicatorBatchOutgoingAsyncPtr&); void updateConnectionObservers(); void updateThreadObservers(); void incDirectCount(); void decDirectCount(); IceInternal::ThreadPoolPtr getThreadPool() const; IceInternal::ServantManagerPtr getServantManager() const; Ice::Int getACM() const; private: ObjectAdapterI(const IceInternal::InstancePtr&, const CommunicatorPtr&, const IceInternal::ObjectAdapterFactoryPtr&, const std::string&, bool); virtual ~ObjectAdapterI(); void initialize(const RouterPrx&); friend class IceInternal::ObjectAdapterFactory; ObjectPrx newProxy(const Identity&, const std::string&) const; ObjectPrx newDirectProxy(const Identity&, const std::string&) const; ObjectPrx newIndirectProxy(const Identity&, const std::string&, const std::string&) const; void checkForDeactivation() const; static void checkIdentity(const Identity&); std::vector parseEndpoints(const std::string&, bool) const; std::vector parsePublishedEndpoints(); void updateLocatorRegistry(const IceInternal::LocatorInfoPtr&, const Ice::ObjectPrx&, bool); bool filterProperties(Ice::StringSeq&); bool _deactivated; IceInternal::InstancePtr _instance; CommunicatorPtr _communicator; IceInternal::ObjectAdapterFactoryPtr _objectAdapterFactory; IceInternal::ThreadPoolPtr _threadPool; bool _hasAcmTimeout; Ice::Int _acmTimeout; IceInternal::ServantManagerPtr _servantManager; bool _activateOneOffDone; const std::string _name; const std::string _id; const std::string _replicaGroupId; IceInternal::ReferencePtr _reference; std::vector _incomingConnectionFactories; std::vector _connectors; std::vector _routerEndpoints; IceInternal::RouterInfoPtr _routerInfo; std::vector _publishedEndpoints; IceInternal::LocatorInfoPtr _locatorInfo; int _directCount; // The number of direct proxies dispatching on this object adapter. bool _waitForActivate; int _waitForHold; bool _waitForHoldRetry; bool _destroying; bool _destroyed; bool _noConfig; Identity _processId; }; } #endif Ice-3.5.1/cpp/src/Ice/Reference.h0000644000076400007640000002545612223561476014526 0ustar mesmes// ********************************************************************** // // 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 ICE_REFERENCE_H #define ICE_REFERENCE_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace IceInternal { class BasicStream; class Reference : public IceUtil::Shared { public: class GetConnectionCallback : virtual public IceUtil::Shared { public: virtual void setConnection(const Ice::ConnectionIPtr&, bool) = 0; virtual void setException(const Ice::LocalException&) = 0; }; typedef IceUtil::Handle GetConnectionCallbackPtr; enum Mode { ModeTwoway, ModeOneway, ModeBatchOneway, ModeDatagram, ModeBatchDatagram, ModeLast = ModeBatchDatagram }; Mode getMode() const { return _mode; } bool getSecure() const { return _secure; } const Ice::ProtocolVersion& getProtocol() const { return _protocol; } const Ice::EncodingVersion& getEncoding() const { return _encoding; } const Ice::Identity& getIdentity() const { return _identity; } const std::string& getFacet() const { return _facet; } const InstancePtr& getInstance() const { return _instance; } const SharedContextPtr& getContext() const { return _context; } Ice::CommunicatorPtr getCommunicator() const; virtual std::vector getEndpoints() const = 0; virtual std::string getAdapterId() const = 0; virtual LocatorInfoPtr getLocatorInfo() const { return 0; } virtual RouterInfoPtr getRouterInfo() const { return 0; } virtual bool getCollocationOptimized() const = 0; virtual bool getCacheConnection() const = 0; virtual bool getPreferSecure() const = 0; virtual Ice::EndpointSelectionType getEndpointSelection() const = 0; virtual int getLocatorCacheTimeout() const = 0; virtual std::string getConnectionId() const = 0; // // The change* methods (here and in derived classes) create // a new reference based on the existing one, with the // corresponding value changed. // ReferencePtr changeContext(const Ice::Context&) const; ReferencePtr changeMode(Mode) const; ReferencePtr changeSecure(bool) const; ReferencePtr changeIdentity(const Ice::Identity&) const; ReferencePtr changeFacet(const std::string&) const; virtual ReferencePtr changeEncoding(const Ice::EncodingVersion&) const; virtual ReferencePtr changeCompress(bool) const; virtual ReferencePtr changeEndpoints(const std::vector&) const = 0; virtual ReferencePtr changeAdapterId(const std::string&) const = 0; virtual ReferencePtr changeLocator(const Ice::LocatorPrx&) const = 0; virtual ReferencePtr changeRouter(const Ice::RouterPrx&) const = 0; virtual ReferencePtr changeCollocationOptimized(bool) const = 0; virtual ReferencePtr changeLocatorCacheTimeout(int) const = 0; virtual ReferencePtr changeCacheConnection(bool) const = 0; virtual ReferencePtr changePreferSecure(bool) const = 0; virtual ReferencePtr changeEndpointSelection(Ice::EndpointSelectionType) const = 0; virtual ReferencePtr changeTimeout(int) const = 0; virtual ReferencePtr changeConnectionId(const std::string&) const = 0; int hash() const; // Conceptually const. // // Utility methods. // virtual bool isIndirect() const = 0; virtual bool isWellKnown() const = 0; // // Marshal the reference. // virtual void streamWrite(BasicStream*) const; // // Convert the reference to its string form. // virtual std::string toString() const; // // Convert the refernce to its property form. // virtual Ice::PropertyDict toProperty(const std::string&) const = 0; // // Get a suitable connection for this reference. // virtual Ice::ConnectionIPtr getConnection(bool&) const = 0; virtual void getConnection(const GetConnectionCallbackPtr&) const = 0; virtual bool operator==(const Reference&) const; virtual bool operator!=(const Reference&) const; virtual bool operator<(const Reference&) const; virtual ReferencePtr clone() const = 0; protected: Reference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const std::string&, Mode, bool, const Ice::ProtocolVersion&, const Ice::EncodingVersion&); Reference(const Reference&); virtual Ice::Int hashInit() const; mutable Ice::Int _hashValue; mutable bool _hashInitialized; private: const InstancePtr _instance; const Ice::CommunicatorPtr _communicator; Mode _mode; bool _secure; Ice::Identity _identity; SharedContextPtr _context; std::string _facet; Ice::ProtocolVersion _protocol; Ice::EncodingVersion _encoding; protected: bool _overrideCompress; bool _compress; // Only used if _overrideCompress == true }; class FixedReference : public Reference { public: FixedReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const std::string&, Mode, bool, const Ice::EncodingVersion&, const Ice::ConnectionIPtr&); virtual std::vector getEndpoints() const; virtual std::string getAdapterId() const; virtual bool getCollocationOptimized() const; virtual bool getCacheConnection() const; virtual bool getPreferSecure() const; virtual Ice::EndpointSelectionType getEndpointSelection() const; virtual int getLocatorCacheTimeout() const; virtual std::string getConnectionId() const; virtual ReferencePtr changeEndpoints(const std::vector&) const; virtual ReferencePtr changeAdapterId(const std::string&) const; virtual ReferencePtr changeLocator(const Ice::LocatorPrx&) const; virtual ReferencePtr changeRouter(const Ice::RouterPrx&) const; virtual ReferencePtr changeCollocationOptimized(bool) const; virtual ReferencePtr changeCacheConnection(bool) const; virtual ReferencePtr changePreferSecure(bool) const; virtual ReferencePtr changeEndpointSelection(Ice::EndpointSelectionType) const; virtual ReferencePtr changeLocatorCacheTimeout(int) const; virtual ReferencePtr changeTimeout(int) const; virtual ReferencePtr changeConnectionId(const std::string&) const; virtual bool isIndirect() const; virtual bool isWellKnown() const; virtual void streamWrite(BasicStream*) const; virtual std::string toString() const; virtual Ice::PropertyDict toProperty(const std::string&) const; virtual Ice::ConnectionIPtr getConnection(bool&) const; virtual void getConnection(const GetConnectionCallbackPtr&) const; virtual bool operator==(const Reference&) const; virtual bool operator!=(const Reference&) const; virtual bool operator<(const Reference&) const; virtual ReferencePtr clone() const; private: FixedReference(const FixedReference&); Ice::ConnectionIPtr _fixedConnection; }; class RoutableReference : public Reference { public: RoutableReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const std::string&, Mode, bool, const Ice::ProtocolVersion&, const Ice::EncodingVersion&, const std::vector&, const std::string&, const LocatorInfoPtr&, const RouterInfoPtr&, bool, bool, bool, Ice::EndpointSelectionType, int); virtual std::vector getEndpoints() const; virtual std::string getAdapterId() const; virtual LocatorInfoPtr getLocatorInfo() const; virtual RouterInfoPtr getRouterInfo() const; virtual bool getCollocationOptimized() const; virtual bool getCacheConnection() const; virtual bool getPreferSecure() const; virtual Ice::EndpointSelectionType getEndpointSelection() const; virtual int getLocatorCacheTimeout() const; virtual std::string getConnectionId() const; virtual ReferencePtr changeEncoding(const Ice::EncodingVersion&) const; virtual ReferencePtr changeCompress(bool) const; virtual ReferencePtr changeEndpoints(const std::vector&) const; virtual ReferencePtr changeAdapterId(const std::string&) const; virtual ReferencePtr changeLocator(const Ice::LocatorPrx&) const; virtual ReferencePtr changeRouter(const Ice::RouterPrx&) const; virtual ReferencePtr changeCollocationOptimized(bool) const; virtual ReferencePtr changeCacheConnection(bool) const; virtual ReferencePtr changePreferSecure(bool) const; virtual ReferencePtr changeEndpointSelection(Ice::EndpointSelectionType) const; virtual ReferencePtr changeLocatorCacheTimeout(int) const; virtual ReferencePtr changeTimeout(int) const; virtual ReferencePtr changeConnectionId(const std::string&) const; virtual bool isIndirect() const; virtual bool isWellKnown() const; virtual void streamWrite(BasicStream*) const; virtual std::string toString() const; virtual Ice::PropertyDict toProperty(const std::string&) const; virtual bool operator==(const Reference&) const; virtual bool operator!=(const Reference&) const; virtual bool operator<(const Reference&) const; virtual ReferencePtr clone() const; virtual Ice::ConnectionIPtr getConnection(bool&) const; virtual void getConnection(const GetConnectionCallbackPtr&) const; virtual void getConnectionNoRouterInfo(const GetConnectionCallbackPtr&) const; Ice::ConnectionIPtr createConnection(const std::vector&, bool&) const; void createConnection(const std::vector&, const GetConnectionCallbackPtr&) const; void applyOverrides(std::vector&) const; protected: RoutableReference(const RoutableReference&); std::vector filterEndpoints(const std::vector&) const; virtual int hashInit() const; private: std::vector _endpoints; // Empty if indirect proxy. std::string _adapterId; // Empty if direct proxy. LocatorInfoPtr _locatorInfo; // Null if no locator is used. RouterInfoPtr _routerInfo; // Null if no router is used. bool _collocationOptimized; bool _cacheConnection; bool _preferSecure; Ice::EndpointSelectionType _endpointSelection; int _locatorCacheTimeout; bool _overrideTimeout; int _timeout; // Only used if _overrideTimeout == true std::string _connectionId; }; } #endif Ice-3.5.1/cpp/src/Ice/ConnectionMonitor.h0000644000076400007640000000220712223561476016264 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECTION_MONITOR_H #define ICE_CONNECTION_MONITOR_H #include #include #include #include #include #include #include namespace IceInternal { class ConnectionMonitor : public IceUtil::TimerTask, public ::IceUtil::Mutex { public: void checkIntervalForACM(int); void destroy(); void add(const Ice::ConnectionIPtr&); void remove(const Ice::ConnectionIPtr&); private: ConnectionMonitor(const InstancePtr&, Ice::Int); virtual ~ConnectionMonitor(); friend class Instance; virtual void runTimerTask(); InstancePtr _instance; const int _interval; int _scheduledInterval; std::set _connections; }; } #endif Ice-3.5.1/cpp/src/Ice/ConnectorF.h0000644000076400007640000000111212223561476014647 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECTOR_F_H #define ICE_CONNECTOR_F_H #include #include namespace IceInternal { class Connector; ICE_API IceUtil::Shared* upCast(Connector*); typedef Handle ConnectorPtr; } #endif Ice-3.5.1/cpp/src/Ice/EventLoggerMsg.mc0000644000076400007640000000064712223561476015663 0ustar mesmes; // ********************************************************************** ; // ; // 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. ; // ; // ********************************************************************** MessageId=0x0 SymbolicName=EVENT_LOGGER_MSG Language=English %1 . Ice-3.5.1/cpp/src/Ice/BasicStream.cpp0000644000076400007640000025240212223561476015351 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; namespace { class StreamUTF8BufferI : public Ice::UTF8Buffer { public: StreamUTF8BufferI(BasicStream& stream) : _stream(stream) { } Ice::Byte* getMoreBytes(size_t howMany, Ice::Byte* firstUnused) { assert(howMany > 0); if(firstUnused != 0) { // // Return unused bytes // _stream.b.resize(firstUnused - _stream.b.begin()); } // // Index of first unused byte // Buffer::Container::size_type pos = _stream.b.size(); // // Since resize may reallocate the buffer, when firstUnused != 0, the // return value can be != firstUnused // _stream.resize(pos + howMany); return &_stream.b[pos]; } private: BasicStream& _stream; }; const Byte OPTIONAL_END_MARKER = 0xFF; const Byte FLAG_HAS_TYPE_ID_STRING = (1<<0); const Byte FLAG_HAS_TYPE_ID_INDEX = (1<<1); const Byte FLAG_HAS_TYPE_ID_COMPACT = (1<<0) | (1<<1); const Byte FLAG_HAS_OPTIONAL_MEMBERS = (1<<2); const Byte FLAG_HAS_INDIRECTION_TABLE = (1<<3); const Byte FLAG_HAS_SLICE_SIZE = (1<<4); const Byte FLAG_IS_LAST_SLICE = (1<<5); } IceInternal::BasicStream::BasicStream(Instance* instance, const EncodingVersion& encoding, bool unlimited) : IceInternal::Buffer(instance->messageSizeMax()), _instance(instance), _closure(0), _encoding(encoding), _currentReadEncaps(0), _currentWriteEncaps(0), _sliceObjects(true), _messageSizeMax(_instance->messageSizeMax()), // Cached for efficiency. _unlimited(unlimited), _stringConverter(instance->initializationData().stringConverter), _wstringConverter(instance->initializationData().wstringConverter), _startSeq(-1), _sizePos(-1) { // // Initialize the encoding members of our pre-allocated encapsulations, in case // this stream is used without an explicit encapsulation. // _preAllocatedReadEncaps.encoding = encoding; _preAllocatedWriteEncaps.encoding = encoding; } IceInternal::BasicStream::BasicStream(Instance* instance, const EncodingVersion& encoding, const Byte* begin, const Byte* end) : IceInternal::Buffer(begin, end), _instance(instance), _closure(0), _encoding(encoding), _currentReadEncaps(0), _currentWriteEncaps(0), _sliceObjects(true), _messageSizeMax(_instance->messageSizeMax()), // Cached for efficiency. _unlimited(false), _stringConverter(instance->initializationData().stringConverter), _wstringConverter(instance->initializationData().wstringConverter), _startSeq(-1), _sizePos(-1) { // // Initialize the encoding members of our pre-allocated encapsulations, in case // this stream is used without an explicit encapsulation. // _preAllocatedReadEncaps.encoding = encoding; _preAllocatedWriteEncaps.encoding = encoding; } void IceInternal::BasicStream::clear() { while(_currentReadEncaps && _currentReadEncaps != &_preAllocatedReadEncaps) { ReadEncaps* oldEncaps = _currentReadEncaps; _currentReadEncaps = _currentReadEncaps->previous; delete oldEncaps; } while(_currentWriteEncaps && _currentWriteEncaps != &_preAllocatedWriteEncaps) { WriteEncaps* oldEncaps = _currentWriteEncaps; _currentWriteEncaps = _currentWriteEncaps->previous; delete oldEncaps; } _startSeq = -1; _sizePos = -1; _sliceObjects = true; } void* IceInternal::BasicStream::closure() const { return _closure; } void* IceInternal::BasicStream::closure(void* p) { void* prev = _closure; _closure = p; return prev; } void IceInternal::BasicStream::swap(BasicStream& other) { assert(_instance == other._instance); swapBuffer(other); std::swap(_closure, other._closure); // // Swap is never called for BasicStreams that have encapsulations being read/write. However, // encapsulations might still be set in case marhsalling or un-marhsalling failed. We just // reset the encapsulations if there are still some set. // resetEncaps(); other.resetEncaps(); std::swap(_unlimited, other._unlimited); std::swap(_startSeq, other._startSeq); std::swap(_minSeqSize, other._minSeqSize); std::swap(_sizePos, other._sizePos); } void IceInternal::BasicStream::resetEncaps() { while(_currentReadEncaps && _currentReadEncaps != &_preAllocatedReadEncaps) { ReadEncaps* oldEncaps = _currentReadEncaps; _currentReadEncaps = _currentReadEncaps->previous; delete oldEncaps; } while(_currentWriteEncaps && _currentWriteEncaps != &_preAllocatedWriteEncaps) { WriteEncaps* oldEncaps = _currentWriteEncaps; _currentWriteEncaps = _currentWriteEncaps->previous; delete oldEncaps; } _preAllocatedReadEncaps.reset(); _preAllocatedWriteEncaps.reset(); } void IceInternal::BasicStream::startWriteEncaps() { // // If no encoding version is specified, use the current write // encapsulation encoding version if there's a current write // encapsulation, otherwise, use the stream encoding version. // if(_currentWriteEncaps) { startWriteEncaps(_currentWriteEncaps->encoding, _currentWriteEncaps->format); } else { startWriteEncaps(_encoding, Ice::DefaultFormat); } } void IceInternal::BasicStream::endWriteEncapsChecked() { if(!_currentWriteEncaps) { throw EncapsulationException(__FILE__, __LINE__, "not in an encapsulation"); } endWriteEncaps(); } void IceInternal::BasicStream::endReadEncapsChecked() { if(!_currentReadEncaps) { throw EncapsulationException(__FILE__, __LINE__, "not in an encapsulation"); } endReadEncaps(); } Int IceInternal::BasicStream::getReadEncapsSize() { assert(_currentReadEncaps); return _currentReadEncaps->sz - static_cast(sizeof(Int)) - 2; } EncodingVersion IceInternal::BasicStream::skipEncaps() { Int sz; read(sz); if(sz < 6) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } if(i - sizeof(Int) + sz > b.end()) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } EncodingVersion encoding; read(encoding.major); read(encoding.minor); i += sz - sizeof(Int) - 2; return encoding; } void IceInternal::BasicStream::readPendingObjects() { if(_currentReadEncaps && _currentReadEncaps->decoder) { _currentReadEncaps->decoder->readPendingObjects(); } else if(getReadEncoding() == Ice::Encoding_1_0) { // // If using the 1.0 encoding and no objects were read, we // still read an empty sequence of pending objects if // requested (i.e.: if this is called). // // This is required by the 1.0 encoding, even if no objects // are written we do marshal an empty sequence if marshaled // data types use classes. // skipSize(); } } void IceInternal::BasicStream::writePendingObjects() { if(_currentWriteEncaps && _currentWriteEncaps->encoder) { _currentWriteEncaps->encoder->writePendingObjects(); } else if(getWriteEncoding() == Ice::Encoding_1_0) { // // If using the 1.0 encoding and no objects were written, we // still write an empty sequence for pending objects if // requested (i.e.: if this is called). // // This is required by the 1.0 encoding, even if no objects // are written we do marshal an empty sequence if marshaled // data types use classes. // writeSize(0); } } Int IceInternal::BasicStream::readAndCheckSeqSize(int minSize) { Int sz = readSize(); if(sz == 0) { return sz; } // // The _startSeq variable points to the start of the sequence for which // we expect to read at least _minSeqSize bytes from the stream. // // If not initialized or if we already read more data than _minSeqSize, // we reset _startSeq and _minSeqSize for this sequence (possibly a // top-level sequence or enclosed sequence it doesn't really matter). // // Otherwise, we are reading an enclosed sequence and we have to bump // _minSeqSize by the minimum size that this sequence will require on // the stream. // // The goal of this check is to ensure that when we start un-marshalling // a new sequence, we check the minimal size of this new sequence against // the estimated remaining buffer size. This estimatation is based on // the minimum size of the enclosing sequences, it's _minSeqSize. // if(_startSeq == -1 || i > (b.begin() + _startSeq + _minSeqSize)) { _startSeq = static_cast(i - b.begin()); _minSeqSize = sz * minSize; } else { _minSeqSize += sz * minSize; } // // If there isn't enough data to read on the stream for the sequence (and // possibly enclosed sequences), something is wrong with the marshalled // data: it's claiming having more data that what is possible to read. // if(_startSeq + _minSeqSize > static_cast(b.size())) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } return sz; } void IceInternal::BasicStream::writeBlob(const vector& v) { if(!v.empty()) { Container::size_type pos = b.size(); resize(pos + v.size()); memcpy(&b[pos], &v[0], v.size()); } } void IceInternal::BasicStream::readBlob(vector& v, Int sz) { if(sz > 0) { if(b.end() - i < sz) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } vector(i, i + sz).swap(v); i += sz; } else { v.clear(); } } void IceInternal::BasicStream::write(const Byte* begin, const Byte* end) { Int sz = static_cast(end - begin); writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz); memcpy(&b[pos], begin, sz); } } void IceInternal::BasicStream::read(std::vector& v) { std::pair p; read(p); if(p.first != p.second) { v.resize(static_cast(p.second - p.first)); copy(p.first, p.second, v.begin()); } else { v.clear(); } } void IceInternal::BasicStream::read(pair& v) { Int sz = readAndCheckSeqSize(1); if(sz > 0) { v.first = i; v.second = i + sz; i += sz; } else { v.first = v.second = i; } } void IceInternal::BasicStream::write(const vector& v) { Int sz = static_cast(v.size()); writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz); copy(v.begin(), v.end(), b.begin() + pos); } } namespace { template struct BasicStreamWriteBoolHelper { static void write(const bool* begin, BasicStream::Container::size_type pos, BasicStream::Container& b, Int sz) { for(int idx = 0; idx < sz; ++idx) { b[pos + idx] = static_cast(*(begin + idx)); } } }; template<> struct BasicStreamWriteBoolHelper<1> { static void write(const bool* begin, BasicStream::Container::size_type pos, BasicStream::Container& b, Int sz) { memcpy(&b[pos], begin, sz); } }; } void IceInternal::BasicStream::write(const bool* begin, const bool* end) { Int sz = static_cast(end - begin); writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz); BasicStreamWriteBoolHelper::write(begin, pos, b, sz); } } void IceInternal::BasicStream::read(vector& v) { Int sz = readAndCheckSeqSize(1); if(sz > 0) { v.resize(sz); copy(i, i + sz, v.begin()); i += sz; } else { v.clear(); } } namespace { template struct BasicStreamReadBoolHelper { static bool* read(pair& v, Int sz, BasicStream::Container::iterator& i) { bool* array = new bool[sz]; for(int idx = 0; idx < sz; ++idx) { array[idx] = static_cast(*(i + idx)); } v.first = array; v.second = array + sz; return array; } }; template<> struct BasicStreamReadBoolHelper<1> { static bool* read(pair& v, Int sz, BasicStream::Container::iterator& i) { v.first = reinterpret_cast(i); v.second = reinterpret_cast(i) + sz; return 0; } }; } void IceInternal::BasicStream::read(pair& v, IceUtil::ScopedArray& result) { Int sz = readAndCheckSeqSize(1); if(sz > 0) { result.reset(BasicStreamReadBoolHelper::read(v, sz, i)); i += sz; } else { result.reset(); v.first = v.second = reinterpret_cast(i); } } void IceInternal::BasicStream::write(Short v) { Container::size_type pos = b.size(); resize(pos + sizeof(Short)); Byte* dest = &b[pos]; #ifdef ICE_BIG_ENDIAN const Byte* src = reinterpret_cast(&v) + sizeof(Short) - 1; *dest++ = *src--; *dest = *src; #else const Byte* src = reinterpret_cast(&v); *dest++ = *src++; *dest = *src; #endif } void IceInternal::BasicStream::write(const Short* begin, const Short* end) { Int sz = static_cast(end - begin); writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz * sizeof(Short)); #ifdef ICE_BIG_ENDIAN const Byte* src = reinterpret_cast(begin) + sizeof(Short) - 1; Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { *dest++ = *src--; *dest++ = *src--; src += 2 * sizeof(Short); } #else memcpy(&b[pos], reinterpret_cast(begin), sz * sizeof(Short)); #endif } } void IceInternal::BasicStream::read(Short& v) { if(b.end() - i < static_cast(sizeof(Short))) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } const Byte* src = &(*i); i += sizeof(Short); #ifdef ICE_BIG_ENDIAN Byte* dest = reinterpret_cast(&v) + sizeof(Short) - 1; *dest-- = *src++; *dest = *src; #else Byte* dest = reinterpret_cast(&v); *dest++ = *src++; *dest = *src; #endif } void IceInternal::BasicStream::read(vector& v) { Int sz = readAndCheckSeqSize(static_cast(sizeof(Short))); if(sz > 0) { Container::iterator begin = i; i += sz * static_cast(sizeof(Short)); v.resize(sz); #ifdef ICE_BIG_ENDIAN const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&v[0]) + sizeof(Short) - 1; for(int j = 0 ; j < sz ; ++j) { *dest-- = *src++; *dest-- = *src++; dest += 2 * sizeof(Short); } #else copy(begin, i, reinterpret_cast(&v[0])); #endif } else { v.clear(); } } void IceInternal::BasicStream::read(pair& v, IceUtil::ScopedArray& result) { Int sz = readAndCheckSeqSize(static_cast(sizeof(Short))); if(sz > 0) { #if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64) v.first = reinterpret_cast(i); i += sz * static_cast(sizeof(Short)); v.second = reinterpret_cast(i); #else result.reset(new Short[sz]); v.first = result.get(); v.second = result.get() + sz; Container::iterator begin = i; i += sz * static_cast(sizeof(Short)); # ifdef ICE_BIG_ENDIAN const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&result[0]) + sizeof(Short) - 1; for(int j = 0 ; j < sz ; ++j) { *dest-- = *src++; *dest-- = *src++; dest += 2 * sizeof(Short); } # else copy(begin, i, reinterpret_cast(&result[0])); # endif #endif } else { result.reset(); v.first = v.second = 0; } } void IceInternal::BasicStream::write(const Int* begin, const Int* end) { Int sz = static_cast(end - begin); writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz * sizeof(Int)); #ifdef ICE_BIG_ENDIAN const Byte* src = reinterpret_cast(begin) + sizeof(Int) - 1; Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; src += 2 * sizeof(Int); } #else memcpy(&b[pos], reinterpret_cast(begin), sz * sizeof(Int)); #endif } } void IceInternal::BasicStream::read(vector& v) { Int sz = readAndCheckSeqSize(static_cast(sizeof(Int))); if(sz > 0) { Container::iterator begin = i; i += sz * static_cast(sizeof(Int)); v.resize(sz); #ifdef ICE_BIG_ENDIAN const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&v[0]) + sizeof(Int) - 1; for(int j = 0 ; j < sz ; ++j) { *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; dest += 2 * sizeof(Int); } #else copy(begin, i, reinterpret_cast(&v[0])); #endif } else { v.clear(); } } void IceInternal::BasicStream::read(pair& v, ::IceUtil::ScopedArray& result) { Int sz = readAndCheckSeqSize(static_cast(sizeof(Int))); if(sz > 0) { #if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64) v.first = reinterpret_cast(i); i += sz * static_cast(sizeof(Int)); v.second = reinterpret_cast(i); #else result.reset(new Int[sz]); v.first = result.get(); v.second = result.get() + sz; Container::iterator begin = i; i += sz * static_cast(sizeof(Int)); # ifdef ICE_BIG_ENDIAN const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&result[0]) + sizeof(Int) - 1; for(int j = 0 ; j < sz ; ++j) { *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; dest += 2 * sizeof(Int); } # else copy(begin, i, reinterpret_cast(&result[0])); # endif #endif } else { result.reset(); v.first = v.second = 0; } } void IceInternal::BasicStream::write(Long v) { Container::size_type pos = b.size(); resize(pos + sizeof(Long)); Byte* dest = &b[pos]; #ifdef ICE_BIG_ENDIAN const Byte* src = reinterpret_cast(&v) + sizeof(Long) - 1; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest = *src; #else const Byte* src = reinterpret_cast(&v); *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest = *src; #endif } void IceInternal::BasicStream::write(const Long* begin, const Long* end) { Int sz = static_cast(end - begin); writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz * sizeof(Long)); #ifdef ICE_BIG_ENDIAN const Byte* src = reinterpret_cast(begin) + sizeof(Long) - 1; Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; src += 2 * sizeof(Long); } #else memcpy(&b[pos], reinterpret_cast(begin), sz * sizeof(Long)); #endif } } void IceInternal::BasicStream::read(Long& v) { if(b.end() - i < static_cast(sizeof(Long))) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } const Byte* src = &(*i); i += sizeof(Long); #ifdef ICE_BIG_ENDIAN Byte* dest = reinterpret_cast(&v) + sizeof(Long) - 1; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest = *src; #else Byte* dest = reinterpret_cast(&v); *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest = *src; #endif } void IceInternal::BasicStream::read(vector& v) { Int sz = readAndCheckSeqSize(static_cast(sizeof(Long))); if(sz > 0) { Container::iterator begin = i; i += sz * static_cast(sizeof(Long)); v.resize(sz); #ifdef ICE_BIG_ENDIAN const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&v[0]) + sizeof(Long) - 1; for(int j = 0 ; j < sz ; ++j) { *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; dest += 2 * sizeof(Long); } #else copy(begin, i, reinterpret_cast(&v[0])); #endif } else { v.clear(); } } void IceInternal::BasicStream::read(pair& v, IceUtil::ScopedArray& result) { Int sz = readAndCheckSeqSize(static_cast(sizeof(Long))); if(sz > 0) { #if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64) v.first = reinterpret_cast(i); i += sz * static_cast(sizeof(Long)); v.second = reinterpret_cast(i); #else result.reset(new Long[sz]); v.first = result.get(); v.second = result.get() + sz; Container::iterator begin = i; i += sz * static_cast(sizeof(Long)); # ifdef ICE_BIG_ENDIAN const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&result[0]) + sizeof(Long) - 1; for(int j = 0 ; j < sz ; ++j) { *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; dest += 2 * sizeof(Long); } # else copy(begin, i, reinterpret_cast(&result[0])); # endif #endif } else { result.reset(); v.first = v.second = 0; } } void IceInternal::BasicStream::write(Float v) { Container::size_type pos = b.size(); resize(pos + sizeof(Float)); Byte* dest = &b[pos]; #ifdef ICE_BIG_ENDIAN const Byte* src = reinterpret_cast(&v) + sizeof(Float) - 1; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest = *src; #else const Byte* src = reinterpret_cast(&v); *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest = *src; #endif } void IceInternal::BasicStream::write(const Float* begin, const Float* end) { Int sz = static_cast(end - begin); writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz * sizeof(Float)); #ifdef ICE_BIG_ENDIAN const Byte* src = reinterpret_cast(begin) + sizeof(Float) - 1; Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; src += 2 * sizeof(Float); } #else memcpy(&b[pos], reinterpret_cast(begin), sz * sizeof(Float)); #endif } } void IceInternal::BasicStream::read(Float& v) { if(b.end() - i < static_cast(sizeof(Float))) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } const Byte* src = &(*i); i += sizeof(Float); #ifdef ICE_BIG_ENDIAN Byte* dest = reinterpret_cast(&v) + sizeof(Float) - 1; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest = *src; #else Byte* dest = reinterpret_cast(&v); *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest = *src; #endif } void IceInternal::BasicStream::read(vector& v) { Int sz = readAndCheckSeqSize(static_cast(sizeof(Float))); if(sz > 0) { Container::iterator begin = i; i += sz * static_cast(sizeof(Float)); v.resize(sz); #ifdef ICE_BIG_ENDIAN const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&v[0]) + sizeof(Float) - 1; for(int j = 0 ; j < sz ; ++j) { *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; dest += 2 * sizeof(Float); } #else copy(begin, i, reinterpret_cast(&v[0])); #endif } else { v.clear(); } } void IceInternal::BasicStream::read(pair& v, IceUtil::ScopedArray& result) { Int sz = readAndCheckSeqSize(static_cast(sizeof(Float))); if(sz > 0) { #if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64) v.first = reinterpret_cast(i); i += sz * static_cast(sizeof(Float)); v.second = reinterpret_cast(i); #else result.reset(new Float[sz]); v.first = result.get(); v.second = result.get() + sz; Container::iterator begin = i; i += sz * static_cast(sizeof(Float)); # ifdef ICE_BIG_ENDIAN const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&result[0]) + sizeof(Float) - 1; for(int j = 0 ; j < sz ; ++j) { *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; dest += 2 * sizeof(Float); } # else copy(begin, i, reinterpret_cast(&result[0])); # endif #endif } else { result.reset(); v.first = v.second = 0; } } void IceInternal::BasicStream::write(Double v) { Container::size_type pos = b.size(); resize(pos + sizeof(Double)); Byte* dest = &b[pos]; #ifdef ICE_BIG_ENDIAN const Byte* src = reinterpret_cast(&v) + sizeof(Double) - 1; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest = *src; #else const Byte* src = reinterpret_cast(&v); # if defined(ICE_LITTLEBYTE_BIGWORD) dest[4] = *src++; dest[5] = *src++; dest[6] = *src++; dest[7] = *src++; dest[0] = *src++; dest[1] = *src++; dest[2] = *src++; dest[3] = *src; # else *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest = *src; # endif #endif } void IceInternal::BasicStream::write(const Double* begin, const Double* end) { Int sz = static_cast(end - begin); writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz * sizeof(Double)); #ifdef ICE_BIG_ENDIAN const Byte* src = reinterpret_cast(begin) + sizeof(Double) - 1; Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; *dest++ = *src--; src += 2 * sizeof(Double); } #elif defined(ICE_LITTLEBYTE_BIGWORD) const Byte* src = reinterpret_cast(begin); Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { dest[4] = *src++; dest[5] = *src++; dest[6] = *src++; dest[7] = *src++; dest[0] = *src++; dest[1] = *src++; dest[2] = *src++; dest[3] = *src++; dest += sizeof(Double); } #else memcpy(&b[pos], reinterpret_cast(begin), sz * sizeof(Double)); #endif } } void IceInternal::BasicStream::read(Double& v) { if(b.end() - i < static_cast(sizeof(Double))) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } const Byte* src = &(*i); i += sizeof(Double); #ifdef ICE_BIG_ENDIAN Byte* dest = reinterpret_cast(&v) + sizeof(Double) - 1; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest = *src; #else Byte* dest = reinterpret_cast(&v); # if defined(ICE_LITTLEBYTE_BIGWORD) dest[4] = *src++; dest[5] = *src++; dest[6] = *src++; dest[7] = *src++; dest[0] = *src++; dest[1] = *src++; dest[2] = *src++; dest[3] = *src; # else *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest = *src; # endif #endif } void IceInternal::BasicStream::read(vector& v) { Int sz = readAndCheckSeqSize(static_cast(sizeof(Double))); if(sz > 0) { Container::iterator begin = i; i += sz * static_cast(sizeof(Double)); v.resize(sz); #ifdef ICE_BIG_ENDIAN const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&v[0]) + sizeof(Double) - 1; for(int j = 0 ; j < sz ; ++j) { *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; dest += 2 * sizeof(Double); } #elif defined(ICE_LITTLEBYTE_BIGWORD) const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&v[0]); for(int j = 0 ; j < sz ; ++j) { dest[4] = *src++; dest[5] = *src++; dest[6] = *src++; dest[7] = *src++; dest[0] = *src++; dest[1] = *src++; dest[2] = *src++; dest[3] = *src++; dest += sizeof(Double); } #else copy(begin, i, reinterpret_cast(&v[0])); #endif } else { v.clear(); } } void IceInternal::BasicStream::read(pair& v, IceUtil::ScopedArray& result) { Int sz = readAndCheckSeqSize(static_cast(sizeof(Double))); if(sz > 0) { #if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64) v.first = reinterpret_cast(i); i += sz * static_cast(sizeof(Double)); v.second = reinterpret_cast(i); #else result.reset(new Double[sz]); v.first = result.get(); v.second = result.get() + sz; Container::iterator begin = i; i += sz * static_cast(sizeof(Double)); # ifdef ICE_BIG_ENDIAN const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&result[0]) + sizeof(Double) - 1; for(int j = 0 ; j < sz ; ++j) { *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; *dest-- = *src++; dest += 2 * sizeof(Double); } # elif defined(ICE_LITTLEBYTE_BIGWORD) const Byte* src = &(*begin); Byte* dest = reinterpret_cast(&result[0]); for(int j = 0 ; j < sz ; ++j) { dest[4] = *src++; dest[5] = *src++; dest[6] = *src++; dest[7] = *src++; dest[0] = *src++; dest[1] = *src++; dest[2] = *src++; dest[3] = *src++; dest += sizeof(Double); } # else copy(begin, i, reinterpret_cast(&result[0])); # endif #endif } else { result.reset(); v.first = v.second = 0; } } // // NOTE: This member function is intentionally omitted in order to // cause a link error if it is used. This is for efficiency reasons: // writing a const char * requires a traversal of the string to get // the string length first, which takes O(n) time, whereas getting the // string length from a std::string takes constant time. // /* void IceInternal::BasicStream::write(const char*) { } */ void IceInternal::BasicStream::writeConverted(const string& v) { // // What is the size of the resulting UTF-8 encoded string? // Impossible to tell, so we guess. If we don't guess correctly, // we'll have to fix the mistake afterwards // Int guessedSize = static_cast(v.size()); writeSize(guessedSize); // writeSize() only writes the size; it does not reserve any buffer space. size_t firstIndex = b.size(); StreamUTF8BufferI buffer(*this); Byte* lastByte = _stringConverter->toUTF8(v.data(), v.data() + v.size(), buffer); if(lastByte != b.end()) { b.resize(lastByte - b.begin()); } size_t lastIndex = b.size(); Int actualSize = static_cast(lastIndex - firstIndex); // // Check against the guess // if(guessedSize != actualSize) { if(guessedSize <= 254 && actualSize > 254) { // // Move the UTF-8 sequence 4 bytes further // Use memmove instead of memcpy since the source and destination typically overlap. // resize(b.size() + 4); memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, actualSize); } else if(guessedSize > 254 && actualSize <= 254) { // // Move the UTF-8 sequence 4 bytes back // memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, actualSize); resize(b.size() - 4); } if(guessedSize <= 254) { rewriteSize(actualSize, b.begin() + firstIndex - 1); } else { rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4); } } } void IceInternal::BasicStream::write(const string* begin, const string* end, bool convert) { Int sz = static_cast(end - begin); writeSize(sz); if(sz > 0) { for(int i = 0; i < sz; ++i) { write(begin[i], convert); } } } void IceInternal::BasicStream::readConverted(string& v, int sz) { _stringConverter->fromUTF8(i, i + sz, v); } void IceInternal::BasicStream::read(vector& v, bool convert) { Int sz = readAndCheckSeqSize(1); if(sz > 0) { v.resize(sz); for(int j = 0; j < sz; ++j) { read(v[j], convert); } } else { v.clear(); } } void IceInternal::BasicStream::write(const wstring& v) { if(v.empty()) { writeSize(0); return; } // // What is the size of the resulting UTF-8 encoded string? // Impossible to tell, so we guess. If we don't guess correctly, // we'll have to fix the mistake afterwards // Int guessedSize = static_cast(v.size()); writeSize(guessedSize); // writeSize() only writes the size; it does not reserve any buffer space. size_t firstIndex = b.size(); StreamUTF8BufferI buffer(*this); Byte* lastByte = _wstringConverter->toUTF8(v.data(), v.data() + v.size(), buffer); if(lastByte != b.end()) { b.resize(lastByte - b.begin()); } size_t lastIndex = b.size(); Int actualSize = static_cast(lastIndex - firstIndex); // // Check against the guess // if(guessedSize != actualSize) { if(guessedSize <= 254 && actualSize > 254) { // // Move the UTF-8 sequence 4 bytes further // Use memmove instead of memcpy since the source and destination typically overlap. // resize(b.size() + 4); memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, actualSize); } else if(guessedSize > 254 && actualSize <= 254) { // // Move the UTF-8 sequence 4 bytes back // memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, actualSize); resize(b.size() - 4); } if(guessedSize <= 254) { rewriteSize(actualSize, b.begin() + firstIndex - 1); } else { rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4); } } } void IceInternal::BasicStream::write(const wstring* begin, const wstring* end) { Int sz = static_cast(end - begin); writeSize(sz); if(sz > 0) { for(int i = 0; i < sz; ++i) { write(begin[i]); } } } void IceInternal::BasicStream::read(wstring& v) { Int sz = readSize(); if(sz > 0) { if(b.end() - i < sz) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } _wstringConverter->fromUTF8(i, i + sz, v); i += sz; } else { v.clear(); } } void IceInternal::BasicStream::read(vector& v) { Int sz = readAndCheckSeqSize(1); if(sz > 0) { v.resize(sz); for(int j = 0; j < sz; ++j) { read(v[j]); } } else { v.clear(); } } void IceInternal::BasicStream::write(const ObjectPrx& v) { _instance->proxyFactory()->proxyToStream(v, this); } void IceInternal::BasicStream::read(ObjectPrx& v) { v = _instance->proxyFactory()->streamToProxy(this); } Int IceInternal::BasicStream::readEnum(Int maxValue) { if(getReadEncoding() == Encoding_1_0) { if(maxValue < 127) { Byte value; read(value); return value; } else if(maxValue < 32767) { Short value; read(value); return value; } else { Int value; read(value); return value; } } else { return readSize(); } } void IceInternal::BasicStream::writeEnum(Int v, Int maxValue) { if(getWriteEncoding() == Encoding_1_0) { if(maxValue < 127) { write(static_cast(v)); } else if(maxValue < 32767) { write(static_cast(v)); } else { write(v); } } else { writeSize(v); } } void IceInternal::BasicStream::writeException(const Ice::UserException& e) { initWriteEncaps(); _currentWriteEncaps->encoder->write(e); } void IceInternal::BasicStream::throwException(const UserExceptionFactoryPtr& factory) { initReadEncaps(); _currentReadEncaps->decoder->throwException(factory); } void IceInternal::BasicStream::sliceObjects(bool doSlice) { _sliceObjects = doSlice; } bool IceInternal::BasicStream::readOptImpl(Int readTag, OptionalFormat expectedFormat) { if(getReadEncoding() == Encoding_1_0) { return false; // Optional members aren't supported with the 1.0 encoding. } while(true) { if(i >= b.begin() + _currentReadEncaps->start + _currentReadEncaps->sz) { return false; // End of encapsulation also indicates end of optionals. } Byte v; read(v); if(v == OPTIONAL_END_MARKER) { --i; // Rewind return false; } OptionalFormat format = static_cast(v & 0x07); // First 3 bits. Int tag = static_cast(v >> 3); if(tag == 30) { tag = readSize(); } if(tag > readTag) { i -= tag < 30 ? 1 : (tag < 255 ? 2 : 6); // Rewind return false; // No optional data members with the requested tag. } else if(tag < readTag) { skipOpt(format); // Skip optional data members } else { if(format != expectedFormat) { ostringstream os; os << "invalid optional data member `" << tag << "': unexpected format"; throw MarshalException(__FILE__, __LINE__, os.str()); } return true; } } return true; // Keep the compiler happy. } bool IceInternal::BasicStream::writeOptImpl(Int tag, OptionalFormat type) { if(getWriteEncoding() == Encoding_1_0) { return false; // Optional members aren't supported with the 1.0 encoding. } Byte v = static_cast(type); if(tag < 30) { v |= static_cast(tag << 3); write(v); } else { v |= 0xF0; // tag = 30 write(v); writeSize(tag); } return true; } void IceInternal::BasicStream::skipOpt(OptionalFormat type) { switch(type) { case Ice::OptionalFormatF1: { skip(1); break; } case Ice::OptionalFormatF2: { skip(2); break; } case Ice::OptionalFormatF4: { skip(4); break; } case Ice::OptionalFormatF8: { skip(8); break; } case Ice::OptionalFormatSize: { skipSize(); break; } case Ice::OptionalFormatVSize: { skip(readSize()); break; } case Ice::OptionalFormatFSize: { Int sz; read(sz); skip(sz); break; } case Ice::OptionalFormatClass: { read(0, 0); break; } } } void BasicStream::skipOpts() { // // Skip remaining un-read optional members. // while(true) { if(i >= b.begin() + _currentReadEncaps->start + _currentReadEncaps->sz) { return; // End of encapsulation also indicates end of optionals. } Byte v; read(v); if(v == OPTIONAL_END_MARKER) { return; } OptionalFormat format = static_cast(v & 0x07); // Read first 3 bits. if(static_cast(v >> 3) == 30) { skipSize(); } skipOpt(format); } } void IceInternal::BasicStream::throwUnmarshalOutOfBoundsException(const char* file, int line) { throw UnmarshalOutOfBoundsException(file, line); } void IceInternal::BasicStream::throwEncapsulationException(const char* file, int line) { throw EncapsulationException(file, line); } void IceInternal::BasicStream::initReadEncaps() { if(!_currentReadEncaps) // Lazy initialization. { _currentReadEncaps = &_preAllocatedReadEncaps; _currentReadEncaps->sz = static_cast(b.size()); } if(!_currentReadEncaps->decoder) // Lazy initialization. { ObjectFactoryManagerPtr factoryManager = _instance->servantFactoryManager(); if(_currentReadEncaps->encoding == Encoding_1_0) { _currentReadEncaps->decoder = new EncapsDecoder10(this, _currentReadEncaps, _sliceObjects, factoryManager); } else { _currentReadEncaps->decoder = new EncapsDecoder11(this, _currentReadEncaps, _sliceObjects, factoryManager); } } } void IceInternal::BasicStream::initWriteEncaps() { if(!_currentWriteEncaps) // Lazy initialization. { _currentWriteEncaps = &_preAllocatedWriteEncaps; _currentWriteEncaps->start = b.size(); } if(_currentWriteEncaps->format == Ice::DefaultFormat) { _currentWriteEncaps->format = _instance->defaultsAndOverrides()->defaultFormat; } if(!_currentWriteEncaps->encoder) // Lazy initialization. { if(_currentWriteEncaps->encoding == Encoding_1_0) { _currentWriteEncaps->encoder = new EncapsEncoder10(this, _currentWriteEncaps); } else { _currentWriteEncaps->encoder = new EncapsEncoder11(this, _currentWriteEncaps); } } } string IceInternal::BasicStream::EncapsDecoder::readTypeId(bool isIndex) { if(isIndex) { Int index = _stream->readSize(); TypeIdReadMap::const_iterator k = _typeIdMap.find(index); if(k == _typeIdMap.end()) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } return k->second; } else { string typeId; _stream->read(typeId, false); _typeIdMap.insert(make_pair(++_typeIdIndex, typeId)); return typeId; } } Ice::ObjectPtr IceInternal::BasicStream::EncapsDecoder::newInstance(const string& typeId) { Ice::ObjectPtr v; // // Try to find a factory registered for the specific type. // ObjectFactoryPtr userFactory = _servantFactoryManager->find(typeId); if(userFactory) { v = userFactory->create(typeId); } // // If that fails, invoke the default factory if one has been // registered. // if(!v) { userFactory = _servantFactoryManager->find(""); if(userFactory) { v = userFactory->create(typeId); } } // // Last chance: check the table of static factories (i.e., // automatically generated factories for concrete classes). // if(!v) { ObjectFactoryPtr of = IceInternal::factoryTable->getObjectFactory(typeId); if(of) { v = of->create(typeId); assert(v); } } return v; } void IceInternal::BasicStream::EncapsDecoder::addPatchEntry(Int index, PatchFunc patchFunc, void* patchAddr) { assert(index > 0); // // Check if already un-marshalled the object. If that's the case, // just patch the object smart pointer and we're done. // IndexToPtrMap::iterator p = _unmarshaledMap.find(index); if(p != _unmarshaledMap.end()) { (*patchFunc)(patchAddr, p->second); return; } // // Add patch entry if the object isn't un-marshalled yet, the // smart pointer will be patched when the instance is // un-marshalled. // PatchMap::iterator q = _patchMap.find(index); if(q == _patchMap.end()) { // // We have no outstanding instances to be patched for this // index, so make a new entry in the patch map. // q = _patchMap.insert(make_pair(index, PatchList())).first; } // // Append a patch entry for this instance. // PatchEntry e; e.patchFunc = patchFunc; e.patchAddr = patchAddr; q->second.push_back(e); } void IceInternal::BasicStream::EncapsDecoder::unmarshal(Int index, const Ice::ObjectPtr& v) { // // Add the object to the map of un-marshalled objects, this must // be done before reading the objects (for circular references). // _unmarshaledMap.insert(make_pair(index, v)); // // Read the object. // v->__read(_stream); // // Patch all instances now that the object is un-marshalled. // PatchMap::iterator patchPos = _patchMap.find(index); if(patchPos != _patchMap.end()) { assert(patchPos->second.size() > 0); // // Patch all pointers that refer to the instance. // for(PatchList::iterator k = patchPos->second.begin(); k != patchPos->second.end(); ++k) { (*k->patchFunc)(k->patchAddr, v); } // // Clear out the patch map for that index -- there is nothing left // to patch for that index for the time being. // _patchMap.erase(patchPos); } if(_objectList.empty() && _patchMap.empty()) { try { v->ice_postUnmarshal(); } catch(const std::exception& ex) { Warning out(_stream->instance()->initializationData().logger); out << "std::exception raised by ice_postUnmarshal:\n" << ex; } catch(...) { Warning out(_stream->instance()->initializationData().logger); out << "unknown exception raised by ice_postUnmarshal"; } } else { _objectList.push_back(v); if(_patchMap.empty()) { // // Iterate over the object list and invoke ice_postUnmarshal on // each object. We must do this after all objects have been // unmarshaled in order to ensure that any object data members // have been properly patched. // for(ObjectList::iterator p = _objectList.begin(); p != _objectList.end(); ++p) { try { (*p)->ice_postUnmarshal(); } catch(const std::exception& ex) { Warning out(_stream->instance()->initializationData().logger); out << "std::exception raised by ice_postUnmarshal:\n" << ex; } catch(...) { Warning out(_stream->instance()->initializationData().logger); out << "unknown exception raised by ice_postUnmarshal"; } } _objectList.clear(); } } } void IceInternal::BasicStream::EncapsDecoder10::read(PatchFunc patchFunc, void* patchAddr) { assert(patchFunc && patchAddr); // // Object references are encoded as a negative integer in 1.0. // Int index; _stream->read(index); if(index > 0) { throw MarshalException(__FILE__, __LINE__, "invalid object id"); } index = -index; if(index == 0) { // // Calling the patch function for null instances is necessary for correct functioning of Ice for // Python and Ruby. // ObjectPtr nil; patchFunc(patchAddr, nil); } else { addPatchEntry(index, patchFunc, patchAddr); } } void IceInternal::BasicStream::EncapsDecoder10::throwException(const UserExceptionFactoryPtr& factory) { assert(_sliceType == NoSlice); // // User exception with the 1.0 encoding start with a boolean flag // that indicates whether or not the exception has classes. // // This allows reading the pending objects even if some part of // the exception was sliced. // bool usesClasses; _stream->read(usesClasses); _sliceType = ExceptionSlice; _skipFirstSlice = false; // // Read the first slice header. // startSlice(); const string mostDerivedId = _typeId; UserExceptionFactoryPtr exceptionFactory = factory; while(true) { // // Look for a statically-generated factory for this ID. // if(!exceptionFactory) { exceptionFactory = factoryTable->getExceptionFactory(_typeId); } // // We found a factory, we get out of this loop. // if(exceptionFactory) { // // Got factory -- ask the factory to instantiate the // exception, initialize the exception members, and throw // the exception. // try { exceptionFactory->createAndThrow(_typeId); } catch(UserException& ex) { ex.__read(_stream); if(usesClasses) { readPendingObjects(); } throw; // Never reached. } } // // Slice off what we don't understand. // skipSlice(); try { startSlice(); } catch(UnmarshalOutOfBoundsException& ex) { // // An oversight in the 1.0 encoding means there is no marker to indicate // the last slice of an exception. As a result, we just try to read the // next type ID, which raises UnmarshalOutOfBoundsException when the // input buffer underflows. // // Set the reason member to a more helpful message. // ex.reason = "unknown exception type `" + mostDerivedId + "'"; throw; } } } void #ifndef NDEBUG IceInternal::BasicStream::EncapsDecoder10::startInstance(SliceType sliceType) #else IceInternal::BasicStream::EncapsDecoder10::startInstance(SliceType) #endif { assert(_sliceType == sliceType); _skipFirstSlice = true; } SlicedDataPtr IceInternal::BasicStream::EncapsDecoder10::endInstance(bool) { // // Read the Ice::Object slice. // if(_sliceType == ObjectSlice) { startSlice(); Int sz = _stream->readSize(); // For compatibility with the old AFM. if(sz != 0) { throw MarshalException(__FILE__, __LINE__, "invalid Object slice"); } endSlice(); } _sliceType = NoSlice; return 0; } const std::string& IceInternal::BasicStream::EncapsDecoder10::startSlice() { // // If first slice, don't read the header, it was already read in // readInstance or throwException to find the factory. // if(_skipFirstSlice) { _skipFirstSlice = false; return _typeId; } // // For objects, first read the type ID boolean which indicates // whether or not the type ID is encoded as a string or as an // index. For exceptions, the type ID is always encoded as a // string. // if(_sliceType == ObjectSlice) { bool isIndex; _stream->read(isIndex); _typeId = readTypeId(isIndex); } else { _stream->read(_typeId, false); } _stream->read(_sliceSize); if(_sliceSize < 4) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } return _typeId; } void IceInternal::BasicStream::EncapsDecoder10::endSlice() { } void IceInternal::BasicStream::EncapsDecoder10::skipSlice() { if(_stream->instance()->traceLevels()->slicing > 0) { const Ice::LoggerPtr& logger = _stream->instance()->initializationData().logger; if(_sliceType == ExceptionSlice) { traceSlicing("exception", _typeId, _stream->instance()->traceLevels()->slicingCat, logger); } else { traceSlicing("object", _typeId, _stream->instance()->traceLevels()->slicingCat, logger); } } assert(_sliceSize >= 4); _stream->skip(_sliceSize - sizeof(Int)); } void IceInternal::BasicStream::EncapsDecoder10::readPendingObjects() { Int num; do { num = _stream->readSize(); for(Int k = num; k > 0; --k) { readInstance(); } } while(num); if(!_patchMap.empty()) { // // If any entries remain in the patch map, the sender has sent an index for an object, but failed // to supply the object. // throw MarshalException(__FILE__, __LINE__, "index for class received, but no instance"); } } void IceInternal::BasicStream::EncapsDecoder10::readInstance() { Int index; _stream->read(index); if(index <= 0) { throw MarshalException(__FILE__, __LINE__, "invalid object id"); } _sliceType = ObjectSlice; _skipFirstSlice = false; // // Read the first slice header. // startSlice(); const string mostDerivedId = _typeId; ObjectPtr v; while(true) { // // For the 1.0 encoding, the type ID for the base Object class // marks the last slice. // if(_typeId == Object::ice_staticId()) { throw NoObjectFactoryException(__FILE__, __LINE__, "", mostDerivedId); } v = newInstance(_typeId); // // We found a factory, we get out of this loop. // if(v) { break; } // // If object slicing is disabled, stop un-marshalling. // if(!_sliceObjects) { throw NoObjectFactoryException(__FILE__, __LINE__, "object slicing is disabled", _typeId); } // // Slice off what we don't understand. // skipSlice(); startSlice(); // Read next Slice header for next iteration. } // // Un-marshal the object and add-it to the map of un-marshaled objects. // unmarshal(index, v); } void IceInternal::BasicStream::EncapsDecoder11::read(PatchFunc patchFunc, void* patchAddr) { Int index = _stream->readSize(); if(index < 0) { throw MarshalException(__FILE__, __LINE__, "invalid object id"); } else if(index == 0) { // // Calling the patch function for null instances is necessary for correct functioning of Ice for // Python and Ruby. // if(patchFunc) { ObjectPtr nil; patchFunc(patchAddr, nil); } } else if(_current && _current->sliceFlags & FLAG_HAS_INDIRECTION_TABLE) { // // When reading an object within a slice and there's an // indirect object table, always read an indirect reference // that points to an object from the indirect object table // marshaled at the end of the Slice. // // Maintain a list of indirect references. Note that the // indirect index starts at 1, so we decrement it by one to // derive an index into the indirection table that we'll read // at the end of the slice. // if(patchFunc) { IndirectPatchEntry e; e.index = index - 1; e.patchFunc = patchFunc; e.patchAddr = patchAddr; _current->indirectPatchList.push_back(e); } } else { readInstance(index, patchFunc, patchAddr); } } void IceInternal::BasicStream::EncapsDecoder11::throwException(const UserExceptionFactoryPtr& factory) { assert(!_current); push(ExceptionSlice); // // Read the first slice header. // startSlice(); const string mostDerivedId = _current->typeId; UserExceptionFactoryPtr exceptionFactory = factory; while(true) { // // Look for a statically-generated factory for this ID. // if(!exceptionFactory) { exceptionFactory = factoryTable->getExceptionFactory(_current->typeId); } // // We found a factory, we get out of this loop. // if(exceptionFactory) { // // Got factory -- ask the factory to instantiate the // exception, initialize the exception members, and throw // the exception. // try { exceptionFactory->createAndThrow(_current->typeId); } catch(UserException& ex) { ex.__read(_stream); throw; // Never reached. } } // // Slice off what we don't understand. // skipSlice(); // // If this is the last slice, raise an exception and stop un-marshalling. // if(_current->sliceFlags & FLAG_IS_LAST_SLICE) { if(mostDerivedId.length() > 2 && mostDerivedId[0] == ':' && mostDerivedId[1] == ':') { throw UnknownUserException(__FILE__, __LINE__, mostDerivedId.substr(2)); } else { throw UnknownUserException(__FILE__, __LINE__, mostDerivedId); } } startSlice(); } } void #ifndef NDEBUG IceInternal::BasicStream::EncapsDecoder11::startInstance(SliceType sliceType) #else IceInternal::BasicStream::EncapsDecoder11::startInstance(SliceType) #endif { assert(_current->sliceType == sliceType); _current->skipFirstSlice = true; } SlicedDataPtr IceInternal::BasicStream::EncapsDecoder11::endInstance(bool preserve) { SlicedDataPtr slicedData; if(preserve) { slicedData = readSlicedData(); } _current->slices.clear(); _current->indirectionTables.clear(); _current = _current->previous; return slicedData; } const std::string& IceInternal::BasicStream::EncapsDecoder11::startSlice() { // // If first slice, don't read the header, it was already read in // readInstance or throwException to find the factory. // if(_current->skipFirstSlice) { _current->skipFirstSlice = false; return _current->typeId; } _stream->read(_current->sliceFlags); // // Read the type ID, for object slices the type ID is encoded as a // string or as an index, for exceptions it's always encoded as a // string. // if(_current->sliceType == ObjectSlice) { if((_current->sliceFlags & FLAG_HAS_TYPE_ID_COMPACT) == FLAG_HAS_TYPE_ID_COMPACT) // Must be checked first! { _current->typeId.clear(); _current->compactId = _stream->readSize(); } else if(_current->sliceFlags & (FLAG_HAS_TYPE_ID_STRING | FLAG_HAS_TYPE_ID_INDEX)) { _current->typeId = readTypeId(_current->sliceFlags & FLAG_HAS_TYPE_ID_INDEX); _current->compactId = -1; } else { // Only the most derived slice encodes the type ID for the compact format. _current->typeId.clear(); _current->compactId = -1; } } else { _stream->read(_current->typeId, false); } // // Read the slice size if necessary. // if(_current->sliceFlags & FLAG_HAS_SLICE_SIZE) { _stream->read(_current->sliceSize); if(_current->sliceSize < 4) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } } else { _current->sliceSize = 0; } return _current->typeId; } void IceInternal::BasicStream::EncapsDecoder11::endSlice() { if(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS) { _stream->skipOpts(); } // // Read the indirect object table if one is present. // if(_current->sliceFlags & FLAG_HAS_INDIRECTION_TABLE) { IndexList indirectionTable(_stream->readAndCheckSeqSize(1)); for(IndexList::iterator p = indirectionTable.begin(); p != indirectionTable.end(); ++p) { *p = readInstance(_stream->readSize(), 0, 0); } // // Sanity checks. If there are optional members, it's possible // that not all object references were read if they are from // unknown optional data members. // if(indirectionTable.empty()) { throw MarshalException(__FILE__, __LINE__, "empty indirection table"); } if(_current->indirectPatchList.empty() && !(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS)) { throw MarshalException(__FILE__, __LINE__, "no references to indirection table"); } // // Convert indirect references into direct references. // IndirectPatchList::iterator p; for(p = _current->indirectPatchList.begin(); p != _current->indirectPatchList.end(); ++p) { assert(p->index >= 0); if(p->index >= static_cast(indirectionTable.size())) { throw MarshalException(__FILE__, __LINE__, "indirection out of range"); } addPatchEntry(indirectionTable[p->index], p->patchFunc, p->patchAddr); } _current->indirectPatchList.clear(); } } void IceInternal::BasicStream::EncapsDecoder11::skipSlice() { if(_stream->instance()->traceLevels()->slicing > 0) { const Ice::LoggerPtr& logger = _stream->instance()->initializationData().logger; if(_current->sliceType == ExceptionSlice) { traceSlicing("exception", _current->typeId, _stream->instance()->traceLevels()->slicingCat, logger); } else { traceSlicing("object", _current->typeId, _stream->instance()->traceLevels()->slicingCat, logger); } } Container::iterator start = _stream->i; if(_current->sliceFlags & FLAG_HAS_SLICE_SIZE) { assert(_current->sliceSize >= 4); _stream->skip(_current->sliceSize - sizeof(Int)); } else { if(_current->sliceType == ObjectSlice) { throw NoObjectFactoryException( __FILE__, __LINE__, "compact format prevents slicing (the sender should use the sliced format instead)", _current->typeId); } else { if(_current->typeId.length() > 2 && _current->typeId[0] == ':' && _current->typeId[1] == ':') { throw UnknownUserException(__FILE__, __LINE__, _current->typeId.substr(2)); } else { throw UnknownUserException(__FILE__, __LINE__, _current->typeId); } } } // // Preserve this slice. // SliceInfoPtr info = new SliceInfo; info->typeId = _current->typeId; info->compactId = _current->compactId; info->hasOptionalMembers = _current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS; info->isLastSlice = _current->sliceFlags & FLAG_IS_LAST_SLICE; if(info->hasOptionalMembers) { // // Don't include the optional member end marker. It will be re-written by // endSlice when the sliced data is re-written. // vector(start, _stream->i - 1).swap(info->bytes); } else { vector(start, _stream->i).swap(info->bytes); } _current->indirectionTables.push_back(IndexList()); // // Read the indirect object table. We read the instances or their // IDs if the instance is a reference to an already un-marhsaled // object. // // The SliceInfo object sequence is initialized only if // readSlicedData is called. // if(_current->sliceFlags & FLAG_HAS_INDIRECTION_TABLE) { IndexList& table = _current->indirectionTables.back(); table.resize(_stream->readAndCheckSeqSize(1)); for(IndexList::iterator p = table.begin(); p != table.end(); ++p) { *p = readInstance(_stream->readSize(), 0, 0); } } _current->slices.push_back(info); } bool IceInternal::BasicStream::EncapsDecoder11::readOpt(Ice::Int readTag, Ice::OptionalFormat expectedFormat) { if(!_current) { return _stream->readOptImpl(readTag, expectedFormat); } else if(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS) { return _stream->readOptImpl(readTag, expectedFormat); } return false; } Int IceInternal::BasicStream::EncapsDecoder11::readInstance(Int index, PatchFunc patchFunc, void* patchAddr) { assert(index > 0); if(index > 1) { if(patchFunc) { addPatchEntry(index, patchFunc, patchAddr); } return index; } push(ObjectSlice); // // Get the object ID before we start reading slices. If some // slices are skiped, the indirect object table are still read and // might read other objects. // index = ++_objectIdIndex; // // Read the first slice header. // startSlice(); const string mostDerivedId = _current->typeId; Ice::ObjectPtr v; const CompactIdResolverPtr& compactIdResolver = _stream->instance()->initializationData().compactIdResolver; while(true) { if(_current->compactId >= 0) { // // Translate a compact (numeric) type ID into a string type ID. // _current->typeId.clear(); if(compactIdResolver) { try { _current->typeId = compactIdResolver->resolve(_current->compactId); } catch(const LocalException&) { throw; } catch(const std::exception& ex) { ostringstream ostr; ostr << "exception in CompactIdResolver for ID " << _current->compactId; string msg = ostr.str(); string what = ex.what(); if(!what.empty()) { msg += ":\n" + what; } throw MarshalException(__FILE__, __LINE__, msg); } catch(...) { ostringstream ostr; ostr << "unknown exception in CompactIdResolver for ID " << _current->compactId; throw MarshalException(__FILE__, __LINE__, ostr.str()); } } if(_current->typeId.empty()) { _current->typeId = IceInternal::factoryTable->getTypeId(_current->compactId); } } if(!_current->typeId.empty()) { v = newInstance(_current->typeId); // // We found a factory, we get out of this loop. // if(v) { break; } } // // If object slicing is disabled, stop un-marshalling. // if(!_sliceObjects) { throw NoObjectFactoryException(__FILE__, __LINE__, "object slicing is disabled", _current->typeId); } // // Slice off what we don't understand. // skipSlice(); // // If this is the last slice, keep the object as an opaque UnknownSlicedObject. // if(_current->sliceFlags & FLAG_IS_LAST_SLICE) { // // Provide a factory with an opportunity to supply the object. // We pass the "::Ice::Object" ID to indicate that this is the // last chance to preserve the object. // v = newInstance(Object::ice_staticId()); if(!v) { v = new UnknownSlicedObject(mostDerivedId); } break; } startSlice(); // Read next Slice header for next iteration. } // // Un-marshal the object // unmarshal(index, v); if(!_current && !_patchMap.empty()) { // // If any entries remain in the patch map, the sender has sent an index for an object, but failed // to supply the object. // throw MarshalException(__FILE__, __LINE__, "index for class received, but no instance"); } if(patchFunc) { patchFunc(patchAddr, v); } return index; } SlicedDataPtr IceInternal::BasicStream::EncapsDecoder11::readSlicedData() { if(_current->slices.empty()) // No preserved slices. { return 0; } // // The indirectionTables member holds the indirection table for // each slice in slices. // assert(_current->slices.size() == _current->indirectionTables.size()); for(SliceInfoSeq::size_type n = 0; n < _current->slices.size(); ++n) { // // We use the "objects" list in SliceInfo to hold references // to the target objects. Note that the objects might not have // been read yet in the case of a circular reference to an // enclosing object. // const IndexList& table = _current->indirectionTables[n]; vector& objects = _current->slices[n]->objects; objects.resize(table.size()); IndexList::size_type j = 0; for(IndexList::const_iterator p = table.begin(); p != table.end(); ++p) { addPatchEntry(*p, &patchHandle, &objects[j++]); } } return new SlicedData(_current->slices); } Int IceInternal::BasicStream::EncapsEncoder::registerTypeId(const string& typeId) { TypeIdWriteMap::const_iterator p = _typeIdMap.find(typeId); if(p != _typeIdMap.end()) { return p->second; } else { _typeIdMap.insert(make_pair(typeId, ++_typeIdIndex)); return -1; } } void IceInternal::BasicStream::EncapsEncoder10::write(const ObjectPtr& v) { // // Object references are encoded as a negative integer in 1.0. // if(v) { _stream->write(-registerObject(v)); } else { _stream->write(0); } } void IceInternal::BasicStream::EncapsEncoder10::write(const UserException& v) { // // User exception with the 1.0 encoding start with a boolean // flag that indicates whether or not the exception uses // classes. // // This allows reading the pending objects even if some part of // the exception was sliced. // bool usesClasses = v.__usesClasses(); _stream->write(usesClasses); v.__write(_stream); if(usesClasses) { writePendingObjects(); } } void IceInternal::BasicStream::EncapsEncoder10::startInstance(SliceType sliceType, const SlicedDataPtr&) { _sliceType = sliceType; } void IceInternal::BasicStream::EncapsEncoder10::endInstance() { if(_sliceType == ObjectSlice) { // // Write the Object slice. // startSlice(Object::ice_staticId(), -1, true); _stream->writeSize(0); // For compatibility with the old AFM. endSlice(); } _sliceType = NoSlice; } void IceInternal::BasicStream::EncapsEncoder10::startSlice(const string& typeId, int, bool /*last*/) { // // For object slices, encode a boolean to indicate how the type ID // is encoded and the type ID either as a string or index. For // exception slices, always encode the type ID as a string. // if(_sliceType == ObjectSlice) { Int index = registerTypeId(typeId); if(index < 0) { _stream->write(false); _stream->write(typeId, false); } else { _stream->write(true); _stream->writeSize(index); } } else { _stream->write(typeId, false); } _stream->write(Int(0)); // Placeholder for the slice length. _writeSlice = _stream->b.size(); } void IceInternal::BasicStream::EncapsEncoder10::endSlice() { // // Write the slice length. // Int sz = static_cast(_stream->b.size() - _writeSlice + sizeof(Int)); Byte* dest = &(*(_stream->b.begin() + _writeSlice - sizeof(Int))); _stream->write(sz, dest); } void IceInternal::BasicStream::EncapsEncoder10::writePendingObjects() { while(!_toBeMarshaledMap.empty()) { // // Consider the to be marshalled objects as marshalled now, // this is necessary to avoid adding again the "to be // marshalled objects" into _toBeMarshaledMap while writing // objects. // _marshaledMap.insert(_toBeMarshaledMap.begin(), _toBeMarshaledMap.end()); PtrToIndexMap savedMap; savedMap.swap(_toBeMarshaledMap); _stream->writeSize(static_cast(savedMap.size())); for(PtrToIndexMap::iterator p = savedMap.begin(); p != savedMap.end(); ++p) { // // Ask the instance to marshal itself. Any new class // instances that are triggered by the classes marshaled // are added to toBeMarshaledMap. // _stream->write(p->second); try { p->first->ice_preMarshal(); } catch(const std::exception& ex) { Warning out(_stream->instance()->initializationData().logger); out << "std::exception raised by ice_preMarshal:\n" << ex; } catch(...) { Warning out(_stream->instance()->initializationData().logger); out << "unknown exception raised by ice_preMarshal"; } p->first->__write(_stream); } } _stream->writeSize(0); // Zero marker indicates end of sequence of sequences of instances. } Int IceInternal::BasicStream::EncapsEncoder10::registerObject(const ObjectPtr& v) { assert(v); // // Look for this instance in the to-be-marshaled map. // PtrToIndexMap::const_iterator p = _toBeMarshaledMap.find(v); if(p != _toBeMarshaledMap.end()) { return p->second; } // // Didn't find it, try the marshaled map next. // PtrToIndexMap::const_iterator q = _marshaledMap.find(v); if(q != _marshaledMap.end()) { return q->second; } // // We haven't seen this instance previously, create a new // index, and insert it into the to-be-marshaled map. // _toBeMarshaledMap.insert(make_pair(v, ++_objectIdIndex)); return _objectIdIndex; } void IceInternal::BasicStream::EncapsEncoder11::write(const ObjectPtr& v) { if(!v) { _stream->writeSize(0); // Nil reference. } else if(_current && _encaps->format == SlicedFormat) { // // If writting an object within a slice and using the sliced // format, write an index from the object indirection // table. The indirect object table is encoded at the end of // each slice and is always read (even if the Slice is // unknown). // PtrToIndexMap::const_iterator p = _current->indirectionMap.find(v); if(p == _current->indirectionMap.end()) { _current->indirectionTable.push_back(v); Int idx = static_cast(_current->indirectionTable.size()); // Position + 1 (0 is reserved for nil) _current->indirectionMap.insert(make_pair(v, idx)); _stream->writeSize(idx); } else { _stream->writeSize(p->second); } } else { writeInstance(v); // Write the instance or a reference if already marshaled. } } void IceInternal::BasicStream::EncapsEncoder11::write(const UserException& v) { v.__write(_stream); } void IceInternal::BasicStream::EncapsEncoder11::startInstance(SliceType sliceType, const SlicedDataPtr& data) { if(!_current) { _current = &_preAllocatedInstanceData; } else { _current = _current->next ? _current->next : new InstanceData(_current); } _current->sliceType = sliceType; _current->firstSlice = true; if(data) { writeSlicedData(data); } } void IceInternal::BasicStream::EncapsEncoder11::endInstance() { _current = _current->previous; } void IceInternal::BasicStream::EncapsEncoder11::startSlice(const string& typeId, int compactId, bool last) { assert(_current->indirectionTable.empty() && _current->indirectionMap.empty()); _current->sliceFlagsPos = _stream->b.size(); _current->sliceFlags = 0; if(_encaps->format == SlicedFormat) { _current->sliceFlags |= FLAG_HAS_SLICE_SIZE; // Encode the slice size if using the sliced format. } if(last) { _current->sliceFlags |= FLAG_IS_LAST_SLICE; // This is the last slice. } _stream->write(Byte(0)); // Placeholder for the slice flags // // For object slices, encode the flag and the type ID either as a // string or index. For exception slices, always encode the type // ID a string. // if(_current->sliceType == ObjectSlice) { // // Encode the type ID (only in the first slice for the compact // encoding). // if(_encaps->format == SlicedFormat || _current->firstSlice) { if(compactId >= 0) { _current->sliceFlags |= FLAG_HAS_TYPE_ID_COMPACT; _stream->writeSize(compactId); } else { Int index = registerTypeId(typeId); if(index < 0) { _current->sliceFlags |= FLAG_HAS_TYPE_ID_STRING; _stream->write(typeId, false); } else { _current->sliceFlags |= FLAG_HAS_TYPE_ID_INDEX; _stream->writeSize(index); } } } } else { _stream->write(typeId, false); } if(_current->sliceFlags & FLAG_HAS_SLICE_SIZE) { _stream->write(Int(0)); // Placeholder for the slice length. } _current->writeSlice = _stream->b.size(); _current->firstSlice = false; } void IceInternal::BasicStream::EncapsEncoder11::endSlice() { // // Write the optional member end marker if some optional members // were encoded. Note that the optional members are encoded before // the indirection table and are included in the slice size. // if(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS) { _stream->write(OPTIONAL_END_MARKER); } // // Write the slice length if necessary. // if(_current->sliceFlags & FLAG_HAS_SLICE_SIZE) { Int sz = static_cast(_stream->b.size() - _current->writeSlice + sizeof(Int)); Byte* dest = &(*(_stream->b.begin() + _current->writeSlice - sizeof(Int))); _stream->write(sz, dest); } // // Only write the indirection table if it contains entries. // if(!_current->indirectionTable.empty()) { assert(_encaps->format == SlicedFormat); _current->sliceFlags |= FLAG_HAS_INDIRECTION_TABLE; // // Write the indirection object table. // _stream->writeSize(static_cast(_current->indirectionTable.size())); ObjectList::const_iterator p; for(p = _current->indirectionTable.begin(); p != _current->indirectionTable.end(); ++p) { writeInstance(*p); } _current->indirectionTable.clear(); _current->indirectionMap.clear(); } // // Finally, update the slice flags. // Byte* dest = &(*(_stream->b.begin() + _current->sliceFlagsPos)); *dest = _current->sliceFlags; } bool IceInternal::BasicStream::EncapsEncoder11::writeOpt(Ice::Int tag, Ice::OptionalFormat format) { if(!_current) { return _stream->writeOptImpl(tag, format); } else { if(_stream->writeOptImpl(tag, format)) { _current->sliceFlags |= FLAG_HAS_OPTIONAL_MEMBERS; return true; } else { return false; } } } void IceInternal::BasicStream::EncapsEncoder11::writeSlicedData(const SlicedDataPtr& slicedData) { assert(slicedData); // // We only remarshal preserved slices if we are using the sliced // format. Otherwise, we ignore the preserved slices, which // essentially "slices" the object into the most-derived type // known by the sender. // if(_encaps->format != SlicedFormat) { return; } for(SliceInfoSeq::const_iterator p = slicedData->slices.begin(); p != slicedData->slices.end(); ++p) { startSlice((*p)->typeId, (*p)->compactId, (*p)->isLastSlice); // // Write the bytes associated with this slice. // _stream->writeBlob((*p)->bytes); if((*p)->hasOptionalMembers) { _current->sliceFlags |= FLAG_HAS_OPTIONAL_MEMBERS; } // // Make sure to also re-write the object indirection table. // _current->indirectionTable = (*p)->objects; endSlice(); } } void IceInternal::BasicStream::EncapsEncoder11::writeInstance(const ObjectPtr& v) { assert(v); // // If the instance was already marshaled, just write it's ID. // PtrToIndexMap::const_iterator q = _marshaledMap.find(v); if(q != _marshaledMap.end()) { _stream->writeSize(q->second); return; } // // We haven't seen this instance previously, create a new ID, // insert it into the marshaled map, and write the instance. // _marshaledMap.insert(make_pair(v, ++_objectIdIndex)); try { v->ice_preMarshal(); } catch(const std::exception& ex) { Warning out(_stream->instance()->initializationData().logger); out << "std::exception raised by ice_preMarshal:\n" << ex; } catch(...) { Warning out(_stream->instance()->initializationData().logger); out << "unknown exception raised by ice_preMarshal"; } _stream->writeSize(1); // Object instance marker. v->__write(_stream); } Ice-3.5.1/cpp/src/Ice/ProtocolPluginFacade.cpp0000644000076400007640000000463312223561476017221 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(ProtocolPluginFacade* p) { return p; } ProtocolPluginFacadePtr IceInternal::getProtocolPluginFacade(const CommunicatorPtr& communicator) { return new ProtocolPluginFacade(communicator); } CommunicatorPtr IceInternal::ProtocolPluginFacade::getCommunicator() const { return _communicator; } string IceInternal::ProtocolPluginFacade::getDefaultHost() const { return _instance->defaultsAndOverrides()->defaultHost; } Ice::EncodingVersion IceInternal::ProtocolPluginFacade::getDefaultEncoding() const { return _instance->defaultsAndOverrides()->defaultEncoding; } int IceInternal::ProtocolPluginFacade::getNetworkTraceLevel() const { return _instance->traceLevels()->network; } const char* IceInternal::ProtocolPluginFacade::getNetworkTraceCategory() const { return _instance->traceLevels()->networkCat; } EndpointHostResolverPtr IceInternal::ProtocolPluginFacade::getEndpointHostResolver() const { return _instance->endpointHostResolver(); } ProtocolSupport IceInternal::ProtocolPluginFacade::getProtocolSupport() const { return _instance->protocolSupport(); } bool IceInternal::ProtocolPluginFacade::preferIPv6() const { return _instance->preferIPv6(); } NetworkProxyPtr IceInternal::ProtocolPluginFacade::getNetworkProxy() const { return _instance->networkProxy(); } void IceInternal::ProtocolPluginFacade::addEndpointFactory(const EndpointFactoryPtr& factory) const { _instance->endpointFactoryManager()->add(factory); } EndpointFactoryPtr IceInternal::ProtocolPluginFacade::getEndpointFactory(Ice::Short type) const { return _instance->endpointFactoryManager()->get(type); } IceInternal::ProtocolPluginFacade::ProtocolPluginFacade(const CommunicatorPtr& communicator) : _instance(getInstance(communicator)), _communicator(communicator) { } Ice-3.5.1/cpp/src/Ice/Acceptor.h0000644000076400007640000000164512223561476014362 0ustar mesmes// ********************************************************************** // // 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 ICE_ACCEPTOR_H #define ICE_ACCEPTOR_H #include #include #include #include namespace IceInternal { class ICE_API Acceptor : virtual public ::IceUtil::Shared { public: virtual NativeInfoPtr getNativeInfo() = 0; virtual void close() = 0; virtual void listen() = 0; #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) virtual void startAccept() = 0; virtual void finishAccept() = 0; #endif virtual TransceiverPtr accept() = 0; virtual std::string toString() const = 0; }; } #endif Ice-3.5.1/cpp/src/Ice/TcpAcceptor.h0000644000076400007640000000270612223561476015030 0ustar mesmes// ********************************************************************** // // 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 ICE_TCP_ACCEPTOR_H #define ICE_TCP_ACCEPTOR_H #include #include #include #include #include #include namespace IceInternal { class TcpEndpoint; class TcpAcceptor : public Acceptor, public NativeInfo { public: virtual NativeInfoPtr getNativeInfo(); #ifdef ICE_USE_IOCP virtual AsyncInfo* getAsyncInfo(SocketOperation); #endif virtual void close(); virtual void listen(); #ifdef ICE_USE_IOCP virtual void startAccept(); virtual void finishAccept(); #endif virtual TransceiverPtr accept(); virtual std::string toString() const; int effectivePort() const; private: TcpAcceptor(const InstancePtr&, const std::string&, int); virtual ~TcpAcceptor(); friend class TcpEndpointI; const InstancePtr _instance; const TraceLevelsPtr _traceLevels; const ::Ice::LoggerPtr _logger; const Address _addr; int _backlog; #ifdef ICE_USE_IOCP SOCKET _acceptFd; int _acceptError; std::vector _acceptBuf; AsyncInfo _info; #endif }; } #endif Ice-3.5.1/cpp/src/Ice/Connector.h0000644000076400007640000000156312223561476014553 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECTOR_H #define ICE_CONNECTOR_H #include #include #include namespace IceInternal { class ICE_API Connector : public ::IceUtil::Shared { public: virtual TransceiverPtr connect() = 0; virtual Ice::Short type() const = 0; virtual std::string toString() const = 0; virtual bool operator==(const Connector&) const = 0; virtual bool operator!=(const Connector&) const = 0; virtual bool operator<(const Connector&) const = 0; }; } #endif Ice-3.5.1/cpp/src/Ice/.depend0000644000076400007640000100330312223561476013703 0ustar mesmesAcceptor$(OBJEXT): Acceptor.cpp ../Ice/Acceptor.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h ../Ice/AcceptorF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h ../Ice/TransceiverF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/LoggerF.h Application$(OBJEXT): Application.cpp $(includedir)/Ice/Application.h $(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/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 ../Ice/LoggerI.h $(includedir)/IceUtil/FileUtil.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/ArgVector.h ../Ice/GC.h Base64$(OBJEXT): Base64.cpp ../Ice/Base64.h $(includedir)/Ice/Config.h $(includedir)/IceUtil/Config.h Buffer$(OBJEXT): Buffer.cpp $(includedir)/Ice/Buffer.h $(includedir)/Ice/Config.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.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/Identity.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Version.h $(includedir)/Ice/BuiltinSequences.h BasicStream$(OBJEXT): BasicStream.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.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/ObjectAdapterF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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 ../Ice/DefaultsAndOverrides.h ../Ice/DefaultsAndOverridesF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.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/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/CommunicatorF.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/ProxyFactory.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/ObjectFactory.h ../Ice/ObjectFactoryManager.h $(includedir)/Ice/FactoryTableInit.h ../Ice/TraceUtil.h ../Ice/TraceLevels.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/SlicedData.h BuiltinSequences$(OBJEXT): BuiltinSequences.cpp $(includedir)/Ice/BuiltinSequences.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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)/IceUtil/DisableWarnings.h CommunicatorI$(OBJEXT): CommunicatorI.cpp $(includedir)/IceUtil/DisableWarnings.h ../Ice/CommunicatorI.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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)/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/Communicator.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/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/CommunicatorAsync.h ../Ice/Instance.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/NetworkF.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h ../Ice/ConnectionFactory.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Endpoint.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/Network.h $(includedir)/Ice/ConnectionAsync.h ../Ice/AcceptorF.h ../Ice/EndpointI.h ../Ice/ReferenceFactory.h ../Ice/Reference.h ../Ice/SharedContext.h ../Ice/ProxyFactory.h ../Ice/ObjectFactoryManager.h ../Ice/ObjectAdapterFactory.h ../Ice/ObjectAdapterI.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ../Ice/DefaultsAndOverrides.h ../Ice/TraceLevels.h ../Ice/GC.h $(includedir)/Ice/Router.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/UUID.h Communicator$(OBJEXT): Communicator.cpp $(includedir)/Ice/Communicator.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/DisableWarnings.h ConnectRequestHandler$(OBJEXT): ConnectRequestHandler.cpp ../Ice/ConnectRequestHandler.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/MutexProtocol.h ../Ice/RequestHandler.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h ../Ice/Reference.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/UniquePtr.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/LocatorF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h ../Ice/RouterInfo.h ../Ice/ConnectionRequestHandler.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Endpoint.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/Network.h $(includedir)/Ice/ConnectionAsync.h ../Ice/ThreadPool.h ../Ice/Selector.h $(includedir)/IceUtil/StringUtil.h ConnectionFactory$(OBJEXT): ConnectionFactory.cpp ../Ice/ConnectionFactory.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.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)/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/ConnectionFactoryF.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Proxy.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/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/Endpoint.h $(includedir)/Ice/BuiltinSequences.h ../Ice/TransceiverF.h $(includedir)/Ice/ServantManagerF.h ../Ice/ConnectorF.h $(includedir)/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/ThreadPoolF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/ConnectionAsync.h ../Ice/AcceptorF.h ../Ice/RouterInfoF.h ../Ice/EndpointI.h $(includedir)/Ice/InstrumentationF.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ../Ice/TraceLevels.h ../Ice/DefaultsAndOverrides.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h ../Ice/Transceiver.h ../Ice/Connector.h ../Ice/Acceptor.h ../Ice/ThreadPool.h ../Ice/Selector.h $(includedir)/IceUtil/StringUtil.h ../Ice/ObjectAdapterI.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/LocatorF.h ../Ice/Reference.h $(includedir)/Ice/RouterF.h ../Ice/SharedContext.h ../Ice/RouterInfo.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/IceUtil/Random.h ConnectionI$(OBJEXT): ConnectionI.cpp $(includedir)/IceUtil/DisableWarnings.h ../Ice/ConnectionI.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/StopWatch.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/Connection.h $(includedir)/Ice/Proxy.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/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/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ConnectionFactoryF.h ../Ice/TransceiverF.h $(includedir)/Ice/ServantManagerF.h ../Ice/ConnectorF.h $(includedir)/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/ThreadPoolF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/ConnectionAsync.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h ../Ice/TraceUtil.h ../Ice/DefaultsAndOverrides.h ../Ice/Transceiver.h ../Ice/ThreadPool.h ../Ice/Selector.h $(includedir)/IceUtil/StringUtil.h ../Ice/ConnectionMonitor.h ../Ice/ObjectAdapterI.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/LocatorF.h ../Ice/EndpointI.h ../Ice/AcceptorF.h ../Ice/ReferenceFactory.h ../Ice/Reference.h $(includedir)/Ice/RouterF.h ../Ice/SharedContext.h ../Ice/ProxyFactory.h ConnectionMonitor$(OBJEXT): ConnectionMonitor.cpp ../Ice/ConnectionMonitor.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/InstanceF.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.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/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.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/ConnectionFactoryF.h ../Ice/TransceiverF.h $(includedir)/Ice/ServantManagerF.h ../Ice/ConnectorF.h $(includedir)/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/ThreadPoolF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/ConnectionAsync.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Plugin.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/Direct.h Connection$(OBJEXT): Connection.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)/IceUtil/DisableWarnings.h ConnectionRequestHandler$(OBJEXT): ConnectionRequestHandler.cpp ../Ice/ConnectionRequestHandler.h ../Ice/RequestHandler.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.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/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 ../Ice/Reference.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ConnectionFactoryF.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h $(includedir)/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/ThreadPoolF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/ConnectionAsync.h ../Ice/RouterInfo.h Connector$(OBJEXT): Connector.cpp ../Ice/Connector.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h ../Ice/ConnectorF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h ../Ice/TransceiverF.h Current$(OBJEXT): Current.cpp $(includedir)/Ice/Current.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)/IceUtil/Optional.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.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)/IceUtil/DisableWarnings.h DefaultsAndOverrides$(OBJEXT): DefaultsAndOverrides.cpp $(includedir)/IceUtil/DisableWarnings.h ../Ice/DefaultsAndOverrides.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h ../Ice/DefaultsAndOverridesF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/Properties.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/PropertiesAdmin.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/LocalException.h Direct$(OBJEXT): Direct.cpp $(includedir)/Ice/Direct.h $(includedir)/Ice/ServantLocatorF.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/IceUtil/UniquePtr.h ../Ice/ObjectAdapterI.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/Proxy.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/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/BasicStream.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/LocatorF.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectAdapterFactoryF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ServantManagerF.h ../Ice/RouterInfoF.h ../Ice/ConnectorF.h ../Ice/LocatorInfoF.h ../Ice/ThreadPoolF.h ../Ice/ServantManager.h $(includedir)/Ice/ServantLocator.h ../Ice/Reference.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/RouterF.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LocalException.h DispatchInterceptor$(OBJEXT): DispatchInterceptor.cpp $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Config.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.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/ObjectAdapterF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h ../Ice/IncomingRequest.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/BasicStream.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/EndpointF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/ReferenceF.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h DynamicLibrary$(OBJEXT): DynamicLibrary.cpp $(includedir)/Ice/DynamicLibrary.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/IceUtil/StringUtil.h Endpoint$(OBJEXT): Endpoint.cpp $(includedir)/Ice/Endpoint.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)/IceUtil/Optional.h $(includedir)/Ice/Version.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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)/IceUtil/DisableWarnings.h EndpointFactoryManager$(OBJEXT): EndpointFactoryManager.cpp ../Ice/EndpointFactoryManager.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/EndpointFactoryF.h ../Ice/EndpointFactoryManagerF.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/Version.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/EndpointF.h ../Ice/OpaqueEndpointI.h ../Ice/EndpointI.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/EndpointTypes.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/EndpointFactory.h $(includedir)/Ice/LocalException.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h ../Ice/DefaultsAndOverrides.h EndpointFactory$(OBJEXT): EndpointFactory.cpp $(includedir)/Ice/EndpointFactory.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/EndpointFactoryF.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/Version.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h EndpointI$(OBJEXT): EndpointI.cpp ../Ice/EndpointI.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/Version.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/InstanceF.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h $(includedir)/Ice/Protocol.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/LoggerF.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/PropertiesI.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/IceUtil/MutexPtrLock.h EndpointTypes$(OBJEXT): EndpointTypes.cpp $(includedir)/Ice/EndpointTypes.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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)/IceUtil/DisableWarnings.h EventHandler$(OBJEXT): EventHandler.cpp ../Ice/EventHandler.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h ../Ice/EventHandlerF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/InstanceF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.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/ObjectAdapterF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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 ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.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/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/CommunicatorF.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/LoggerF.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h Exception$(OBJEXT): Exception.cpp $(includedir)/Ice/Exception.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Config.h $(includedir)/Ice/Format.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/ObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.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/Identity.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Version.h $(includedir)/Ice/BuiltinSequences.h ../Ice/Network.h $(includedir)/Ice/NetworkF.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/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.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/Plugin.h $(includedir)/Ice/SlicedData.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/StringUtil.h FacetMap$(OBJEXT): FacetMap.cpp $(includedir)/Ice/FacetMap.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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)/IceUtil/DisableWarnings.h FactoryTable$(OBJEXT): FactoryTable.cpp $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.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 FactoryTableInit$(OBJEXT): FactoryTableInit.cpp $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.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)/IceUtil/MutexPtrLock.h GC$(OBJEXT): GC.cpp $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/MutexProtocol.h ../Ice/GC.h $(includedir)/Ice/Config.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.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/EndpointF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h Identity$(OBJEXT): Identity.cpp $(includedir)/Ice/Identity.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Version.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)/IceUtil/DisableWarnings.h ImplicitContextI$(OBJEXT): ImplicitContextI.cpp ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.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)/IceUtil/Optional.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Identity.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Version.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.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)/IceUtil/MutexPtrLock.h ImplicitContext$(OBJEXT): ImplicitContext.cpp $(includedir)/Ice/ImplicitContext.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)/IceUtil/Optional.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Identity.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Version.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.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)/IceUtil/DisableWarnings.h IncomingAsync$(OBJEXT): IncomingAsync.cpp $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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/EndpointF.h $(includedir)/Ice/ServantLocator.h ../Ice/ConnectionI.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/StopWatch.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ConnectionFactoryF.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h $(includedir)/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/ThreadPoolF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/ConnectionAsync.h $(includedir)/Ice/LocalException.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h ../Ice/ReplyStatus.h $(includedir)/IceUtil/MutexPtrLock.h Incoming$(OBJEXT): Incoming.cpp $(includedir)/Ice/Incoming.h $(includedir)/Ice/InstanceF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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/EndpointF.h $(includedir)/Ice/IncomingAsync.h ../Ice/IncomingRequest.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointTypes.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/CommunicatorF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ServantLocator.h ../Ice/ServantManager.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Connection.h $(includedir)/Ice/ConnectionFactoryF.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h $(includedir)/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/ThreadPoolF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/ConnectionAsync.h $(includedir)/Ice/LocalException.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ../Ice/ReplyStatus.h $(includedir)/IceUtil/StringUtil.h Initialize$(OBJEXT): Initialize.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/ArgVector.h $(includedir)/IceUtil/Config.h ../Ice/GC.h $(includedir)/Ice/Config.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.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/EndpointF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/InstanceF.h ../Ice/CommunicatorI.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.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/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/Communicator.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/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/CommunicatorAsync.h ../Ice/PropertiesI.h $(includedir)/Ice/LocalException.h ../Ice/StreamI.h $(includedir)/Ice/Stream.h ../Ice/LoggerI.h $(includedir)/Ice/Logger.h $(includedir)/IceUtil/FileUtil.h ../Ice/Instance.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/NetworkF.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/IceUtil/MutexPtrLock.h Instance$(OBJEXT): Instance.cpp $(includedir)/IceUtil/DisableWarnings.h ../Ice/Instance.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.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/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.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/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/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/TraceLevels.h ../Ice/DefaultsAndOverrides.h $(includedir)/Ice/Endpoint.h ../Ice/RouterInfo.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/Router.h ../Ice/LocatorInfo.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/Locator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/ProcessF.h ../Ice/ReferenceFactory.h ../Ice/Reference.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h ../Ice/ProxyFactory.h ../Ice/ThreadPool.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/Network.h ../Ice/Selector.h $(includedir)/IceUtil/StringUtil.h ../Ice/ConnectionFactory.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Connection.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h $(includedir)/Ice/ConnectionAsync.h ../Ice/AcceptorF.h ../Ice/EndpointI.h ../Ice/ConnectionMonitor.h ../Ice/ObjectFactoryManager.h ../Ice/ObjectAdapterFactory.h ../Ice/ObjectAdapterI.h $(includedir)/Ice/ObjectAdapter.h ../Ice/PropertiesI.h ../Ice/PropertiesAdminI.h $(includedir)/Ice/NativePropertiesAdmin.h ../Ice/LoggerI.h $(includedir)/Ice/Logger.h $(includedir)/IceUtil/FileUtil.h ../Ice/EndpointFactoryManager.h $(includedir)/Ice/EndpointFactoryF.h ../Ice/RetryQueue.h $(includedir)/Ice/DynamicLibrary.h ../Ice/PluginManagerI.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/ImplicitContextF.h ../Ice/GC.h $(includedir)/Ice/MetricsAdminI.h $(includedir)/Ice/Metrics.h ../Ice/InstrumentationI.h $(includedir)/Ice/MetricsObserverI.h $(includedir)/Ice/MetricsFunctional.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/MutexPtrLock.h ../Ice/SysLoggerI.h ../Ice/UdpEndpointI.h $(includedir)/Ice/EndpointFactory.h ../Ice/TcpEndpointI.h LocalException$(OBJEXT): LocalException.cpp $(includedir)/Ice/LocalException.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)/IceUtil/Optional.h $(includedir)/Ice/Identity.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Version.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.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)/IceUtil/DisableWarnings.h LocalObject$(OBJEXT): LocalObject.cpp $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h LocatorInfo$(OBJEXT): LocatorInfo.cpp $(includedir)/IceUtil/DisableWarnings.h ../Ice/LocatorInfo.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h ../Ice/LocatorInfoF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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)/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/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/PropertiesF.h $(includedir)/Ice/Locator.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 $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h ../Ice/TraceLevels.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ../Ice/EndpointI.h $(includedir)/Ice/Endpoint.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h ../Ice/Network.h ../Ice/Reference.h $(includedir)/Ice/RouterF.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h Locator$(OBJEXT): Locator.cpp $(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 $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/DisableWarnings.h LoggerI$(OBJEXT): LoggerI.cpp $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Config.h ../Ice/LoggerI.h $(includedir)/Ice/Logger.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)/IceUtil/FileUtil.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h Logger$(OBJEXT): Logger.cpp $(includedir)/Ice/Logger.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/IceUtil/DisableWarnings.h LoggerUtil$(OBJEXT): LoggerUtil.cpp $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h ../Ice/Instance.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.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/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.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/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/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h Metrics$(OBJEXT): Metrics.cpp $(includedir)/Ice/Metrics.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/FactoryTableInit.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/DisableWarnings.h MetricsAdminI$(OBJEXT): MetricsAdminI.cpp $(includedir)/Ice/MetricsAdminI.h $(includedir)/Ice/Properties.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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.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)/IceUtil/Unicode.h $(includedir)/Ice/Metrics.h $(includedir)/Ice/FactoryTableInit.h ../Ice/InstrumentationI.h $(includedir)/Ice/MetricsObserverI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/Connection.h $(includedir)/Ice/MetricsFunctional.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/NetworkF.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/LoggerUtil.h $(includedir)/IceUtil/StringUtil.h MetricsObserverI$(OBJEXT): MetricsObserverI.cpp $(includedir)/Ice/MetricsObserverI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Instrumentation.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/EndpointF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointTypes.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/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/Metrics.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/MetricsAdminI.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.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)/IceUtil/Unicode.h $(includedir)/Ice/MetricsFunctional.h Network$(OBJEXT): Network.cpp $(includedir)/IceUtil/DisableWarnings.h ../Ice/Network.h $(includedir)/Ice/Config.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/NetworkF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/LoggerF.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Properties.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/PropertiesAdmin.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Random.h ObjectAdapterFactory$(OBJEXT): ObjectAdapterFactory.cpp ../Ice/ObjectAdapterFactory.h ../Ice/ObjectAdapterI.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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)/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/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/ServantLocatorF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectAdapterFactoryF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ServantManagerF.h ../Ice/RouterInfoF.h ../Ice/ConnectorF.h ../Ice/LocatorInfoF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/IceUtil/UUID.h ObjectAdapterI$(OBJEXT): ObjectAdapterI.cpp $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Config.h ../Ice/ObjectAdapterI.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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)/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/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/ServantLocatorF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectAdapterFactoryF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ServantManagerF.h ../Ice/RouterInfoF.h ../Ice/ConnectorF.h ../Ice/LocatorInfoF.h ../Ice/ThreadPoolF.h ../Ice/ObjectAdapterFactory.h ../Ice/Instance.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/Direct.h ../Ice/ConnectionMonitor.h ../Ice/ProxyFactory.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h ../Ice/ReferenceFactory.h ../Ice/Reference.h $(includedir)/Ice/RouterF.h ../Ice/SharedContext.h ../Ice/EndpointI.h ../Ice/TransceiverF.h ../Ice/AcceptorF.h ../Ice/Network.h ../Ice/EndpointFactoryManager.h $(includedir)/Ice/EndpointFactoryF.h ../Ice/ConnectionFactory.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Connection.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h $(includedir)/Ice/ConnectionAsync.h ../Ice/ServantManager.h ../Ice/RouterInfo.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h ../Ice/LocatorInfo.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ../Ice/ThreadPool.h ../Ice/Selector.h $(includedir)/IceUtil/StringUtil.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/Router.h ../Ice/DefaultsAndOverrides.h ../Ice/TraceLevels.h ../Ice/PropertyNames.h ObjectAdapter$(OBJEXT): ObjectAdapter.cpp $(includedir)/Ice/ObjectAdapter.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/ServantLocatorF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/DisableWarnings.h ObjectFactoryManager$(OBJEXT): ObjectFactoryManager.cpp ../Ice/ObjectFactoryManager.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/ObjectFactory.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/BuiltinSequences.h ObjectFactory$(OBJEXT): ObjectFactory.cpp $(includedir)/Ice/ObjectFactory.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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)/IceUtil/DisableWarnings.h Object$(OBJEXT): Object.cpp $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Config.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.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/ObjectAdapterF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/BasicStream.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/EndpointF.h $(includedir)/Ice/IncomingAsync.h ../Ice/IncomingRequest.h $(includedir)/Ice/Direct.h $(includedir)/Ice/ReferenceF.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/SlicedData.h Instrumentation$(OBJEXT): Instrumentation.cpp $(includedir)/Ice/Instrumentation.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)/IceUtil/Optional.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.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)/IceUtil/DisableWarnings.h ObserverHelper$(OBJEXT): ObserverHelper.cpp $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.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)/IceUtil/Optional.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/InstanceF.h ../Ice/Reference.h $(includedir)/Ice/ReferenceF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/RouterF.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/EndpointTypes.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/CommunicatorF.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/LocatorF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h InstrumentationI$(OBJEXT): InstrumentationI.cpp ../Ice/InstrumentationI.h $(includedir)/Ice/MetricsObserverI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Instrumentation.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/EndpointF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointTypes.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/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/Metrics.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/MetricsAdminI.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.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)/IceUtil/Unicode.h $(includedir)/Ice/MetricsFunctional.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h OpaqueEndpointI$(OBJEXT): OpaqueEndpointI.cpp ../Ice/OpaqueEndpointI.h ../Ice/EndpointI.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/Version.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/InstanceF.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h $(includedir)/Ice/Protocol.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/EndpointFactory.h $(includedir)/Ice/EndpointFactoryF.h ../Ice/DefaultsAndOverrides.h ../Ice/DefaultsAndOverridesF.h ../Ice/Base64.h ../Ice/HashUtil.h $(includedir)/Ice/LocalException.h OutgoingAsync$(OBJEXT): OutgoingAsync.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/ConnectionIF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.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/EndpointF.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ConnectionFactoryF.h ../Ice/TransceiverF.h $(includedir)/Ice/ServantManagerF.h ../Ice/ConnectorF.h $(includedir)/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/ThreadPoolF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/ConnectionAsync.h ../Ice/RequestHandler.h ../Ice/Reference.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Direct.h $(includedir)/Ice/PropertiesAdmin.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ../Ice/LocatorInfo.h ../Ice/ProxyFactory.h ../Ice/RouterInfo.h ../Ice/ReplyStatus.h ../Ice/ThreadPool.h ../Ice/Selector.h $(includedir)/IceUtil/StringUtil.h ../Ice/RetryQueue.h Outgoing$(OBJEXT): Outgoing.cpp $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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/EndpointF.h ../Ice/RequestHandler.h $(includedir)/Ice/OutgoingAsyncF.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ConnectionFactoryF.h ../Ice/TransceiverF.h $(includedir)/Ice/ServantManagerF.h ../Ice/ConnectorF.h $(includedir)/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/ThreadPoolF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/ConnectionAsync.h ../Ice/Reference.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Direct.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LocalException.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h ../Ice/ReplyStatus.h ../Ice/ProxyFactory.h PluginManagerI$(OBJEXT): PluginManagerI.cpp $(includedir)/IceUtil/Options.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h ../Ice/PluginManagerI.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/LoggerF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/IceUtil/Mutex.h $(includedir)/Ice/DynamicLibrary.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/Proxy.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/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/StatsF.h $(includedir)/Ice/InstrumentationF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h ../Ice/Instance.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/NetworkF.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h Plugin$(OBJEXT): Plugin.cpp $(includedir)/Ice/Plugin.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)/IceUtil/Optional.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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)/IceUtil/DisableWarnings.h Process$(OBJEXT): Process.cpp $(includedir)/Ice/Process.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 PropertiesAdminI$(OBJEXT): PropertiesAdminI.cpp $(includedir)/IceUtil/DisableWarnings.h ../Ice/PropertiesAdminI.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/Properties.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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)/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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Plugin.h PropertiesI$(OBJEXT): PropertiesI.cpp ../Ice/PropertiesI.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/Properties.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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)/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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/IceUtil/Unicode.h $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/FileUtil.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/LocalException.h ../Ice/PropertyNames.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h PropertiesAdmin$(OBJEXT): PropertiesAdmin.cpp $(includedir)/Ice/PropertiesAdmin.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/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/DisableWarnings.h Properties$(OBJEXT): Properties.cpp $(includedir)/Ice/Properties.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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/DisableWarnings.h PropertyNames$(OBJEXT): PropertyNames.cpp ../Ice/PropertyNames.h $(includedir)/Ice/Config.h $(includedir)/IceUtil/Config.h Protocol$(OBJEXT): Protocol.cpp $(includedir)/Ice/Protocol.h $(includedir)/Ice/Config.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Version.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.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/LocalException.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BuiltinSequences.h ProtocolPluginFacade$(OBJEXT): ProtocolPluginFacade.cpp $(includedir)/Ice/ProtocolPluginFacade.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/ProtocolPluginFacadeF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/EndpointFactoryF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/Version.h ../Ice/Instance.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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/Buffer.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/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/EndpointFactoryManager.h ../Ice/TraceLevels.h ../Ice/DefaultsAndOverrides.h $(includedir)/Ice/Endpoint.h ProxyFactory$(OBJEXT): ProxyFactory.cpp $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h ../Ice/ProxyFactory.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Properties.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)/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/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/UniquePtr.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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h ../Ice/ReferenceFactory.h ../Ice/Reference.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h ../Ice/SharedContext.h ../Ice/LocatorInfo.h ../Ice/RouterInfo.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ../Ice/TraceLevels.h Proxy$(OBJEXT): Proxy.cpp $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.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 ../Ice/ProxyFactory.h $(includedir)/Ice/Properties.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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h ../Ice/ReferenceFactory.h ../Ice/ReferenceFactoryF.h ../Ice/Reference.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/SharedContext.h ../Ice/ObjectAdapterFactory.h ../Ice/ObjectAdapterI.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterFactoryF.h $(includedir)/Ice/ConnectionFactoryF.h ../Ice/ConnectorF.h ../Ice/ThreadPoolF.h ../Ice/ConnectRequestHandler.h ../Ice/RequestHandler.h ../Ice/RouterInfo.h ../Ice/ConnectionRequestHandler.h ../Ice/EndpointI.h ../Ice/TransceiverF.h ../Ice/AcceptorF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h ../Ice/Instance.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h $(includedir)/Ice/ConnectionMonitorF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Process.h ../Ice/LocatorInfo.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Connection.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h $(includedir)/Ice/ConnectionAsync.h $(includedir)/Ice/Stream.h ReferenceFactory$(OBJEXT): ReferenceFactory.cpp $(includedir)/Ice/Communicator.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h ../Ice/ReferenceFactory.h ../Ice/ReferenceFactoryF.h ../Ice/Reference.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/SharedContext.h ../Ice/ProxyFactory.h $(includedir)/Ice/LocalException.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h ../Ice/EndpointI.h $(includedir)/Ice/Endpoint.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h ../Ice/Network.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Connection.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h $(includedir)/Ice/ConnectionAsync.h ../Ice/EndpointFactoryManager.h $(includedir)/Ice/EndpointFactoryF.h ../Ice/RouterInfo.h $(includedir)/Ice/Router.h ../Ice/LocatorInfo.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ../Ice/DefaultsAndOverrides.h ../Ice/PropertyNames.h $(includedir)/IceUtil/StringUtil.h Reference$(OBJEXT): Reference.cpp ../Ice/Reference.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.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/EndpointF.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.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/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/LocatorF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h ../Ice/ReferenceFactory.h $(includedir)/Ice/LocalException.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h ../Ice/EndpointI.h $(includedir)/Ice/Endpoint.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h ../Ice/Network.h ../Ice/OpaqueEndpointI.h $(includedir)/Ice/EndpointFactory.h $(includedir)/Ice/EndpointFactoryF.h ../Ice/RouterInfo.h $(includedir)/Ice/Router.h ../Ice/LocatorInfo.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h ../Ice/ConnectionI.h $(includedir)/IceUtil/StopWatch.h $(includedir)/Ice/Connection.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h $(includedir)/Ice/ConnectionAsync.h ../Ice/ConnectionFactory.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ../Ice/TraceLevels.h ../Ice/HashUtil.h ../Ice/DefaultsAndOverrides.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h $(includedir)/IceUtil/MutexPtrLock.h RetryQueue$(OBJEXT): RetryQueue.cpp ../Ice/RetryQueue.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h ../Ice/RetryQueueF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/ConnectionIF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.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/EndpointF.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h RequestHandler$(OBJEXT): RequestHandler.cpp ../Ice/RequestHandler.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h ../Ice/Reference.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.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/EndpointF.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.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/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/LocatorF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h RouterInfo$(OBJEXT): RouterInfo.cpp ../Ice/RouterInfo.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h ../Ice/RouterInfoF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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)/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/BuiltinSequences.h $(includedir)/Ice/Router.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/Connection.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h ../Ice/Reference.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/LocatorF.h ../Ice/LocatorInfoF.h ../Ice/SharedContext.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h Router$(OBJEXT): Router.cpp $(includedir)/Ice/Router.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/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/DisableWarnings.h Selector$(OBJEXT): Selector.cpp ../Ice/Selector.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/MutexProtocol.h ../Ice/Network.h $(includedir)/Ice/Config.h $(includedir)/Ice/NetworkF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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)/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/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/LoggerF.h ../Ice/EventHandlerF.h ../Ice/EventHandler.h ../Ice/ThreadPoolF.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ServantLocator$(OBJEXT): ServantLocator.cpp $(includedir)/Ice/ServantLocator.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)/IceUtil/Optional.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.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)/IceUtil/DisableWarnings.h ServantManager$(OBJEXT): ServantManager.cpp ../Ice/ServantManager.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/Identity.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Version.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.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/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/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/Direct.h $(includedir)/IceUtil/StringUtil.h Service$(OBJEXT): Service.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/ArgVector.h $(includedir)/IceUtil/FileUtil.h $(includedir)/Ice/Service.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/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/Timer.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/IconvStringConverter.h ../Ice/LoggerI.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/NetworkF.h ../Ice/ImplicitContextI.h ../Ice/Network.h SliceChecksumDict$(OBJEXT): SliceChecksumDict.cpp $(includedir)/Ice/SliceChecksumDict.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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)/IceUtil/DisableWarnings.h SliceChecksums$(OBJEXT): SliceChecksums.cpp $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/MutexPtrLock.h SlicedData$(OBJEXT): SlicedData.cpp $(includedir)/Ice/SlicedData.h $(includedir)/Ice/SlicedDataF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.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/ObjectAdapterF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h Stats$(OBJEXT): Stats.cpp $(includedir)/Ice/Stats.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/IceUtil/DisableWarnings.h StreamI$(OBJEXT): StreamI.cpp ../Ice/StreamI.h $(includedir)/Ice/Stream.h $(includedir)/Ice/StreamF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.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/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/Proxy.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/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/BasicStream.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 ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/DefaultsAndOverrides.h $(includedir)/Ice/Endpoint.h Stream$(OBJEXT): Stream.cpp $(includedir)/Ice/Stream.h $(includedir)/Ice/StreamF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.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/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/Proxy.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/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/BasicStream.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 StringConverter$(OBJEXT): StringConverter.cpp $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Config.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.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/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/Functional.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/IceUtil/StringUtil.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.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)/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/StatsF.h $(includedir)/Ice/InstrumentationF.h $(includedir)/Ice/Dispatcher.h ../Ice/Instance.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/IconvStringConverter.h TcpAcceptor$(OBJEXT): TcpAcceptor.cpp ../Ice/TcpAcceptor.h ../Ice/TransceiverF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/InstanceF.h ../Ice/TraceLevelsF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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 ../Ice/Acceptor.h ../Ice/AcceptorF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.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/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 ../Ice/TcpTransceiver.h $(includedir)/Ice/StatsF.h ../Ice/Transceiver.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/TraceLevels.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/IceUtil/StringUtil.h TcpConnector$(OBJEXT): TcpConnector.cpp ../Ice/TcpConnector.h ../Ice/TransceiverF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/Version.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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 ../Ice/TraceLevelsF.h $(includedir)/Ice/LoggerF.h ../Ice/Connector.h ../Ice/ConnectorF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.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/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h ../Ice/TcpTransceiver.h $(includedir)/Ice/StatsF.h ../Ice/Transceiver.h ../Ice/TcpEndpointI.h ../Ice/EndpointI.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h ../Ice/AcceptorF.h $(includedir)/Ice/EndpointFactory.h $(includedir)/Ice/EndpointFactoryF.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/TraceLevels.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h TcpEndpointI$(OBJEXT): TcpEndpointI.cpp ../Ice/TcpEndpointI.h $(includedir)/IceUtil/Config.h ../Ice/EndpointI.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/Version.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/InstanceF.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h $(includedir)/Ice/Protocol.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/EndpointFactory.h $(includedir)/Ice/EndpointFactoryF.h ../Ice/TcpAcceptor.h ../Ice/TraceLevelsF.h ../Ice/Acceptor.h ../Ice/TcpConnector.h ../Ice/Connector.h ../Ice/TcpTransceiver.h $(includedir)/Ice/StatsF.h ../Ice/Transceiver.h $(includedir)/Ice/LocalException.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/DefaultsAndOverrides.h ../Ice/HashUtil.h TcpTransceiver$(OBJEXT): TcpTransceiver.cpp ../Ice/TcpTransceiver.h $(includedir)/Ice/InstanceF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h ../Ice/TraceLevelsF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/StatsF.h ../Ice/Transceiver.h ../Ice/TransceiverF.h $(includedir)/Ice/ConnectionF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.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/CommunicatorF.h $(includedir)/Ice/Current.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/Connection.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/TraceLevels.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/IceUtil/DisableWarnings.h $(includedir)/Ice/Stats.h ThreadPool$(OBJEXT): ThreadPool.cpp ../Ice/ThreadPool.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.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 ../Ice/ThreadPoolF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.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/Timer.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.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 ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h ../Ice/Selector.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/DisableWarnings.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h ../Ice/ObjectAdapterFactory.h ../Ice/ObjectAdapterI.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/Endpoint.h ../Ice/ConnectorF.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h ../Ice/TraceLevels.h TraceLevels$(OBJEXT): TraceLevels.cpp ../Ice/TraceLevels.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h ../Ice/TraceLevelsF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/Properties.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/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h TraceUtil$(OBJEXT): TraceUtil.cpp $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/StringUtil.h ../Ice/TraceUtil.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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 ../Ice/TraceLevelsF.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h $(includedir)/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.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/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.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/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/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/TraceLevels.h $(includedir)/Ice/Logger.h ../Ice/ReplyStatus.h Transceiver$(OBJEXT): Transceiver.cpp ../Ice/Transceiver.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h ../Ice/TransceiverF.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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 ../Ice/Network.h $(includedir)/Ice/NetworkF.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/CommunicatorF.h $(includedir)/Ice/Current.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 UdpConnector$(OBJEXT): UdpConnector.cpp ../Ice/UdpConnector.h ../Ice/TransceiverF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/InstanceF.h ../Ice/Connector.h ../Ice/ConnectorF.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/Version.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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 ../Ice/Network.h $(includedir)/Ice/NetworkF.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/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/LoggerF.h ../Ice/UdpTransceiver.h ../Ice/TraceLevelsF.h $(includedir)/Ice/StatsF.h ../Ice/Transceiver.h ../Ice/UdpEndpointI.h ../Ice/EndpointI.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h ../Ice/AcceptorF.h $(includedir)/Ice/EndpointFactory.h $(includedir)/Ice/EndpointFactoryF.h $(includedir)/Ice/LocalException.h UdpEndpointI$(OBJEXT): UdpEndpointI.cpp ../Ice/UdpEndpointI.h $(includedir)/IceUtil/Config.h ../Ice/EndpointI.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/Version.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/InstanceF.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h $(includedir)/Ice/Protocol.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/EndpointFactory.h $(includedir)/Ice/EndpointFactoryF.h ../Ice/UdpConnector.h ../Ice/Connector.h ../Ice/UdpTransceiver.h ../Ice/TraceLevelsF.h $(includedir)/Ice/StatsF.h ../Ice/Transceiver.h $(includedir)/Ice/LocalException.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/DefaultsAndOverrides.h ../Ice/HashUtil.h $(includedir)/Ice/Logger.h UdpTransceiver$(OBJEXT): UdpTransceiver.cpp ../Ice/UdpTransceiver.h $(includedir)/Ice/InstanceF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h ../Ice/TraceLevelsF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/StatsF.h ../Ice/Transceiver.h ../Ice/TransceiverF.h $(includedir)/Ice/ConnectionF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.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/CommunicatorF.h $(includedir)/Ice/Current.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/Connection.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Ice/InstrumentationF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Process.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h ../Ice/TraceLevels.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Properties.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/DisableWarnings.h $(includedir)/Ice/Stats.h Version$(OBJEXT): Version.cpp $(includedir)/Ice/Version.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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)/IceUtil/DisableWarnings.h SysLoggerI$(OBJEXT): SysLoggerI.cpp ../Ice/SysLoggerI.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/Logger.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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/LocalException.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/BuiltinSequences.h DLLMain$(OBJEXT): DLLMain.cpp ../Ice/ImplicitContextI.h $(includedir)/Ice/ImplicitContext.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)/IceUtil/Optional.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Identity.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Version.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Service.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.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/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/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)/IceUtil/Unicode.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/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/IconvStringConverter.h $(HDIR)/BuiltinSequences.h BuiltinSequences.cpp: $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/CommunicatorF.h CommunicatorF.cpp: $(slicedir)/Ice/CommunicatorF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Communicator.h Communicator.cpp: $(slicedir)/Ice/Communicator.ice $(slicedir)/Ice/LoggerF.ice $(slicedir)/Ice/StatsF.ice $(slicedir)/Ice/InstrumentationF.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/ObjectFactoryF.ice $(slicedir)/Ice/RouterF.ice $(slicedir)/Ice/LocatorF.ice $(slicedir)/Ice/PluginF.ice $(slicedir)/Ice/ImplicitContextF.ice $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ConnectionF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/Properties.ice $(slicedir)/Ice/PropertiesAdmin.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ConnectionF.h ConnectionF.cpp: $(slicedir)/Ice/ConnectionF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Connection.h Connection.cpp: $(slicedir)/Ice/Connection.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Endpoint.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/EndpointF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Current.h Current.cpp: $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/ConnectionF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Endpoint.h Endpoint.cpp: $(slicedir)/Ice/Endpoint.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/EndpointF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/EndpointF.h EndpointF.cpp: $(slicedir)/Ice/EndpointF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/EndpointTypes.h EndpointTypes.cpp: $(slicedir)/Ice/EndpointTypes.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/FacetMap.h FacetMap.cpp: $(slicedir)/Ice/FacetMap.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Identity.h Identity.cpp: $(slicedir)/Ice/Identity.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ImplicitContextF.h ImplicitContextF.cpp: $(slicedir)/Ice/ImplicitContextF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ImplicitContext.h ImplicitContext.cpp: $(slicedir)/Ice/ImplicitContext.ice $(slicedir)/Ice/LocalException.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/ConnectionF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/LocalException.h LocalException.cpp: $(slicedir)/Ice/LocalException.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/LocatorF.h LocatorF.cpp: $(slicedir)/Ice/LocatorF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Locator.h Locator.cpp: $(slicedir)/Ice/Locator.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/ProcessF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/LoggerF.h LoggerF.cpp: $(slicedir)/Ice/LoggerF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Logger.h Logger.cpp: $(slicedir)/Ice/Logger.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Metrics.h Metrics.cpp: $(slicedir)/Ice/Metrics.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ObjectAdapterF.h ObjectAdapterF.cpp: $(slicedir)/Ice/ObjectAdapterF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ObjectAdapter.h ObjectAdapter.cpp: $(slicedir)/Ice/ObjectAdapter.ice $(slicedir)/Ice/CommunicatorF.ice $(slicedir)/Ice/ServantLocatorF.ice $(slicedir)/Ice/LocatorF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/FacetMap.ice $(slicedir)/Ice/Endpoint.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/EndpointF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ObjectFactoryF.h ObjectFactoryF.cpp: $(slicedir)/Ice/ObjectFactoryF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ObjectFactory.h ObjectFactory.cpp: $(slicedir)/Ice/ObjectFactory.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Instrumentation.h Instrumentation.cpp: $(slicedir)/Ice/Instrumentation.ice $(slicedir)/Ice/EndpointF.ice $(slicedir)/Ice/ConnectionF.ice $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/InstrumentationF.h InstrumentationF.cpp: $(slicedir)/Ice/InstrumentationF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/PluginF.h PluginF.cpp: $(slicedir)/Ice/PluginF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Plugin.h Plugin.cpp: $(slicedir)/Ice/Plugin.ice $(slicedir)/Ice/LoggerF.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ProcessF.h ProcessF.cpp: $(slicedir)/Ice/ProcessF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Process.h Process.cpp: $(slicedir)/Ice/Process.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/PropertiesF.h PropertiesF.cpp: $(slicedir)/Ice/PropertiesF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/PropertiesAdmin.h PropertiesAdmin.cpp: $(slicedir)/Ice/PropertiesAdmin.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Properties.h Properties.cpp: $(slicedir)/Ice/Properties.ice $(slicedir)/Ice/PropertiesAdmin.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/RouterF.h RouterF.cpp: $(slicedir)/Ice/RouterF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Router.h Router.cpp: $(slicedir)/Ice/Router.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ServantLocatorF.h ServantLocatorF.cpp: $(slicedir)/Ice/ServantLocatorF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ServantLocator.h ServantLocator.cpp: $(slicedir)/Ice/ServantLocator.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ConnectionF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Version.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/SliceChecksumDict.h SliceChecksumDict.cpp: $(slicedir)/Ice/SliceChecksumDict.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/StatsF.h StatsF.cpp: $(slicedir)/Ice/StatsF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Stats.h Stats.cpp: $(slicedir)/Ice/Stats.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Version.h Version.cpp: $(slicedir)/Ice/Version.ice $(SLICE2CPP) $(SLICEPARSERLIB) Ice-3.5.1/cpp/src/Ice/OutgoingAsync.cpp0000644000076400007640000010056212223561476015744 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include // For LocalExceptionWrapper. #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* Ice::upCast(AsyncResult* p) { return p; } IceUtil::Shared* IceInternal::upCast(OutgoingAsyncMessageCallback* p) { return p; } IceUtil::Shared* IceInternal::upCast(OutgoingAsync* p) { return p; } IceUtil::Shared* IceInternal::upCast(BatchOutgoingAsync* p) { return p; } IceUtil::Shared* IceInternal::upCast(ProxyBatchOutgoingAsync* p) { return p; } IceUtil::Shared* IceInternal::upCast(ConnectionBatchOutgoingAsync* p) { return p; } IceUtil::Shared* IceInternal::upCast(CommunicatorBatchOutgoingAsync* p) { return p; } const unsigned char Ice::AsyncResult::OK = 0x1; const unsigned char Ice::AsyncResult::Done = 0x2; const unsigned char Ice::AsyncResult::Sent = 0x4; const unsigned char Ice::AsyncResult::EndCalled = 0x8; namespace { class AsynchronousException : public DispatchWorkItem { public: AsynchronousException(const IceInternal::InstancePtr& instance, const Ice::AsyncResultPtr& result, const Ice::Exception& ex) : DispatchWorkItem(instance), _result(result), _exception(ex.ice_clone()) { } virtual void run() { _result->__exception(*_exception.get()); } private: const Ice::AsyncResultPtr _result; const IceUtil::UniquePtr _exception; }; class AsynchronousSent : public DispatchWorkItem { public: AsynchronousSent(const IceInternal::InstancePtr& instance, const Ice::AsyncResultPtr& result) : DispatchWorkItem(instance), _result(result) { } virtual void run() { _result->__sent(); } private: const Ice::AsyncResultPtr _result; }; }; Ice::AsyncResult::AsyncResult(const CommunicatorPtr& communicator, const IceInternal::InstancePtr& instance, const string& op, const CallbackBasePtr& del, const LocalObjectPtr& cookie) : _communicator(communicator), _instance(instance), _operation(op), _callback(del), _cookie(cookie), _is(instance.get(), Ice::currentProtocolEncoding), _os(instance.get(), Ice::currentProtocolEncoding), _state(0), _sentSynchronously(false), _exception(0) { if(!_callback) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__); } const_cast(_callback) = _callback->__verify(const_cast(_cookie)); } Ice::AsyncResult::~AsyncResult() { } bool Ice::AsyncResult::operator==(const AsyncResult& r) const { return this == &r; } bool Ice::AsyncResult::operator<(const AsyncResult& r) const { return this < &r; } Int Ice::AsyncResult::getHash() const { return static_cast(reinterpret_cast(this) >> 4); } bool Ice::AsyncResult::isCompleted() const { IceUtil::Monitor::Lock sync(_monitor); return _state & Done; } void Ice::AsyncResult::waitForCompleted() { IceUtil::Monitor::Lock sync(_monitor); while(!(_state & Done)) { _monitor.wait(); } } bool Ice::AsyncResult::isSent() const { IceUtil::Monitor::Lock sync(_monitor); return _state & Sent; } void Ice::AsyncResult::waitForSent() { IceUtil::Monitor::Lock sync(_monitor); while(!(_state & Sent) && !_exception.get()) { _monitor.wait(); } } void Ice::AsyncResult::throwLocalException() const { IceUtil::Monitor::Lock sync(_monitor); if(_exception.get()) { _exception.get()->ice_throw(); } } bool Ice::AsyncResult::__wait() { IceUtil::Monitor::Lock sync(_monitor); if(_state & EndCalled) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "end_ method called more than once"); } _state |= EndCalled; while(!(_state & Done)) { _monitor.wait(); } if(_exception.get()) { _exception.get()->ice_throw(); } return _state & OK; } void Ice::AsyncResult::__throwUserException() { try { _is.startReadEncaps(); _is.throwException(); } catch(const Ice::UserException&) { _is.endReadEncaps(); throw; } } void Ice::AsyncResult::__sent() { // // Note: no need to change the _state here, specializations are responsible for // changing the state. // if(_callback) { try { AsyncResultPtr self(this); _callback->__sent(self); } catch(const std::exception& ex) { __warning(ex); } catch(...) { __warning(); } } if(_observer) { Ice::ObjectPrx proxy = getProxy(); if(!proxy || !proxy->ice_isTwoway()) { _observer.detach(); } } } void Ice::AsyncResult::__sentAsync() { // // This is called when it's not safe to call the sent callback synchronously // from this thread. Instead the exception callback is called asynchronously from // the client thread pool. // try { _instance->clientThreadPool()->execute(new AsynchronousSent(_instance, this)); } catch(const Ice::CommunicatorDestroyedException&) { } } void Ice::AsyncResult::__exception(const Ice::Exception& ex) { { IceUtil::Monitor::Lock sync(_monitor); _state |= Done; _os.resize(0); // Clear buffer now, instead of waiting for AsyncResult deallocation _exception.reset(ex.ice_clone()); _monitor.notifyAll(); } if(_callback) { try { AsyncResultPtr self(this); _callback->__completed(self); } catch(const std::exception& ex) { __warning(ex); } catch(...) { __warning(); } } _observer.detach(); } void Ice::AsyncResult::__exceptionAsync(const Ice::Exception& ex) { // // This is called when it's not safe to call the exception callback synchronously // from this thread. Instead the exception callback is called asynchronously from // the client thread pool. // // CommunicatorDestroyedException is the only exception that can propagate directly // from this method. // _instance->clientThreadPool()->execute(new AsynchronousException(_instance, this, ex)); } void Ice::AsyncResult::__response() { // // Note: no need to change the _state here, specializations are responsible for // changing the state. // if(_callback) { try { AsyncResultPtr self(this); _callback->__completed(self); } catch(const std::exception& ex) { __warning(ex); } catch(...) { __warning(); } } _observer.detach(); } void Ice::AsyncResult::__check(const AsyncResultPtr& r, const IceProxy::Ice::Object* prx, const string& operation) { __check(r, operation); if(r->getProxy().get() != prx) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "Proxy for call to end_" + operation + " does not match proxy that was used to call corresponding begin_" + operation + " method"); } } void Ice::AsyncResult::__check(const AsyncResultPtr& r, const Ice::Communicator* com, const string& operation) { __check(r, operation); if(r->getCommunicator().get() != com) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "Communicator for call to end_" + operation + " does not match communicator that was used to call corresponding " + "begin_" + operation + " method"); } } void Ice::AsyncResult::__check(const AsyncResultPtr& r, const Ice::Connection* con, const string& operation) { __check(r, operation); if(r->getConnection().get() != con) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "Connection for call to end_" + operation + " does not match connection that was used to call corresponding " + "begin_" + operation + " method"); } } void Ice::AsyncResult::__check(const AsyncResultPtr& r, const string& operation) { if(!r) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "AsyncResult == null"); } else if(&r->_operation != &operation) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "Incorrect operation for end_" + operation + " method: " + r->_operation); } } void Ice::AsyncResult::__warning(const std::exception& exc) const { if(_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0) { Warning out(_instance->initializationData().logger); const Exception* ex = dynamic_cast(&exc); if(ex) { out << "Ice::Exception raised by AMI callback:\n" << *ex; } else { out << "std::exception raised by AMI callback:\n" << exc.what(); } } } void Ice::AsyncResult::__warning() const { if(_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0) { Warning out(_instance->initializationData().logger); out << "unknown exception raised by AMI callback"; } } IceInternal::OutgoingAsync::OutgoingAsync(const ObjectPrx& prx, const std::string& operation, const CallbackBasePtr& delegate, const Ice::LocalObjectPtr& cookie) : AsyncResult(prx->ice_getCommunicator(), prx->__reference()->getInstance(), operation, delegate, cookie), _proxy(prx), _encoding(getCompatibleEncoding(prx->__reference()->getEncoding())) { } void IceInternal::OutgoingAsync::__prepare(const std::string& operation, OperationMode mode, const Context* context) { _delegate = 0; _cnt = 0; _mode = mode; _sentSynchronously = false; checkSupportedProtocol(getCompatibleProtocol(_proxy->__reference()->getProtocol())); _observer.attach(_proxy.get(), operation, context); // // Can't call async via a batch proxy. // if(_proxy->ice_isBatchOneway() || _proxy->ice_isBatchDatagram()) { throw Ice::FeatureNotSupportedException(__FILE__, __LINE__, "can't send batch requests with AMI"); } _os.writeBlob(requestHdr, sizeof(requestHdr)); Reference* ref = _proxy->__reference().get(); _os.write(ref->getIdentity()); // // For compatibility with the old FacetPath. // if(ref->getFacet().empty()) { _os.write(static_cast(0), static_cast(0)); } else { string facet = ref->getFacet(); _os.write(&facet, &facet + 1); } _os.write(operation, false); _os.write(static_cast(_mode)); if(context != 0) { // // Explicit context // _os.write(*context); } else { // // Implicit context // const ImplicitContextIPtr& implicitContext = ref->getInstance()->getImplicitContext(); const Context& prxContext = ref->getContext()->getValue(); if(implicitContext == 0) { _os.write(prxContext); } else { implicitContext->write(prxContext, &_os); } } } bool IceInternal::OutgoingAsync::__sent(Ice::ConnectionI* connection) { IceUtil::Monitor::Lock sync(_monitor); bool alreadySent = _state & Sent; // Expected in case of a retry. _state |= Sent; assert(!(_state & Done)); if(!_proxy->ice_isTwoway()) { _remoteObserver.detach(); if(!_callback || !_callback->__hasSentCallback()) { _observer.detach(); } _state |= Done | OK; _os.resize(0); // Clear buffer now, instead of waiting for AsyncResult deallocation } else if(connection->timeout() > 0) { assert(!_timerTaskConnection); _timerTaskConnection = connection; IceUtil::Time timeout = IceUtil::Time::milliSeconds(connection->timeout()); _instance->timer()->schedule(this, timeout); } _monitor.notifyAll(); return !alreadySent && _callback && _callback->__hasSentCallback(); } void IceInternal::OutgoingAsync::__sent() { ::Ice::AsyncResult::__sent(); } void IceInternal::OutgoingAsync::__finished(const Ice::LocalException& exc, bool sent) { { IceUtil::Monitor::Lock sync(_monitor); assert(!(_state & Done)); _remoteObserver.failed(exc.ice_name()); _remoteObserver.detach(); if(_timerTaskConnection) { _instance->timer()->cancel(this); _timerTaskConnection = 0; } } // // NOTE: at this point, synchronization isn't needed, no other threads should be // calling on the callback. // try { int interval = handleException(exc, sent); // This will throw if the invocation can't be retried. if(interval > 0) { _instance->retryQueue()->add(this, interval); } else { __send(false); } } catch(const Ice::LocalException& ex) { __exception(ex); } } void IceInternal::OutgoingAsync::__finished(const LocalExceptionWrapper& exc) { // // NOTE: at this point, synchronization isn't needed, no other threads should be // calling on the callback. The LocalExceptionWrapper exception is only called // before the invocation is sent. // _remoteObserver.failed(exc.get()->ice_name()); _remoteObserver.detach(); try { int interval = handleException(exc); // This will throw if the invocation can't be retried. if(interval > 0) { _instance->retryQueue()->add(this, interval); } else { __send(false); } } catch(const Ice::LocalException& ex) { __exception(ex); } } void IceInternal::OutgoingAsync::__finished() { assert(_proxy->ice_isTwoway()); // Can only be called for twoways. Ice::Byte replyStatus; try { IceUtil::Monitor::Lock sync(_monitor); assert(!_exception.get() && !(_state & Done)); assert(!_is.b.empty()); if(_remoteObserver) { _remoteObserver->reply(static_cast(_is.b.size() - headerSize - 4)); } _remoteObserver.detach(); if(_timerTaskConnection) { _instance->timer()->cancel(this); _timerTaskConnection = 0; } _is.read(replyStatus); switch(replyStatus) { case replyOK: { break; } case replyUserException: { _observer.userException(); break; } case replyObjectNotExist: case replyFacetNotExist: case replyOperationNotExist: { Identity ident; _is.read(ident); // // For compatibility with the old FacetPath. // vector facetPath; _is.read(facetPath); string facet; if(!facetPath.empty()) { if(facetPath.size() > 1) { throw MarshalException(__FILE__, __LINE__); } facet.swap(facetPath[0]); } string operation; _is.read(operation, false); IceUtil::UniquePtr ex; switch(replyStatus) { case replyObjectNotExist: { ex.reset(new ObjectNotExistException(__FILE__, __LINE__)); break; } case replyFacetNotExist: { ex.reset(new FacetNotExistException(__FILE__, __LINE__)); break; } case replyOperationNotExist: { ex.reset(new OperationNotExistException(__FILE__, __LINE__)); break; } default: { assert(false); break; } } ex->id = ident; ex->facet = facet; ex->operation = operation; ex->ice_throw(); } case replyUnknownException: case replyUnknownLocalException: case replyUnknownUserException: { string unknown; _is.read(unknown, false); IceUtil::UniquePtr ex; switch(replyStatus) { case replyUnknownException: { ex.reset(new UnknownException(__FILE__, __LINE__)); break; } case replyUnknownLocalException: { ex.reset(new UnknownLocalException(__FILE__, __LINE__)); break; } case replyUnknownUserException: { ex.reset(new UnknownUserException(__FILE__, __LINE__)); break; } default: { assert(false); break; } } ex->unknown = unknown; ex->ice_throw(); } default: { throw UnknownReplyStatusException(__FILE__, __LINE__); } } _state |= Done; _os.resize(0); // Clear buffer now, instead of waiting for AsyncResult deallocation if(replyStatus == replyOK) { _state |= OK; } _monitor.notifyAll(); } catch(const LocalException& ex) { __finished(ex, true); return; } assert(replyStatus == replyOK || replyStatus == replyUserException); __response(); } bool IceInternal::OutgoingAsync::__send(bool synchronous) { while(true) { int interval = 0; try { _delegate = _proxy->__getDelegate(true); AsyncStatus status = _delegate->__getRequestHandler()->sendAsyncRequest(this); if(status & AsyncStatusSent) { if(synchronous) { _sentSynchronously = true; if(status & AsyncStatusInvokeSentCallback) { __sent(); // Call the sent callback from the user thread. } } else { if(status & AsyncStatusInvokeSentCallback) { __sentAsync(); // Call the sent callback from a client thread pool thread. } } } break; } catch(const LocalExceptionWrapper& ex) { interval = handleException(ex); } catch(const Ice::LocalException& ex) { interval = handleException(ex, false); } if(interval > 0) { _instance->retryQueue()->add(this, interval); return false; } } return _sentSynchronously; } int IceInternal::OutgoingAsync::handleException(const LocalExceptionWrapper& ex) { if(_mode == Nonmutating || _mode == Idempotent) { return _proxy->__handleExceptionWrapperRelaxed(_delegate, ex, false, _cnt, _observer); } else { return _proxy->__handleExceptionWrapper(_delegate, ex, _observer); } } int IceInternal::OutgoingAsync::handleException(const Ice::LocalException& exc, bool sent) { try { // // A CloseConnectionException indicates graceful server shutdown, and is therefore // always repeatable without violating "at-most-once". That's because by sending a // close connection message, the server guarantees that all outstanding requests // can safely be repeated. // // An ObjectNotExistException can always be retried as well without violating // "at-most-once" (see the implementation of the checkRetryAfterException method of // the ProxyFactory class for the reasons why it can be useful). // if(!sent || dynamic_cast(&exc) || dynamic_cast(&exc)) { exc.ice_throw(); } // // Throw the exception wrapped in a LocalExceptionWrapper, to indicate that the // request cannot be resent without potentially violating the "at-most-once" // principle. // throw LocalExceptionWrapper(exc, false); } catch(const LocalExceptionWrapper& ex) { if(_mode == Nonmutating || _mode == Idempotent) { return _proxy->__handleExceptionWrapperRelaxed(_delegate, ex, false, _cnt, _observer); } else { return _proxy->__handleExceptionWrapper(_delegate, ex, _observer); } } catch(const Ice::LocalException& ex) { return _proxy->__handleException(_delegate, ex, false, _cnt, _observer); } return 0; // Keep the compiler happy. } void IceInternal::OutgoingAsync::runTimerTask() // Implementation of TimerTask::runTimerTask() { Ice::ConnectionIPtr connection; { IceUtil::Monitor::Lock sync(_monitor); connection = _timerTaskConnection; _timerTaskConnection = 0; } if(connection) { connection->exception(Ice::TimeoutException(__FILE__, __LINE__)); } } IceInternal::BatchOutgoingAsync::BatchOutgoingAsync(const CommunicatorPtr& communicator, const InstancePtr& instance, const std::string& operation, const CallbackBasePtr& delegate, const Ice::LocalObjectPtr& cookie) : AsyncResult(communicator, instance, operation, delegate, cookie) { } bool IceInternal::BatchOutgoingAsync::__sent(Ice::ConnectionI* /*connection*/) { IceUtil::Monitor::Lock sync(_monitor); assert(!_exception.get()); _state |= Done | OK | Sent; _os.resize(0); // Clear buffer now, instead of waiting for AsyncResult deallocation _remoteObserver.detach(); _monitor.notifyAll(); if(!_callback || !_callback->__hasSentCallback()) { _observer.detach(); return false; } return true; } void IceInternal::BatchOutgoingAsync::__sent() { ::Ice::AsyncResult::__sent(); } void IceInternal::BatchOutgoingAsync::__finished(const Ice::LocalException& exc, bool) { _remoteObserver.failed(exc.ice_name()); _remoteObserver.detach(); __exception(exc); } IceInternal::ProxyBatchOutgoingAsync::ProxyBatchOutgoingAsync(const Ice::ObjectPrx& proxy, const std::string& operation, const CallbackBasePtr& delegate, const Ice::LocalObjectPtr& cookie) : BatchOutgoingAsync(proxy->ice_getCommunicator(), proxy->__reference()->getInstance(), operation, delegate, cookie), _proxy(proxy) { _observer.attach(proxy.get(), operation, 0); } void IceInternal::ProxyBatchOutgoingAsync::__send() { checkSupportedProtocol(_proxy->__reference()->getProtocol()); // // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch // requests were queued with the connection, they would be lost without being noticed. // Handle delegate; int cnt = -1; // Don't retry. try { delegate = _proxy->__getDelegate(true); AsyncStatus status = delegate->__getRequestHandler()->flushAsyncBatchRequests(this); if(status & AsyncStatusSent) { _sentSynchronously = true; if(status & AsyncStatusInvokeSentCallback) { __sent(); } } } catch(const ::Ice::LocalException& ex) { _proxy->__handleException(delegate, ex, 0, cnt, _observer); } } IceInternal::ConnectionBatchOutgoingAsync::ConnectionBatchOutgoingAsync(const ConnectionIPtr& con, const CommunicatorPtr& communicator, const InstancePtr& instance, const string& operation, const CallbackBasePtr& delegate, const Ice::LocalObjectPtr& cookie) : BatchOutgoingAsync(communicator, instance, operation, delegate, cookie), _connection(con) { _observer.attach(instance.get(), operation); } void IceInternal::ConnectionBatchOutgoingAsync::__send() { AsyncStatus status = _connection->flushAsyncBatchRequests(this); if(status & AsyncStatusSent) { _sentSynchronously = true; if(status & AsyncStatusInvokeSentCallback) { __sent(); } } } Ice::ConnectionPtr IceInternal::ConnectionBatchOutgoingAsync::getConnection() const { return _connection; } IceInternal::CommunicatorBatchOutgoingAsync::CommunicatorBatchOutgoingAsync(const CommunicatorPtr& communicator, const InstancePtr& instance, const string& operation, const CallbackBasePtr& delegate, const Ice::LocalObjectPtr& cookie) : AsyncResult(communicator, instance, operation, delegate, cookie) { // // _useCount is initialized to 1 to prevent premature callbacks. // The caller must invoke ready() after all flush requests have // been initiated. // _useCount = 1; // // Assume all connections are flushed synchronously. // _sentSynchronously = true; // // Attach observer // _observer.attach(instance.get(), operation); } void IceInternal::CommunicatorBatchOutgoingAsync::flushConnection(const ConnectionIPtr& con) { class BatchOutgoingAsyncI : public BatchOutgoingAsync { public: BatchOutgoingAsyncI(const CommunicatorBatchOutgoingAsyncPtr& outAsync, const InstancePtr& instance, InvocationObserver& observer) : BatchOutgoingAsync(outAsync->getCommunicator(), instance, outAsync->getOperation(), __dummyCallback, 0), _outAsync(outAsync), _observer(observer) { } virtual bool __sent(Ice::ConnectionI*) { _remoteObserver.detach(); _outAsync->check(false); return false; } #ifdef __SUNPRO_CC using BatchOutgoingAsync::__sent; #endif virtual void __finished(const Ice::LocalException& ex, bool) { _remoteObserver.failed(ex.ice_name()); _remoteObserver.detach(); _outAsync->check(false); } virtual void __attachRemoteObserver(const Ice::ConnectionInfoPtr& connection, const Ice::EndpointPtr& endpt, Ice::Int requestId, Ice::Int sz) { _remoteObserver.attach(_observer.getRemoteObserver(connection, endpt, requestId, sz)); } private: const CommunicatorBatchOutgoingAsyncPtr _outAsync; InvocationObserver& _observer; }; { IceUtil::Monitor::Lock sync(_monitor); ++_useCount; } try { AsyncStatus status = con->flushAsyncBatchRequests(new BatchOutgoingAsyncI(this, _instance, _observer)); if(!(status & AsyncStatusSent)) { _sentSynchronously = false; } } catch(const Ice::LocalException&) { check(false); throw; } } void IceInternal::CommunicatorBatchOutgoingAsync::ready() { check(true); } void IceInternal::CommunicatorBatchOutgoingAsync::check(bool userThread) { { IceUtil::Monitor::Lock sync(_monitor); assert(_useCount > 0); if(--_useCount > 0) { return; } _state |= Done | OK | Sent; _os.resize(0); // Clear buffer now, instead of waiting for AsyncResult deallocation _monitor.notifyAll(); } if(!_callback || !_callback->__hasSentCallback()) { _observer.detach(); } else { // // _sentSynchronously is immutable here. // if(!_sentSynchronously || !userThread) { __sentAsync(); } else { AsyncResult::__sent(); } } } namespace { // // Dummy class derived from CallbackBase // We use this class for the __dummyCallback extern pointer in OutgoingAsync. In turn, // this allows us to test whether the user supplied a null delegate instance to the // generated begin_ method without having to generate a separate test to throw IllegalArgumentException // in the inlined versions of the begin_ method. In other words, this reduces the amount of generated // object code. // class DummyCallback : public CallbackBase { public: DummyCallback() { } virtual void __completed(const Ice::AsyncResultPtr&) const { assert(false); } virtual CallbackBasePtr __verify(Ice::LocalObjectPtr&) { // // Called by the AsyncResult constructor to verify the delegate. The dummy // delegate is passed when the user used a begin_ method without delegate. // By returning 0 here, we tell the AsyncResult that no delegates was // provided. // return 0; } virtual void __sent(const AsyncResultPtr&) const { assert(false); } virtual bool __hasSentCallback() const { assert(false); return false; } }; } // // This gives a pointer value to compare against in the generated // begin_ method to decide whether the caller passed a null pointer // versus the generated inline version of the begin_ method having // passed a pointer to the dummy delegate. // CallbackBasePtr IceInternal::__dummyCallback = new DummyCallback; void Ice::AMICallbackBase::__exception(const ::Ice::Exception& ex) { ice_exception(ex); } void Ice::AMICallbackBase::__sent(bool sentSynchronously) { if(!sentSynchronously) { dynamic_cast(this)->ice_sent(); } } Ice-3.5.1/cpp/src/Ice/PropertyNames.h0000644000076400007640000000346112223561476015430 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** // // Generated by makeprops.py from file ./config/PropertyNames.xml, Fri Jul 26 23:12:55 2013 // IMPORTANT: Do not edit this file -- any edits made here will be lost! #ifndef ICE_INTERNAL_PropertyNames_H #define ICE_INTERNAL_PropertyNames_H #include namespace IceInternal { struct Property { const char* pattern; bool deprecated; const char* deprecatedBy; Property(const char* n, bool d, const char* b) : pattern(n), deprecated(d), deprecatedBy(b) { } Property() : pattern(0), deprecated(false), deprecatedBy(0) { } }; struct PropertyArray { const Property* properties; const int length; PropertyArray(const Property* p, size_t len) : properties(p), length(static_cast(len)) { } }; class PropertyNames { public: static const PropertyArray IceProps; static const PropertyArray IceMXProps; static const PropertyArray IceBoxProps; static const PropertyArray IceBoxAdminProps; static const PropertyArray IceGridAdminProps; static const PropertyArray IceGridProps; static const PropertyArray IcePatch2Props; static const PropertyArray IcePatch2ClientProps; static const PropertyArray IceSSLProps; static const PropertyArray IceStormAdminProps; static const PropertyArray Glacier2Props; static const PropertyArray FreezeProps; static const PropertyArray validProps[]; static const char * clPropNames[]; }; } #endif Ice-3.5.1/cpp/src/Ice/Base64.h0000644000076400007640000000137312223561476013644 0ustar mesmes// ********************************************************************** // // 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 ICE_BASE_64_H #define ICE_BASE_64_H #include #include #include namespace IceInternal { class Base64 { public: static std::string encode(const std::vector&); static std::vector decode(const std::string&); static bool isBase64(char); private: static char encode(unsigned char); static unsigned char decode(char); }; } #endif Ice-3.5.1/cpp/src/Ice/TraceLevels.cpp0000644000076400007640000000302212223561476015355 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; using namespace Ice; using namespace IceInternal; ICE_DECLSPEC_EXPORT IceUtil::Shared* IceInternal::upCast(TraceLevels* p) { return p; } IceInternal::TraceLevels::TraceLevels(const PropertiesPtr& properties) : network(0), networkCat("Network"), protocol(0), protocolCat("Protocol"), retry(0), retryCat("Retry"), location(0), locationCat("Locator"), slicing(0), slicingCat("Slicing"), gc(0), gcCat("GC"), threadPool(0), threadPoolCat("ThreadPool") { const string keyBase = "Ice.Trace."; const_cast(network) = properties->getPropertyAsInt(keyBase + networkCat); const_cast(protocol) = properties->getPropertyAsInt(keyBase + protocolCat); const_cast(retry) = properties->getPropertyAsInt(keyBase + retryCat); const_cast(location) = properties->getPropertyAsInt(keyBase + locationCat); const_cast(slicing) = properties->getPropertyAsInt(keyBase + slicingCat); const_cast(gc) = properties->getPropertyAsInt(keyBase + gcCat); const_cast(threadPool) = properties->getPropertyAsInt(keyBase + threadPoolCat); } Ice-3.5.1/cpp/src/Ice/StringConverter.cpp0000644000076400007640000002653212223561476016315 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #ifndef _WIN32 #include #endif #ifdef __MINGW32__ # include #endif using namespace IceUtil; using namespace IceUtilInternal; using namespace std; namespace { class UTF8BufferI : public Ice::UTF8Buffer { public: UTF8BufferI() : _buffer(0), _offset(0) { } ~UTF8BufferI() { free(_buffer); } Ice::Byte* getMoreBytes(size_t howMany, Byte* firstUnused) { if(_buffer == 0) { _buffer = (Byte*)malloc(howMany); } else { assert(firstUnused != 0); _offset = firstUnused - _buffer; _buffer = (Byte*)realloc(_buffer, _offset + howMany); } if(!_buffer) { throw std::bad_alloc(); } return _buffer + _offset; } Ice::Byte* getBuffer() { return _buffer; } void reset() { free(_buffer); _buffer = 0; _offset = 0; } private: Ice::Byte* _buffer; size_t _offset; }; } namespace Ice { UnicodeWstringConverter::UnicodeWstringConverter(ConversionFlags flags) : _conversionFlags(flags) { } Byte* UnicodeWstringConverter::toUTF8(const wchar_t* sourceStart, const wchar_t* sourceEnd, UTF8Buffer& buffer) const { // // The "chunk size" is the maximum of the number of characters in the // source and 6 (== max bytes necessary to encode one Unicode character). // size_t chunkSize = std::max(static_cast(sourceEnd - sourceStart), 6); Byte* targetStart = buffer.getMoreBytes(chunkSize, 0); Byte* targetEnd = targetStart + chunkSize; ConversionResult result; while((result = convertUTFWstringToUTF8(sourceStart, sourceEnd, targetStart, targetEnd, _conversionFlags)) == targetExhausted) { targetStart = buffer.getMoreBytes(chunkSize, targetStart); targetEnd = targetStart + chunkSize; } switch(result) { case conversionOK: break; case sourceExhausted: throw StringConversionException(__FILE__, __LINE__, "wide string source exhausted"); case sourceIllegal: throw StringConversionException(__FILE__, __LINE__, "wide string source illegal"); default: { assert(0); throw StringConversionException(__FILE__, __LINE__); } } return targetStart; } void UnicodeWstringConverter::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd, wstring& target) const { if(sourceStart == sourceEnd) { target = L""; return; } ConversionResult result = convertUTF8ToUTFWstring(sourceStart, sourceEnd, target, _conversionFlags); switch(result) { case conversionOK: break; case sourceExhausted: throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source exhausted"); case sourceIllegal: throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source illegal"); default: { assert(0); throw StringConversionException(__FILE__, __LINE__); } } } #ifdef _WIN32 WindowsStringConverter::WindowsStringConverter(unsigned int cp) : _cp(cp) { } Byte* WindowsStringConverter::toUTF8(const char* sourceStart, const char* sourceEnd, UTF8Buffer& buffer) const { // // First convert to UTF-16 // int sourceSize = static_cast(sourceEnd - sourceStart); if(sourceSize == 0) { return buffer.getMoreBytes(1, 0); } int size = 0; int writtenWchar = 0; ScopedArray wbuffer; do { size = size == 0 ? sourceSize + 2 : 2 * size; wbuffer.reset(new wchar_t[size]); writtenWchar = MultiByteToWideChar(_cp, MB_ERR_INVALID_CHARS, sourceStart, sourceSize, wbuffer.get(), size); } while(writtenWchar == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER); if(writtenWchar == 0) { throw StringConversionException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString()); } // // Then convert this UTF-16 wbuffer into UTF-8 // return _unicodeWstringConverter.toUTF8(wbuffer.get(), wbuffer.get() + writtenWchar, buffer); } void WindowsStringConverter::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd, string& target) const { if(sourceStart == sourceEnd) { target = ""; return; } // // First convert to wstring (UTF-16) // wstring wtarget; _unicodeWstringConverter.fromUTF8(sourceStart, sourceEnd, wtarget); // // And then to a multi-byte narrow string // int size = 0; int writtenChar = 0; ScopedArray buffer; do { size = size == 0 ? static_cast(sourceEnd - sourceStart) + 2 : 2 * size; buffer.reset(new char[size]); writtenChar = WideCharToMultiByte(_cp, 0, wtarget.data(), static_cast(wtarget.size()), buffer.get(), size, 0, 0); } while(writtenChar == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER); if(writtenChar == 0) { throw StringConversionException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString()); } target.assign(buffer.get(), writtenChar); } #endif StringConverterPlugin::StringConverterPlugin(const CommunicatorPtr& communicator, const StringConverterPtr& stringConverter, const WstringConverterPtr& wstringConverter) { if(communicator == 0) { throw PluginInitializationException(__FILE__, __LINE__, "Communicator cannot be null"); } IceInternal::InstancePtr instance = IceInternal::getInstance(communicator); if(stringConverter != 0) { instance->setStringConverter(stringConverter); } if(wstringConverter != 0) { instance->setWstringConverter(wstringConverter); } } void StringConverterPlugin::initialize() { } void StringConverterPlugin::destroy() { } } // // The entry point for the "string converter" plug-in built-in the Ice library // extern "C" { using namespace Ice; ICE_DECLSPEC_EXPORT Plugin* createStringConverter(const CommunicatorPtr& communicator, const string& name, const StringSeq& args) { StringConverterPtr stringConverter; WstringConverterPtr wstringConverter; if(args.size() > 2) { Error out(communicator->getLogger()); out << "Plugin " << name << ": too many arguments"; return 0; } try { #ifdef _WIN32 int cp = -1; for(size_t i = 0; i < args.size(); ++i) { if(args[i].find("windows=") == 0) { cp = atoi(args[i].substr(strlen("windows=")).c_str()); } else if(args[i].find("iconv=") != 0) { Error out(communicator->getLogger()); out << "Plugin " << name << ": invalid \"" << args[i] << "\" argument"; return 0; } } if(cp == -1) { Error out(communicator->getLogger()); out << "Plugin " << name << ": missing windows= argument"; return 0; } if(cp == 0 || cp == INT_MAX || cp < 0) { Error out(communicator->getLogger()); out << "Plugin " << name << ": invalid Windows code page"; return 0; } stringConverter = new WindowsStringConverter(static_cast(cp)); #else StringSeq iconvArgs; for(size_t i = 0; i < args.size(); ++i) { if(args[i].find("iconv=") == 0) { if(!IceUtilInternal::splitString(args[i].substr(strlen("iconv=")), ", \t\r\n", iconvArgs)) { Error out(communicator->getLogger()); out << "Plugin " << name << ": invalid iconv argument"; return 0; } } else if(args[i].find("windows=") != 0) { Error out(communicator->getLogger()); out << "Plugin " << name << ": invalid \"" << args[i] << "\" argument"; return 0; } } switch(iconvArgs.size()) { case 0: { stringConverter = new IconvStringConverter; break; } case 1: { stringConverter = new IconvStringConverter(iconvArgs[0].c_str()); break; } case 2: { stringConverter = new IconvStringConverter(iconvArgs[0].c_str()); wstringConverter = new IconvStringConverter(iconvArgs[1].c_str()); break; } default: { assert(0); } } #endif return new StringConverterPlugin(communicator, stringConverter, wstringConverter); } catch(const std::exception& ex) { Error out(communicator->getLogger()); out << "Plugin " << name << ": creation failed with " << ex.what(); return 0; } catch(...) { Error out(communicator->getLogger()); out << "Plugin " << name << ": creation failed with unknown exception"; return 0; } } } string Ice::nativeToUTF8(const Ice::StringConverterPtr& converter, const string& str) { if(!converter) { return str; } if(str.empty()) { return str; } UTF8BufferI buffer; Ice::Byte* last = converter->toUTF8(str.data(), str.data() + str.size(), buffer); return string(reinterpret_cast(buffer.getBuffer()), last - buffer.getBuffer()); } string Ice::nativeToUTF8(const Ice::CommunicatorPtr& ic, const string& str) { return nativeToUTF8(IceInternal::getInstance(ic)->initializationData().stringConverter, str); } string Ice::UTF8ToNative(const Ice::StringConverterPtr& converter, const string& str) { if(!converter) { return str; } if(str.empty()) { return str; } string tmp; converter->fromUTF8(reinterpret_cast(str.data()), reinterpret_cast(str.data() + str.size()), tmp); return tmp; } string Ice::UTF8ToNative(const Ice::CommunicatorPtr& ic, const std::string& str) { return UTF8ToNative(IceInternal::getInstance(ic)->initializationData().stringConverter, str); } Ice-3.5.1/cpp/src/Ice/Initialize.cpp0000644000076400007640000002226612223561476015260 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** // // We disable deprecation warning here, to allow clean compilation of // of deprecated methods from StreamI.h. // #ifdef _MSC_VER # pragma warning( disable : 4996 ) #endif #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; namespace IceInternal { extern IceUtil::Handle theCollector; } namespace { pair makePair(const vector& v) { if(v.empty()) { return pair(static_cast(0), static_cast(0)); } else { return pair(&v[0], &v[0] + v.size()); } } } void Ice::collectGarbage() { if(theCollector) { theCollector->collectGarbage(); } } StringSeq Ice::argsToStringSeq(int argc, char* argv[]) { StringSeq result; for(int i = 0; i < argc; i++) { result.push_back(argv[i]); } return result; } #ifdef _WIN32 StringSeq Ice::argsToStringSeq(int argc, wchar_t* argv[]) { return argsToStringSeq(argc, argv, 0); } StringSeq Ice::argsToStringSeq(int /*argc*/, wchar_t* argv[], const StringConverterPtr& converter) { StringSeq args; for(int i=0; argv[i] != 0; i++) { string value = IceUtil::wstringToString(argv[i]); value = Ice::UTF8ToNative(converter, value); args.push_back(value); } return args; } #endif void Ice::stringSeqToArgs(const StringSeq& args, int& argc, char* argv[]) { // // Shift all elements in argv which are present in args to the // beginning of argv. We record the original value of argc so // that we can know later if we've shifted the array. // const int argcOrig = argc; int i = 0; while(i < argc) { if(find(args.begin(), args.end(), argv[i]) == args.end()) { for(int j = i; j < argc - 1; j++) { argv[j] = argv[j + 1]; } --argc; } else { ++i; } } // // Make sure that argv[argc] == 0, the ISO C++ standard requires this. // We can only do this if we've shifted the array, otherwise argv[argc] // may point to an invalid address. // if(argv && argcOrig != argc) { argv[argc] = 0; } } PropertiesPtr Ice::createProperties(const StringConverterPtr& converter) { return new PropertiesI(converter); } PropertiesPtr Ice::createProperties(StringSeq& args, const PropertiesPtr& defaults, const StringConverterPtr& converter) { return new PropertiesI(args, defaults, converter); } PropertiesPtr Ice::createProperties(int& argc, char* argv[], const PropertiesPtr& defaults, const StringConverterPtr& converter) { StringSeq args = argsToStringSeq(argc, argv); PropertiesPtr properties = createProperties(args, defaults, converter); stringSeqToArgs(args, argc, argv); return properties; } Ice::ThreadHookPlugin::ThreadHookPlugin(const CommunicatorPtr& communicator, const ThreadNotificationPtr& threadHook) { if(communicator == 0) { throw PluginInitializationException(__FILE__, __LINE__, "Communicator cannot be null"); } IceInternal::InstancePtr instance = IceInternal::getInstance(communicator); instance->setThreadHook(threadHook); } void Ice::ThreadHookPlugin::initialize() { } void Ice::ThreadHookPlugin::destroy() { } namespace { inline void checkIceVersion(Int version) { #ifndef ICE_IGNORE_VERSION # if ICE_INT_VERSION % 100 > 50 // // Beta version: exact match required // if(ICE_INT_VERSION != version) { throw VersionMismatchException(__FILE__, __LINE__); } # else // // Major and minor version numbers must match. // if(ICE_INT_VERSION / 100 != version / 100) { throw VersionMismatchException(__FILE__, __LINE__); } // // Reject beta caller // if(version % 100 > 50) { throw VersionMismatchException(__FILE__, __LINE__); } // // The caller's patch level cannot be greater than library's patch level. (Patch level changes are // backward-compatible, but not forward-compatible.) // if(version % 100 > ICE_INT_VERSION % 100) { throw VersionMismatchException(__FILE__, __LINE__); } # endif #endif } } CommunicatorPtr Ice::initialize(int& argc, char* argv[], const InitializationData& initializationData, Int version) { checkIceVersion(version); InitializationData initData = initializationData; initData.properties = createProperties(argc, argv, initData.properties, initData.stringConverter); CommunicatorI* communicatorI = new CommunicatorI(initData); CommunicatorPtr result = communicatorI; // For exception safety. communicatorI->finishSetup(argc, argv); return result; } CommunicatorPtr Ice::initialize(StringSeq& args, const InitializationData& initializationData, Int version) { CommunicatorPtr communicator; IceUtilInternal::ArgVector av(args); communicator = initialize(av.argc, av.argv, initializationData, version); args = argsToStringSeq(av.argc, av.argv); return communicator; } CommunicatorPtr Ice::initialize(const InitializationData& initData, Int version) { // // We can't simply call the other initialize() because this one does NOT read // the config file, while the other one always does. // checkIceVersion(version); CommunicatorI* communicatorI = new CommunicatorI(initData); CommunicatorPtr result = communicatorI; // For exception safety. int argc = 0; char* argv[] = { 0 }; communicatorI->finishSetup(argc, argv); return result; } InputStreamPtr Ice::createInputStream(const CommunicatorPtr& communicator, const vector& bytes) { return new InputStreamI(communicator, makePair(bytes), true); } InputStreamPtr Ice::createInputStream(const CommunicatorPtr& communicator, const vector& bytes, const EncodingVersion& v) { return new InputStreamI(communicator, makePair(bytes), v, true); } InputStreamPtr Ice::wrapInputStream(const CommunicatorPtr& communicator, const vector& bytes) { return new InputStreamI(communicator, makePair(bytes), false); } InputStreamPtr Ice::wrapInputStream(const CommunicatorPtr& communicator, const vector& bytes, const EncodingVersion& v) { return new InputStreamI(communicator, makePair(bytes), v, false); } InputStreamPtr Ice::createInputStream(const CommunicatorPtr& communicator, const pair& bytes) { return new InputStreamI(communicator, bytes, true); } InputStreamPtr Ice::createInputStream(const CommunicatorPtr& communicator, const pair& bytes, const EncodingVersion& v) { return new InputStreamI(communicator, bytes, v, true); } InputStreamPtr Ice::wrapInputStream(const CommunicatorPtr& communicator, const pair& bytes) { return new InputStreamI(communicator, bytes, false); } InputStreamPtr Ice::wrapInputStream(const CommunicatorPtr& communicator, const pair& bytes, const EncodingVersion& v) { return new InputStreamI(communicator, bytes, v, false); } OutputStreamPtr Ice::createOutputStream(const CommunicatorPtr& communicator) { return new OutputStreamI(communicator); } OutputStreamPtr Ice::createOutputStream(const CommunicatorPtr& communicator, const EncodingVersion& v) { return new OutputStreamI(communicator, v); } static IceUtil::Mutex* processLoggerMutex = 0; static Ice::LoggerPtr processLogger; namespace { class Init { public: Init() { processLoggerMutex = new IceUtil::Mutex; } ~Init() { delete processLoggerMutex; processLoggerMutex = 0; } }; Init init; } LoggerPtr Ice::getProcessLogger() { IceUtilInternal::MutexPtrLock lock(processLoggerMutex); if(processLogger == 0) { // // TODO: Would be nice to be able to use process name as prefix by default. // processLogger = new Ice::LoggerI("", ""); } return processLogger; } void Ice::setProcessLogger(const LoggerPtr& logger) { IceUtilInternal::MutexPtrLock lock(processLoggerMutex); processLogger = logger; } InstancePtr IceInternal::getInstance(const CommunicatorPtr& communicator) { CommunicatorI* p = dynamic_cast(communicator.get()); assert(p); return p->_instance; } #ifdef ICE_CPP11 void IceInternal::Cpp11Dispatcher::dispatch(const ::Ice::DispatcherCallPtr& call, const ::Ice::ConnectionPtr& conn) { _cb(call, conn); } #endif Ice-3.5.1/cpp/src/Ice/DLLMain.cpp0000644000076400007640000000233712223561476014374 0ustar mesmes// ********************************************************************** // // 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 #include extern "C" BOOL WINAPI _CRT_INIT(HINSTANCE, DWORD, LPVOID); extern "C" { BOOL WINAPI ice_DLL_Main(HINSTANCE hDLL, DWORD reason, LPVOID reserved) { // // During ATTACH, we must call _CRT_INIT first. // if(reason == DLL_PROCESS_ATTACH || reason == DLL_THREAD_ATTACH) { if(!_CRT_INIT(hDLL, reason, reserved)) { return FALSE; } } if(reason == DLL_PROCESS_ATTACH) { Ice::Service::setModuleHandle(hDLL); } else if(reason == DLL_THREAD_DETACH) { Ice::ImplicitContextI::cleanupThread(); } // // During DETACH, we must call _CRT_INIT last. // if(reason == DLL_PROCESS_DETACH || reason == DLL_THREAD_DETACH) { if(!_CRT_INIT(hDLL, reason, reserved)) { return FALSE; } } return TRUE; } } Ice-3.5.1/cpp/src/Ice/RouterInfoF.h0000644000076400007640000000127112223561476015017 0ustar mesmes// ********************************************************************** // // 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 ICE_ROUTER_INFO_F_H #define ICE_ROUTER_INFO_F_H #include #include namespace IceInternal { class RouterManager; IceUtil::Shared* upCast(RouterManager*); typedef Handle RouterManagerPtr; class RouterInfo; IceUtil::Shared* upCast(RouterInfo*); typedef Handle RouterInfoPtr; } #endif Ice-3.5.1/cpp/src/Ice/ReferenceFactory.h0000644000076400007640000000455512223561476016053 0ustar mesmes// ********************************************************************** // // 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 ICE_REFERENCE_FACTORY_H #define ICE_REFERENCE_FACTORY_H #include #include #include // For Reference::Mode #include #include namespace IceInternal { class ReferenceFactory : public ::IceUtil::Shared { public: // // Make a polymorphic copy of a reference. // ReferencePtr copy(const Reference* r) const; // // Create a direct reference. // ReferencePtr create(const ::Ice::Identity&, const ::std::string&, const ReferencePtr&, const ::std::vector&); // // Create an indirect reference. // ReferencePtr create(const ::Ice::Identity&, const ::std::string&, const ReferencePtr&, const std::string&); // // Create a fixed reference. // ReferencePtr create(const ::Ice::Identity&, const Ice::ConnectionIPtr&); // // Create a reference from a string. // ReferencePtr create(const ::std::string&, const std::string&); // // Create a reference by unmarshaling it from a stream. // ReferencePtr create(const ::Ice::Identity&, BasicStream*); ReferenceFactoryPtr setDefaultRouter(const ::Ice::RouterPrx&); ::Ice::RouterPrx getDefaultRouter() const; ReferenceFactoryPtr setDefaultLocator(const ::Ice::LocatorPrx&); ::Ice::LocatorPrx getDefaultLocator() const; private: ReferenceFactory(const InstancePtr&, const ::Ice::CommunicatorPtr&); friend class Instance; void checkForUnknownProperties(const std::string&); RoutableReferencePtr create(const ::Ice::Identity&, const ::std::string&, Reference::Mode, bool, const Ice::ProtocolVersion&, const Ice::EncodingVersion&, const std::vector&, const std::string&, const std::string&); const InstancePtr _instance; const ::Ice::CommunicatorPtr _communicator; ::Ice::RouterPrx _defaultRouter; ::Ice::LocatorPrx _defaultLocator; }; } #endif Ice-3.5.1/cpp/src/Ice/DefaultsAndOverrides.cpp0000644000076400007640000000743712223561476017237 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(DefaultsAndOverrides* p) { return p; } IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& properties) : overrideTimeout(false), overrideTimeoutValue(-1), overrideConnectTimeout(false), overrideConnectTimeoutValue(-1), overrideCloseTimeout(false), overrideCloseTimeoutValue(-1), overrideCompress(false), overrideCompressValue(false), overrideSecure(false), overrideSecureValue(false) { const_cast(defaultProtocol) = properties->getPropertyWithDefault("Ice.Default.Protocol", "tcp"); const_cast(defaultHost) = properties->getProperty("Ice.Default.Host"); string value; value = properties->getProperty("Ice.Override.Timeout"); if(!value.empty()) { const_cast(overrideTimeout) = true; const_cast(overrideTimeoutValue) = properties->getPropertyAsInt("Ice.Override.Timeout"); } value = properties->getProperty("Ice.Override.ConnectTimeout"); if(!value.empty()) { const_cast(overrideConnectTimeout) = true; const_cast(overrideConnectTimeoutValue) = properties->getPropertyAsInt("Ice.Override.ConnectTimeout"); } value = properties->getProperty("Ice.Override.CloseTimeout"); if(!value.empty()) { const_cast(overrideCloseTimeout) = true; const_cast(overrideCloseTimeoutValue) = properties->getPropertyAsInt("Ice.Override.CloseTimeout"); } value = properties->getProperty("Ice.Override.Compress"); if(!value.empty()) { const_cast(overrideCompress) = true; const_cast(overrideCompressValue) = properties->getPropertyAsInt("Ice.Override.Compress"); } value = properties->getProperty("Ice.Override.Secure"); if(!value.empty()) { const_cast(overrideSecure) = true; const_cast(overrideSecureValue) = properties->getPropertyAsInt("Ice.Override.Secure"); } const_cast(defaultCollocationOptimization) = properties->getPropertyAsIntWithDefault("Ice.Default.CollocationOptimized", 1) > 0; value = properties->getPropertyWithDefault("Ice.Default.EndpointSelection", "Random"); if(value == "Random") { defaultEndpointSelection = Random; } else if(value == "Ordered") { defaultEndpointSelection = Ordered; } else { EndpointSelectionTypeParseException ex(__FILE__, __LINE__); ex.str = "illegal value `" + value + "'; expected `Random' or `Ordered'"; throw ex; } const_cast(defaultLocatorCacheTimeout) = properties->getPropertyAsIntWithDefault("Ice.Default.LocatorCacheTimeout", -1); const_cast(defaultPreferSecure) = properties->getPropertyAsIntWithDefault("Ice.Default.PreferSecure", 0) > 0; value = properties->getPropertyWithDefault("Ice.Default.EncodingVersion", encodingVersionToString(currentEncoding)); defaultEncoding = stringToEncodingVersion(value); checkSupportedEncoding(defaultEncoding); bool slicedFormat = properties->getPropertyAsIntWithDefault("Ice.Default.SlicedFormat", 0) > 0; const_cast(defaultFormat) = slicedFormat ? SlicedFormat : CompactFormat; } Ice-3.5.1/cpp/src/Ice/RequestHandler.h0000644000076400007640000000270112223561476015542 0ustar mesmes// ********************************************************************** // // 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 ICE_REQUEST_HANDLER_H #define ICE_REQUEST_HANDLER_H #include #include #include #include #include #include namespace IceInternal { class BasicStream; class Outgoing; class BatchOutgoing; class RequestHandler : virtual public ::IceUtil::Shared { public: virtual ~RequestHandler(); virtual void prepareBatchRequest(BasicStream*) = 0; virtual void finishBatchRequest(BasicStream*) = 0; virtual void abortBatchRequest() = 0; virtual Ice::ConnectionI* sendRequest(Outgoing*) = 0; virtual AsyncStatus sendAsyncRequest(const OutgoingAsyncPtr&) = 0; virtual bool flushBatchRequests(BatchOutgoing*) = 0; virtual AsyncStatus flushAsyncBatchRequests(const BatchOutgoingAsyncPtr&) = 0; const ReferencePtr& getReference() const { return _reference; } // Inlined for performances. virtual Ice::ConnectionIPtr getConnection(bool) = 0; protected: RequestHandler(const ReferencePtr&); const ReferencePtr _reference; const bool _response; }; } #endif Ice-3.5.1/cpp/src/Ice/EndpointFactoryManagerF.h0000644000076400007640000000122412223561476017324 0ustar mesmes// ********************************************************************** // // 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 ICE_ENDPOINT_FACTORY_MANAGER_F_H #define ICE_ENDPOINT_FACTORY_MANAGER_F_H #include #include namespace IceInternal { class EndpointFactoryManager; IceUtil::Shared* upCast(EndpointFactoryManager*); typedef Handle EndpointFactoryManagerPtr; } #endif Ice-3.5.1/cpp/src/Ice/EndpointFactoryManager.cpp0000644000076400007640000001121612223561476017553 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(EndpointFactoryManager* p) { return p; } IceInternal::EndpointFactoryManager::EndpointFactoryManager(const InstancePtr& instance) : _instance(instance) { } void IceInternal::EndpointFactoryManager::add(const EndpointFactoryPtr& factory) { IceUtil::Mutex::Lock sync(*this); // TODO: Necessary? // // TODO: Optimize with a map? // for(vector::size_type i = 0; i < _factories.size(); i++) { if(_factories[i]->type() == factory->type()) { assert(false); // TODO: Exception? } } _factories.push_back(factory); } EndpointFactoryPtr IceInternal::EndpointFactoryManager::get(Short type) const { IceUtil::Mutex::Lock sync(*this); // TODO: Necessary? // // TODO: Optimize with a map? // for(vector::size_type i = 0; i < _factories.size(); i++) { if(_factories[i]->type() == type) { return _factories[i]; } } return 0; } EndpointIPtr IceInternal::EndpointFactoryManager::create(const string& str, bool oaEndpoint) const { const string delim = " \t\n\r"; string::size_type beg = str.find_first_not_of(delim); if(beg == string::npos) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "value has no non-whitespace characters"; throw ex; } string::size_type end = str.find_first_of(delim, beg); if(end == string::npos) { end = str.length(); } string protocol = str.substr(beg, end - beg); if(protocol == "default") { protocol = _instance->defaultsAndOverrides()->defaultProtocol; } EndpointFactoryPtr factory; { IceUtil::Mutex::Lock sync(*this); // TODO: Necessary? // // TODO: Optimize with a map? // for(vector::size_type i = 0; i < _factories.size(); i++) { if(_factories[i]->protocol() == protocol) { factory = _factories[i]; } } } if(factory) { #if 1 return factory->create(str.substr(end), oaEndpoint); #else // Code below left in place for debugging. EndpointIPtr e = factory->create(str.substr(end), oaEndpoint); BasicStream bs(_instance.get(), Ice::currentProtocolEncoding); e->streamWrite(&bs); bs.i = bs.b.begin(); short type; bs.read(type); EndpointIPtr ue = new IceInternal::OpaqueEndpointI(type, &bs); cerr << "Normal: " << e->toString() << endl; cerr << "Opaque: " << ue->toString() << endl; return e; #endif } // // If the stringified endpoint is opaque, create an unknown endpoint, // then see whether the type matches one of the known endpoints. // if(protocol == "opaque") { EndpointIPtr ue = new OpaqueEndpointI(str.substr(end)); factory = get(ue->type()); if(factory) { // // Make a temporary stream, write the opaque endpoint data into the stream, // and ask the factory to read the endpoint data from that stream to create // the actual endpoint. // BasicStream bs(_instance.get(), Ice::currentProtocolEncoding); ue->streamWrite(&bs); bs.i = bs.b.begin(); short type; bs.read(type); return factory->read(&bs); } return ue; // Endpoint is opaque, but we don't have a factory for its type. } return 0; } EndpointIPtr IceInternal::EndpointFactoryManager::read(BasicStream* s) const { Short type; s->read(type); EndpointFactoryPtr factory = get(type); if(factory) { return factory->read(s); } return new OpaqueEndpointI(type, s); } void IceInternal::EndpointFactoryManager::destroy() { for(vector::size_type i = 0; i < _factories.size(); i++) { _factories[i]->destroy(); } _factories.clear(); } Ice-3.5.1/cpp/src/Ice/FactoryTable.cpp0000644000076400007640000000752712223561476015541 0ustar mesmes// ********************************************************************** // // 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 #include // // Add a factory to the exception factory table. // If the factory is present already, increment its reference count. // void IceInternal::FactoryTable::addExceptionFactory(const std::string& t, const IceInternal::UserExceptionFactoryPtr& f) { IceUtil::Mutex::Lock lock(_m); assert(f); EFTable::iterator i = _eft.find(t); if(i == _eft.end()) { _eft[t] = EFPair(f, 1); } else { i->second.second++; } } // // Return the exception factory for a given type ID // IceInternal::UserExceptionFactoryPtr IceInternal::FactoryTable::getExceptionFactory(const std::string& t) const { IceUtil::Mutex::Lock lock(_m); EFTable::const_iterator i = _eft.find(t); return i != _eft.end() ? i->second.first : IceInternal::UserExceptionFactoryPtr(); } // // Remove a factory from the exception factory table. If the factory // is not present, do nothing; otherwise, decrement the factory's // reference count; if the count drops to zero, remove the factory's // entry from the table. // void IceInternal::FactoryTable::removeExceptionFactory(const std::string& t) { IceUtil::Mutex::Lock lock(_m); EFTable::iterator i = _eft.find(t); if(i != _eft.end()) { if(--i->second.second == 0) { _eft.erase(i); } } } // // Add a factory to the object factory table. // void IceInternal::FactoryTable::addObjectFactory(const std::string& t, const Ice::ObjectFactoryPtr& f) { IceUtil::Mutex::Lock lock(_m); assert(f); OFTable::iterator i = _oft.find(t); if(i == _oft.end()) { _oft[t] = OFPair(f, 1); } else { i->second.second++; } } // // Return the object factory for a given type ID // Ice::ObjectFactoryPtr IceInternal::FactoryTable::getObjectFactory(const std::string& t) const { IceUtil::Mutex::Lock lock(_m); OFTable::const_iterator i = _oft.find(t); return i != _oft.end() ? i->second.first : Ice::ObjectFactoryPtr(); } // // Remove a factory from the object factory table. If the factory // is not present, do nothing; otherwise, decrement the factory's // reference count if the count drops to zero, remove the factory's // entry from the table. // void IceInternal::FactoryTable::removeObjectFactory(const std::string& t) { IceUtil::Mutex::Lock lock(_m); OFTable::iterator i = _oft.find(t); if(i != _oft.end()) { if(--i->second.second == 0) { _oft.erase(i); } } } // // Add a factory to the object factory table. // void IceInternal::FactoryTable::addTypeId(int compactId, const std::string& typeId) { IceUtil::Mutex::Lock lock(_m); assert(!typeId.empty() && compactId >= 0); TypeIdTable::iterator i = _typeIdTable.find(compactId); if(i == _typeIdTable.end()) { _typeIdTable[compactId] = TypeIdPair(typeId, 1); } else { i->second.second++; } } // // Return the type ID for the given compact ID // std::string IceInternal::FactoryTable::getTypeId(int compactId) const { IceUtil::Mutex::Lock lock(_m); TypeIdTable::const_iterator i = _typeIdTable.find(compactId); return i != _typeIdTable.end() ? i->second.first : std::string(); } void IceInternal::FactoryTable::removeTypeId(int compactId) { IceUtil::Mutex::Lock lock(_m); TypeIdTable::iterator i = _typeIdTable.find(compactId); if(i != _typeIdTable.end()) { if(--i->second.second == 0) { _typeIdTable.erase(i); } } } Ice-3.5.1/cpp/src/Ice/Buffer.cpp0000644000076400007640000000410212223561476014355 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; using namespace Ice; using namespace IceInternal; void IceInternal::Buffer::swapBuffer(Buffer& other) { b.swap(other.b); std::swap(i, other.i); } IceInternal::Buffer::Container::Container(size_type maxCapacity) : _buf(0), _size(0), _capacity(0), _maxCapacity(maxCapacity), _shrinkCounter(0) { } IceInternal::Buffer::Container::Container(const_iterator beg, const_iterator end) : _buf(const_cast(beg)), _size(end - beg), _capacity(0), _maxCapacity(0), _shrinkCounter(0) { } IceInternal::Buffer::Container::~Container() { if(_buf && _capacity > 0) { ::free(_buf); } } void IceInternal::Buffer::Container::swap(Container& other) { assert(!_buf || _capacity > 0); std::swap(_buf, other._buf); std::swap(_size, other._size); std::swap(_capacity, other._capacity); std::swap(_shrinkCounter, other._shrinkCounter); } void IceInternal::Buffer::Container::clear() { assert(!_buf || _capacity > 0); free(_buf); _buf = 0; _size = 0; _capacity = 0; } void IceInternal::Buffer::Container::reserve(size_type n) { assert(!_buf || _capacity > 0); size_type c = _capacity; if(n > _capacity) { _capacity = std::max(n, std::min(2 * _capacity, _maxCapacity)); _capacity = std::max(static_cast(240), _capacity); } else if(n < _capacity) { _capacity = n; } else { return; } pointer p = reinterpret_cast(::realloc(_buf, _capacity)); if(!p) { _capacity = c; // Restore the previous capacity. throw std::bad_alloc(); } _buf = p; } Ice-3.5.1/cpp/src/Ice/TcpEndpointI.cpp0000644000076400007640000003301012223561476015504 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const string& ho, Int po, Int ti, const string& conId, bool co) : EndpointI(conId), _instance(instance), _host(ho), _port(po), _timeout(ti), _compress(co) { } IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const string& str, bool oaEndpoint) : EndpointI(""), _instance(instance), _port(0), _timeout(-1), _compress(false) { const string delim = " \t\n\r"; string::size_type beg; string::size_type end = 0; while(true) { beg = str.find_first_not_of(delim, end); if(beg == string::npos) { break; } end = str.find_first_of(delim, beg); if(end == string::npos) { end = str.length(); } string option = str.substr(beg, end - beg); if(option.length() != 2 || option[0] != '-') { EndpointParseException ex(__FILE__, __LINE__); ex.str = "expected an endpoint option but found `" + option + "' in endpoint `tcp " + str + "'"; throw ex; } string argument; string::size_type argumentBeg = str.find_first_not_of(delim, end); if(argumentBeg != string::npos && str[argumentBeg] != '-') { beg = argumentBeg; end = str.find_first_of(delim, beg); if(end == string::npos) { end = str.length(); } argument = str.substr(beg, end - beg); if(argument[0] == '\"' && argument[argument.size() - 1] == '\"') { argument = argument.substr(1, argument.size() - 2); } } switch(option[1]) { case 'h': { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -h option in endpoint `tcp " + str + "'"; throw ex; } const_cast(_host) = argument; break; } case 'p': { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -p option in endpoint `tcp " + str + "'"; throw ex; } istringstream p(argument); if(!(p >> const_cast(_port)) || !p.eof()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid port value `" + argument + "' in endpoint `tcp " + str + "'"; throw ex; } else if(_port < 0 || _port > 65535) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "port value `" + argument + "' out of range in endpoint `tcp " + str + "'"; throw ex; } break; } case 't': { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -t option in endpoint `tcp " + str + "'"; throw ex; } istringstream t(argument); if(!(t >> const_cast(_timeout)) || !t.eof()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid timeout value `" + argument + "' in endpoint `tcp " + str + "'"; throw ex; } break; } case 'z': { if(!argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "unexpected argument `" + argument + "' provided for -z option in `tcp " + str + "'"; throw ex; } const_cast(_compress) = true; break; } default: { Ice::EndpointParseException ex(__FILE__, __LINE__); ex.str = "unknown option `" + option + "' in endpoint `tcp " + str + "'"; throw ex; } } } if(_host.empty()) { const_cast(_host) = _instance->defaultsAndOverrides()->defaultHost; } else if(_host == "*") { if(oaEndpoint) { const_cast(_host) = string(); } else { EndpointParseException ex(__FILE__, __LINE__); ex.str = "`-h *' not valid for proxy endpoint `tcp " + str + "'"; throw ex; } } } IceInternal::TcpEndpointI::TcpEndpointI(BasicStream* s) : _instance(s->instance()), _port(0), _timeout(-1), _compress(false) { s->startReadEncaps(); s->read(const_cast(_host), false); s->read(const_cast(_port)); s->read(const_cast(_timeout)); s->read(const_cast(_compress)); s->endReadEncaps(); } void IceInternal::TcpEndpointI::streamWrite(BasicStream* s) const { s->write(TCPEndpointType); s->startWriteEncaps(); s->write(_host, false); s->write(_port); s->write(_timeout); s->write(_compress); s->endWriteEncaps(); } string IceInternal::TcpEndpointI::toString() 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 << "tcp"; if(!_host.empty()) { s << " -h "; bool addQuote = _host.find(':') != string::npos; if(addQuote) { s << "\""; } s << _host; if(addQuote) { s << "\""; } } s << " -p " << _port; if(_timeout != -1) { s << " -t " << _timeout; } if(_compress) { s << " -z"; } return s.str(); } EndpointInfoPtr IceInternal::TcpEndpointI::getInfo() const { class InfoI : public Ice::TCPEndpointInfo { public: InfoI(Ice::Int to, bool comp, const string& host, Ice::Int port) : TCPEndpointInfo(to, comp, host, port) { } virtual Ice::Short type() const { return TCPEndpointType; } virtual bool datagram() const { return false; } virtual bool secure() const { return false; } }; return new InfoI(_timeout, _compress, _host, _port); } Short IceInternal::TcpEndpointI::type() const { return TCPEndpointType; } std::string IceInternal::TcpEndpointI::protocol() const { return "tcp"; } Int IceInternal::TcpEndpointI::timeout() const { return _timeout; } EndpointIPtr IceInternal::TcpEndpointI::timeout(Int timeout) const { if(timeout == _timeout) { return const_cast(this); } else { return new TcpEndpointI(_instance, _host, _port, timeout, _connectionId, _compress); } } EndpointIPtr IceInternal::TcpEndpointI::connectionId(const string& connectionId) const { if(connectionId == _connectionId) { return const_cast(this); } else { return new TcpEndpointI(_instance, _host, _port, _timeout, connectionId, _compress); } } bool IceInternal::TcpEndpointI::compress() const { return _compress; } EndpointIPtr IceInternal::TcpEndpointI::compress(bool compress) const { if(compress == _compress) { return const_cast(this); } else { return new TcpEndpointI(_instance, _host, _port, _timeout, _connectionId, compress); } } bool IceInternal::TcpEndpointI::datagram() const { return false; } bool IceInternal::TcpEndpointI::secure() const { return false; } TransceiverPtr IceInternal::TcpEndpointI::transceiver(EndpointIPtr& endp) const { endp = const_cast(this); return 0; } vector IceInternal::TcpEndpointI::connectors(EndpointSelectionType selType) const { return _instance->endpointHostResolver()->resolve(_host, _port, selType, const_cast(this)); } void IceInternal::TcpEndpointI::connectors_async(EndpointSelectionType selType, const EndpointI_connectorsPtr& cb) const { _instance->endpointHostResolver()->resolve(_host, _port, selType, const_cast(this), cb); } AcceptorPtr IceInternal::TcpEndpointI::acceptor(EndpointIPtr& endp, const string&) const { TcpAcceptor* p = new TcpAcceptor(_instance, _host, _port); endp = new TcpEndpointI(_instance, _host, p->effectivePort(), _timeout, _connectionId, _compress); return p; } vector IceInternal::TcpEndpointI::expand() const { vector endps; vector hosts = getHostsForEndpointExpand(_host, _instance->protocolSupport(), false); if(hosts.empty()) { endps.push_back(const_cast(this)); } else { for(vector::const_iterator p = hosts.begin(); p != hosts.end(); ++p) { endps.push_back(new TcpEndpointI(_instance, *p, _port, _timeout, _connectionId, _compress)); } } return endps; } bool IceInternal::TcpEndpointI::equivalent(const EndpointIPtr& endpoint) const { const TcpEndpointI* tcpEndpointI = dynamic_cast(endpoint.get()); if(!tcpEndpointI) { return false; } return tcpEndpointI->_host == _host && tcpEndpointI->_port == _port; } vector IceInternal::TcpEndpointI::connectors(const vector
          & addresses, const NetworkProxyPtr& proxy) const { vector connectors; for(unsigned int i = 0; i < addresses.size(); ++i) { connectors.push_back(new TcpConnector(_instance, addresses[i], proxy, _timeout, _connectionId)); } return connectors; } bool IceInternal::TcpEndpointI::operator==(const LocalObject& r) const { const TcpEndpointI* p = dynamic_cast(&r); if(!p) { return false; } if(this == p) { return true; } if(_host != p->_host) { return false; } if(_port != p->_port) { return false; } if(_timeout != p->_timeout) { return false; } if(_connectionId != p->_connectionId) { return false; } if(_compress != p->_compress) { return false; } return true; } bool IceInternal::TcpEndpointI::operator<(const LocalObject& r) const { const TcpEndpointI* p = dynamic_cast(&r); if(!p) { const EndpointI* e = dynamic_cast(&r); if(!e) { return false; } return type() < e->type(); } if(this == p) { return false; } if(_host < p->_host) { return true; } else if (p->_host < _host) { return false; } if(_port < p->_port) { return true; } else if(p->_port < _port) { 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; } Ice::Int IceInternal::TcpEndpointI::hashInit() const { Ice::Int h = 5381; hashAdd(h, TCPEndpointType); hashAdd(h, _host); hashAdd(h, _port); hashAdd(h, _timeout); hashAdd(h, _connectionId); hashAdd(h, _compress); return h; } IceInternal::TcpEndpointFactory::TcpEndpointFactory(const InstancePtr& instance) : _instance(instance) { } IceInternal::TcpEndpointFactory::~TcpEndpointFactory() { } Short IceInternal::TcpEndpointFactory::type() const { return TCPEndpointType; } string IceInternal::TcpEndpointFactory::protocol() const { return "tcp"; } EndpointIPtr IceInternal::TcpEndpointFactory::create(const std::string& str, bool oaEndpoint) const { return new TcpEndpointI(_instance, str, oaEndpoint); } EndpointIPtr IceInternal::TcpEndpointFactory::read(BasicStream* s) const { return new TcpEndpointI(s); } void IceInternal::TcpEndpointFactory::destroy() { _instance = 0; } Ice-3.5.1/cpp/src/Ice/SysLoggerI.h0000644000076400007640000000167112223561476014650 0ustar mesmes// ********************************************************************** // // 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 ICE_SYS_LOGGER_I_H #define ICE_SYS_LOGGER_I_H #include #include namespace Ice { class SysLoggerI : public Logger, public ::IceUtil::Mutex { public: SysLoggerI(const std::string&, const std::string&); ~SysLoggerI(); virtual void print(const std::string&); virtual void trace(const std::string&, const std::string&); virtual void warning(const std::string&); virtual void error(const std::string&); virtual LoggerPtr cloneWithPrefix(const std::string&); private: SysLoggerI(const std::string&, int); int _facility; }; } #endif Ice-3.5.1/cpp/src/Ice/Network.cpp0000644000076400007640000017354312223561476014615 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** // // The following is required on HP-UX in order to bring in // the definition for the ip_mreq structure. // #if defined(__hpux) # undef _XOPEN_SOURCE_EXTENDED # define _XOPEN_SOURCE # include #endif // // The following is required for MinGW to bring in // some definitions. // #if defined(__MINGW32__) # define _WIN32_WINNT 0x0501 # ifndef IPV6_V6ONLY # define IPV6_V6ONLY 27 # endif #endif #include #include #include #include #include #include // For setTcpBufSize #include // For setTcpBufSize #include #include #if defined(ICE_OS_WINRT) # include # include // For Concurrency::task #elif defined(_WIN32) # include # include # include # include #else # include # include #endif #if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__) # include #elif defined(__sun) # include #endif using namespace std; using namespace Ice; using namespace IceInternal; #ifdef ICE_OS_WINRT using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Storage::Streams; using namespace Windows::Networking; using namespace Windows::Networking::Sockets; #endif namespace { #ifndef ICE_OS_WINRT struct AddressIsIPv6 : public unary_function { public: bool operator()(const Address& ss) const { return ss.saStorage.ss_family == AF_INET6; } }; struct RandomNumberGenerator : public std::unary_function { ptrdiff_t operator()(ptrdiff_t d) { return IceUtilInternal::random(static_cast(d)); } }; void sortAddresses(vector
          & addrs, ProtocolSupport protocol, Ice::EndpointSelectionType selType, bool preferIPv6) { if(selType == Ice::Random) { RandomNumberGenerator rng; random_shuffle(addrs.begin(), addrs.end(), rng); } if(protocol == EnableBoth) { if(preferIPv6) { stable_partition(addrs.begin(), addrs.end(), AddressIsIPv6()); } else { stable_partition(addrs.begin(), addrs.end(), not1(AddressIsIPv6())); } } } void setTcpNoDelay(SOCKET fd) { int flag = 1; if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } void setKeepAlive(SOCKET fd) { int flag = 1; if(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } #endif #ifdef ICE_OS_WINRT SOCKET createSocketImpl(bool udp, int) { SOCKET fd; if(udp) { return ref new DatagramSocket(); } else { StreamSocket^ socket = ref new StreamSocket(); socket->Control->KeepAlive = true; socket->Control->NoDelay = true; return socket; } return fd; } #else SOCKET createSocketImpl(bool udp, int family) { SOCKET fd; if(udp) { fd = socket(family, SOCK_DGRAM, IPPROTO_UDP); } else { fd = socket(family, SOCK_STREAM, IPPROTO_TCP); } if(fd == INVALID_SOCKET) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } if(!udp) { setTcpNoDelay(fd); setKeepAlive(fd); } return fd; } #endif #ifndef ICE_OS_WINRT vector
          getLocalAddresses(ProtocolSupport protocol) { vector
          result; #if defined(_WIN32) try { for(int i = 0; i < 2; i++) { if((i == 0 && protocol == EnableIPv6) || (i == 1 && protocol == EnableIPv4)) { continue; } SOCKET fd = createSocketImpl(false, i == 0 ? AF_INET : AF_INET6); vector buffer; buffer.resize(1024); unsigned long len = 0; int rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0, &buffer[0], static_cast(buffer.size()), &len, 0, 0); if(rs == SOCKET_ERROR) { // // If the buffer wasn't big enough, resize it to the // required length and try again. // if(getSocketErrno() == WSAEFAULT) { buffer.resize(len); rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0, &buffer[0], static_cast(buffer.size()), &len, 0, 0); } if(rs == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } // // Add the local interface addresses. // SOCKET_ADDRESS_LIST* addrs = reinterpret_cast(&buffer[0]); for (int i = 0; i < addrs->iAddressCount; ++i) { Address addr; memcpy(&addr.saStorage, addrs->Address[i].lpSockaddr, addrs->Address[i].iSockaddrLength); if(addr.saStorage.ss_family == AF_INET && protocol != EnableIPv6) { if(addr.saIn.sin_addr.s_addr != 0) { result.push_back(addr); } } else if(addr.saStorage.ss_family == AF_INET6 && protocol != EnableIPv4) { if(!IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr) && !IN6_IS_ADDR_LOOPBACK(&addr.saIn6.sin6_addr)) { result.push_back(addr); } } } closeSocket(fd); } } catch(const Ice::LocalException&) { // // TODO: Warning? // } #elif defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__) struct ifaddrs* ifap; if(::getifaddrs(&ifap) == SOCKET_ERROR) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } struct ifaddrs* curr = ifap; while(curr != 0) { if(curr->ifa_addr && !(curr->ifa_flags & IFF_LOOPBACK)) // Don't include loopback interface addresses { if(curr->ifa_addr->sa_family == AF_INET && protocol != EnableIPv6) { Address addr; memcpy(&addr.saStorage, curr->ifa_addr, sizeof(sockaddr_in)); if(addr.saIn.sin_addr.s_addr != 0) { result.push_back(addr); } } else if(curr->ifa_addr->sa_family == AF_INET6 && protocol != EnableIPv4) { Address addr; memcpy(&addr.saStorage, curr->ifa_addr, sizeof(sockaddr_in6)); if(!IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr)) { result.push_back(addr); } } } curr = curr->ifa_next; } ::freeifaddrs(ifap); #else for(int i = 0; i < 2; i++) { if((i == 0 && protocol == EnableIPv6) || (i == 1 && protocol == EnableIPv4)) { continue; } SOCKET fd = createSocketImpl(false, i == 0 ? AF_INET : 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(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); closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } 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); } closeSocket(fd); numaddrs = ifc.ifc_len / static_cast(sizeof(struct ifreq)); struct ifreq* ifr = ifc.ifc_req; for(int i = 0; i < numaddrs; ++i) { if(!(ifr[i].ifr_flags & IFF_LOOPBACK)) // Don't include loopback interface addresses { // // On Solaris the above Loopback check does not always work so we double // check the address below. Solaris also returns duplicate entries that need // to be filtered out. // if(ifr[i].ifr_addr.sa_family == AF_INET && protocol != EnableIPv6) { Address addr; memcpy(&addr.saStorage, &ifr[i].ifr_addr, sizeof(sockaddr_in)); if(addr.saIn.sin_addr.s_addr != 0 && addr.saIn.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) { unsigned int j; for(j = 0; j < result.size(); ++j) { if(compareAddress(addr, result[j]) == 0) { break; } } if(j == result.size()) { result.push_back(addr); } } } else if(ifr[i].ifr_addr.sa_family == AF_INET6 && protocol != EnableIPv4) { Address addr; memcpy(&addr.saStorage, &ifr[i].ifr_addr, sizeof(sockaddr_in6)); if(!IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr) && !IN6_IS_ADDR_LOOPBACK(&addr.saIn6.sin6_addr)) { unsigned int j; for(j = 0; j < result.size(); ++j) { if(compareAddress(addr, result[j]) == 0) { break; } } if(j == result.size()) { result.push_back(addr); } } } } } free(ifc.ifc_buf); } #endif return result; } bool isWildcard(const string& host, ProtocolSupport protocol) { try { Address addr = getAddressForServer(host, 0, protocol, true); if(addr.saStorage.ss_family == AF_INET) { if(addr.saIn.sin_addr.s_addr == INADDR_ANY) { return true; } } else if(addr.saStorage.ss_family) { if(IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr)) { return true; } } } catch(const DNSException&) { } return false; } int getInterfaceIndex(const string& name) { int index = 0; #ifdef _WIN32 IP_ADAPTER_ADDRESSES addrs; ULONG buflen = 0; if(::GetAdaptersAddresses(AF_INET6, 0, 0, &addrs, &buflen) == ERROR_BUFFER_OVERFLOW) { PIP_ADAPTER_ADDRESSES paddrs; char* buf = new char[buflen]; paddrs = reinterpret_cast(buf); if(::GetAdaptersAddresses(AF_INET6, 0, 0, paddrs, &buflen) == NO_ERROR) { while(paddrs) { if(IceUtil::wstringToString(paddrs->FriendlyName) == name) { index = paddrs->Ipv6IfIndex; break; } paddrs = paddrs->Next; } } delete[] buf; } #elif !defined(__hpux) index = if_nametoindex(name.c_str()); #endif return index; } struct in_addr getInterfaceAddress(const string& name) { struct in_addr addr; addr.s_addr = INADDR_ANY; #ifdef _WIN32 IP_ADAPTER_ADDRESSES addrs; ULONG buflen = 0; if(::GetAdaptersAddresses(AF_INET, 0, 0, &addrs, &buflen) == ERROR_BUFFER_OVERFLOW) { PIP_ADAPTER_ADDRESSES paddrs; char* buf = new char[buflen]; paddrs = reinterpret_cast(buf); if(::GetAdaptersAddresses(AF_INET, 0, 0, paddrs, &buflen) == NO_ERROR) { while(paddrs) { if(IceUtil::wstringToString(paddrs->FriendlyName) == name) { struct sockaddr_in addrin; memcpy(&addrin, paddrs->FirstUnicastAddress->Address.lpSockaddr, paddrs->FirstUnicastAddress->Address.iSockaddrLength); addr = addrin.sin_addr; break; } paddrs = paddrs->Next; } } delete[] buf; } #else ifreq if_address; strcpy(if_address.ifr_name, name.c_str()); SOCKET fd = createSocketImpl(false, AF_INET); int rc = ioctl(fd, SIOCGIFADDR, &if_address); closeSocketNoThrow(fd); if(rc != SOCKET_ERROR) { addr = reinterpret_cast(&if_address.ifr_addr)->sin_addr; } #endif return addr; } #endif // #ifndef ICE_OS_WINRT } #ifdef ICE_USE_IOCP IceInternal::AsyncInfo::AsyncInfo(SocketOperation s) { ZeroMemory(this, sizeof(AsyncInfo)); status = s; } #endif IceUtil::Shared* IceInternal::upCast(NetworkProxy* p) { return p; } #ifndef ICE_OS_WINRT IceInternal::SOCKSNetworkProxy::SOCKSNetworkProxy(const string& host, int port) : _host(host), _port(port) { assert(!host.empty()); memset(&_address, 0, sizeof(_address)); } IceInternal::SOCKSNetworkProxy::SOCKSNetworkProxy(const Address& addr) : _port(0), _address(addr) { } void IceInternal::SOCKSNetworkProxy::beginWriteConnectRequest(const Address& addr, Buffer& buf) { if(addr.saStorage.ss_family != AF_INET) { throw FeatureNotSupportedException(__FILE__, __LINE__, "SOCKS4 only supports IPv4 addresses"); } // // SOCKS connect request // buf.b.resize(9); buf.i = buf.b.begin(); Byte* dest = &buf.b[0]; *dest++ = 0x04; // SOCKS version 4. *dest++ = 0x01; // Command, establish a TCP/IP stream connection const Byte* src; // // Port (already in big-endian order) // src = reinterpret_cast(&addr.saIn.sin_port); *dest++ = *src++; *dest++ = *src; // // IPv4 address (already in big-endian order) // src = reinterpret_cast(&addr.saIn.sin_addr.s_addr); *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src; *dest = 0x00; // User ID. } void IceInternal::SOCKSNetworkProxy::endWriteConnectRequest(Buffer& buf) { buf.b.reset(); } void IceInternal::SOCKSNetworkProxy::beginReadConnectRequestResponse(Buffer& buf) { // // Read the SOCKS4 response whose size is 8 bytes. // buf.b.resize(8); buf.i = buf.b.begin(); } void IceInternal::SOCKSNetworkProxy::endReadConnectRequestResponse(Buffer& buf) { buf.i = buf.b.begin(); if(buf.b.end() - buf.i < 2) { throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } const Byte* src = &(*buf.i); const Byte b1 = *src++; const Byte b2 = *src++; if(b1 != 0x00 || b2 != 0x5a) { throw ConnectFailedException(__FILE__, __LINE__); } buf.b.reset(); } NetworkProxyPtr IceInternal::SOCKSNetworkProxy::resolveHost() const { assert(!_host.empty()); return new SOCKSNetworkProxy(getAddresses(_host, _port, EnableIPv4, Random, false, true)[0]); } Address IceInternal::SOCKSNetworkProxy::getAddress() const { assert(_host.empty()); // Host must be resolved. return _address; } string IceInternal::SOCKSNetworkProxy::getName() const { return "SOCKS"; } #endif // ICE_OS_WINRT bool IceInternal::noMoreFds(int error) { #if defined(ICE_OS_WINRT) return error == (int)SocketErrorStatus::TooManyOpenFiles; #elif defined(_WIN32) return error == WSAEMFILE; #else return error == EMFILE || error == ENFILE; #endif } #if defined(ICE_OS_WINRT) string IceInternal::errorToStringDNS(int) { return "Host not found"; } #else string IceInternal::errorToStringDNS(int error) { # if defined(_WIN32) return IceUtilInternal::errorToString(error); # else return gai_strerror(error); # endif } #endif #ifdef ICE_OS_WINRT vector
          IceInternal::getAddresses(const string& host, int port, ProtocolSupport, Ice::EndpointSelectionType, bool, bool) { try { vector
          result; Address addr; if(host.empty()) { addr.host = ref new HostName("localhost"); } else { addr.host = ref new HostName(ref new String(IceUtil::stringToWstring(host).c_str())); } stringstream os; os << port; addr.port = ref new String(IceUtil::stringToWstring(os.str()).c_str()); result.push_back(addr); return result; } catch(Platform::Exception^ pex) { DNSException ex(__FILE__, __LINE__); ex.error = (int)SocketError::GetStatus(pex->HResult); ex.host = host; throw ex; } } #else vector
          IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol, Ice::EndpointSelectionType selType, bool preferIPv6, bool blocking) { vector
          result; Address addr; memset(&addr.saStorage, 0, sizeof(sockaddr_storage)); // // We don't use getaddrinfo when host is empty as it's not portable (some old Linux // versions don't support it). // if(host.empty()) { if(protocol != EnableIPv4) { addr.saIn6.sin6_family = AF_INET6; addr.saIn6.sin6_port = htons(port); addr.saIn6.sin6_addr = in6addr_loopback; result.push_back(addr); } if(protocol != EnableIPv6) { addr.saIn.sin_family = AF_INET; addr.saIn.sin_port = htons(port); addr.saIn.sin_addr.s_addr = htonl(INADDR_LOOPBACK); result.push_back(addr); } sortAddresses(result, protocol, selType, preferIPv6); return result; } struct addrinfo* info = 0; int retry = 5; struct addrinfo hints = { 0 }; if(protocol == EnableIPv4) { hints.ai_family = PF_INET; } else if(protocol == EnableIPv6) { hints.ai_family = PF_INET6; } else { hints.ai_family = PF_UNSPEC; } if(!blocking) { hints.ai_flags = AI_NUMERICHOST; } int rs = 0; do { rs = getaddrinfo(host.c_str(), 0, &hints, &info); } while(info == 0 && rs == EAI_AGAIN && --retry >= 0); // In theory, getaddrinfo should only return EAI_NONAME if // AI_NUMERICHOST is specified and the host name is not a IP // address. However on some platforms (e.g. OS X 10.4.x) // EAI_NODATA is also returned so we also check for it. # ifdef EAI_NODATA if(!blocking && (rs == EAI_NONAME || rs == EAI_NODATA)) # else if(!blocking && rs == EAI_NONAME) # endif { return result; // Empty result indicates that a blocking lookup is necessary. } else if(rs != 0) { DNSException ex(__FILE__, __LINE__); ex.error = rs; ex.host = host; throw ex; } for(struct addrinfo* p = info; p != NULL; p = p->ai_next) { memcpy(&addr.saStorage, p->ai_addr, p->ai_addrlen); if(p->ai_family == PF_INET) { addr.saIn.sin_port = htons(port); } else if(p->ai_family == PF_INET6) { addr.saIn6.sin6_port = htons(port); } bool found = false; for(unsigned int i = 0; i < result.size(); ++i) { if(compareAddress(result[i], addr) == 0) { found = true; break; } } if(!found) { result.push_back(addr); } } freeaddrinfo(info); if(result.empty()) { DNSException ex(__FILE__, __LINE__); ex.host = host; throw ex; } sortAddresses(result, protocol, selType, preferIPv6); return result; } #endif #ifdef ICE_OS_WINRT ProtocolSupport IceInternal::getProtocolSupport(const Address&) { // For WinRT, there's no distinction between IPv4 and IPv6 adresses. return EnableBoth; } #else ProtocolSupport IceInternal::getProtocolSupport(const Address& addr) { return addr.saStorage.ss_family == AF_INET ? EnableIPv4 : EnableIPv6; } #endif Address IceInternal::getAddressForServer(const string& host, int port, ProtocolSupport protocol, bool preferIPv6) { // // We don't use getaddrinfo when host is empty as it's not portable (some old Linux // versions don't support it). // if(host.empty()) { Address addr; #ifdef ICE_OS_WINRT ostringstream os; os << port; addr.port = ref new String(IceUtil::stringToWstring(os.str()).c_str()); addr.host = nullptr; // Equivalent of inaddr_any, see doBind implementation. #else memset(&addr.saStorage, 0, sizeof(sockaddr_storage)); if(protocol != EnableIPv4) { addr.saIn6.sin6_family = AF_INET6; addr.saIn6.sin6_port = htons(port); addr.saIn6.sin6_addr = in6addr_any; } else { addr.saIn.sin_family = AF_INET; addr.saIn.sin_port = htons(port); addr.saIn.sin_addr.s_addr = htonl(INADDR_ANY); } #endif return addr; } return getAddresses(host, port, protocol, Ice::Ordered, preferIPv6, true)[0]; } int IceInternal::compareAddress(const Address& addr1, const Address& addr2) { #ifdef ICE_OS_WINRT int o = String::CompareOrdinal(addr1.port, addr2.port); if(o != 0) { return o; } return String::CompareOrdinal(addr1.host->RawName, addr2.host->RawName); #else if(addr1.saStorage.ss_family < addr2.saStorage.ss_family) { return -1; } else if(addr2.saStorage.ss_family < addr1.saStorage.ss_family) { return 1; } if(addr1.saStorage.ss_family == AF_INET) { if(addr1.saIn.sin_port < addr2.saIn.sin_port) { return -1; } else if(addr2.saIn.sin_port < addr1.saIn.sin_port) { return 1; } if(addr1.saIn.sin_addr.s_addr < addr2.saIn.sin_addr.s_addr) { return -1; } else if(addr2.saIn.sin_addr.s_addr < addr1.saIn.sin_addr.s_addr) { return 1; } } else { if(addr1.saIn6.sin6_port < addr2.saIn6.sin6_port) { return -1; } else if(addr2.saIn6.sin6_port < addr1.saIn6.sin6_port) { return 1; } int res = memcmp(&addr1.saIn6.sin6_addr, &addr2.saIn6.sin6_addr, sizeof(in6_addr)); if(res < 0) { return -1; } else if(res > 0) { return 1; } } return 0; #endif } #ifdef ICE_OS_WINRT SOCKET IceInternal::createSocket(bool udp, const Address&) { return createSocketImpl(udp, 0); } #else SOCKET IceInternal::createSocket(bool udp, const Address& addr) { return createSocketImpl(udp, addr.saStorage.ss_family); } #endif #ifndef ICE_OS_WINRT SOCKET IceInternal::createServerSocket(bool udp, const Address& addr, ProtocolSupport protocol) { SOCKET fd = createSocket(udp, addr); if(addr.saStorage.ss_family == AF_INET6 && protocol != EnableIPv4) { int flag = protocol == EnableIPv6 ? 1 : 0; if(setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR) { #ifdef _WIN32 if(getSocketErrno() == WSAENOPROTOOPT) { return fd; // Windows XP doesn't support IPV6_V6ONLY } #endif closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } return fd; } #else SOCKET IceInternal::createServerSocket(bool udp, const Address& addr, ProtocolSupport) { return createSocket(udp, addr); } #endif void IceInternal::closeSocketNoThrow(SOCKET fd) { #if defined(ICE_OS_WINRT) // // NOTE: StreamSocket::Close or DatagramSocket::Close aren't // exposed in C++, you have to delete the socket to close // it. According some Microsoft samples, this is safe even if // there are still references to the object... // //fd->Close(); delete fd; #elif defined(_WIN32) int error = WSAGetLastError(); closesocket(fd); WSASetLastError(error); #else int error = errno; close(fd); errno = error; #endif } void IceInternal::closeSocket(SOCKET fd) { #if defined(ICE_OS_WINRT) // // NOTE: StreamSocket::Close or DatagramSocket::Close aren't // exposed in C++, you have to delete the socket to close // it. According some Microsoft samples, this is safe even if // there are still references to the object... // //fd->Close(); delete fd; #elif defined(_WIN32) int error = WSAGetLastError(); if(closesocket(fd) == SOCKET_ERROR) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } WSASetLastError(error); #else int error = errno; if(close(fd) == SOCKET_ERROR) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } errno = error; #endif } string IceInternal::addrToString(const Address& addr) { ostringstream s; s << inetAddrToString(addr) << ':' << getPort(addr); return s.str(); } void IceInternal::fdToLocalAddress(SOCKET fd, Address& addr) { #ifndef ICE_OS_WINRT socklen_t len = static_cast(sizeof(sockaddr_storage)); if(getsockname(fd, &addr.sa, &len) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } #else StreamSocket^ stream = dynamic_cast(fd); if(stream) { addr.host = stream->Information->LocalAddress; addr.port = stream->Information->LocalPort; } DatagramSocket^ datagram = dynamic_cast(fd); if(datagram) { addr.host = datagram->Information->LocalAddress; addr.port = datagram->Information->LocalPort; } #endif } bool IceInternal::fdToRemoteAddress(SOCKET fd, Address& addr) { #ifndef ICE_OS_WINRT socklen_t len = static_cast(sizeof(sockaddr_storage)); if(getpeername(fd, &addr.sa, &len) == SOCKET_ERROR) { if(notConnected()) { return false; } else { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } return true; #else StreamSocket^ stream = dynamic_cast(fd); if(stream != nullptr) { addr.host = stream->Information->RemoteAddress; addr.port = stream->Information->RemotePort; } DatagramSocket^ datagram = dynamic_cast(fd); if(datagram != nullptr) { addr.host = datagram->Information->RemoteAddress; addr.port = datagram->Information->RemotePort; } return addr.host != nullptr; #endif } std::string IceInternal::fdToString(SOCKET fd, const NetworkProxyPtr& proxy, const Address& target, #if defined(_WIN32) bool connected) #else bool /*connected*/) #endif { if(fd == INVALID_SOCKET) { return ""; } ostringstream s; #if defined(_WIN32) if(!connected) { // // The local address is only accessible with connected sockets on Windows. // s << "local address = "; } else { Address localAddr; fdToLocalAddress(fd, localAddr); s << "local address = " << addrToString(localAddr); } #else Address localAddr; fdToLocalAddress(fd, localAddr); s << "local address = " << addrToString(localAddr); #endif Address remoteAddr; bool peerConnected = fdToRemoteAddress(fd, remoteAddr); if(proxy) { if(!peerConnected) { remoteAddr = proxy->getAddress(); } s << "\n" + proxy->getName() + " proxy address = " << addrToString(remoteAddr); s << "\nremote address = " << addrToString(target); } else { if(!peerConnected) { remoteAddr = target; } s << "\nremote address = " << addrToString(remoteAddr); } return s.str(); } std::string IceInternal::fdToString(SOCKET fd) { if(fd == INVALID_SOCKET) { return ""; } Address localAddr; fdToLocalAddress(fd, localAddr); Address remoteAddr; bool peerConnected = fdToRemoteAddress(fd, remoteAddr); return addressesToString(localAddr, remoteAddr, peerConnected); } void IceInternal::fdToAddressAndPort(SOCKET fd, string& localAddress, int& localPort, string& remoteAddress, int& remotePort) { if(fd == INVALID_SOCKET) { localAddress.clear(); remoteAddress.clear(); localPort = -1; remotePort = -1; return; } Address localAddr; fdToLocalAddress(fd, localAddr); addrToAddressAndPort(localAddr, localAddress, localPort); Address remoteAddr; if(fdToRemoteAddress(fd, remoteAddr)) { addrToAddressAndPort(remoteAddr, remoteAddress, remotePort); } else { remoteAddress.clear(); remotePort = -1; } } void IceInternal::addrToAddressAndPort(const Address& addr, string& address, int& port) { address = inetAddrToString(addr); port = getPort(addr); } std::string IceInternal::addressesToString(const Address& localAddr, const Address& remoteAddr, bool peerConnected) { ostringstream s; s << "local address = " << addrToString(localAddr); if(peerConnected) { s << "\nremote address = " << addrToString(remoteAddr); } else { s << "\nremote address = "; } return s.str(); } bool IceInternal::isAddressValid(const Address& addr) { #ifndef ICE_OS_WINRT return addr.saStorage.ss_family != AF_UNSPEC; #else return addr.host != nullptr || addr.port != nullptr; #endif } #ifdef ICE_OS_WINRT vector IceInternal::getHostsForEndpointExpand(const string&, ProtocolSupport, bool) { // // No support for expanding wildcard addresses on WinRT // vector hosts; return hosts; } #else vector IceInternal::getHostsForEndpointExpand(const string& host, ProtocolSupport protocolSupport, bool includeLoopback) { vector hosts; if(isWildcard(host, protocolSupport)) { vector
          addrs = getLocalAddresses(protocolSupport); for(vector
          ::const_iterator p = addrs.begin(); p != addrs.end(); ++p) { // // NOTE: We don't publish link-local IPv6 addresses as these addresses can only // be accessed in general with a scope-id. // if(p->saStorage.ss_family != AF_INET6 || !IN6_IS_ADDR_LINKLOCAL(&p->saIn6.sin6_addr)) { hosts.push_back(inetAddrToString(*p)); } } if(hosts.empty() || includeLoopback) { if(protocolSupport != EnableIPv6) { hosts.push_back("127.0.0.1"); } if(protocolSupport != EnableIPv4) { hosts.push_back("0:0:0:0:0:0:0:1"); } } } return hosts; // An empty host list indicates to just use the given host. } #endif string IceInternal::inetAddrToString(const Address& ss) { #ifndef ICE_OS_WINRT int size = 0; if(ss.saStorage.ss_family == AF_INET) { size = static_cast(sizeof(sockaddr_in)); } else if(ss.saStorage.ss_family == AF_INET6) { size = static_cast(sizeof(sockaddr_in6)); } else { return ""; } char namebuf[1024]; namebuf[0] = '\0'; getnameinfo(&ss.sa, size, namebuf, static_cast(sizeof(namebuf)), 0, 0, NI_NUMERICHOST); return string(namebuf); #else if(ss.host == nullptr) { return ""; } else { return IceUtil::wstringToString(ss.host->RawName->Data()); } #endif } int IceInternal::getPort(const Address& addr) { #ifndef ICE_OS_WINRT if(addr.saStorage.ss_family == AF_INET) { return ntohs(addr.saIn.sin_port); } else if(addr.saStorage.ss_family == AF_INET6) { return ntohs(addr.saIn6.sin6_port); } else { return -1; } #else IceUtil::Int64 port; if(addr.port == nullptr || !IceUtilInternal::stringToInt64(IceUtil::wstringToString(addr.port->Data()), port)) { return -1; } return static_cast(port); #endif } void IceInternal::setPort(Address& addr, int port) { #ifndef ICE_OS_WINRT if(addr.saStorage.ss_family == AF_INET) { addr.saIn.sin_port = htons(port); } else { assert(addr.saStorage.ss_family == AF_INET6); addr.saIn6.sin6_port = htons(port); } #else ostringstream os; os << port; addr.port = ref new String(IceUtil::stringToWstring(os.str()).c_str()); #endif } bool IceInternal::isMulticast(const Address& addr) { #ifndef ICE_OS_WINRT if(addr.saStorage.ss_family == AF_INET) { return IN_MULTICAST(ntohl(addr.saIn.sin_addr.s_addr)); } else if(addr.saStorage.ss_family == AF_INET6) { return IN6_IS_ADDR_MULTICAST(&addr.saIn6.sin6_addr); } #else if(addr.host == nullptr) { return false; } string host = IceUtil::wstringToString(addr.host->RawName->Data()); string ip = IceUtilInternal::toUpper(host); vector tokens; IceUtilInternal::splitString(ip, ".", tokens); if(tokens.size() == 4) { IceUtil::Int64 j; if(IceUtilInternal::stringToInt64(tokens[0], j)) { if(j >= 233 && j <= 239) { return true; } } } if(ip.find("::") != string::npos) { return ip.compare(0, 2, "FF") == 0; } #endif return false; } void IceInternal::setTcpBufSize(SOCKET fd, const Ice::PropertiesPtr& properties, const Ice::LoggerPtr& logger) { assert(fd != INVALID_SOCKET); // // By default, on Windows we use a 128KB buffer size. On Unix // platforms, we use the system defaults. // #ifdef _WIN32 const int dfltBufSize = 128 * 1024; #else const int dfltBufSize = 0; #endif Int sizeRequested; sizeRequested = properties->getPropertyAsIntWithDefault("Ice.TCP.RcvSize", dfltBufSize); if(sizeRequested > 0) { // // Try to set the buffer size. The kernel will silently adjust // the size to an acceptable value. Then read the size back to // get the size that was actually set. // setRecvBufferSize(fd, sizeRequested); int size = getRecvBufferSize(fd); if(size > 0 && size < sizeRequested) // Warn if the size that was set is less than the requested size. { Ice::Warning out(logger); out << "TCP receive buffer size: requested size of " << sizeRequested << " adjusted to " << size; } } sizeRequested = properties->getPropertyAsIntWithDefault("Ice.TCP.SndSize", dfltBufSize); if(sizeRequested > 0) { // // Try to set the buffer size. The kernel will silently adjust // the size to an acceptable value. Then read the size back to // get the size that was actually set. // setSendBufferSize(fd, sizeRequested); int size = getSendBufferSize(fd); if(size > 0 && size < sizeRequested) // Warn if the size that was set is less than the requested size. { Ice::Warning out(logger); out << "TCP send buffer size: requested size of " << sizeRequested << " adjusted to " << size; } } } void #ifndef ICE_OS_WINRT IceInternal::setBlock(SOCKET fd, bool block) #else IceInternal::setBlock(SOCKET fd, bool) #endif { #ifndef ICE_OS_WINRT if(block) { #ifdef _WIN32 unsigned long arg = 0; if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = WSAGetLastError(); throw ex; } #else int flags = fcntl(fd, F_GETFL); flags &= ~O_NONBLOCK; if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = errno; throw ex; } #endif } else { #ifdef _WIN32 unsigned long arg = 1; if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = WSAGetLastError(); throw ex; } #else int flags = fcntl(fd, F_GETFL); flags |= O_NONBLOCK; if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = errno; throw ex; } #endif } #endif } void IceInternal::setSendBufferSize(SOCKET fd, int sz) { #ifndef ICE_OS_WINRT if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&sz, int(sizeof(int))) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } #else StreamSocket^ stream = dynamic_cast(fd); if(stream != nullptr) { stream->Control->OutboundBufferSizeInBytes = sz; } #endif } int IceInternal::getSendBufferSize(SOCKET fd) { #ifndef ICE_OS_WINRT int sz; socklen_t len = sizeof(sz); if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&sz, &len) == SOCKET_ERROR || static_cast(len) != sizeof(sz)) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } return sz; #else StreamSocket^ stream = dynamic_cast(fd); if(stream != nullptr) { return stream->Control->OutboundBufferSizeInBytes; } return 0; // Not supported #endif } #ifdef ICE_OS_WINRT void IceInternal::setRecvBufferSize(SOCKET, int) { } #else void IceInternal::setRecvBufferSize(SOCKET fd, int sz) { if(setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&sz, int(sizeof(int))) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } #endif int IceInternal::getRecvBufferSize(SOCKET fd) { #ifndef ICE_OS_WINRT int sz; socklen_t len = sizeof(sz); if(getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&sz, &len) == SOCKET_ERROR || static_cast(len) != sizeof(sz)) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } return sz; #else return 0; // Not supported #endif } #ifndef ICE_OS_WINRT void IceInternal::setMcastGroup(SOCKET fd, const Address& group, const string& intf) { int rc; if(group.saStorage.ss_family == AF_INET) { 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; } } 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; } } } rc = setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char*)&mreq, int(sizeof(mreq))); } if(rc == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } #else void IceInternal::setMcastGroup(SOCKET fd, const Address& group, const string&) { try { // // NOTE: WinRT doesn't allow specyfing the interface. // safe_cast(fd)->JoinMulticastGroup(group.host); } catch(Platform::Exception^ pex) { throw SocketException(__FILE__, __LINE__, (int)SocketError::GetStatus(pex->HResult)); } } #endif #ifdef ICE_OS_WINRT void IceInternal::setMcastInterface(SOCKET, const string&, const Address&) { } #else void IceInternal::setMcastInterface(SOCKET fd, const string& intf, const Address& addr) { 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) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } #endif #ifdef ICE_OS_WINRT void IceInternal::setMcastTtl(SOCKET, int, const Address&) { } #else void IceInternal::setMcastTtl(SOCKET fd, int ttl, const Address& addr) { int rc; if(addr.saStorage.ss_family == AF_INET) { rc = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ttl, int(sizeof(int))); } else { rc = setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char*)&ttl, int(sizeof(int))); } if(rc == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } #endif #ifdef ICE_OS_WINRT void IceInternal::setReuseAddress(SOCKET, bool) { } #else void IceInternal::setReuseAddress(SOCKET fd, bool reuse) { int flag = reuse ? 1 : 0; if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } #endif Address IceInternal::doBind(SOCKET fd, const Address& addr) { #ifdef ICE_OS_WINRT Address local; try { StreamSocketListener^ listener = dynamic_cast(fd); if(listener != nullptr) { if(addr.host == nullptr) // inaddr_any { concurrency::create_task(listener->BindServiceNameAsync(addr.port)).wait(); } else { concurrency::create_task(listener->BindEndpointAsync(addr.host, addr.port)).wait(); } local.host = addr.host; local.port = listener->Information->LocalPort; } DatagramSocket^ datagram = dynamic_cast(fd); if(datagram != nullptr) { if(addr.host == nullptr) // inaddr_any { concurrency::create_task(datagram->BindServiceNameAsync(addr.port)).wait(); } else { concurrency::create_task(datagram->BindEndpointAsync(addr.host, addr.port)).wait(); } local.host = datagram->Information->LocalAddress; local.port = datagram->Information->LocalPort; } } catch(Platform::Exception^ pex) { closeSocketNoThrow(fd); checkErrorCode(__FILE__, __LINE__, pex->HResult); } return local; #else int size; if(addr.saStorage.ss_family == AF_INET) { size = static_cast(sizeof(sockaddr_in)); } else if(addr.saStorage.ss_family == AF_INET6) { size = static_cast(sizeof(sockaddr_in6)); } else { assert(false); size = 0; // Keep the compiler happy. } if(::bind(fd, &addr.sa, size) == SOCKET_ERROR) { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } Address local; socklen_t len = static_cast(sizeof(sockaddr_storage)); #ifdef NDEBUG getsockname(fd, &local.sa, &len); #else int ret = getsockname(fd, &local.sa, &len); assert(ret != SOCKET_ERROR); #endif return local; #endif } #ifndef ICE_OS_WINRT int IceInternal::getSocketErrno() { #if defined(_WIN32) return WSAGetLastError(); #else return errno; #endif } bool IceInternal::interrupted() { #ifdef _WIN32 return WSAGetLastError() == WSAEINTR; #else # ifdef EPROTO return errno == EINTR || errno == EPROTO; # else return errno == EINTR; # endif #endif } bool IceInternal::acceptInterrupted() { if(interrupted()) { return true; } #ifdef _WIN32 int error = WSAGetLastError(); return error == WSAECONNABORTED || error == WSAECONNRESET || error == WSAETIMEDOUT; #else return errno == ECONNABORTED || errno == ECONNRESET || errno == ETIMEDOUT; #endif } bool IceInternal::noBuffers() { #ifdef _WIN32 int error = WSAGetLastError(); return error == WSAENOBUFS || error == WSAEFAULT; #else return errno == ENOBUFS; #endif } bool IceInternal::wouldBlock() { #ifdef _WIN32 int error = WSAGetLastError(); return error == WSAEWOULDBLOCK || error == WSA_IO_PENDING || error == ERROR_IO_PENDING; #else return errno == EAGAIN || errno == EWOULDBLOCK; #endif } bool IceInternal::connectFailed() { #if defined(_WIN32) int error = WSAGetLastError(); return error == WSAECONNREFUSED || error == WSAETIMEDOUT || error == WSAENETUNREACH || error == WSAEHOSTUNREACH || error == WSAECONNRESET || error == WSAESHUTDOWN || error == WSAECONNABORTED || error == ERROR_SEM_TIMEOUT || error == ERROR_NETNAME_DELETED; #else return errno == ECONNREFUSED || errno == ETIMEDOUT || errno == ENETUNREACH || errno == EHOSTUNREACH || errno == ECONNRESET || errno == ESHUTDOWN || errno == ECONNABORTED; #endif } bool IceInternal::connectionRefused() { #if defined(_WIN32) int error = WSAGetLastError(); return error == WSAECONNREFUSED || error == ERROR_CONNECTION_REFUSED; #else return errno == ECONNREFUSED; #endif } bool IceInternal::connectionLost() { #ifdef _WIN32 int error = WSAGetLastError(); return error == WSAECONNRESET || error == WSAESHUTDOWN || error == WSAENOTCONN || # ifdef ICE_USE_IOCP error == ERROR_NETNAME_DELETED || # endif error == WSAECONNABORTED; #else return errno == ECONNRESET || errno == ENOTCONN || errno == ESHUTDOWN || errno == ECONNABORTED || errno == EPIPE; #endif } bool IceInternal::connectInProgress() { #ifdef _WIN32 int error = WSAGetLastError(); return error == WSAEWOULDBLOCK || error == WSA_IO_PENDING || error == ERROR_IO_PENDING; #else return errno == EINPROGRESS; #endif } bool IceInternal::notConnected() { #ifdef _WIN32 return WSAGetLastError() == WSAENOTCONN; #elif defined(__APPLE__) || defined(__FreeBSD__) return errno == ENOTCONN || errno == EINVAL; #else return errno == ENOTCONN; #endif } bool IceInternal::recvTruncated() { #ifdef _WIN32 int err = WSAGetLastError(); return err == WSAEMSGSIZE || err == ERROR_MORE_DATA; #else // We don't get an error under Linux if a datagram is truncated. return false; #endif } void IceInternal::doListen(SOCKET fd, int backlog) { repeatListen: if(::listen(fd, backlog) == SOCKET_ERROR) { if(interrupted()) { goto repeatListen; } closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } bool IceInternal::doConnect(SOCKET fd, const Address& addr) { repeatConnect: int size; if(addr.saStorage.ss_family == AF_INET) { size = static_cast(sizeof(sockaddr_in)); } else if(addr.saStorage.ss_family == AF_INET6) { size = static_cast(sizeof(sockaddr_in6)); } else { assert(false); size = 0; // Keep the compiler happy. } if(::connect(fd, &addr.sa, size) == SOCKET_ERROR) { if(interrupted()) { goto repeatConnect; } if(connectInProgress()) { return false; } closeSocketNoThrow(fd); 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; } } #if defined(__linux) // // Prevent self connect (self connect happens on Linux when a client tries to connect to // a server which was just deactivated if the client socket re-uses the same ephemeral // port as the server). // Address localAddr; fdToLocalAddress(fd, localAddr); if(compareAddress(addr, localAddr) == 0) { ConnectionRefusedException ex(__FILE__, __LINE__); ex.error = 0; // No appropriate errno throw ex; } #endif return true; } void IceInternal::doFinishConnect(SOCKET fd) { // // Note: we don't close the socket if there's an exception. It's the responsability // of the caller to do so. // // // Strange windows bug: The following call to Sleep() is // necessary, otherwise no error is reported through // getsockopt. // #if defined(_WIN32) Sleep(0); #endif int val; socklen_t len = static_cast(sizeof(int)); if(getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast(&val), &len) == SOCKET_ERROR) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } if(val > 0) { #if defined(_WIN32) WSASetLastError(val); #else errno = val; #endif 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; } } #if defined(__linux) // // Prevent self connect (self connect happens on Linux when a client tries to connect to // a server which was just deactivated if the client socket re-uses the same ephemeral // port as the server). // Address localAddr; fdToLocalAddress(fd, localAddr); Address remoteAddr; if(fdToRemoteAddress(fd, remoteAddr) && compareAddress(remoteAddr, localAddr) == 0) { ConnectionRefusedException ex(__FILE__, __LINE__); ex.error = 0; // No appropriate errno throw ex; } #endif } SOCKET IceInternal::doAccept(SOCKET fd) { #ifdef _WIN32 SOCKET ret; #else int ret; #endif repeatAccept: if((ret = ::accept(fd, 0, 0)) == INVALID_SOCKET) { if(acceptInterrupted()) { goto repeatAccept; } SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } setTcpNoDelay(ret); setKeepAlive(ret); return ret; } void IceInternal::createPipe(SOCKET fds[2]) { #ifdef _WIN32 SOCKET fd = createSocketImpl(false, AF_INET); setBlock(fd, true); Address addr; memset(&addr.saStorage, 0, sizeof(sockaddr_storage)); addr.saIn.sin_family = AF_INET; addr.saIn.sin_port = htons(0); addr.saIn.sin_addr.s_addr = htonl(INADDR_LOOPBACK); addr = doBind(fd, addr); doListen(fd, 1); try { fds[0] = createSocketImpl(false, AF_INET); } catch(...) { ::closesocket(fd); throw; } try { setBlock(fds[0], true); #ifndef NDEBUG bool connected = doConnect(fds[0], addr); assert(connected); #else doConnect(fds[0], addr); #endif } catch(...) { // fds[0] is closed by doConnect ::closesocket(fd); throw; } try { fds[1] = doAccept(fd); } catch(...) { ::closesocket(fds[0]); ::closesocket(fd); throw; } ::closesocket(fd); try { setBlock(fds[1], true); } catch(...) { ::closesocket(fds[0]); // fds[1] is closed by setBlock throw; } #else if(::pipe(fds) != 0) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } try { setBlock(fds[0], true); } catch(...) { // fds[0] is closed by setBlock closeSocketNoThrow(fds[1]); throw; } try { setBlock(fds[1], true); } catch(...) { closeSocketNoThrow(fds[0]); // fds[1] is closed by setBlock throw; } #endif } #else // ICE_OS_WINRT void IceInternal::checkConnectErrorCode(const char* file, int line, HRESULT herr, HostName^ host) { if(herr == E_ACCESSDENIED) { SocketException ex(file, line); ex.error = static_cast(herr); throw ex; } SocketErrorStatus error = SocketError::GetStatus(herr); if(error == SocketErrorStatus::ConnectionRefused) { ConnectionRefusedException ex(file, line); ex.error = static_cast(error); throw ex; } else if(error == SocketErrorStatus::NetworkDroppedConnectionOnReset || error == SocketErrorStatus::ConnectionTimedOut || error == SocketErrorStatus::NetworkIsUnreachable || error == SocketErrorStatus::UnreachableHost || error == SocketErrorStatus::ConnectionResetByPeer || error == SocketErrorStatus::SoftwareCausedConnectionAbort) { ConnectFailedException ex(file, line); ex.error = static_cast(error); throw ex; } else if(error == SocketErrorStatus::HostNotFound) { DNSException ex(file, line); ex.error = static_cast(error); ex.host = IceUtil::wstringToString(host->RawName->Data()); throw ex; } else { SocketException ex(file, line); ex.error = static_cast(error); throw ex; } } void IceInternal::checkErrorCode(const char* file, int line, HRESULT herr) { if(herr == E_ACCESSDENIED) { SocketException ex(file, line); ex.error = static_cast(herr); throw ex; } SocketErrorStatus error = SocketError::GetStatus(herr); if(error == SocketErrorStatus::NetworkDroppedConnectionOnReset || error == SocketErrorStatus::SoftwareCausedConnectionAbort || error == SocketErrorStatus::ConnectionResetByPeer) { ConnectionLostException ex(file, line); ex.error = static_cast(error); throw ex; } else if(error == SocketErrorStatus::HostNotFound) { DNSException ex(file, line); ex.error = static_cast(error); throw ex; } else { SocketException ex(file, line); ex.error = static_cast(error); throw ex; } } #endif #if defined(ICE_USE_IOCP) void IceInternal::doConnectAsync(SOCKET fd, const Address& addr, AsyncInfo& info) { // // NOTE: It's the caller's responsability to close the socket upon // failure to connect. The socket isn't closed by this method. // Address bindAddr; memset(&bindAddr.saStorage, 0, sizeof(sockaddr_storage)); int size; if(addr.saStorage.ss_family == AF_INET) { size = sizeof(sockaddr_in); bindAddr.saIn.sin_family = AF_INET; bindAddr.saIn.sin_port = htons(0); bindAddr.saIn.sin_addr.s_addr = htonl(INADDR_ANY); } else if(addr.saStorage.ss_family == AF_INET6) { size = sizeof(sockaddr_in6); bindAddr.saIn6.sin6_family = AF_INET6; bindAddr.saIn6.sin6_port = htons(0); bindAddr.saIn6.sin6_addr = in6addr_any; } else { assert(false); size = 0; // Keep the compiler happy. } if(::bind(fd, &bindAddr.sa, size) == SOCKET_ERROR) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } LPFN_CONNECTEX ConnectEx = NULL; // a pointer to the 'ConnectEx()' function GUID GuidConnectEx = WSAID_CONNECTEX; // The Guid DWORD dwBytes; if(WSAIoctl(fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &GuidConnectEx, sizeof(GuidConnectEx), &ConnectEx, sizeof(ConnectEx), &dwBytes, NULL, NULL) == SOCKET_ERROR) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } if(!ConnectEx(fd, &addr.sa, size, 0, 0, 0, &info)) { if(!connectInProgress()) { 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; } } } } void IceInternal::doFinishConnectAsync(SOCKET fd, AsyncInfo& info) { // // NOTE: It's the caller's responsability to close the socket upon // failure to connect. The socket isn't closed by this method. // if(static_cast(info.count) == SOCKET_ERROR) { WSASetLastError(info.error); 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; } } if(setsockopt(fd, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, NULL, 0) == SOCKET_ERROR) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } #endif Ice-3.5.1/cpp/src/Ice/TraceUtil.cpp0000644000076400007640000002224612223561476015051 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; static void printIdentityFacetOperation(ostream& s, BasicStream& stream) { Identity identity; stream.read(identity); s << "\nidentity = " << stream.instance()->identityToString(identity); vector facet; stream.read(facet); s << "\nfacet = "; if(!facet.empty()) { s << IceUtilInternal::escapeString(facet[0], ""); } string operation; stream.read(operation, false); s << "\noperation = " << operation; } static string getMessageTypeAsString(Byte type) { switch(type) { case requestMsg: return "request"; case requestBatchMsg: return "batch request"; case replyMsg: return "reply"; case closeConnectionMsg: return "close connection"; case validateConnectionMsg: return "validate connection"; default: return "unknown"; } } static void printRequestHeader(ostream& s, BasicStream& stream) { printIdentityFacetOperation(s, stream); Byte mode; stream.read(mode); s << "\nmode = " << static_cast(mode) << ' '; switch(mode) { case Normal: { s << "(normal)"; break; } case Nonmutating: { s << "(nonmutating)"; break; } case Idempotent: { s << "(idempotent)"; break; } default: { s << "(unknown)"; break; } } Int sz = stream.readSize(); s << "\ncontext = "; while(sz--) { pair pair; stream.read(pair.first); stream.read(pair.second); s << pair.first << '/' << pair.second; if(sz) { s << ", "; } } Ice::EncodingVersion v = stream.skipEncaps(); if(v > Ice::Encoding_1_0) { s << "\nencoding = " << v; } } static Byte printHeader(ostream& s, BasicStream& stream) { Byte magicNumber; stream.read(magicNumber); // Don't bother printing the magic number stream.read(magicNumber); stream.read(magicNumber); stream.read(magicNumber); Byte pMajor; Byte pMinor; stream.read(pMajor); stream.read(pMinor); // s << "\nprotocol version = " << static_cast(pMajor) // << "." << static_cast(pMinor); Byte eMajor; Byte eMinor; stream.read(eMajor); stream.read(eMinor); // s << "\nencoding version = " << static_cast(eMajor) // << "." << static_cast(eMinor); Byte type; stream.read(type); s << "\nmessage type = " << static_cast(type) << " (" << getMessageTypeAsString(type) << ')'; Byte compress; stream.read(compress); s << "\ncompression status = " << static_cast(compress) << ' '; switch(compress) { case 0: { s << "(not compressed; do not compress response, if any)"; break; } case 1: { s << "(not compressed; compress response, if any)"; break; } case 2: { s << "(compressed; compress response, if any)"; break; } default: { s << "(unknown)"; break; } } Int size; stream.read(size); s << "\nmessage size = " << size; return type; } static void printRequest(ostream& s, BasicStream& stream) { Int requestId; stream.read(requestId); s << "\nrequest id = " << requestId; if(requestId == 0) { s << " (oneway)"; } printRequestHeader(s, stream); } static void printBatchRequest(ostream& s, BasicStream& stream) { int batchRequestNum; stream.read(batchRequestNum); s << "\nnumber of requests = " << batchRequestNum; for(int i = 0; i < batchRequestNum; ++i) { s << "\nrequest #" << i << ':'; printRequestHeader(s, stream); } } static void printReply(ostream& s, BasicStream& stream) { Int requestId; stream.read(requestId); s << "\nrequest id = " << requestId; Byte replyStatus; stream.read(replyStatus); s << "\nreply status = " << static_cast(replyStatus) << ' '; switch(replyStatus) { case replyOK: { s << "(ok)"; break; } case replyUserException: { s << "(user exception)"; break; } case replyObjectNotExist: case replyFacetNotExist: case replyOperationNotExist: { switch(replyStatus) { case replyObjectNotExist: { s << "(object not exist)"; break; } case replyFacetNotExist: { s << "(facet not exist)"; break; } case replyOperationNotExist: { s << "(operation not exist)"; break; } default: { assert(false); break; } } printIdentityFacetOperation(s, stream); break; } case replyUnknownException: case replyUnknownLocalException: case replyUnknownUserException: { switch(replyStatus) { case replyUnknownException: { s << "(unknown exception)"; break; } case replyUnknownLocalException: { s << "(unknown local exception)"; break; } case replyUnknownUserException: { s << "(unknown user exception)"; break; } default: { assert(false); break; } } string unknown; stream.read(unknown, false); s << "\nunknown = " << unknown; break; } default: { s << "(unknown)"; break; } } } static Byte printMessage(ostream& s, BasicStream& stream) { Byte type = printHeader(s, stream); switch(type) { case closeConnectionMsg: case validateConnectionMsg: { // We're done. break; } case requestMsg: { printRequest(s, stream); break; } case requestBatchMsg: { printBatchRequest(s, stream); break; } case replyMsg: { printReply(s, stream); break; } default: { break; } } return type; } namespace { IceUtil::Mutex* slicingMutex = 0; class Init { public: Init() { slicingMutex = new IceUtil::Mutex; } ~Init() { delete slicingMutex; slicingMutex = 0; } }; Init init; } void IceInternal::traceSlicing(const char* kind, const string& typeId, const char* slicingCat, const LoggerPtr& logger) { IceUtilInternal::MutexPtrLock lock(slicingMutex); static set slicingIds; if(slicingIds.insert(typeId).second) { string s("unknown "); s += kind; s += " type `" + typeId + "'"; logger->trace(slicingCat, s); } } void IceInternal::traceSend(const BasicStream& str, const LoggerPtr& logger, const TraceLevelsPtr& tl) { if(tl->protocol >= 1) { BasicStream& stream = const_cast(str); BasicStream::Container::iterator p = stream.i; stream.i = stream.b.begin(); ostringstream s; Byte type = printMessage(s, stream); logger->trace(tl->protocolCat, "sending " + getMessageTypeAsString(type) + " " + s.str()); stream.i = p; } } void IceInternal::traceRecv(const BasicStream& str, const LoggerPtr& logger, const TraceLevelsPtr& tl) { if(tl->protocol >= 1) { BasicStream& stream = const_cast(str); BasicStream::Container::iterator p = stream.i; stream.i = stream.b.begin(); ostringstream s; Byte type = printMessage(s, stream); logger->trace(tl->protocolCat, "received " + getMessageTypeAsString(type) + " " + s.str()); stream.i = p; } } void IceInternal::trace(const char* heading, const BasicStream& str, const LoggerPtr& logger, const TraceLevelsPtr& tl) { if(tl->protocol >= 1) { BasicStream& stream = const_cast(str); BasicStream::Container::iterator p = stream.i; stream.i = stream.b.begin(); ostringstream s; s << heading; printMessage(s, stream); logger->trace(tl->protocolCat, s.str()); stream.i = p; } } Ice-3.5.1/cpp/src/Ice/CommunicatorI.h0000644000076400007640000001015212223561476015364 0ustar mesmes// ********************************************************************** // // 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 ICE_COMMUNICATOR_I_H #define ICE_COMMUNICATOR_I_H #include #include #include #include #include namespace Ice { class CommunicatorI : public Communicator { public: virtual void destroy(); virtual void shutdown(); virtual void waitForShutdown(); virtual bool isShutdown() const; virtual ObjectPrx stringToProxy(const std::string&) const; virtual std::string proxyToString(const ObjectPrx&) const; virtual ObjectPrx propertyToProxy(const std::string&) const; virtual PropertyDict proxyToProperty(const ObjectPrx&, const std::string&) const; virtual Identity stringToIdentity(const std::string&) const; virtual std::string identityToString(const Identity&) const; virtual ObjectAdapterPtr createObjectAdapter(const std::string&); virtual ObjectAdapterPtr createObjectAdapterWithEndpoints(const std::string&, const std::string&); virtual ObjectAdapterPtr createObjectAdapterWithRouter(const std::string&, const RouterPrx&); virtual void addObjectFactory(const ObjectFactoryPtr&, const std::string&); virtual ObjectFactoryPtr findObjectFactory(const std::string&) const; virtual ImplicitContextPtr getImplicitContext() const; virtual PropertiesPtr getProperties() const; virtual LoggerPtr getLogger() const; virtual StatsPtr getStats() const; virtual Ice::Instrumentation::CommunicatorObserverPtr getObserver() const; virtual RouterPrx getDefaultRouter() const; virtual void setDefaultRouter(const RouterPrx&); virtual LocatorPrx getDefaultLocator() const; virtual void setDefaultLocator(const LocatorPrx&); virtual PluginManagerPtr getPluginManager() const; virtual void flushBatchRequests(); #ifdef ICE_CPP11 virtual ::Ice::AsyncResultPtr begin_flushBatchRequests( const ::IceInternal::Function& exception, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_flushBatchRequests(new Cpp11FnCallbackNC_Communicator_flushBatchRequests(exception, sent), 0); } #endif virtual AsyncResultPtr begin_flushBatchRequests(); virtual AsyncResultPtr begin_flushBatchRequests(const CallbackPtr&, const LocalObjectPtr& = 0); virtual AsyncResultPtr begin_flushBatchRequests(const Callback_Communicator_flushBatchRequestsPtr&, const LocalObjectPtr& = 0); virtual void end_flushBatchRequests(const AsyncResultPtr&); virtual ObjectPrx getAdmin() const; virtual void addAdminFacet(const ObjectPtr&, const std::string&); virtual ObjectPtr removeAdminFacet(const std::string&); virtual ObjectPtr findAdminFacet(const std::string&); private: CommunicatorI(const InitializationData&); virtual ~CommunicatorI(); // // Certain initialization tasks need to be completed after the // constructor. // void finishSetup(int&, char*[]); friend ICE_API CommunicatorPtr initialize(int&, char*[], const InitializationData&, Int); friend ICE_API CommunicatorPtr initialize(StringSeq&, const InitializationData&, Int); friend ICE_API CommunicatorPtr initialize(const InitializationData&, Int); friend ICE_API ::IceInternal::InstancePtr IceInternal::getInstance(const ::Ice::CommunicatorPtr&); AsyncResultPtr __begin_flushBatchRequests(const IceInternal::CallbackBasePtr&, const LocalObjectPtr&); const ::IceInternal::InstancePtr _instance; // // We don't want the dynamic libraries to be unloaded until the // Communicator's destructor is invoked. // const ::IceInternal::DynamicLibraryListPtr _dynamicLibraryList; }; } #endif Ice-3.5.1/cpp/src/Ice/EndpointFactory.cpp0000644000076400007640000000116112223561476016256 0ustar mesmes// ********************************************************************** // // 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 using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(EndpointFactory* p) { return p; } IceInternal::EndpointFactory::EndpointFactory() { } IceInternal::EndpointFactory::~EndpointFactory() { } Ice-3.5.1/cpp/src/Ice/PropertiesI.h0000644000076400007640000000463512223561476015071 0ustar mesmes// ********************************************************************** // // 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 ICE_PROPERTIES_I_H #define ICE_PROPERTIES_I_H #include #include #include #include namespace Ice { class PropertiesI : public Properties, public IceUtil::Mutex { public: virtual std::string getProperty(const std::string&); virtual std::string getPropertyWithDefault(const std::string&, const std::string&); virtual Ice::Int getPropertyAsInt(const std::string&); virtual Ice::Int getPropertyAsIntWithDefault(const std::string&, Ice::Int); virtual Ice::StringSeq getPropertyAsList(const std::string&); virtual Ice::StringSeq getPropertyAsListWithDefault(const std::string&, const Ice::StringSeq&); virtual PropertyDict getPropertiesForPrefix(const std::string&); virtual void setProperty(const std::string&, const std::string&); virtual StringSeq getCommandLineOptions(); virtual StringSeq parseCommandLineOptions(const std::string&, const StringSeq&); virtual StringSeq parseIceCommandLineOptions(const StringSeq&); virtual void load(const std::string&); virtual PropertiesPtr clone(); std::set getUnusedProperties(); private: PropertiesI(const StringConverterPtr&); PropertiesI(StringSeq&, const PropertiesPtr&, const StringConverterPtr&); PropertiesI(const PropertiesI*); friend ICE_API PropertiesPtr createProperties(const StringConverterPtr&); friend ICE_API PropertiesPtr createProperties(StringSeq&, const PropertiesPtr&, const StringConverterPtr&); friend ICE_API PropertiesPtr createProperties(int&, char*[], const PropertiesPtr&, const StringConverterPtr&); void parseLine(const std::string&, const StringConverterPtr&); void loadConfig(); struct PropertyValue { PropertyValue() : used(false) { } PropertyValue(const std::string& v, bool u) : value(v), used(u) { } std::string value; bool used; }; std::map _properties; const StringConverterPtr _converter; }; } #endif Ice-3.5.1/cpp/src/Ice/Application.cpp0000644000076400007640000005027012223561476015416 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceUtil; using namespace IceUtilInternal; // // static initializations. // Mutex* IceInternal::Application::mutex = 0; bool IceInternal::Application::_callbackInProgress = false; bool IceInternal::Application::_destroyed = false; bool IceInternal::Application::_interrupted = false; string IceInternal::Application::_appName; CommunicatorPtr IceInternal::Application::_communicator; SignalPolicy IceInternal::Application::_signalPolicy = HandleSignals; Cond* IceInternal::Application::_condVar; Application* IceInternal::Application::_application; // // _mutex and _condVar are used to synchronize the main thread and // the CtrlCHandler thread // namespace { class Init { public: Init() { IceInternal::Application::mutex = new IceUtil::Mutex; IceInternal::Application::_condVar = new Cond(); } ~Init() { delete IceInternal::Application::mutex; IceInternal::Application::mutex = 0; delete IceInternal::Application::_condVar; IceInternal::Application::_condVar = 0; } }; Init init; // // Variables than can change while run() and communicator->destroy() are running! // bool _released = false; CtrlCHandlerCallback _previousCallback = 0; // // Variables that are immutable during run() and until communicator->destroy() has returned; // before and after run(), and once communicator->destroy() has returned, we assume that // only the main thread and CtrlCHandler threads are running. // CtrlCHandler* _ctrlCHandler = 0; bool _nohup = false; } #ifdef _WIN32 const DWORD SIGHUP = CTRL_LOGOFF_EVENT; #else # include #endif // // Compaq C++ defines signal() as a macro, causing problems with the _condVar->signal() // statement, which the compiler for some reason replaces by the macro. // #if defined (__digital__) && defined (__unix__) # undef signal #endif // // CtrlCHandler callbacks. // static void holdInterruptCallback(int signal) { CtrlCHandlerCallback callback = 0; { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); while(!_released) { IceInternal::Application::_condVar->wait(lock); } if(IceInternal::Application::_destroyed) { // // Being destroyed by main thread // return; } assert(_ctrlCHandler != 0); callback = _ctrlCHandler->getCallback(); } if(callback != 0) { callback(signal); } } static void destroyOnInterruptCallback(int signal) { { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); if(IceInternal::Application::_destroyed) { // // Being destroyed by main thread // return; } if(_nohup && signal == static_cast(SIGHUP)) { return; } assert(!IceInternal::Application::_callbackInProgress); IceInternal::Application::_callbackInProgress = true; IceInternal::Application::_interrupted = true; IceInternal::Application::_destroyed = true; } try { assert(IceInternal::Application::_communicator != 0); IceInternal::Application::_communicator->destroy(); } catch(const std::exception& ex) { Error out(getProcessLogger()); out << "(while destroying in response to signal " << signal << "): " << ex; } catch(const std::string& msg) { Error out(getProcessLogger()); out << "(while destroying in response to signal " << signal << "): " << msg; } catch(const char* msg) { Error out(getProcessLogger()); out << "(while destroying in response to signal " << signal << "): " << msg; } catch(...) { Error out(getProcessLogger()); out << "(while destroying in response to signal " << signal << "): unknown exception"; } { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); IceInternal::Application::_callbackInProgress = false; } IceInternal::Application::_condVar->signal(); } static void shutdownOnInterruptCallback(int signal) { { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); if(IceInternal::Application::_destroyed) { // // Being destroyed by main thread // return; } if(_nohup && signal == static_cast(SIGHUP)) { return; } assert(!IceInternal::Application::_callbackInProgress); IceInternal::Application::_callbackInProgress = true; IceInternal::Application::_interrupted = true; } try { assert(IceInternal::Application::_communicator != 0); IceInternal::Application::_communicator->shutdown(); } catch(const std::exception& ex) { Error out(getProcessLogger()); out << "(while shutting down in response to signal " << signal << "): std::exception: " << ex; } catch(const std::string& msg) { Error out(getProcessLogger()); out << "(while shutting down in response to signal " << signal << "): " << msg; } catch(const char* msg) { Error out(getProcessLogger()); out << "(while shutting down in response to signal " << signal << "): " << msg; } catch(...) { Error out(getProcessLogger()); out << "(while shutting down in response to signal " << signal << "): unknown exception"; } { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); IceInternal::Application::_callbackInProgress = false; } IceInternal::Application::_condVar->signal(); } static void callbackOnInterruptCallback(int signal) { { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); if(IceInternal::Application::_destroyed) { // // Being destroyed by main thread // return; } // For SIGHUP the user callback is always called. It can // decide what to do. assert(!IceInternal::Application::_callbackInProgress); IceInternal::Application::_callbackInProgress = true; IceInternal::Application::_interrupted = true; } try { assert(IceInternal::Application::_application != 0); IceInternal::Application::_application->interruptCallback(signal); } catch(const std::exception& ex) { Error out(getProcessLogger()); out << "(while interrupting in response to signal " << signal << "): std::exception: " << ex; } catch(const std::string& msg) { Error out(getProcessLogger()); out << "(while interrupting in response to signal " << signal << "): " << msg; } catch(const char* msg) { Error out(getProcessLogger()); out << "(while interrupting in response to signal " << signal << "): " << msg; } catch(...) { Error out(getProcessLogger()); out << "(while interrupting in response to signal " << signal << "): unknown exception"; } { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); IceInternal::Application::_callbackInProgress = false; } IceInternal::Application::_condVar->signal(); } Ice::Application::Application(SignalPolicy signalPolicy) { IceInternal::Application::_signalPolicy = signalPolicy; } Ice::Application::~Application() { } int Ice::Application::main(int argc, char* argv[], const char* configFile) { // // We don't call the main below to avoid a deprecated warning // IceInternal::Application::_appName = ""; if(argc > 0) { IceInternal::Application::_appName = argv[0]; } if(argc > 0 && argv[0] && LoggerIPtr::dynamicCast(getProcessLogger())) { setProcessLogger(new LoggerI(argv[0], "")); } InitializationData initData; if(configFile) { try { initData.properties = createProperties(); initData.properties->load(configFile); } catch(const std::exception& ex) { Error out(getProcessLogger()); out << ex; return EXIT_FAILURE; } catch(...) { Error out(getProcessLogger()); out << "unknown exception"; return EXIT_FAILURE; } } return main(argc, argv, initData); } #ifdef _WIN32 int Ice::Application::main(int argc, wchar_t* argv[], const char* config) { return main(argsToStringSeq(argc, argv), config); } int Ice::Application::main(int argc, wchar_t* argv[], const Ice::InitializationData& initData) { // // On Windows the given wchar_t* strings are UTF16 and therefore // needs to be converted to native narow string encoding. // return main(argsToStringSeq(argc, argv, initData.stringConverter), initData); } #endif int Ice::Application::main(int argc, char* argv[], const InitializationData& initializationData) { if(argc > 0 && argv[0] && LoggerIPtr::dynamicCast(getProcessLogger())) { setProcessLogger(new LoggerI(argv[0], "")); } if(IceInternal::Application::_communicator != 0) { Error out(getProcessLogger()); out << "only one instance of the Application class can be used"; return EXIT_FAILURE; } int status; // // We parse the properties here to extract Ice.ProgramName. // InitializationData initData = initializationData; try { initData.properties = createProperties(argc, argv, initData.properties, initData.stringConverter); } catch(const std::exception& ex) { Error out(getProcessLogger()); out << ex; return EXIT_FAILURE; } catch(...) { Error out(getProcessLogger()); out << "unknown exception"; return EXIT_FAILURE; } IceInternal::Application::_appName = initData.properties->getPropertyWithDefault("Ice.ProgramName", IceInternal::Application::_appName); // // Used by destroyOnInterruptCallback and shutdownOnInterruptCallback. // _nohup = initData.properties->getPropertyAsInt("Ice.Nohup") > 0; IceInternal::Application::_application = this; if(IceInternal::Application::_signalPolicy == HandleSignals) { try { // // The ctrlCHandler must be created before starting any thread, in particular // before initializing the communicator. // CtrlCHandler ctrCHandler; _ctrlCHandler = &ctrCHandler; status = doMain(argc, argv, initData); // // Set _ctrlCHandler to 0 only once communicator->destroy() has completed. // _ctrlCHandler = 0; } catch(const CtrlCHandlerException&) { Error out(getProcessLogger()); out << "only one instance of the CtrlCHandler class can be used"; status = EXIT_FAILURE; } } else { status = doMain(argc, argv, initData); } return status; } int Ice::Application::main(int argc, char* const argv[], const char* configFile) { ArgVector av(argc, argv); return main(av.argc, av.argv, configFile); } int Ice::Application::main(int argc, char* const argv[], const Ice::InitializationData& initData) { ArgVector av(argc, argv); return main(av.argc, av.argv, initData); } int Ice::Application::main(const StringSeq& args, const char* configFile) { ArgVector av(args); return main(av.argc, av.argv, configFile); } int Ice::Application::main(const StringSeq& args, const InitializationData& initData) { ArgVector av(args); return main(av.argc, av.argv, initData); } void Ice::Application::interruptCallback(int) { } const char* Ice::Application::appName() { return IceInternal::Application::_appName.c_str(); } CommunicatorPtr Ice::Application::communicator() { return IceInternal::Application::_communicator; } void Ice::Application::destroyOnInterrupt() { if(IceInternal::Application::_signalPolicy == HandleSignals) { if(_ctrlCHandler != 0) { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); // we serialize all the interrupt-setting if(_ctrlCHandler->getCallback() == holdInterruptCallback) { _released = true; IceInternal::Application::_condVar->signal(); } _ctrlCHandler->setCallback(destroyOnInterruptCallback); } } else { Warning out(getProcessLogger()); out << "interrupt method called on Application configured to not handle interrupts."; } } void Ice::Application::shutdownOnInterrupt() { if(IceInternal::Application::_signalPolicy == HandleSignals) { if(_ctrlCHandler != 0) { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); // we serialize all the interrupt-setting if(_ctrlCHandler->getCallback() == holdInterruptCallback) { _released = true; IceInternal::Application::_condVar->signal(); } _ctrlCHandler->setCallback(shutdownOnInterruptCallback); } } else { Warning out(getProcessLogger()); out << "interrupt method called on Application configured to not handle interrupts."; } } void Ice::Application::ignoreInterrupt() { if(IceInternal::Application::_signalPolicy == HandleSignals) { if(_ctrlCHandler != 0) { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); // we serialize all the interrupt-setting if(_ctrlCHandler->getCallback() == holdInterruptCallback) { _released = true; IceInternal::Application::_condVar->signal(); } _ctrlCHandler->setCallback(0); } } else { Warning out(getProcessLogger()); out << "interrupt method called on Application configured to not handle interrupts."; } } void Ice::Application::callbackOnInterrupt() { if(IceInternal::Application::_signalPolicy == HandleSignals) { if(_ctrlCHandler != 0) { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); // we serialize all the interrupt-setting if(_ctrlCHandler->getCallback() == holdInterruptCallback) { _released = true; IceInternal::Application::_condVar->signal(); } _ctrlCHandler->setCallback(callbackOnInterruptCallback); } } else { Warning out(getProcessLogger()); out << "interrupt method called on Application configured to not handle interrupts."; } } void Ice::Application::holdInterrupt() { if(IceInternal::Application::_signalPolicy == HandleSignals) { if(_ctrlCHandler != 0) { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); // we serialize all the interrupt-setting if(_ctrlCHandler->getCallback() != holdInterruptCallback) { _previousCallback = _ctrlCHandler->getCallback(); _released = false; _ctrlCHandler->setCallback(holdInterruptCallback); } // else, we were already holding signals } } else { Warning out(getProcessLogger()); out << "interrupt method called on Application configured to not handle interrupts."; } } void Ice::Application::releaseInterrupt() { if(IceInternal::Application::_signalPolicy == HandleSignals) { if(_ctrlCHandler != 0) { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); // we serialize all the interrupt-setting if(_ctrlCHandler->getCallback() == holdInterruptCallback) { // // Note that it's very possible no signal is held; // in this case the callback is just replaced and // setting _released to true and signalling _condVar // do no harm. // _released = true; _ctrlCHandler->setCallback(_previousCallback); IceInternal::Application::_condVar->signal(); } // Else nothing to release. } } else { Warning out(getProcessLogger()); out << "interrupt method called on Application configured to not handle interrupts."; } } bool Ice::Application::interrupted() { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); return IceInternal::Application::_interrupted; } int Ice::Application::doMain(int argc, char* argv[], const InitializationData& initData) { int status; try { IceInternal::Application::_interrupted = false; // // If the process logger is the default logger, we now replace it with a // a logger which is using the program name for the prefix. // if(initData.properties->getProperty("Ice.ProgramName") != "" && LoggerIPtr::dynamicCast(getProcessLogger())) { setProcessLogger(new LoggerI(initData.properties->getProperty("Ice.ProgramName"), "")); } IceInternal::Application::_communicator = initialize(argc, argv, initData); IceInternal::Application::_destroyed = false; // // The default is to destroy when a signal is received. // if(IceInternal::Application::_signalPolicy == HandleSignals) { destroyOnInterrupt(); } status = run(argc, argv); } catch(const std::exception& ex) { Error out(getProcessLogger()); out << ex; status = EXIT_FAILURE; } catch(const std::string& msg) { Error out(getProcessLogger()); out << msg; status = EXIT_FAILURE; } catch(const char* msg) { Error out(getProcessLogger()); out << msg; status = EXIT_FAILURE; } catch(...) { Error out(getProcessLogger()); out << "unknown exception"; status = EXIT_FAILURE; } // // Don't want any new interrupt and at this point (post-run), // it would not make sense to release a held signal to run // shutdown or destroy. // if(IceInternal::Application::_signalPolicy == HandleSignals) { ignoreInterrupt(); } { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); while(IceInternal::Application::_callbackInProgress) { IceInternal::Application::_condVar->wait(lock); } if(IceInternal::Application::_destroyed) { IceInternal::Application::_communicator = 0; } else { IceInternal::Application::_destroyed = true; // // And _communicator != 0, meaning will be destroyed // next, _destroyed = true also ensures that any // remaining callback won't do anything // } IceInternal::Application::_application = 0; } if(IceInternal::Application::_communicator != 0) { try { IceInternal::Application::_communicator->destroy(); } catch(const std::exception& ex) { Error out(getProcessLogger()); out << ex; status = EXIT_FAILURE; } catch(...) { Error out(getProcessLogger()); out << "unknown exception"; status = EXIT_FAILURE; } IceInternal::Application::_communicator = 0; } return status; } Ice-3.5.1/cpp/src/Ice/EndpointFactoryManager.h0000644000076400007640000000220212223561476017213 0ustar mesmes// ********************************************************************** // // 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 ICE_ENDPOINT_FACTORY_MANAGER_H #define ICE_ENDPOINT_FACTORY_MANAGER_H #include #include #include #include #include #include #include namespace IceInternal { class BasicStream; class EndpointFactoryManager : public ::IceUtil::Shared, public ::IceUtil::Mutex { public: void add(const EndpointFactoryPtr&); EndpointFactoryPtr get(::Ice::Short) const; EndpointIPtr create(const std::string&, bool) const; EndpointIPtr read(BasicStream*) const; private: EndpointFactoryManager(const InstancePtr&); void destroy(); friend class Instance; InstancePtr _instance; std::vector _factories; }; } #endif Ice-3.5.1/cpp/src/Ice/RequestHandler.cpp0000644000076400007640000000132312223561476016074 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(RequestHandler* obj) { return obj; } RequestHandler::~RequestHandler() { } RequestHandler::RequestHandler(const ReferencePtr& reference) : _reference(reference), _response(reference->getMode() == Reference::ModeTwoway) { } Ice-3.5.1/cpp/src/Ice/PropertyNames.cpp0000644000076400007640000015775212223561476016000 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** // // Generated by makeprops.py from file ./config/PropertyNames.xml, Fri Jul 26 23:12:55 2013 // IMPORTANT: Do not edit this file -- any edits made here will be lost! #include const IceInternal::Property IcePropsData[] = { IceInternal::Property("Ice.ACM.Client", false, 0), IceInternal::Property("Ice.ACM.Server", false, 0), IceInternal::Property("Ice.Admin.ACM", false, 0), IceInternal::Property("Ice.Admin.AdapterId", false, 0), IceInternal::Property("Ice.Admin.Endpoints", false, 0), IceInternal::Property("Ice.Admin.Locator.EndpointSelection", false, 0), IceInternal::Property("Ice.Admin.Locator.ConnectionCached", false, 0), IceInternal::Property("Ice.Admin.Locator.PreferSecure", false, 0), IceInternal::Property("Ice.Admin.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("Ice.Admin.Locator.Locator", false, 0), IceInternal::Property("Ice.Admin.Locator.Router", false, 0), IceInternal::Property("Ice.Admin.Locator.CollocationOptimized", false, 0), IceInternal::Property("Ice.Admin.Locator", false, 0), IceInternal::Property("Ice.Admin.PublishedEndpoints", false, 0), IceInternal::Property("Ice.Admin.ReplicaGroupId", false, 0), IceInternal::Property("Ice.Admin.Router.EndpointSelection", false, 0), IceInternal::Property("Ice.Admin.Router.ConnectionCached", false, 0), IceInternal::Property("Ice.Admin.Router.PreferSecure", false, 0), IceInternal::Property("Ice.Admin.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("Ice.Admin.Router.Locator", false, 0), IceInternal::Property("Ice.Admin.Router.Router", false, 0), IceInternal::Property("Ice.Admin.Router.CollocationOptimized", false, 0), IceInternal::Property("Ice.Admin.Router", false, 0), IceInternal::Property("Ice.Admin.ProxyOptions", false, 0), IceInternal::Property("Ice.Admin.ThreadPool.Size", false, 0), IceInternal::Property("Ice.Admin.ThreadPool.SizeMax", false, 0), IceInternal::Property("Ice.Admin.ThreadPool.SizeWarn", false, 0), IceInternal::Property("Ice.Admin.ThreadPool.StackSize", false, 0), IceInternal::Property("Ice.Admin.ThreadPool.Serialize", false, 0), IceInternal::Property("Ice.Admin.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("Ice.Admin.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("Ice.Admin.DelayCreation", false, 0), IceInternal::Property("Ice.Admin.Facets", false, 0), IceInternal::Property("Ice.Admin.InstanceName", false, 0), IceInternal::Property("Ice.Admin.ServerId", false, 0), IceInternal::Property("Ice.BackgroundLocatorCacheUpdates", false, 0), IceInternal::Property("Ice.BatchAutoFlush", false, 0), IceInternal::Property("Ice.ChangeUser", false, 0), IceInternal::Property("Ice.ClientAccessPolicyProtocol", false, 0), IceInternal::Property("Ice.Compression.Level", false, 0), IceInternal::Property("Ice.Config", false, 0), IceInternal::Property("Ice.ConsoleListener", false, 0), IceInternal::Property("Ice.Default.CollocationOptimized", false, 0), IceInternal::Property("Ice.Default.EncodingVersion", false, 0), IceInternal::Property("Ice.Default.EndpointSelection", false, 0), IceInternal::Property("Ice.Default.Host", false, 0), IceInternal::Property("Ice.Default.Locator.EndpointSelection", false, 0), IceInternal::Property("Ice.Default.Locator.ConnectionCached", false, 0), IceInternal::Property("Ice.Default.Locator.PreferSecure", false, 0), IceInternal::Property("Ice.Default.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("Ice.Default.Locator.Locator", false, 0), IceInternal::Property("Ice.Default.Locator.Router", false, 0), IceInternal::Property("Ice.Default.Locator.CollocationOptimized", false, 0), IceInternal::Property("Ice.Default.Locator", false, 0), IceInternal::Property("Ice.Default.LocatorCacheTimeout", false, 0), IceInternal::Property("Ice.Default.Package", false, 0), IceInternal::Property("Ice.Default.PreferSecure", false, 0), IceInternal::Property("Ice.Default.Protocol", false, 0), IceInternal::Property("Ice.Default.Router.EndpointSelection", false, 0), IceInternal::Property("Ice.Default.Router.ConnectionCached", false, 0), IceInternal::Property("Ice.Default.Router.PreferSecure", false, 0), IceInternal::Property("Ice.Default.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("Ice.Default.Router.Locator", false, 0), IceInternal::Property("Ice.Default.Router.Router", false, 0), IceInternal::Property("Ice.Default.Router.CollocationOptimized", false, 0), IceInternal::Property("Ice.Default.Router", false, 0), IceInternal::Property("Ice.Default.SlicedFormat", false, 0), IceInternal::Property("Ice.IPv4", false, 0), IceInternal::Property("Ice.IPv6", false, 0), IceInternal::Property("Ice.EventLog.Source", false, 0), IceInternal::Property("Ice.FactoryAssemblies", false, 0), IceInternal::Property("Ice.GC.Interval", false, 0), IceInternal::Property("Ice.ImplicitContext", false, 0), IceInternal::Property("Ice.InitPlugins", false, 0), IceInternal::Property("Ice.LogFile", false, 0), IceInternal::Property("Ice.MessageSizeMax", false, 0), IceInternal::Property("Ice.MonitorConnections", false, 0), IceInternal::Property("Ice.Nohup", false, 0), IceInternal::Property("Ice.NullHandleAbort", false, 0), IceInternal::Property("Ice.Override.CloseTimeout", false, 0), IceInternal::Property("Ice.Override.Compress", false, 0), IceInternal::Property("Ice.Override.ConnectTimeout", false, 0), IceInternal::Property("Ice.Override.Timeout", false, 0), IceInternal::Property("Ice.Override.Secure", false, 0), IceInternal::Property("Ice.Package.*", false, 0), IceInternal::Property("Ice.Plugin.*", false, 0), IceInternal::Property("Ice.PluginLoadOrder", false, 0), IceInternal::Property("Ice.PreferIPv6Address", false, 0), IceInternal::Property("Ice.PrintAdapterReady", false, 0), IceInternal::Property("Ice.PrintProcessId", false, 0), IceInternal::Property("Ice.PrintStackTraces", false, 0), IceInternal::Property("Ice.ProgramName", false, 0), IceInternal::Property("Ice.RetryIntervals", false, 0), IceInternal::Property("Ice.ServerIdleTime", false, 0), IceInternal::Property("Ice.SOCKSProxyHost", false, 0), IceInternal::Property("Ice.SOCKSProxyPort", false, 0), IceInternal::Property("Ice.StdErr", false, 0), IceInternal::Property("Ice.StdOut", false, 0), IceInternal::Property("Ice.SyslogFacility", false, 0), IceInternal::Property("Ice.ThreadPool.Client.Size", false, 0), IceInternal::Property("Ice.ThreadPool.Client.SizeMax", false, 0), IceInternal::Property("Ice.ThreadPool.Client.SizeWarn", false, 0), IceInternal::Property("Ice.ThreadPool.Client.StackSize", false, 0), IceInternal::Property("Ice.ThreadPool.Client.Serialize", false, 0), IceInternal::Property("Ice.ThreadPool.Client.ThreadIdleTime", false, 0), IceInternal::Property("Ice.ThreadPool.Client.ThreadPriority", false, 0), IceInternal::Property("Ice.ThreadPool.Server.Size", false, 0), IceInternal::Property("Ice.ThreadPool.Server.SizeMax", false, 0), IceInternal::Property("Ice.ThreadPool.Server.SizeWarn", false, 0), IceInternal::Property("Ice.ThreadPool.Server.StackSize", false, 0), IceInternal::Property("Ice.ThreadPool.Server.Serialize", false, 0), IceInternal::Property("Ice.ThreadPool.Server.ThreadIdleTime", false, 0), IceInternal::Property("Ice.ThreadPool.Server.ThreadPriority", false, 0), IceInternal::Property("Ice.ThreadPriority", false, 0), IceInternal::Property("Ice.Trace.Admin.Properties", false, 0), IceInternal::Property("Ice.Trace.GC", false, 0), IceInternal::Property("Ice.Trace.Locator", false, 0), IceInternal::Property("Ice.Trace.Network", false, 0), IceInternal::Property("Ice.Trace.Protocol", false, 0), IceInternal::Property("Ice.Trace.Retry", false, 0), IceInternal::Property("Ice.Trace.Slicing", false, 0), IceInternal::Property("Ice.Trace.ThreadPool", false, 0), IceInternal::Property("Ice.UDP.RcvSize", false, 0), IceInternal::Property("Ice.UDP.SndSize", false, 0), IceInternal::Property("Ice.TCP.Backlog", false, 0), IceInternal::Property("Ice.TCP.RcvSize", false, 0), IceInternal::Property("Ice.TCP.SndSize", false, 0), IceInternal::Property("Ice.UseApplicationClassLoader", false, 0), IceInternal::Property("Ice.UseSyslog", false, 0), IceInternal::Property("Ice.Warn.AMICallback", false, 0), IceInternal::Property("Ice.Warn.Connections", false, 0), IceInternal::Property("Ice.Warn.Datagrams", false, 0), IceInternal::Property("Ice.Warn.Dispatch", false, 0), IceInternal::Property("Ice.Warn.Endpoints", false, 0), IceInternal::Property("Ice.Warn.UnknownProperties", false, 0), IceInternal::Property("Ice.Warn.UnusedProperties", false, 0), IceInternal::Property("Ice.CacheMessageBuffers", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::IceProps(IcePropsData, sizeof(IcePropsData)/sizeof(IcePropsData[0])); const IceInternal::Property IceMXPropsData[] = { IceInternal::Property("IceMX.Metrics.*.GroupBy", false, 0), IceInternal::Property("IceMX.Metrics.*.Map", false, 0), IceInternal::Property("IceMX.Metrics.*.RetainDetached", false, 0), IceInternal::Property("IceMX.Metrics.*.Accept", false, 0), IceInternal::Property("IceMX.Metrics.*.Reject", false, 0), IceInternal::Property("IceMX.Metrics.*", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::IceMXProps(IceMXPropsData, sizeof(IceMXPropsData)/sizeof(IceMXPropsData[0])); const IceInternal::Property IceBoxPropsData[] = { IceInternal::Property("IceBox.InheritProperties", false, 0), IceInternal::Property("IceBox.InstanceName", false, 0), IceInternal::Property("IceBox.LoadOrder", false, 0), IceInternal::Property("IceBox.PrintServicesReady", false, 0), IceInternal::Property("IceBox.Service.*", false, 0), IceInternal::Property("IceBox.ServiceManager.ACM", false, 0), IceInternal::Property("IceBox.ServiceManager.AdapterId", false, 0), IceInternal::Property("IceBox.ServiceManager.Endpoints", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator.EndpointSelection", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator.ConnectionCached", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator.PreferSecure", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator.Locator", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator.Router", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator", false, 0), IceInternal::Property("IceBox.ServiceManager.PublishedEndpoints", false, 0), IceInternal::Property("IceBox.ServiceManager.ReplicaGroupId", false, 0), IceInternal::Property("IceBox.ServiceManager.Router.EndpointSelection", false, 0), IceInternal::Property("IceBox.ServiceManager.Router.ConnectionCached", false, 0), IceInternal::Property("IceBox.ServiceManager.Router.PreferSecure", false, 0), IceInternal::Property("IceBox.ServiceManager.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceBox.ServiceManager.Router.Locator", false, 0), IceInternal::Property("IceBox.ServiceManager.Router.Router", false, 0), IceInternal::Property("IceBox.ServiceManager.Router.CollocationOptimized", false, 0), IceInternal::Property("IceBox.ServiceManager.Router", false, 0), IceInternal::Property("IceBox.ServiceManager.ProxyOptions", false, 0), IceInternal::Property("IceBox.ServiceManager.ThreadPool.Size", false, 0), IceInternal::Property("IceBox.ServiceManager.ThreadPool.SizeMax", false, 0), IceInternal::Property("IceBox.ServiceManager.ThreadPool.SizeWarn", false, 0), IceInternal::Property("IceBox.ServiceManager.ThreadPool.StackSize", false, 0), IceInternal::Property("IceBox.ServiceManager.ThreadPool.Serialize", false, 0), IceInternal::Property("IceBox.ServiceManager.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("IceBox.ServiceManager.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("IceBox.Trace.ServiceObserver", false, 0), IceInternal::Property("IceBox.UseSharedCommunicator.*", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::IceBoxProps(IceBoxPropsData, sizeof(IceBoxPropsData)/sizeof(IceBoxPropsData[0])); const IceInternal::Property IceBoxAdminPropsData[] = { IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.EndpointSelection", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.ConnectionCached", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.PreferSecure", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.LocatorCacheTimeout", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.Locator", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.Router", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.CollocationOptimized", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::IceBoxAdminProps(IceBoxAdminPropsData, sizeof(IceBoxAdminPropsData)/sizeof(IceBoxAdminPropsData[0])); const IceInternal::Property IceGridAdminPropsData[] = { IceInternal::Property("IceGridAdmin.AuthenticateUsingSSL", false, 0), IceInternal::Property("IceGridAdmin.MetricsConfig", false, 0), IceInternal::Property("IceGridAdmin.Username", false, 0), IceInternal::Property("IceGridAdmin.Password", false, 0), IceInternal::Property("IceGridAdmin.Replica", false, 0), IceInternal::Property("IceGridAdmin.Trace.Observers", false, 0), IceInternal::Property("IceGridAdmin.Trace.SaveToRegistry", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::IceGridAdminProps(IceGridAdminPropsData, sizeof(IceGridAdminPropsData)/sizeof(IceGridAdminPropsData[0])); const IceInternal::Property IceGridPropsData[] = { IceInternal::Property("IceGrid.AdminRouter.ACM", false, 0), IceInternal::Property("IceGrid.AdminRouter.AdapterId", false, 0), IceInternal::Property("IceGrid.AdminRouter.Endpoints", false, 0), IceInternal::Property("IceGrid.AdminRouter.Locator.EndpointSelection", false, 0), IceInternal::Property("IceGrid.AdminRouter.Locator.ConnectionCached", false, 0), IceInternal::Property("IceGrid.AdminRouter.Locator.PreferSecure", false, 0), IceInternal::Property("IceGrid.AdminRouter.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.AdminRouter.Locator.Locator", false, 0), IceInternal::Property("IceGrid.AdminRouter.Locator.Router", false, 0), IceInternal::Property("IceGrid.AdminRouter.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.AdminRouter.Locator", false, 0), IceInternal::Property("IceGrid.AdminRouter.PublishedEndpoints", false, 0), IceInternal::Property("IceGrid.AdminRouter.ReplicaGroupId", false, 0), IceInternal::Property("IceGrid.AdminRouter.Router.EndpointSelection", false, 0), IceInternal::Property("IceGrid.AdminRouter.Router.ConnectionCached", false, 0), IceInternal::Property("IceGrid.AdminRouter.Router.PreferSecure", false, 0), IceInternal::Property("IceGrid.AdminRouter.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.AdminRouter.Router.Locator", false, 0), IceInternal::Property("IceGrid.AdminRouter.Router.Router", false, 0), IceInternal::Property("IceGrid.AdminRouter.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.AdminRouter.Router", false, 0), IceInternal::Property("IceGrid.AdminRouter.ProxyOptions", false, 0), IceInternal::Property("IceGrid.AdminRouter.ThreadPool.Size", false, 0), IceInternal::Property("IceGrid.AdminRouter.ThreadPool.SizeMax", false, 0), IceInternal::Property("IceGrid.AdminRouter.ThreadPool.SizeWarn", false, 0), IceInternal::Property("IceGrid.AdminRouter.ThreadPool.StackSize", false, 0), IceInternal::Property("IceGrid.AdminRouter.ThreadPool.Serialize", false, 0), IceInternal::Property("IceGrid.AdminRouter.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("IceGrid.AdminRouter.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("IceGrid.InstanceName", false, 0), IceInternal::Property("IceGrid.Node.ACM", false, 0), IceInternal::Property("IceGrid.Node.AdapterId", false, 0), IceInternal::Property("IceGrid.Node.Endpoints", false, 0), IceInternal::Property("IceGrid.Node.Locator.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Node.Locator.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Node.Locator.PreferSecure", false, 0), IceInternal::Property("IceGrid.Node.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Node.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Node.Locator.Router", false, 0), IceInternal::Property("IceGrid.Node.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Node.Locator", false, 0), IceInternal::Property("IceGrid.Node.PublishedEndpoints", false, 0), IceInternal::Property("IceGrid.Node.ReplicaGroupId", false, 0), IceInternal::Property("IceGrid.Node.Router.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Node.Router.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Node.Router.PreferSecure", false, 0), IceInternal::Property("IceGrid.Node.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Node.Router.Locator", false, 0), IceInternal::Property("IceGrid.Node.Router.Router", false, 0), IceInternal::Property("IceGrid.Node.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Node.Router", false, 0), IceInternal::Property("IceGrid.Node.ProxyOptions", false, 0), IceInternal::Property("IceGrid.Node.ThreadPool.Size", false, 0), IceInternal::Property("IceGrid.Node.ThreadPool.SizeMax", false, 0), IceInternal::Property("IceGrid.Node.ThreadPool.SizeWarn", false, 0), IceInternal::Property("IceGrid.Node.ThreadPool.StackSize", false, 0), IceInternal::Property("IceGrid.Node.ThreadPool.Serialize", false, 0), IceInternal::Property("IceGrid.Node.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("IceGrid.Node.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("IceGrid.Node.AllowRunningServersAsRoot", false, 0), IceInternal::Property("IceGrid.Node.AllowEndpointsOverride", false, 0), IceInternal::Property("IceGrid.Node.CollocateRegistry", false, 0), IceInternal::Property("IceGrid.Node.Data", false, 0), IceInternal::Property("IceGrid.Node.DisableOnFailure", false, 0), IceInternal::Property("IceGrid.Node.Name", false, 0), IceInternal::Property("IceGrid.Node.Output", false, 0), IceInternal::Property("IceGrid.Node.ProcessorSocketCount", false, 0), IceInternal::Property("IceGrid.Node.PrintServersReady", false, 0), IceInternal::Property("IceGrid.Node.PropertiesOverride", false, 0), IceInternal::Property("IceGrid.Node.RedirectErrToOut", false, 0), IceInternal::Property("IceGrid.Node.Trace.Activator", false, 0), IceInternal::Property("IceGrid.Node.Trace.Adapter", false, 0), IceInternal::Property("IceGrid.Node.Trace.Patch", false, 0), IceInternal::Property("IceGrid.Node.Trace.Replica", false, 0), IceInternal::Property("IceGrid.Node.Trace.Server", false, 0), IceInternal::Property("IceGrid.Node.UserAccounts", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper.PreferSecure", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper.Locator", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper.Router", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper", false, 0), IceInternal::Property("IceGrid.Node.WaitTime", false, 0), IceInternal::Property("IceGrid.Registry.AdminCryptPasswords", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.Locator", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.Router", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionFilters", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ACM", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.AdapterId", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Endpoints", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.Router", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.PublishedEndpoints", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ReplicaGroupId", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.Locator", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.Router", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ProxyOptions", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ThreadPool.Size", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ThreadPool.SizeMax", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ThreadPool.SizeWarn", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ThreadPool.StackSize", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ThreadPool.Serialize", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.Locator", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.Router", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier", false, 0), IceInternal::Property("IceGrid.Registry.Client.ACM", false, 0), IceInternal::Property("IceGrid.Registry.Client.AdapterId", false, 0), IceInternal::Property("IceGrid.Registry.Client.Endpoints", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator.Router", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Client.PublishedEndpoints", false, 0), IceInternal::Property("IceGrid.Registry.Client.ReplicaGroupId", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router.Router", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router", false, 0), IceInternal::Property("IceGrid.Registry.Client.ProxyOptions", false, 0), IceInternal::Property("IceGrid.Registry.Client.ThreadPool.Size", false, 0), IceInternal::Property("IceGrid.Registry.Client.ThreadPool.SizeMax", false, 0), IceInternal::Property("IceGrid.Registry.Client.ThreadPool.SizeWarn", false, 0), IceInternal::Property("IceGrid.Registry.Client.ThreadPool.StackSize", false, 0), IceInternal::Property("IceGrid.Registry.Client.ThreadPool.Serialize", false, 0), IceInternal::Property("IceGrid.Registry.Client.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("IceGrid.Registry.Client.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("IceGrid.Registry.CryptPasswords", false, 0), IceInternal::Property("IceGrid.Registry.Data", false, 0), IceInternal::Property("IceGrid.Registry.DefaultTemplates", false, 0), IceInternal::Property("IceGrid.Registry.DynamicRegistration", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ACM", false, 0), IceInternal::Property("IceGrid.Registry.Internal.AdapterId", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Endpoints", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator.Router", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Internal.PublishedEndpoints", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ReplicaGroupId", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router.Router", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ProxyOptions", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ThreadPool.Size", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ThreadPool.SizeMax", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ThreadPool.SizeWarn", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ThreadPool.StackSize", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ThreadPool.Serialize", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("IceGrid.Registry.NodeSessionTimeout", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier.Locator", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier.Router", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier", false, 0), IceInternal::Property("IceGrid.Registry.ReplicaName", false, 0), IceInternal::Property("IceGrid.Registry.ReplicaSessionTimeout", false, 0), IceInternal::Property("IceGrid.Registry.RequireNodeCertCN", false, 0), IceInternal::Property("IceGrid.Registry.RequireReplicaCertCN", false, 0), IceInternal::Property("IceGrid.Registry.Server.ACM", false, 0), IceInternal::Property("IceGrid.Registry.Server.AdapterId", false, 0), IceInternal::Property("IceGrid.Registry.Server.Endpoints", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator.Router", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Server.PublishedEndpoints", false, 0), IceInternal::Property("IceGrid.Registry.Server.ReplicaGroupId", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router.Router", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router", false, 0), IceInternal::Property("IceGrid.Registry.Server.ProxyOptions", false, 0), IceInternal::Property("IceGrid.Registry.Server.ThreadPool.Size", false, 0), IceInternal::Property("IceGrid.Registry.Server.ThreadPool.SizeMax", false, 0), IceInternal::Property("IceGrid.Registry.Server.ThreadPool.SizeWarn", false, 0), IceInternal::Property("IceGrid.Registry.Server.ThreadPool.StackSize", false, 0), IceInternal::Property("IceGrid.Registry.Server.ThreadPool.Serialize", false, 0), IceInternal::Property("IceGrid.Registry.Server.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("IceGrid.Registry.Server.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("IceGrid.Registry.SessionFilters", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ACM", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.AdapterId", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Endpoints", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator.Router", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.PublishedEndpoints", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ReplicaGroupId", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router.Locator", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router.Router", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ProxyOptions", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ThreadPool.Size", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ThreadPool.SizeMax", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ThreadPool.SizeWarn", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ThreadPool.StackSize", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ThreadPool.Serialize", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("IceGrid.Registry.SessionTimeout", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.EndpointSelection", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.ConnectionCached", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.PreferSecure", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.Locator", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.Router", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Application", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Adapter", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Node", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Object", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Patch", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Replica", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Server", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Session", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Subscriber", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Topic", false, 0), IceInternal::Property("IceGrid.Registry.Trace.TopicManager", false, 0), IceInternal::Property("IceGrid.Registry.UserAccounts", false, 0), IceInternal::Property("IceGrid.SQL.DatabaseType", false, 0), IceInternal::Property("IceGrid.SQL.EncodingVersion", false, 0), IceInternal::Property("IceGrid.SQL.HostName", false, 0), IceInternal::Property("IceGrid.SQL.Port", false, 0), IceInternal::Property("IceGrid.SQL.DatabaseName", false, 0), IceInternal::Property("IceGrid.SQL.UserName", false, 0), IceInternal::Property("IceGrid.SQL.Password", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::IceGridProps(IceGridPropsData, sizeof(IceGridPropsData)/sizeof(IceGridPropsData[0])); const IceInternal::Property IcePatch2PropsData[] = { IceInternal::Property("IcePatch2.ACM", false, 0), IceInternal::Property("IcePatch2.AdapterId", false, 0), IceInternal::Property("IcePatch2.Endpoints", false, 0), IceInternal::Property("IcePatch2.Locator.EndpointSelection", false, 0), IceInternal::Property("IcePatch2.Locator.ConnectionCached", false, 0), IceInternal::Property("IcePatch2.Locator.PreferSecure", false, 0), IceInternal::Property("IcePatch2.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IcePatch2.Locator.Locator", false, 0), IceInternal::Property("IcePatch2.Locator.Router", false, 0), IceInternal::Property("IcePatch2.Locator.CollocationOptimized", false, 0), IceInternal::Property("IcePatch2.Locator", false, 0), IceInternal::Property("IcePatch2.PublishedEndpoints", false, 0), IceInternal::Property("IcePatch2.ReplicaGroupId", false, 0), IceInternal::Property("IcePatch2.Router.EndpointSelection", false, 0), IceInternal::Property("IcePatch2.Router.ConnectionCached", false, 0), IceInternal::Property("IcePatch2.Router.PreferSecure", false, 0), IceInternal::Property("IcePatch2.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IcePatch2.Router.Locator", false, 0), IceInternal::Property("IcePatch2.Router.Router", false, 0), IceInternal::Property("IcePatch2.Router.CollocationOptimized", false, 0), IceInternal::Property("IcePatch2.Router", false, 0), IceInternal::Property("IcePatch2.ProxyOptions", false, 0), IceInternal::Property("IcePatch2.ThreadPool.Size", false, 0), IceInternal::Property("IcePatch2.ThreadPool.SizeMax", false, 0), IceInternal::Property("IcePatch2.ThreadPool.SizeWarn", false, 0), IceInternal::Property("IcePatch2.ThreadPool.StackSize", false, 0), IceInternal::Property("IcePatch2.ThreadPool.Serialize", false, 0), IceInternal::Property("IcePatch2.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("IcePatch2.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("IcePatch2.ChunkSize", true, "IcePatch2Client.ChunkSize"), IceInternal::Property("IcePatch2.Directory", false, 0), IceInternal::Property("IcePatch2.InstanceName", false, 0), IceInternal::Property("IcePatch2.Remove", true, "IcePatch2Client.Remove"), IceInternal::Property("IcePatch2.Thorough", true, "IcePatch2Client.Thorough"), }; const IceInternal::PropertyArray IceInternal::PropertyNames::IcePatch2Props(IcePatch2PropsData, sizeof(IcePatch2PropsData)/sizeof(IcePatch2PropsData[0])); const IceInternal::Property IcePatch2ClientPropsData[] = { IceInternal::Property("IcePatch2Client.ChunkSize", false, 0), IceInternal::Property("IcePatch2Client.Directory", false, 0), IceInternal::Property("IcePatch2Client.Proxy", false, 0), IceInternal::Property("IcePatch2Client.Remove", false, 0), IceInternal::Property("IcePatch2Client.Thorough", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::IcePatch2ClientProps(IcePatch2ClientPropsData, sizeof(IcePatch2ClientPropsData)/sizeof(IcePatch2ClientPropsData[0])); const IceInternal::Property IceSSLPropsData[] = { IceInternal::Property("IceSSL.Alias", false, 0), IceInternal::Property("IceSSL.CertAuthDir", false, 0), IceInternal::Property("IceSSL.CertAuthFile", false, 0), IceInternal::Property("IceSSL.CertFile", false, 0), IceInternal::Property("IceSSL.CertVerifier", false, 0), IceInternal::Property("IceSSL.CheckCertName", false, 0), IceInternal::Property("IceSSL.CheckCRL", false, 0), IceInternal::Property("IceSSL.Ciphers", false, 0), IceInternal::Property("IceSSL.DefaultDir", false, 0), IceInternal::Property("IceSSL.DH.*", false, 0), IceInternal::Property("IceSSL.EntropyDaemon", false, 0), IceInternal::Property("IceSSL.FindCert.*", false, 0), IceInternal::Property("IceSSL.ImportCert.*", false, 0), IceInternal::Property("IceSSL.InitOpenSSL", false, 0), IceInternal::Property("IceSSL.KeyFile", false, 0), IceInternal::Property("IceSSL.KeySet", false, 0), IceInternal::Property("IceSSL.Keystore", false, 0), IceInternal::Property("IceSSL.KeystorePassword", false, 0), IceInternal::Property("IceSSL.KeystoreType", false, 0), IceInternal::Property("IceSSL.Password", false, 0), IceInternal::Property("IceSSL.PasswordCallback", false, 0), IceInternal::Property("IceSSL.PasswordRetryMax", false, 0), IceInternal::Property("IceSSL.PersistKeySet", false, 0), IceInternal::Property("IceSSL.Protocols", false, 0), IceInternal::Property("IceSSL.Random", false, 0), IceInternal::Property("IceSSL.Trace.Security", false, 0), IceInternal::Property("IceSSL.TrustOnly", false, 0), IceInternal::Property("IceSSL.TrustOnly.Client", false, 0), IceInternal::Property("IceSSL.TrustOnly.Server", false, 0), IceInternal::Property("IceSSL.TrustOnly.Server.*", false, 0), IceInternal::Property("IceSSL.Truststore", false, 0), IceInternal::Property("IceSSL.TruststorePassword", false, 0), IceInternal::Property("IceSSL.TruststoreType", false, 0), IceInternal::Property("IceSSL.VerifyDepthMax", false, 0), IceInternal::Property("IceSSL.VerifyPeer", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::IceSSLProps(IceSSLPropsData, sizeof(IceSSLPropsData)/sizeof(IceSSLPropsData[0])); const IceInternal::Property IceStormAdminPropsData[] = { IceInternal::Property("IceStormAdmin.TopicManager.*", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::IceStormAdminProps(IceStormAdminPropsData, sizeof(IceStormAdminPropsData)/sizeof(IceStormAdminPropsData[0])); const IceInternal::Property Glacier2PropsData[] = { IceInternal::Property("Glacier2.AddSSLContext", true, 0), IceInternal::Property("Glacier2.AddConnectionContext", false, 0), IceInternal::Property("Glacier2.Client.ACM", false, 0), IceInternal::Property("Glacier2.Client.AdapterId", false, 0), IceInternal::Property("Glacier2.Client.Endpoints", false, 0), IceInternal::Property("Glacier2.Client.Locator.EndpointSelection", false, 0), IceInternal::Property("Glacier2.Client.Locator.ConnectionCached", false, 0), IceInternal::Property("Glacier2.Client.Locator.PreferSecure", false, 0), IceInternal::Property("Glacier2.Client.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.Client.Locator.Locator", false, 0), IceInternal::Property("Glacier2.Client.Locator.Router", false, 0), IceInternal::Property("Glacier2.Client.Locator.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.Client.Locator", false, 0), IceInternal::Property("Glacier2.Client.PublishedEndpoints", false, 0), IceInternal::Property("Glacier2.Client.ReplicaGroupId", false, 0), IceInternal::Property("Glacier2.Client.Router.EndpointSelection", false, 0), IceInternal::Property("Glacier2.Client.Router.ConnectionCached", false, 0), IceInternal::Property("Glacier2.Client.Router.PreferSecure", false, 0), IceInternal::Property("Glacier2.Client.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.Client.Router.Locator", false, 0), IceInternal::Property("Glacier2.Client.Router.Router", false, 0), IceInternal::Property("Glacier2.Client.Router.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.Client.Router", false, 0), IceInternal::Property("Glacier2.Client.ProxyOptions", false, 0), IceInternal::Property("Glacier2.Client.ThreadPool.Size", false, 0), IceInternal::Property("Glacier2.Client.ThreadPool.SizeMax", false, 0), IceInternal::Property("Glacier2.Client.ThreadPool.SizeWarn", false, 0), IceInternal::Property("Glacier2.Client.ThreadPool.StackSize", false, 0), IceInternal::Property("Glacier2.Client.ThreadPool.Serialize", false, 0), IceInternal::Property("Glacier2.Client.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("Glacier2.Client.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("Glacier2.Client.AlwaysBatch", false, 0), IceInternal::Property("Glacier2.Client.Buffered", false, 0), IceInternal::Property("Glacier2.Client.ForwardContext", false, 0), IceInternal::Property("Glacier2.Client.SleepTime", false, 0), IceInternal::Property("Glacier2.Client.Trace.Override", false, 0), IceInternal::Property("Glacier2.Client.Trace.Reject", false, 0), IceInternal::Property("Glacier2.Client.Trace.Request", false, 0), IceInternal::Property("Glacier2.Filter.Address.Reject", false, 0), IceInternal::Property("Glacier2.Filter.Address.Accept", false, 0), IceInternal::Property("Glacier2.Filter.ProxySizeMax", false, 0), IceInternal::Property("Glacier2.Filter.Category.Accept", false, 0), IceInternal::Property("Glacier2.Filter.Category.AcceptUser", false, 0), IceInternal::Property("Glacier2.Filter.AdapterId.Accept", false, 0), IceInternal::Property("Glacier2.Filter.Identity.Accept", false, 0), IceInternal::Property("Glacier2.CryptPasswords", false, 0), IceInternal::Property("Glacier2.InstanceName", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier.EndpointSelection", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier.ConnectionCached", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier.PreferSecure", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier.Locator", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier.Router", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier", false, 0), IceInternal::Property("Glacier2.ReturnClientProxy", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier.EndpointSelection", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier.ConnectionCached", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier.PreferSecure", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier.Locator", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier.Router", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier", false, 0), IceInternal::Property("Glacier2.RoutingTable.MaxSize", false, 0), IceInternal::Property("Glacier2.Server.ACM", false, 0), IceInternal::Property("Glacier2.Server.AdapterId", false, 0), IceInternal::Property("Glacier2.Server.Endpoints", false, 0), IceInternal::Property("Glacier2.Server.Locator.EndpointSelection", false, 0), IceInternal::Property("Glacier2.Server.Locator.ConnectionCached", false, 0), IceInternal::Property("Glacier2.Server.Locator.PreferSecure", false, 0), IceInternal::Property("Glacier2.Server.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.Server.Locator.Locator", false, 0), IceInternal::Property("Glacier2.Server.Locator.Router", false, 0), IceInternal::Property("Glacier2.Server.Locator.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.Server.Locator", false, 0), IceInternal::Property("Glacier2.Server.PublishedEndpoints", false, 0), IceInternal::Property("Glacier2.Server.ReplicaGroupId", false, 0), IceInternal::Property("Glacier2.Server.Router.EndpointSelection", false, 0), IceInternal::Property("Glacier2.Server.Router.ConnectionCached", false, 0), IceInternal::Property("Glacier2.Server.Router.PreferSecure", false, 0), IceInternal::Property("Glacier2.Server.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.Server.Router.Locator", false, 0), IceInternal::Property("Glacier2.Server.Router.Router", false, 0), IceInternal::Property("Glacier2.Server.Router.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.Server.Router", false, 0), IceInternal::Property("Glacier2.Server.ProxyOptions", false, 0), IceInternal::Property("Glacier2.Server.ThreadPool.Size", false, 0), IceInternal::Property("Glacier2.Server.ThreadPool.SizeMax", false, 0), IceInternal::Property("Glacier2.Server.ThreadPool.SizeWarn", false, 0), IceInternal::Property("Glacier2.Server.ThreadPool.StackSize", false, 0), IceInternal::Property("Glacier2.Server.ThreadPool.Serialize", false, 0), IceInternal::Property("Glacier2.Server.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("Glacier2.Server.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("Glacier2.Server.AlwaysBatch", false, 0), IceInternal::Property("Glacier2.Server.Buffered", false, 0), IceInternal::Property("Glacier2.Server.ForwardContext", false, 0), IceInternal::Property("Glacier2.Server.SleepTime", false, 0), IceInternal::Property("Glacier2.Server.Trace.Override", false, 0), IceInternal::Property("Glacier2.Server.Trace.Request", false, 0), IceInternal::Property("Glacier2.SessionManager.EndpointSelection", false, 0), IceInternal::Property("Glacier2.SessionManager.ConnectionCached", false, 0), IceInternal::Property("Glacier2.SessionManager.PreferSecure", false, 0), IceInternal::Property("Glacier2.SessionManager.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.SessionManager.Locator", false, 0), IceInternal::Property("Glacier2.SessionManager.Router", false, 0), IceInternal::Property("Glacier2.SessionManager.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.SessionManager", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.EndpointSelection", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.ConnectionCached", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.PreferSecure", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.Locator", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.Router", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.SSLSessionManager", false, 0), IceInternal::Property("Glacier2.SessionTimeout", false, 0), IceInternal::Property("Glacier2.Trace.RoutingTable", false, 0), IceInternal::Property("Glacier2.Trace.Session", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::Glacier2Props(Glacier2PropsData, sizeof(Glacier2PropsData)/sizeof(Glacier2PropsData[0])); const IceInternal::Property FreezePropsData[] = { IceInternal::Property("Freeze.DbEnv.*.CheckpointPeriod", false, 0), IceInternal::Property("Freeze.DbEnv.*.DbHome", false, 0), IceInternal::Property("Freeze.DbEnv.*.DbPrivate", false, 0), IceInternal::Property("Freeze.DbEnv.*.DbRecoverFatal", false, 0), IceInternal::Property("Freeze.DbEnv.*.EncodingVersion", false, 0), IceInternal::Property("Freeze.DbEnv.*.LockFile", false, 0), IceInternal::Property("Freeze.DbEnv.*.OldLogsAutoDelete", false, 0), IceInternal::Property("Freeze.DbEnv.*.PeriodicCheckpointMinSize", false, 0), IceInternal::Property("Freeze.Evictor.*.BtreeMinKey", false, 0), IceInternal::Property("Freeze.Evictor.*.Checksum", false, 0), IceInternal::Property("Freeze.Evictor.*.MaxTxSize", false, 0), IceInternal::Property("Freeze.Evictor.*.PageSize", false, 0), IceInternal::Property("Freeze.Evictor.*.PopulateEmptyIndices", false, 0), IceInternal::Property("Freeze.Evictor.*.RollbackOnUserException", false, 0), IceInternal::Property("Freeze.Evictor.*.SavePeriod", false, 0), IceInternal::Property("Freeze.Evictor.*.SaveSizeTrigger", false, 0), IceInternal::Property("Freeze.Evictor.*.StreamTimeout", false, 0), IceInternal::Property("Freeze.Map.*.BtreeMinKey", false, 0), IceInternal::Property("Freeze.Map.*.Checksum", false, 0), IceInternal::Property("Freeze.Map.*.PageSize", false, 0), IceInternal::Property("Freeze.Trace.DbEnv", false, 0), IceInternal::Property("Freeze.Trace.Evictor", false, 0), IceInternal::Property("Freeze.Trace.Map", false, 0), IceInternal::Property("Freeze.Trace.Transaction", false, 0), IceInternal::Property("Freeze.Warn.Deadlocks", false, 0), IceInternal::Property("Freeze.Warn.Rollback", false, 0), }; const IceInternal::PropertyArray IceInternal::PropertyNames::FreezeProps(FreezePropsData, sizeof(FreezePropsData)/sizeof(FreezePropsData[0])); const IceInternal::PropertyArray IceInternal::PropertyNames::validProps[] = { IceProps, IceMXProps, IceBoxProps, IceBoxAdminProps, IceGridAdminProps, IceGridProps, IcePatch2Props, IcePatch2ClientProps, IceSSLProps, IceStormAdminProps, Glacier2Props, FreezeProps, IceInternal::PropertyArray(0,0) }; const char* IceInternal::PropertyNames::clPropNames[] = { "Ice", "IceMX", "IceBox", "IceBoxAdmin", "IceGridAdmin", "IceGrid", "IcePatch2", "IcePatch2Client", "IceSSL", "IceStormAdmin", "Glacier2", "Freeze", 0 }; Ice-3.5.1/cpp/src/Ice/PluginManagerI.cpp0000644000076400007640000002544012223561476016016 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; const char * const Ice::PluginManagerI::_kindOfObject = "plugin"; typedef Ice::Plugin* (*PLUGIN_FACTORY)(const CommunicatorPtr&, const string&, const StringSeq&); void Ice::PluginManagerI::initializePlugins() { if(_initialized) { InitializationException ex(__FILE__, __LINE__); ex.reason = "plug-ins already initialized"; throw ex; } // // Invoke initialize() on the plug-ins, in the order they were loaded. // vector initializedPlugins; try { for(PluginInfoList::iterator p = _plugins.begin(); p != _plugins.end(); ++p) { p->plugin->initialize(); initializedPlugins.push_back(p->plugin); } } catch(...) { // // Destroy the plug-ins that have been successfully initialized, in the // reverse order. // for(vector::reverse_iterator p = initializedPlugins.rbegin(); p != initializedPlugins.rend(); ++p) { try { (*p)->destroy(); } catch(...) { // Ignore. } } throw; } _initialized = true; } StringSeq Ice::PluginManagerI::getPlugins() { IceUtil::Mutex::Lock sync(*this); StringSeq names; for(PluginInfoList::iterator p = _plugins.begin(); p != _plugins.end(); ++p) { names.push_back(p->name); } return names; } PluginPtr Ice::PluginManagerI::getPlugin(const string& name) { IceUtil::Mutex::Lock sync(*this); if(!_communicator) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } PluginPtr p = findPlugin(name); if(p) { return p; } NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = _kindOfObject; ex.id = name; throw ex; } void Ice::PluginManagerI::addPlugin(const string& name, const PluginPtr& plugin) { IceUtil::Mutex::Lock sync(*this); if(!_communicator) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } if(findPlugin(name)) { AlreadyRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = _kindOfObject; ex.id = name; throw ex; } PluginInfo info; info.name = name; info.plugin = plugin; _plugins.push_back(info); } void Ice::PluginManagerI::destroy() { IceUtil::Mutex::Lock sync(*this); if(_communicator) { if(_initialized) { // // Destroy the plug-ins that have been successfully initialized, in the // reverse order. // for(PluginInfoList::reverse_iterator p = _plugins.rbegin(); p != _plugins.rend(); ++p) { try { p->plugin->destroy(); } catch(const std::exception& ex) { Warning out(getProcessLogger()); out << "unexpected exception raised by plug-in `" << p->name << "' destruction:\n" << ex.what(); } catch(const std::string& str) { Warning out(getProcessLogger()); out << "unexpected exception raised by plug-in `" << p->name << "' destruction:\n" << str; } catch(const char* msg) { Warning out(getProcessLogger()); out << "unexpected exception raised by plug-in `" << p->name << "' destruction:\n" << msg; } catch(...) { Warning out(getProcessLogger()); out << "unexpected exception raised by plug-in `" << p->name << "' destruction"; } } } _communicator = 0; } _plugins.clear(); _libraries = 0; } Ice::PluginManagerI::PluginManagerI(const CommunicatorPtr& communicator, const DynamicLibraryListPtr& libraries) : _communicator(communicator), _libraries(libraries), _initialized(false) { } void Ice::PluginManagerI::loadPlugins(int& argc, char* argv[]) { assert(_communicator); StringSeq cmdArgs = argsToStringSeq(argc, argv); // // Load and initialize the plug-ins defined in the property set // with the prefix "Ice.Plugin.". These properties should // have the following format: // // Ice.Plugin.name[.]=entry_point [args] // // If the Ice.PluginLoadOrder property is defined, load the // specified plug-ins in the specified order, then load any // remaining plug-ins. // const string prefix = "Ice.Plugin."; PropertiesPtr properties = _communicator->getProperties(); PropertyDict plugins = properties->getPropertiesForPrefix(prefix); StringSeq loadOrder = properties->getPropertyAsList("Ice.PluginLoadOrder"); for(StringSeq::const_iterator p = loadOrder.begin(); p != loadOrder.end(); ++p) { string name = *p; if(findPlugin(name)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "plug-in `" + name + "' already loaded"; throw ex; } PropertyDict::iterator r = plugins.find("Ice.Plugin." + name + ".cpp"); if(r == plugins.end()) { r = plugins.find("Ice.Plugin." + name); } else { plugins.erase("Ice.Plugin." + name); } if(r != plugins.end()) { loadPlugin(name, r->second, cmdArgs); plugins.erase(r); } else { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "plug-in `" + name + "' not defined"; throw ex; } } // // Load any remaining plug-ins that weren't specified in PluginLoadOrder. // while(!plugins.empty()) { PropertyDict::iterator p = plugins.begin(); string name = p->first.substr(prefix.size()); size_t dotPos = name.find_last_of('.'); if(dotPos != string::npos) { string suffix = name.substr(dotPos + 1); if(suffix == "java" || suffix == "clr") { // // Ignored // plugins.erase(p); } else if(suffix == "cpp") { name = name.substr(0, dotPos); loadPlugin(name, p->second, cmdArgs); plugins.erase(p); plugins.erase("Ice.Plugin." + name); } else { // // Name is just a regular name that happens to contain a dot // dotPos = string::npos; } } if(dotPos == string::npos) { // // Is there a .cpp entry? // PropertyDict::iterator q = plugins.find("Ice.Plugin." + name + ".cpp"); if(q != plugins.end()) { plugins.erase(p); p = q; } loadPlugin(name, p->second, cmdArgs); plugins.erase(p); } } stringSeqToArgs(cmdArgs, argc, argv); } void Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, StringSeq& cmdArgs) { assert(_communicator); // // Split the entire property value into arguments. An entry point containing spaces // must be enclosed in quotes. // StringSeq args; try { args = IceUtilInternal::Options::split(pluginSpec); } catch(const IceUtilInternal::BadOptException& ex) { PluginInitializationException e(__FILE__, __LINE__); e.reason = "invalid arguments for plug-in `" + name + "':\n" + ex.reason; throw e; } assert(!args.empty()); // // Shift the arguments. // const string entryPoint = args[0]; args.erase(args.begin()); // // Convert command-line options into properties. First we // convert the options from the plug-in configuration, then // we convert the options from the application command-line. // PropertiesPtr properties = _communicator->getProperties(); args = properties->parseCommandLineOptions(name, args); cmdArgs = properties->parseCommandLineOptions(name, cmdArgs); // // Load the entry point symbol. // PluginPtr plugin; DynamicLibraryPtr library = new DynamicLibrary(IceInternal::getInstance(_communicator)->initializationData().stringConverter); DynamicLibrary::symbol_type sym = library->loadEntryPoint(entryPoint); if(sym == 0) { ostringstream out; string msg = library->getErrorMessage(); out << "unable to load entry point `" << entryPoint << "'"; if(!msg.empty()) { out << ": " + msg; } PluginInitializationException ex(__FILE__, __LINE__); ex.reason = out.str(); throw ex; } // // Invoke the factory function. No exceptions can be raised // by the factory function because it's declared extern "C". // PLUGIN_FACTORY factory = (PLUGIN_FACTORY)sym; plugin = factory(_communicator, name, args); if(!plugin) { PluginInitializationException e(__FILE__, __LINE__); ostringstream out; out << "failure in entry point `" << entryPoint << "'"; e.reason = out.str(); throw e; } PluginInfo info; info.name = name; info.plugin = plugin; _plugins.push_back(info); _libraries->add(library); } Ice::PluginPtr Ice::PluginManagerI::findPlugin(const string& name) const { for(PluginInfoList::const_iterator p = _plugins.begin(); p != _plugins.end(); ++p) { if(name == p->name) { return p->plugin; } } return 0; } void IceInternal::loadPlugin(const Ice::CommunicatorPtr& communicator, const string& name, const string& pluginSpec, Ice::StringSeq& cmdArgs) { PluginManagerIPtr pluginManager = PluginManagerIPtr::dynamicCast(getInstance(communicator)->pluginManager()); pluginManager->loadPlugin(name, pluginSpec, cmdArgs); } Ice-3.5.1/cpp/src/Ice/UdpEndpointI.cpp0000644000076400007640000004116012223561476015513 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const string& ho, Int po, const string& mif, Int mttl, bool conn, const string& conId, bool co) : EndpointI(conId), _instance(instance), _host(ho), _port(po), _mcastInterface(mif), _mcastTtl(mttl), _connect(conn), _compress(co) { } IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const string& str, bool oaEndpoint) : EndpointI(""), _instance(instance), _port(0), _mcastTtl(-1), _connect(false), _compress(false) { const string delim = " \t\n\r"; string::size_type beg; string::size_type end = 0; while(true) { beg = str.find_first_not_of(delim, end); if(beg == string::npos) { break; } end = str.find_first_of(delim, beg); if(end == string::npos) { end = str.length(); } string option = str.substr(beg, end - beg); if(option[0] != '-') { EndpointParseException ex(__FILE__, __LINE__); ex.str = "expected an endpoint option but found `" + option + "' in endpoint `udp " + str + "'"; throw ex; } string argument; string::size_type argumentBeg = str.find_first_not_of(delim, end); if(argumentBeg != string::npos && str[argumentBeg] != '-') { beg = argumentBeg; if(str[beg] == '\"') { end = str.find_first_of('\"', beg + 1); if(end == string::npos) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "mismatched quotes around `" + argument + "' in endpoint `udp " + str + "'"; throw ex; } else { ++end; } } else { end = str.find_first_of(delim, beg); if(end == string::npos) { end = str.length(); } } argument = str.substr(beg, end - beg); if(argument[0] == '\"' && argument[argument.size() - 1] == '\"') { argument = argument.substr(1, argument.size() - 2); } } if(option == "-h") { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -h option in endpoint `udp " + str + "'"; throw ex; } const_cast(_host) = argument; } else if(option == "-p") { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -p option in endpoint `udp " + str + "'"; throw ex; } istringstream p(argument); if(!(p >> const_cast(_port)) || !p.eof()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid port value `" + argument + "' in endpoint `udp " + str + "'"; throw ex; } else if(_port < 0 || _port > 65535) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "port value `" + argument + "' out of range in endpoint `udp " + str + "'"; throw ex; } } else if(option == "-c") { if(!argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "unexpected argument `" + argument + "' provided for -c option in `udp " + str + "'"; throw ex; } const_cast(_connect) = true; } else if(option == "-z") { if(!argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "unexpected argument `" + argument + "' provided for -z option in `udp " + str + "'"; throw ex; } const_cast(_compress) = true; } else if(option == "-v" || option == "-e") { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for " + option + " option in endpoint `udp " + str + "'"; throw ex; } try { Ice::Byte major, minor; IceInternal::stringToMajorMinor(argument, major, minor); if(major != 1 || minor != 0) { _instance->initializationData().logger->warning("deprecated udp endpoint option: " + option); } } catch(const VersionParseException& e) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid version `" + argument + "' in endpoint `udp " + str + "':\n" + e.str; throw ex; } } else if(option == "--interface") { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for --interface option in endpoint `udp " + str + "'"; throw ex; } const_cast(_mcastInterface) = argument; } else if(option == "--ttl") { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for --ttl option in endpoint `udp " + str + "'"; throw ex; } istringstream p(argument); if(!(p >> const_cast(_mcastTtl)) || !p.eof()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid TTL value `" + argument + "' in endpoint `udp " + str + "'"; throw ex; } } else { Ice::EndpointParseException ex(__FILE__, __LINE__); ex.str = "unknown option `" + option + "' in endpoint `udp " + str + "'"; throw ex; } } if(_host.empty()) { const_cast(_host) = _instance->defaultsAndOverrides()->defaultHost; } else if(_host == "*") { if(oaEndpoint) { const_cast(_host) = string(); } else { EndpointParseException ex(__FILE__, __LINE__); ex.str = "`-h *' not valid for proxy endpoint `udp " + str + "'"; throw ex; } } } IceInternal::UdpEndpointI::UdpEndpointI(BasicStream* s) : _instance(s->instance()), _port(0), _mcastTtl(-1), _connect(false), _compress(false) { s->startReadEncaps(); s->read(const_cast(_host), false); s->read(const_cast(_port)); if(s->getReadEncoding() == Ice::Encoding_1_0) { Ice::Byte b; s->read(b); s->read(b); s->read(b); s->read(b); } // Not transmitted. //s->read(const_cast(_connect)); s->read(const_cast(_compress)); s->endReadEncaps(); } void IceInternal::UdpEndpointI::streamWrite(BasicStream* s) const { s->write(UDPEndpointType); s->startWriteEncaps(); s->write(_host, false); s->write(_port); if(s->getWriteEncoding() == Ice::Encoding_1_0) { s->write(Ice::Protocol_1_0); s->write(Ice::Encoding_1_0); } // Not transmitted. //s->write(_connect); s->write(_compress); s->endWriteEncaps(); } string IceInternal::UdpEndpointI::toString() 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 << "udp"; if(!_host.empty()) { s << " -h "; bool addQuote = _host.find(':') != string::npos; if(addQuote) { s << "\""; } s << _host; if(addQuote) { s << "\""; } } s << " -p " << _port; if(_mcastInterface.length() > 0) { s << " --interface " << _mcastInterface; } if(_mcastTtl != -1) { s << " --ttl " << _mcastTtl; } if(_connect) { s << " -c"; } if(_compress) { s << " -z"; } return s.str(); } EndpointInfoPtr IceInternal::UdpEndpointI::getInfo() const { class InfoI : public Ice::UDPEndpointInfo { public: InfoI(bool comp, const string& host, Ice::Int port, const std::string& mcastInterface, Ice::Int mcastTtl) : UDPEndpointInfo(-1, comp, host, port, mcastInterface, mcastTtl) { } virtual Ice::Short type() const { return UDPEndpointType; } virtual bool datagram() const { return true; } virtual bool secure() const { return false; } }; return new InfoI(_compress, _host, _port, _mcastInterface, _mcastTtl); } Short IceInternal::UdpEndpointI::type() const { return UDPEndpointType; } std::string IceInternal::UdpEndpointI::protocol() const { return "udp"; } Int IceInternal::UdpEndpointI::timeout() const { return -1; } EndpointIPtr IceInternal::UdpEndpointI::timeout(Int) const { return const_cast(this); } EndpointIPtr IceInternal::UdpEndpointI::connectionId(const string& connectionId) const { if(connectionId == _connectionId) { return const_cast(this); } else { return new UdpEndpointI(_instance, _host, _port, _mcastInterface, _mcastTtl, _connect, connectionId, _compress); } } bool IceInternal::UdpEndpointI::compress() const { return _compress; } EndpointIPtr IceInternal::UdpEndpointI::compress(bool compress) const { if(compress == _compress) { return const_cast(this); } else { return new UdpEndpointI(_instance, _host, _port, _mcastInterface, _mcastTtl, _connect, _connectionId, compress); } } bool IceInternal::UdpEndpointI::datagram() const { return true; } bool IceInternal::UdpEndpointI::secure() const { return false; } TransceiverPtr IceInternal::UdpEndpointI::transceiver(EndpointIPtr& endp) const { UdpTransceiver* p = new UdpTransceiver(_instance, _host, _port, _mcastInterface, _connect); endp = new UdpEndpointI(_instance, _host, p->effectivePort(), _mcastInterface, _mcastTtl, _connect, _connectionId, _compress); return p; } vector IceInternal::UdpEndpointI::connectors(Ice::EndpointSelectionType selType) const { return _instance->endpointHostResolver()->resolve(_host, _port, selType, const_cast(this)); } void IceInternal::UdpEndpointI::connectors_async(Ice::EndpointSelectionType selType, const EndpointI_connectorsPtr& cb) const { _instance->endpointHostResolver()->resolve(_host, _port, selType, const_cast(this), cb); } AcceptorPtr IceInternal::UdpEndpointI::acceptor(EndpointIPtr& endp, const string&) const { endp = const_cast(this); return 0; } vector IceInternal::UdpEndpointI::expand() const { vector endps; vector hosts = getHostsForEndpointExpand(_host, _instance->protocolSupport(), false); if(hosts.empty()) { endps.push_back(const_cast(this)); } else { for(vector::const_iterator p = hosts.begin(); p != hosts.end(); ++p) { endps.push_back(new UdpEndpointI(_instance, *p, _port, _mcastInterface, _mcastTtl, _connect, _connectionId, _compress)); } } return endps; } bool IceInternal::UdpEndpointI::equivalent(const EndpointIPtr& endpoint) const { const UdpEndpointI* udpEndpointI = dynamic_cast(endpoint.get()); if(!udpEndpointI) { return false; } return udpEndpointI->_host == _host && udpEndpointI->_port == _port; } vector IceInternal::UdpEndpointI::connectors(const vector
          & addresses, const NetworkProxyPtr&) const { vector connectors; for(unsigned int i = 0; i < addresses.size(); ++i) { connectors.push_back(new UdpConnector(_instance, addresses[i], _mcastInterface, _mcastTtl, _connectionId)); } return connectors; } bool IceInternal::UdpEndpointI::operator==(const LocalObject& r) const { const UdpEndpointI* p = dynamic_cast(&r); if(!p) { return false; } if(this == p) { return true; } if(_host != p->_host) { return false; } if(_port != p->_port) { return false; } if(_compress != p->_compress) { return false; } if(_connectionId != p->_connectionId) { return false; } if(_connect != p->_connect) { return false; } if(_mcastTtl != p->_mcastTtl) { return false; } if(_mcastInterface != p->_mcastInterface) { return false; } return true; } bool IceInternal::UdpEndpointI::operator<(const LocalObject& r) const { const UdpEndpointI* p = dynamic_cast(&r); if(!p) { const EndpointI* e = dynamic_cast(&r); if(!e) { return false; } return type() < e->type(); } if(this == p) { return false; } if(_host < p->_host) { return true; } else if (p->_host < _host) { return false; } if(_port < p->_port) { return true; } else if(p->_port < _port) { 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; } if(!_connect && p->_connect) { return true; } else if(!p->_connect && _connect) { return false; } if(_mcastTtl < p->_mcastTtl) { return true; } else if(p->_mcastTtl < _mcastTtl) { return false; } if(_mcastInterface < p->_mcastInterface) { return true; } else if(p->_mcastInterface < _mcastInterface) { return false; } return false; } Ice::Int IceInternal::UdpEndpointI::hashInit() const { Ice::Int h = 5381; hashAdd(h, UDPEndpointType); hashAdd(h, _host); hashAdd(h, _port); hashAdd(h, _mcastInterface); hashAdd(h, _mcastTtl); hashAdd(h, _connect); hashAdd(h, _connectionId); hashAdd(h, _compress); return h; } IceInternal::UdpEndpointFactory::UdpEndpointFactory(const InstancePtr& instance) : _instance(instance) { } IceInternal::UdpEndpointFactory::~UdpEndpointFactory() { } Short IceInternal::UdpEndpointFactory::type() const { return UDPEndpointType; } string IceInternal::UdpEndpointFactory::protocol() const { return "udp"; } EndpointIPtr IceInternal::UdpEndpointFactory::create(const std::string& str, bool oaEndpoint) const { return new UdpEndpointI(_instance, str, oaEndpoint); } EndpointIPtr IceInternal::UdpEndpointFactory::read(BasicStream* s) const { return new UdpEndpointI(s); } void IceInternal::UdpEndpointFactory::destroy() { _instance = 0; } Ice-3.5.1/cpp/src/Ice/EventHandler.h0000644000076400007640000000337012223561476015176 0ustar mesmes// ********************************************************************** // // 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 ICE_EVENT_HANDLER_H #define ICE_EVENT_HANDLER_H #include #include #include #include #include #include namespace IceInternal { class ICE_API EventHandler : virtual public ::IceUtil::Shared { public: #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) // // Called to start a new asynchronous read or write operation. // virtual bool startAsync(SocketOperation) = 0; virtual bool finishAsync(SocketOperation) = 0; #endif // // Called when there's a message ready to be processed. // virtual void message(ThreadPoolCurrent&) = 0; // // Called when the event handler is unregistered. // virtual void finished(ThreadPoolCurrent&) = 0; // // Get a textual representation of the event handler. // virtual std::string toString() const = 0; // // Get the native information of the handler, this is used by the selector. // virtual NativeInfoPtr getNativeInfo() = 0; protected: EventHandler(); virtual ~EventHandler(); #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) SocketOperation _ready; SocketOperation _pending; SocketOperation _started; bool _finish; #else SocketOperation _disabled; #endif SocketOperation _registered; friend class ThreadPool; friend class Selector; }; } #endif Ice-3.5.1/cpp/src/Ice/Exception.cpp0000644000076400007640000004342412223561476015114 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #ifdef ICE_OS_WINRT # include #endif #include using namespace std; using namespace Ice; using namespace IceInternal; namespace { inline string socketErrorToString(int error) { if(error == 0) { return "unknown error"; } #ifdef ICE_OS_WINRT if(error == E_ACCESSDENIED) { ostringstream os; os << "access to a resource or feature is denied, ensure that you have requested the appropriate\n"; os << "capability and made the required declarations in the package manifest of your app."; return os.str(); } else { return IceUtil::wstringToString( static_cast(error).ToString()->Data()); } #else return IceUtilInternal::errorToString(error); #endif } }; namespace IceInternal { namespace Ex { void throwUOE(const string& expectedType, const ObjectPtr& v) { // // If the object is an unknown sliced object, we didn't find an // object factory, in this case raise a NoObjectFactoryException // instead. // UnknownSlicedObject* uso = dynamic_cast(v.get()); if(uso) { throw NoObjectFactoryException(__FILE__, __LINE__, "", uso->getUnknownTypeId()); } string type = v->ice_id(); throw Ice::UnexpectedObjectException(__FILE__, __LINE__, "expected element of type `" + expectedType + "' but received '" + type, type, expectedType); } void throwMemoryLimitException(const char* file, int line, size_t requested, size_t maximum) { ostringstream s; s << "requested " << requested << " bytes, maximum allowed is " << maximum << " bytes (see Ice.MessageSizeMax)"; throw Ice::MemoryLimitException(file, line, s.str()); } void throwMarshalException(const char* file, int line, const string& reason) { throw Ice::MarshalException(file, line, reason); } } } void Ice::UserException::__write(::IceInternal::BasicStream* os) const { os->startWriteException(0); __writeImpl(os); os->endWriteException(); } void Ice::UserException::__read(::IceInternal::BasicStream* is) { is->startReadException(); __readImpl(is); is->endReadException(false); } void Ice::UserException::__write(const Ice::OutputStreamPtr& os) const { os->startException(0); __writeImpl(os); os->endException(); } void Ice::UserException::__read(const Ice::InputStreamPtr& is) { is->startException(); __readImpl(is); is->endException(false); } void Ice::UserException::__writeImpl(const Ice::OutputStreamPtr&) const { throw MarshalException(__FILE__, __LINE__, "user exception was not generated with stream support"); } void Ice::UserException::__readImpl(const Ice::InputStreamPtr&) { throw MarshalException(__FILE__, __LINE__, "user exception was not generated with stream support"); } bool Ice::UserException::__usesClasses() const { return false; } Ice::LocalException::LocalException(const char* file, int line) : Exception(file, line) { } Ice::LocalException::~LocalException() throw() { } Ice::SystemException::SystemException(const char* file, int line) : Exception(file, line) { } Ice::SystemException::~SystemException() throw() { } #if defined(__SUNPRO_CC) ostream& Ice::operator<<(ostream& out, const Ice::UserException& ex) { ex.ice_print(out); return out; } ostream& Ice::operator<<(ostream& out, const Ice::LocalException& ex) { ex.ice_print(out); return out; } ostream& Ice::operator<<(ostream& out, const Ice::SystemException& ex) { ex.ice_print(out); return out; } #endif void Ice::InitializationException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\ninitialization exception"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::UnknownException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nunknown exception"; if(!unknown.empty()) { out << ":\n" << unknown; } } void Ice::UnknownLocalException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nunknown local exception"; if(!unknown.empty()) { out << ":\n" << unknown; } } void Ice::UnknownUserException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nunknown user exception"; if(!unknown.empty()) { out << ":\n" << unknown; } } void Ice::VersionMismatchException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nIce library version mismatch"; } void Ice::CommunicatorDestroyedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\ncommunicator object destroyed"; } void Ice::ObjectAdapterDeactivatedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nobject adapter `" << name << "' deactivated"; } void Ice::ObjectAdapterIdInUseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nobject adapter with id `" << id << "' is already in use"; } void Ice::NoEndpointException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nno suitable endpoint available for proxy `" << proxy << "'"; } void Ice::EndpointParseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nerror while parsing endpoint `" << str << "'"; } void Ice::EndpointSelectionTypeParseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nerror while parsing endpoint selection type `" << str << "'"; } void Ice::VersionParseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nerror while parsing version `" << str << "'"; } void Ice::IdentityParseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nerror while parsing identity `" << str << "'"; } void Ice::ProxyParseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nerror while parsing proxy `" << str << "'"; } void Ice::IllegalIdentityException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nillegal identity: `"; if(id.category.empty()) { out << IceUtilInternal::escapeString(id.name, "/"); } else { out << IceUtilInternal::escapeString(id.category, "/") << '/' << IceUtilInternal::escapeString(id.name, "/"); } out << "'"; } static void printFailedRequestData(ostream& out, const RequestFailedException& ex) { out << ":\nidentity: `"; if(ex.id.category.empty()) { out << IceUtilInternal::escapeString(ex.id.name, "/"); } else { out << IceUtilInternal::escapeString(ex.id.category, "/") << '/' << IceUtilInternal::escapeString(ex.id.name, "/"); } out << "'"; out << "\nfacet: " << ex.facet; out << "\noperation: " << ex.operation; } void Ice::RequestFailedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nrequest failed"; printFailedRequestData(out, *this); } void Ice::ObjectNotExistException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nobject does not exist"; printFailedRequestData(out, *this); } void Ice::FacetNotExistException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nfacet does not exist"; printFailedRequestData(out, *this); } void Ice::OperationNotExistException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\noperation does not exist"; printFailedRequestData(out, *this); } void Ice::SyscallException::ice_print(ostream& out) const { Exception::ice_print(out); if(error != 0) { out << ":\nsyscall exception: " << IceUtilInternal::errorToString(error); } } void Ice::SocketException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nsocket exception: " << socketErrorToString(error); } void Ice::FileException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nfile exception: "; if(error == 0) { out << "couldn't open file"; } else { out << IceUtilInternal::errorToString(error); } if(!path.empty()) { out << "\npath: " << path; } } void Ice::ConnectFailedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nconnect failed: " << socketErrorToString(error); } void Ice::ConnectionRefusedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nconnection refused: " << socketErrorToString(error); } void Ice::ConnectionLostException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nconnection lost: "; if(error == 0) { out << "recv() returned zero"; } else { out << socketErrorToString(error); } } void Ice::DNSException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nDNS error: "; #ifdef ICE_OS_WINRT out << socketErrorToString(error); #else out << errorToStringDNS(error); #endif out << "\nhost: " << host; } void Ice::TimeoutException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\ntimeout while sending or receiving data"; } void Ice::ConnectTimeoutException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\ntimeout while establishing a connection"; } void Ice::CloseTimeoutException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\ntimeout while closing a connection"; } void Ice::ConnectionTimeoutException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nconnection has timed out"; } void Ice::ProtocolException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol exception"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::BadMagicException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nunknown magic number: "; ios_base::fmtflags originalFlags = out.flags(); // Save stream state ostream::char_type originalFill = out.fill(); out.flags(ios_base::hex); // Change to hex out.fill('0'); // Fill with leading zeros out << "0x" << setw(2) << static_cast(static_cast(badMagic[0])) << ", "; out << "0x" << setw(2) << static_cast(static_cast(badMagic[1])) << ", "; out << "0x" << setw(2) << static_cast(static_cast(badMagic[2])) << ", "; out << "0x" << setw(2) << static_cast(static_cast(badMagic[3])); out.fill(originalFill); // Restore stream state out.flags(originalFlags); if(!reason.empty()) { out << "\n" << reason; } } void Ice::UnsupportedProtocolException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: unsupported protocol version: " << bad; out << "\n(can only support protocols compatible with version " << supported << ")"; } void Ice::UnsupportedEncodingException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: unsupported encoding version: " << bad; out << "\n(can only support encodings compatible with version " << supported << ")"; if(!reason.empty()) { out << "\n" << reason; } } void Ice::UnknownMessageException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: unknown message type"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::ConnectionNotValidatedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: received message over unvalidated connection"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::UnknownRequestIdException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: unknown request id"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::UnknownReplyStatusException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: unknown reply status"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::CloseConnectionException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: connection closed"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::ForcedCloseConnectionException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: connection forcefully closed"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::IllegalMessageSizeException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: illegal message size"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::CompressionException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: failed to compress or uncompress data"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::DatagramLimitException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: maximum datagram payload size exceeded"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::MarshalException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: error during marshaling or unmarshaling"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::ProxyUnmarshalException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: inconsistent proxy data during unmarshaling"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::UnmarshalOutOfBoundsException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: out of bounds during unmarshaling"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::NoObjectFactoryException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: no suitable object factory found for `" << type << "'"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::UnexpectedObjectException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nunexpected class instance of type `" << type << "'; expected instance of type `" << expectedType << "'"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::MemoryLimitException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: memory limit exceeded"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::StringConversionException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: string conversion failed"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::EncapsulationException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: illegal encapsulation"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::PluginInitializationException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nplug-in initialization failed"; if(!reason.empty()) { out << ": " << reason; } } void Ice::CollocationOptimizationException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nrequested feature not available with collocation optimization"; } void Ice::AlreadyRegisteredException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n" << kindOfObject << " with id `" << id << "' is already registered"; } void Ice::NotRegisteredException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n no " << kindOfObject << " with id `" << id << "' is registered"; } void Ice::TwowayOnlyException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n operation `" << operation << "' can only be invoked as a twoway request"; } void Ice::CloneNotImplementedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n ice_clone() must be implemented in classes derived from abstract base classes"; } void Ice::FeatureNotSupportedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nfeature `" << unsupportedFeature << "' is not supported."; } void Ice::SecurityException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nsecurity exception"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::FixedProxyException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nfixed proxy exception"; } void Ice::ResponseSentException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nresponse sent exception"; } Ice-3.5.1/cpp/src/Ice/Proxy.cpp0000644000076400007640000016311712223561476014301 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // To convert from ConnectionIPtr to ConnectionPtr in ice_getConnection(). #include #include using namespace std; using namespace Ice; using namespace IceInternal; namespace { const string ice_ping_name = "ice_ping"; const string ice_ids_name = "ice_ids"; const string ice_id_name = "ice_id"; const string ice_isA_name = "ice_isA"; const string ice_invoke_name = "ice_invoke"; const string ice_flushBatchRequests_name = "ice_flushBatchRequests"; } ::Ice::ObjectPrx IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string& typeId, const Context* context) { if(b) { ObjectPrx bb = b->ice_facet(f); try { if(context == 0 ? bb->ice_isA(typeId) : bb->ice_isA(typeId, *context)) { return bb; } #ifndef NDEBUG else { assert(typeId != "::Ice::Object"); } #endif } catch(const FacetNotExistException&) { } } return 0; } #ifdef ICE_CPP11 void IceInternal::Cpp11FnOnewayCallbackNC::__completed(const ::Ice::AsyncResultPtr& result) const { try { result->getProxy()->__end(result, result->getOperation()); } catch(const ::Ice::Exception& ex) { Cpp11FnCallbackNC::__exception(result, ex); return; } if(_cb != nullptr) { _cb(); } } #endif bool IceProxy::Ice::Object::operator==(const Object& r) const { return _reference == r._reference; } bool IceProxy::Ice::Object::operator!=(const Object& r) const { return _reference != r._reference; } bool IceProxy::Ice::Object::operator<(const Object& r) const { return _reference < r._reference; } Int IceProxy::Ice::Object::ice_getHash() const { return _reference->hash(); } CommunicatorPtr IceProxy::Ice::Object::ice_getCommunicator() const { return _reference->getCommunicator(); } string IceProxy::Ice::Object::ice_toString() const { // // Returns the stringified proxy. There's no need to convert the // string to a native string: a stringified proxy only contains // printable ASCII which is a subset of all native character sets. // return _reference->toString(); } bool IceProxy::Ice::Object::ice_isA(const string& typeId, const Context* context) { InvocationObserver __observer(this, ice_isA_name, context); int __cnt = 0; while(true) { Handle< ::IceDelegate::Ice::Object> __del; try { __checkTwowayOnly(ice_isA_name); __del = __getDelegate(false); return __del->ice_isA(typeId, context, __observer); } catch(const LocalExceptionWrapper& __ex) { __handleExceptionWrapperRelaxed(__del, __ex, true, __cnt, __observer); } catch(const LocalException& __ex) { __handleException(__del, __ex, true, __cnt, __observer); } } } Ice::AsyncResultPtr IceProxy::Ice::Object::begin_ice_isA(const string& typeId, const Context* ctx, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie) { OutgoingAsyncPtr __result = new OutgoingAsync(this, ice_isA_name, del, cookie); __checkAsyncTwowayOnly(ice_isA_name); try { __result->__prepare(ice_isA_name, Nonmutating, ctx); IceInternal::BasicStream* __os = __result->__startWriteParams(DefaultFormat); __os->write(typeId); __result->__endWriteParams(); __result->__send(true); } catch(const LocalException& __ex) { __result->__exceptionAsync(__ex); } return __result; } bool IceProxy::Ice::Object::end_ice_isA(const AsyncResultPtr& __result) { AsyncResult::__check(__result, this, ice_isA_name); bool __ok = __result->__wait(); try { if(!__ok) { try { __result->__throwUserException(); } catch(const UserException& __ex) { throw UnknownUserException(__FILE__, __LINE__, __ex.ice_name()); } } bool __ret; IceInternal::BasicStream* __is = __result->__startReadParams(); __is->read(__ret); __result->__endReadParams(); return __ret; } catch(const ::Ice::LocalException& ex) { __result->__getObserver().failed(ex.ice_name()); throw; } } void IceProxy::Ice::Object::ice_ping(const Context* context) { InvocationObserver __observer(this, ice_ping_name, context); int __cnt = 0; while(true) { Handle __del; try { __del = __getDelegate(false); __del->ice_ping(context, __observer); return; } catch(const LocalExceptionWrapper& __ex) { __handleExceptionWrapperRelaxed(__del, __ex, true, __cnt, __observer); } catch(const LocalException& __ex) { __handleException(__del, __ex, true, __cnt, __observer); } } } AsyncResultPtr IceProxy::Ice::Object::begin_ice_ping(const Context* ctx, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie) { OutgoingAsyncPtr __result = new OutgoingAsync(this, ice_ping_name, del, cookie); try { __result->__prepare(ice_ping_name, Nonmutating, ctx); __result->__writeEmptyParams(); __result->__send(true); } catch(const LocalException& __ex) { __result->__exceptionAsync(__ex); } return __result; } void IceProxy::Ice::Object::end_ice_ping(const AsyncResultPtr& __result) { __end(__result, ice_ping_name); } vector IceProxy::Ice::Object::ice_ids(const Context* context) { InvocationObserver __observer(this, ice_ids_name, context); int __cnt = 0; while(true) { Handle __del; try { __checkTwowayOnly(ice_ids_name); __del = __getDelegate(false); return __del->ice_ids(context, __observer); } catch(const LocalExceptionWrapper& __ex) { __handleExceptionWrapperRelaxed(__del, __ex, true, __cnt, __observer); } catch(const LocalException& __ex) { __handleException(__del, __ex, true, __cnt, __observer); } } } string IceProxy::Ice::Object::ice_id(const Context* context) { InvocationObserver __observer(this, ice_id_name, context); int __cnt = 0; while(true) { Handle __del; try { __checkTwowayOnly(ice_id_name); __del = __getDelegate(false); return __del->ice_id(context, __observer); } catch(const LocalExceptionWrapper& __ex) { __handleExceptionWrapperRelaxed(__del, __ex, true, __cnt, __observer); } catch(const LocalException& __ex) { __handleException(__del, __ex, true, __cnt, __observer); } } } AsyncResultPtr IceProxy::Ice::Object::begin_ice_ids(const Context* ctx, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie) { OutgoingAsyncPtr __result = new OutgoingAsync(this, ice_ids_name, del, cookie); __checkAsyncTwowayOnly(ice_ids_name); try { __result->__prepare(ice_ids_name, Nonmutating, ctx); __result->__writeEmptyParams(); __result->__send(true); } catch(const LocalException& __ex) { __result->__exceptionAsync(__ex); } return __result; } vector IceProxy::Ice::Object::end_ice_ids(const AsyncResultPtr& __result) { AsyncResult::__check(__result, this, ice_ids_name); bool __ok = __result->__wait(); try { if(!__ok) { try { __result->__throwUserException(); } catch(const UserException& __ex) { throw UnknownUserException(__FILE__, __LINE__, __ex.ice_name()); } } vector __ret; IceInternal::BasicStream* __is = __result->__startReadParams(); __is->read(__ret); __result->__endReadParams(); return __ret; } catch(const ::Ice::LocalException& ex) { __result->__getObserver().failed(ex.ice_name()); throw; } } AsyncResultPtr IceProxy::Ice::Object::begin_ice_id(const Context* ctx, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie) { OutgoingAsyncPtr __result = new OutgoingAsync(this, ice_id_name, del, cookie); __checkAsyncTwowayOnly(ice_id_name); try { __result->__prepare(ice_id_name, Nonmutating, ctx); __result->__writeEmptyParams(); __result->__send(true); } catch(const LocalException& __ex) { __result->__exceptionAsync(__ex); } return __result; } string IceProxy::Ice::Object::end_ice_id(const AsyncResultPtr& __result) { AsyncResult::__check(__result, this, ice_id_name); bool __ok = __result->__wait(); try { if(!__ok) { try { __result->__throwUserException(); } catch(const UserException& __ex) { throw UnknownUserException(__FILE__, __LINE__, __ex.ice_name()); } } string __ret; IceInternal::BasicStream* __is = __result->__startReadParams(); __is->read(__ret); __result->__endReadParams(); return __ret; } catch(const ::Ice::LocalException& ex) { __result->__getObserver().failed(ex.ice_name()); throw; } } bool IceProxy::Ice::Object::ice_invoke(const string& operation, OperationMode mode, const vector& inEncaps, vector& outEncaps, const Context* context) { pair inPair; if(inEncaps.empty()) { inPair.first = inPair.second = 0; } else { inPair.first = &inEncaps[0]; inPair.second = inPair.first + inEncaps.size(); } return ice_invoke(operation, mode, inPair, outEncaps, context); } bool IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb, const string& operation, OperationMode mode, const vector& inEncaps) { Callback_Object_ice_invokePtr del; if(dynamic_cast< ::Ice::AMISentCallback*>(cb.get())) { del = newCallback_Object_ice_invoke(cb, &AMI_Object_ice_invoke::__response, &AMI_Object_ice_invoke::__exception, &AMI_Object_ice_invoke::__sent); } else { del = newCallback_Object_ice_invoke(cb, &AMI_Object_ice_invoke::__response, &AMI_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inEncaps, del); return result->sentSynchronously(); } bool IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb, const string& operation, OperationMode mode, const vector& inEncaps, const Context& context) { Callback_Object_ice_invokePtr del; if(dynamic_cast< ::Ice::AMISentCallback*>(cb.get())) { del = newCallback_Object_ice_invoke(cb, &AMI_Object_ice_invoke::__response, &AMI_Object_ice_invoke::__exception, &AMI_Object_ice_invoke::__sent); } else { del = newCallback_Object_ice_invoke(cb, &AMI_Object_ice_invoke::__response, &AMI_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inEncaps, context, del); return result->sentSynchronously(); } AsyncResultPtr IceProxy::Ice::Object::begin_ice_invoke(const string& operation, OperationMode mode, const vector& inEncaps, const Context* ctx, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie) { pair inPair; if(inEncaps.empty()) { inPair.first = inPair.second = 0; } else { inPair.first = &inEncaps[0]; inPair.second = inPair.first + inEncaps.size(); } return begin_ice_invoke(operation, mode, inPair, ctx, del, cookie); } bool IceProxy::Ice::Object::end_ice_invoke(vector& outEncaps, const AsyncResultPtr& __result) { AsyncResult::__check(__result, this, ice_invoke_name); bool ok = __result->__wait(); if(_reference->getMode() == Reference::ModeTwoway) { try { const Byte* v; Int sz; __result->__readParamEncaps(v, sz); vector(v, v + sz).swap(outEncaps); } catch(const ::Ice::LocalException& ex) { __result->__getObserver().failed(ex.ice_name()); throw; } } return ok; } bool IceProxy::Ice::Object::ice_invoke(const string& operation, OperationMode mode, const pair& inEncaps, vector& outEncaps, const Context* context) { InvocationObserver __observer(this, operation, context); int __cnt = 0; while(true) { Handle< ::IceDelegate::Ice::Object> __del; try { __del = __getDelegate(false); return __del->ice_invoke(operation, mode, inEncaps, outEncaps, context, __observer); } catch(const LocalExceptionWrapper& __ex) { bool canRetry = mode == Nonmutating || mode == Idempotent; if(canRetry) { __handleExceptionWrapperRelaxed(__del, __ex, true, __cnt, __observer); } else { __handleExceptionWrapper(__del, __ex, __observer); } } catch(const LocalException& __ex) { __handleException(__del, __ex, true, __cnt, __observer); } } } bool IceProxy::Ice::Object::ice_invoke_async(const AMI_Array_Object_ice_invokePtr& cb, const string& operation, OperationMode mode, const pair& inEncaps) { Callback_Object_ice_invokePtr del; if(dynamic_cast< ::Ice::AMISentCallback*>(cb.get())) { del = newCallback_Object_ice_invoke(cb, &AMI_Array_Object_ice_invoke::__response, &AMI_Array_Object_ice_invoke::__exception, &AMI_Array_Object_ice_invoke::__sent); } else { del = newCallback_Object_ice_invoke(cb, &AMI_Array_Object_ice_invoke::__response, &AMI_Array_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inEncaps, del); return result->sentSynchronously(); } bool IceProxy::Ice::Object::ice_invoke_async(const AMI_Array_Object_ice_invokePtr& cb, const string& operation, OperationMode mode, const pair& inEncaps, const Context& context) { Callback_Object_ice_invokePtr del; if(dynamic_cast< ::Ice::AMISentCallback*>(cb.get())) { del = newCallback_Object_ice_invoke(cb, &AMI_Array_Object_ice_invoke::__response, &AMI_Array_Object_ice_invoke::__exception, &AMI_Array_Object_ice_invoke::__sent); } else { del = newCallback_Object_ice_invoke(cb, &AMI_Array_Object_ice_invoke::__response, &AMI_Array_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inEncaps, context, del); return result->sentSynchronously(); } AsyncResultPtr IceProxy::Ice::Object::begin_ice_invoke(const string& operation, OperationMode mode, const pair& inEncaps, const Context* ctx, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie) { OutgoingAsyncPtr __result = new OutgoingAsync(this, ice_invoke_name, del, cookie); try { __result->__prepare(operation, mode, ctx); __result->__writeParamEncaps(inEncaps.first, static_cast(inEncaps.second - inEncaps.first)); __result->__send(true); } catch(const LocalException& __ex) { __result->__exceptionAsync(__ex); } return __result; } bool IceProxy::Ice::Object::___end_ice_invoke(pair& outEncaps, const AsyncResultPtr& __result) { AsyncResult::__check(__result, this, ice_invoke_name); bool ok = __result->__wait(); if(_reference->getMode() == Reference::ModeTwoway) { try { Int sz; __result->__readParamEncaps(outEncaps.first, sz); outEncaps.second = outEncaps.first + sz; } catch(const ::Ice::LocalException& ex) { __result->__getObserver().failed(ex.ice_name()); throw; } } return ok; } Identity IceProxy::Ice::Object::ice_getIdentity() const { return _reference->getIdentity(); } ObjectPrx IceProxy::Ice::Object::ice_identity(const Identity& newIdentity) const { if(newIdentity.name.empty()) { throw IllegalIdentityException(__FILE__, __LINE__); } if(newIdentity == _reference->getIdentity()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = new Object; proxy->setup(_reference->changeIdentity(newIdentity)); return proxy; } } Context IceProxy::Ice::Object::ice_getContext() const { return _reference->getContext()->getValue(); } ObjectPrx IceProxy::Ice::Object::ice_context(const Context& newContext) const { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeContext(newContext)); return proxy; } const string& IceProxy::Ice::Object::ice_getFacet() const { return _reference->getFacet(); } ObjectPrx IceProxy::Ice::Object::ice_facet(const string& newFacet) const { if(newFacet == _reference->getFacet()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = new Object; proxy->setup(_reference->changeFacet(newFacet)); return proxy; } } string IceProxy::Ice::Object::ice_getAdapterId() const { return _reference->getAdapterId(); } ObjectPrx IceProxy::Ice::Object::ice_adapterId(const string& newAdapterId) const { if(newAdapterId == _reference->getAdapterId()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeAdapterId(newAdapterId)); return proxy; } } EndpointSeq IceProxy::Ice::Object::ice_getEndpoints() const { vector endpoints = _reference->getEndpoints(); EndpointSeq retSeq; for(vector::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { retSeq.push_back(EndpointPtr::dynamicCast(*p)); } return retSeq; } ObjectPrx IceProxy::Ice::Object::ice_endpoints(const EndpointSeq& newEndpoints) const { vector endpoints; for(EndpointSeq::const_iterator p = newEndpoints.begin(); p != newEndpoints.end(); ++p) { endpoints.push_back(EndpointIPtr::dynamicCast(*p)); } if(endpoints == _reference->getEndpoints()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeEndpoints(endpoints)); return proxy; } } Int IceProxy::Ice::Object::ice_getLocatorCacheTimeout() const { return _reference->getLocatorCacheTimeout(); } ObjectPrx IceProxy::Ice::Object::ice_locatorCacheTimeout(Int newTimeout) const { if(newTimeout == _reference->getLocatorCacheTimeout()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeLocatorCacheTimeout(newTimeout)); return proxy; } } bool IceProxy::Ice::Object::ice_isConnectionCached() const { return _reference->getCacheConnection(); } ObjectPrx IceProxy::Ice::Object::ice_connectionCached(bool newCache) const { if(newCache == _reference->getCacheConnection()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeCacheConnection(newCache)); return proxy; } } EndpointSelectionType IceProxy::Ice::Object::ice_getEndpointSelection() const { return _reference->getEndpointSelection(); } ObjectPrx IceProxy::Ice::Object::ice_endpointSelection(EndpointSelectionType newType) const { if(newType == _reference->getEndpointSelection()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeEndpointSelection(newType)); return proxy; } } bool IceProxy::Ice::Object::ice_isSecure() const { return _reference->getSecure(); } ObjectPrx IceProxy::Ice::Object::ice_secure(bool b) const { if(b == _reference->getSecure()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeSecure(b)); return proxy; } } ::Ice::EncodingVersion IceProxy::Ice::Object::ice_getEncodingVersion() const { return _reference->getEncoding(); } ObjectPrx IceProxy::Ice::Object::ice_encodingVersion(const ::Ice::EncodingVersion& encoding) const { if(encoding == _reference->getEncoding()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeEncoding(encoding)); return proxy; } } bool IceProxy::Ice::Object::ice_isPreferSecure() const { return _reference->getPreferSecure(); } ObjectPrx IceProxy::Ice::Object::ice_preferSecure(bool b) const { if(b == _reference->getPreferSecure()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changePreferSecure(b)); return proxy; } } RouterPrx IceProxy::Ice::Object::ice_getRouter() const { RouterInfoPtr ri = _reference->getRouterInfo(); return ri ? ri->getRouter() : RouterPrx(); } ObjectPrx IceProxy::Ice::Object::ice_router(const RouterPrx& router) const { ReferencePtr ref = _reference->changeRouter(router); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(ref); return proxy; } } LocatorPrx IceProxy::Ice::Object::ice_getLocator() const { LocatorInfoPtr ri = _reference->getLocatorInfo(); return ri ? ri->getLocator() : LocatorPrx(); } ObjectPrx IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const { ReferencePtr ref = _reference->changeLocator(locator); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(ref); return proxy; } } bool IceProxy::Ice::Object::ice_isCollocationOptimized() const { return _reference->getCollocationOptimized(); } ObjectPrx IceProxy::Ice::Object::ice_collocationOptimized(bool b) const { if(b == _reference->getCollocationOptimized()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeCollocationOptimized(b)); return proxy; } } ObjectPrx IceProxy::Ice::Object::ice_twoway() const { if(_reference->getMode() == Reference::ModeTwoway) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeMode(Reference::ModeTwoway)); return proxy; } } bool IceProxy::Ice::Object::ice_isTwoway() const { return _reference->getMode() == Reference::ModeTwoway; } ObjectPrx IceProxy::Ice::Object::ice_oneway() const { if(_reference->getMode() == Reference::ModeOneway) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeMode(Reference::ModeOneway)); return proxy; } } bool IceProxy::Ice::Object::ice_isOneway() const { return _reference->getMode() == Reference::ModeOneway; } ObjectPrx IceProxy::Ice::Object::ice_batchOneway() const { if(_reference->getMode() == Reference::ModeBatchOneway) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeMode(Reference::ModeBatchOneway)); return proxy; } } bool IceProxy::Ice::Object::ice_isBatchOneway() const { return _reference->getMode() == Reference::ModeBatchOneway; } ObjectPrx IceProxy::Ice::Object::ice_datagram() const { if(_reference->getMode() == Reference::ModeDatagram) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeMode(Reference::ModeDatagram)); return proxy; } } bool IceProxy::Ice::Object::ice_isDatagram() const { return _reference->getMode() == Reference::ModeDatagram; } ObjectPrx IceProxy::Ice::Object::ice_batchDatagram() const { if(_reference->getMode() == Reference::ModeBatchDatagram) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeMode(Reference::ModeBatchDatagram)); return proxy; } } bool IceProxy::Ice::Object::ice_isBatchDatagram() const { return _reference->getMode() == Reference::ModeBatchDatagram; } ObjectPrx IceProxy::Ice::Object::ice_compress(bool b) const { ReferencePtr ref = _reference->changeCompress(b); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(ref); return proxy; } } ObjectPrx IceProxy::Ice::Object::ice_timeout(int t) const { ReferencePtr ref = _reference->changeTimeout(t); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(ref); return proxy; } } ObjectPrx IceProxy::Ice::Object::ice_connectionId(const string& id) const { ReferencePtr ref = _reference->changeConnectionId(id); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy = __newInstance(); proxy->setup(ref); return proxy; } } string IceProxy::Ice::Object::ice_getConnectionId() const { return _reference->getConnectionId(); } ConnectionPtr IceProxy::Ice::Object::ice_getConnection() { InvocationObserver __observer(this, "ice_getConnection", 0); int __cnt = 0; while(true) { Handle< ::IceDelegate::Ice::Object> __del; try { __del = __getDelegate(false); return __del->__getRequestHandler()->getConnection(true); // Wait for the connection to be established. } catch(const LocalException& __ex) { __handleException(__del, __ex, true, __cnt, __observer); } } } ConnectionPtr IceProxy::Ice::Object::ice_getCachedConnection() const { Handle< ::IceDelegate::Ice::Object> __del; { IceUtil::Mutex::Lock sync(_mutex); __del = _delegate; } if(__del) { try { return __del->__getRequestHandler()->getConnection(false); } catch(const LocalException&) { } } return 0; } void IceProxy::Ice::Object::ice_flushBatchRequests() { // // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch // requests were queued with the connection, they would be lost without being noticed. // InvocationObserver __observer(this, ice_flushBatchRequests_name, 0); Handle< ::IceDelegate::Ice::Object> __del; int __cnt = -1; // Don't retry. try { __del = __getDelegate(false); __del->ice_flushBatchRequests(__observer); } catch(const LocalException& __ex) { __handleException(__del, __ex, true, __cnt, __observer); } } bool IceProxy::Ice::Object::ice_flushBatchRequests_async(const AMI_Object_ice_flushBatchRequestsPtr& cb) { Callback_Object_ice_flushBatchRequestsPtr __del; if(dynamic_cast< AMISentCallback*>(cb.get())) { __del = newCallback_Object_ice_flushBatchRequests(cb, &AMI_Object_ice_flushBatchRequests::__exception, &AMI_Object_ice_flushBatchRequests::__sent); } else { __del = newCallback_Object_ice_flushBatchRequests(cb, &AMI_Object_ice_flushBatchRequests::__exception); } ::Ice::AsyncResultPtr result = begin_ice_flushBatchRequestsInternal(__del, 0); return result->sentSynchronously(); } ::Ice::AsyncResultPtr IceProxy::Ice::Object::begin_ice_flushBatchRequestsInternal(const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie) { ::IceInternal::ProxyBatchOutgoingAsyncPtr __result = new ::IceInternal::ProxyBatchOutgoingAsync(this, ice_flushBatchRequests_name, del, cookie); try { __result->__send(); } catch(const LocalException& __ex) { __result->__exceptionAsync(__ex); } return __result; } void IceProxy::Ice::Object::end_ice_flushBatchRequests(const AsyncResultPtr& __result) { AsyncResult::__check(__result, this, ice_flushBatchRequests_name); __result->__wait(); } Int IceProxy::Ice::Object::__hash() const { return _reference->hash(); } void IceProxy::Ice::Object::__copyFrom(const ObjectPrx& from) { ReferencePtr ref; Handle< ::IceDelegateD::Ice::Object> delegateD; Handle< ::IceDelegateM::Ice::Object> delegateM; { IceUtil::Mutex::Lock sync(from->_mutex); ref = from->_reference; delegateD = dynamic_cast< ::IceDelegateD::Ice::Object*>(from->_delegate.get()); delegateM = dynamic_cast< ::IceDelegateM::Ice::Object*>(from->_delegate.get()); } // // No need to synchronize "*this", as this operation is only // called upon initialization. // assert(!_reference); assert(!_delegate); _reference = ref; if(_reference->getCacheConnection()) { // // The _delegate attribute is only used if "cache connection" // is enabled. If it's not enabled, we don't keep track of the // delegate -- a new delegate is created for each invocations. // if(delegateD) { Handle< ::IceDelegateD::Ice::Object> delegate = __createDelegateD(); delegate->__copyFrom(delegateD); _delegate = delegate; } else if(delegateM) { Handle< ::IceDelegateM::Ice::Object> delegate = __createDelegateM(); delegate->__copyFrom(delegateM); _delegate = delegate; } } } int IceProxy::Ice::Object::__handleException(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>& delegate, const LocalException& ex, bool sleep, int& cnt, InvocationObserver& observer) { // // Only _delegate needs to be mutex protected here. // { IceUtil::Mutex::Lock sync(_mutex); if(delegate.get() == _delegate.get()) { _delegate = 0; } } try { if(cnt == -1) // Don't retry if the retry count is -1. { ex.ice_throw(); } int interval = 0; try { interval = _reference->getInstance()->proxyFactory()->checkRetryAfterException(ex, _reference, sleep, cnt); } catch(const CommunicatorDestroyedException&) { // // The communicator is already destroyed, so we cannot retry. // ex.ice_throw(); } observer.retried(); return interval; } catch(const ::Ice::LocalException& ex) { observer.failed(ex.ice_name()); throw; } return 0; // Keep the compiler happy. } int IceProxy::Ice::Object::__handleExceptionWrapper(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>& delegate, const LocalExceptionWrapper& ex, InvocationObserver& observer) { { IceUtil::Mutex::Lock sync(_mutex); if(delegate.get() == _delegate.get()) { _delegate = 0; } } if(!ex.retry()) { observer.failed(ex.get()->ice_name()); ex.get()->ice_throw(); } return 0; } int IceProxy::Ice::Object::__handleExceptionWrapperRelaxed(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>& del, const LocalExceptionWrapper& ex, bool sleep, int& cnt, InvocationObserver& observer) { if(!ex.retry()) { return __handleException(del, *ex.get(), sleep, cnt, observer); } else { { IceUtil::Mutex::Lock sync(_mutex); if(del.get() == _delegate.get()) { _delegate = 0; } } return 0; } } void IceProxy::Ice::Object::__checkTwowayOnly(const string& name) const { // // No mutex lock necessary, there is nothing mutable in this operation. // if(!ice_isTwoway()) { TwowayOnlyException ex(__FILE__, __LINE__); ex.operation = name; throw ex; } } void IceProxy::Ice::Object::__checkAsyncTwowayOnly(const string& name) const { // // No mutex lock necessary, there is nothing mutable in this operation. // if(!ice_isTwoway()) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "`" + name + "' can only be called with a twoway proxy"); } } void IceProxy::Ice::Object::__end(const ::Ice::AsyncResultPtr& __result, const std::string& operation) const { AsyncResult::__check(__result, this, operation); bool __ok = __result->__wait(); if(_reference->getMode() == Reference::ModeTwoway) { try { if(!__ok) { try { __result->__throwUserException(); } catch(const UserException& __ex) { throw UnknownUserException(__FILE__, __LINE__, __ex.ice_name()); } } __result->__readEmptyParams(); } catch(const ::Ice::LocalException& ex) { __result->__getObserver().failed(ex.ice_name()); throw; } } } ostream& operator<<(ostream& os, const ::IceProxy::Ice::Object& p) { return os << p.ice_toString(); } Handle< ::IceDelegate::Ice::Object> IceProxy::Ice::Object::__getDelegate(bool ami) { if(_reference->getCacheConnection()) { IceUtil::Mutex::Lock sync(_mutex); if(_delegate) { return _delegate; } _delegate = createDelegate(true); // Connect asynchrously to avoid blocking with the proxy mutex locked. return _delegate; } else { const Reference::Mode mode = _reference->getMode(); return createDelegate(ami || mode == Reference::ModeBatchOneway || mode == Reference::ModeBatchDatagram); } } void IceProxy::Ice::Object::__setRequestHandler(const Handle< ::IceDelegate::Ice::Object>& delegate, const ::IceInternal::RequestHandlerPtr& handler) { if(_reference->getCacheConnection()) { IceUtil::Mutex::Lock sync(_mutex); if(_delegate.get() == delegate.get()) { if(dynamic_cast< ::IceDelegateM::Ice::Object*>(_delegate.get())) { _delegate = __createDelegateM(); _delegate->__setRequestHandler(handler); } else if(dynamic_cast< ::IceDelegateD::Ice::Object*>(_delegate.get())) { _delegate = __createDelegateD(); _delegate->__setRequestHandler(handler); } } } } Handle< ::IceDelegateM::Ice::Object> IceProxy::Ice::Object::__createDelegateM() { return Handle< ::IceDelegateM::Ice::Object>(new ::IceDelegateM::Ice::Object); } Handle< ::IceDelegateD::Ice::Object> IceProxy::Ice::Object::__createDelegateD() { return Handle< ::IceDelegateD::Ice::Object>(new ::IceDelegateD::Ice::Object); } IceProxy::Ice::Object* IceProxy::Ice::Object::__newInstance() const { return new Object; } Handle< ::IceDelegate::Ice::Object> IceProxy::Ice::Object::createDelegate(bool async) { if(_reference->getCollocationOptimized()) { ObjectAdapterPtr adapter = _reference->getInstance()->objectAdapterFactory()->findObjectAdapter(this); if(adapter) { Handle< ::IceDelegateD::Ice::Object> d = __createDelegateD(); d->setup(_reference, adapter); return d; } } Handle< ::IceDelegateM::Ice::Object> d = __createDelegateM(); d->setup(_reference, this, async); return d; } void IceProxy::Ice::Object::setup(const ReferencePtr& ref) { // // No need to synchronize "*this", as this operation is only // called upon initialization. // assert(!_reference); assert(!_delegate); _reference = ref; } IceDelegateM::Ice::Object::~Object() { } bool IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context* context, InvocationObserver& observer) { Outgoing __og(__handler.get(), ice_isA_name, ::Ice::Nonmutating, context, observer); try { BasicStream* __os = __og.startWriteParams(DefaultFormat); __os->write(__id, false); __og.endWriteParams(); } catch(const ::Ice::LocalException& __ex) { __og.abort(__ex); } bool __ret; bool __ok = __og.invoke(); try { if(!__ok) { try { __og.throwUserException(); } catch(const ::Ice::UserException& __ex) { throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name()); } } BasicStream* __is = __og.startReadParams(); __is->read(__ret); __og.endReadParams(); } catch(const ::Ice::LocalException& __ex) { throw ::IceInternal::LocalExceptionWrapper(__ex, false); } return __ret; } void IceDelegateM::Ice::Object::ice_ping(const Context* context, InvocationObserver& observer) { Outgoing __og(__handler.get(), ice_ping_name, ::Ice::Nonmutating, context, observer); __og.writeEmptyParams(); bool __ok = __og.invoke(); if(__og.hasResponse()) { try { if(!__ok) { try { __og.throwUserException(); } catch(const ::Ice::UserException& __ex) { throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name()); } } __og.readEmptyParams(); } catch(const ::Ice::LocalException& __ex) { throw ::IceInternal::LocalExceptionWrapper(__ex, false); } } } vector IceDelegateM::Ice::Object::ice_ids(const Context* context, InvocationObserver& observer) { Outgoing __og(__handler.get(), ice_ids_name, ::Ice::Nonmutating, context, observer); __og.writeEmptyParams(); vector __ret; bool __ok = __og.invoke(); try { if(!__ok) { try { __og.throwUserException(); } catch(const ::Ice::UserException& __ex) { throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name()); } } BasicStream* __is = __og.startReadParams(); __is->read(__ret, false); __og.endReadParams(); } catch(const ::Ice::LocalException& __ex) { throw ::IceInternal::LocalExceptionWrapper(__ex, false); } return __ret; } string IceDelegateM::Ice::Object::ice_id(const Context* context, InvocationObserver& observer) { Outgoing __og(__handler.get(), ice_id_name, ::Ice::Nonmutating, context, observer); __og.writeEmptyParams(); string __ret; bool __ok = __og.invoke(); try { if(!__ok) { try { __og.throwUserException(); } catch(const ::Ice::UserException& __ex) { throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name()); } } BasicStream* __is = __og.startReadParams(); __is->read(__ret, false); __og.endReadParams(); } catch(const ::Ice::LocalException& __ex) { throw ::IceInternal::LocalExceptionWrapper(__ex, false); } return __ret; } bool IceDelegateM::Ice::Object::ice_invoke(const string& operation, OperationMode mode, const pair& inEncaps, vector& outEncaps, const Context* context, InvocationObserver& observer) { Outgoing __og(__handler.get(), operation, mode, context, observer); try { __og.writeParamEncaps(inEncaps.first, static_cast(inEncaps.second - inEncaps.first)); } catch(const ::Ice::LocalException& __ex) { __og.abort(__ex); } bool ok = __og.invoke(); if(__handler->getReference()->getMode() == Reference::ModeTwoway) { try { const Byte* v; Int sz; __og.readParamEncaps(v, sz); vector(v, v + sz).swap(outEncaps); } catch(const ::Ice::LocalException& __ex) { throw ::IceInternal::LocalExceptionWrapper(__ex, false); } } return ok; } void IceDelegateM::Ice::Object::ice_flushBatchRequests(InvocationObserver& observer) { BatchOutgoing __og(__handler.get(), observer); __og.invoke(); } RequestHandlerPtr IceDelegateM::Ice::Object::__getRequestHandler() const { return __handler; } void IceDelegateM::Ice::Object::__setRequestHandler(const RequestHandlerPtr& handler) { __handler = handler; } void IceDelegateM::Ice::Object::__copyFrom(const ::IceInternal::Handle< ::IceDelegateM::Ice::Object>& from) { // // No need to synchronize "from", as the delegate is immutable // after creation. // // // No need to synchronize "*this", as this operation is only // called upon initialization. // assert(!__handler); __handler = from->__handler; } void IceDelegateM::Ice::Object::setup(const ReferencePtr& ref, const ::Ice::ObjectPrx& proxy, bool async) { // // No need to synchronize "*this", as this operation is only // called upon initialization. // assert(!__handler); if(async) { IceInternal::ConnectRequestHandlerPtr handler = new ::IceInternal::ConnectRequestHandler(ref, proxy, this); __handler = handler->connect(); } else { __handler = new ::IceInternal::ConnectionRequestHandler(ref, proxy); } } bool IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context* context, InvocationObserver& /*observer*/) { class DirectI : public Direct { public: DirectI(bool& __result, const string& __id, const Current& __current) : Direct(__current), _result(__result), _id(__id) { } virtual ::Ice::DispatchStatus run(::Ice::Object* object) { _result = object->ice_isA(_id, _current); return DispatchOK; } private: bool& _result; const string& _id; }; Current __current; __initCurrent(__current, "ice_isA", ::Ice::Nonmutating, context); bool __result; try { DirectI __direct(__result, __id, __current); try { __direct.getServant()->__collocDispatch(__direct); } catch(const ::std::exception& __ex) { __direct.destroy(); LocalExceptionWrapper::throwWrapper(__ex); } catch(...) { __direct.destroy(); throw UnknownException(__FILE__, __LINE__, "unknown c++ exception"); } __direct.destroy(); } catch(const LocalExceptionWrapper&) { throw; } catch(const ::std::exception& __ex) { LocalExceptionWrapper::throwWrapper(__ex); } catch(...) { throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false); } return __result; } void IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context* context, InvocationObserver&) { class DirectI : public Direct { public: DirectI(const Current& __current) : Direct(__current) { } virtual ::Ice::DispatchStatus run(::Ice::Object* object) { object->ice_ping(_current); return DispatchOK; } }; Current __current; __initCurrent(__current, "ice_ping", ::Ice::Nonmutating, context); try { DirectI __direct(__current); try { __direct.getServant()->__collocDispatch(__direct); } catch(const ::std::exception& __ex) { __direct.destroy(); LocalExceptionWrapper::throwWrapper(__ex); } catch(...) { __direct.destroy(); throw UnknownException(__FILE__, __LINE__, "unknown c++ exception"); } __direct.destroy(); } catch(const LocalExceptionWrapper&) { throw; } catch(const ::std::exception& __ex) { LocalExceptionWrapper::throwWrapper(__ex); } catch(...) { throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false); } } vector IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context* context, InvocationObserver&) { class DirectI : public Direct { public: DirectI(vector& __result, const Current& __current) : Direct(__current), _result(__result) { } virtual ::Ice::DispatchStatus run(::Ice::Object* object) { _result = object->ice_ids(_current); return DispatchOK; } private: vector& _result; }; Current __current; __initCurrent(__current, "ice_ids", ::Ice::Nonmutating, context); vector __result; try { DirectI __direct(__result, __current); try { __direct.getServant()->__collocDispatch(__direct); } catch(const ::std::exception& __ex) { __direct.destroy(); LocalExceptionWrapper::throwWrapper(__ex); } catch(...) { __direct.destroy(); throw UnknownException(__FILE__, __LINE__, "unknown c++ exception"); } __direct.destroy(); } catch(const LocalExceptionWrapper&) { throw; } catch(const ::std::exception& __ex) { LocalExceptionWrapper::throwWrapper(__ex); } catch(...) { throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false); } return __result; } string IceDelegateD::Ice::Object::ice_id(const ::Ice::Context* context, InvocationObserver&) { class DirectI : public Direct { public: DirectI(string& __result, const Current& __current) : Direct(__current), _result(__result) { } virtual ::Ice::DispatchStatus run(::Ice::Object* object) { _result = object->ice_id(_current); return DispatchOK; } private: string& _result; }; Current __current; __initCurrent(__current, "ice_id", ::Ice::Nonmutating, context); string __result; try { DirectI __direct(__result, __current); try { __direct.getServant()->__collocDispatch(__direct); } catch(const ::std::exception& __ex) { __direct.destroy(); LocalExceptionWrapper::throwWrapper(__ex); } catch(...) { __direct.destroy(); throw UnknownException(__FILE__, __LINE__, "unknown c++ exception"); } __direct.destroy(); } catch(const LocalExceptionWrapper&) { throw; } catch(const ::std::exception& __ex) { LocalExceptionWrapper::throwWrapper(__ex); } catch(...) { throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false); } return __result; } bool IceDelegateD::Ice::Object::ice_invoke(const string&, OperationMode, const pair& /*inEncaps*/, vector&, const Context*, InvocationObserver&) { throw CollocationOptimizationException(__FILE__, __LINE__); return false; } void IceDelegateD::Ice::Object::ice_flushBatchRequests(InvocationObserver& /*observer*/) { throw CollocationOptimizationException(__FILE__, __LINE__); } RequestHandlerPtr IceDelegateD::Ice::Object::__getRequestHandler() const { throw CollocationOptimizationException(__FILE__, __LINE__); return 0; } void IceDelegateD::Ice::Object::__setRequestHandler(const RequestHandlerPtr&) { throw CollocationOptimizationException(__FILE__, __LINE__); } void IceDelegateD::Ice::Object::__copyFrom(const ::IceInternal::Handle< ::IceDelegateD::Ice::Object>& from) { // // No need to synchronize "from", as the delegate is immutable // after creation. // // // No need to synchronize "*this", as this operation is only // called upon initialization. // assert(!__reference); assert(!__adapter); __reference = from->__reference; __adapter = from->__adapter; } void IceDelegateD::Ice::Object::__initCurrent(Current& current, const string& op, OperationMode mode, const Context* context) { current.adapter = __adapter; current.id = __reference->getIdentity(); current.facet = __reference->getFacet(); current.operation = op; current.mode = mode; if(context != 0) { // // Explicit context // current.ctx = *context; } else { // // Implicit context // const ImplicitContextIPtr& implicitContext = __reference->getInstance()->getImplicitContext(); const Context& prxContext = __reference->getContext()->getValue(); if(implicitContext == 0) { current.ctx = prxContext; } else { implicitContext->combine(prxContext, current.ctx); } } current.requestId = -1; } void IceDelegateD::Ice::Object::setup(const ReferencePtr& ref, const ObjectAdapterPtr& adapter) { // // No need to synchronize "*this", as this operation is only // called upon initialization. // assert(!__reference); assert(!__adapter); __reference = ref; __adapter = adapter; } bool Ice::proxyIdentityLess(const ObjectPrx& lhs, const ObjectPrx& rhs) { if(!lhs && !rhs) { return false; } else if(!lhs && rhs) { return true; } else if(lhs && !rhs) { return false; } else { return lhs->ice_getIdentity() < rhs->ice_getIdentity(); } } bool Ice::proxyIdentityEqual(const ObjectPrx& lhs, const ObjectPrx& rhs) { if(!lhs && !rhs) { return true; } else if(!lhs && rhs) { return false; } else if(lhs && !rhs) { return false; } else { return lhs->ice_getIdentity() == rhs->ice_getIdentity(); } } bool Ice::proxyIdentityAndFacetLess(const ObjectPrx& lhs, const ObjectPrx& rhs) { if(!lhs && !rhs) { return false; } else if(!lhs && rhs) { return true; } else if(lhs && !rhs) { return false; } else { Identity lhsIdentity = lhs->ice_getIdentity(); Identity rhsIdentity = rhs->ice_getIdentity(); if(lhsIdentity < rhsIdentity) { return true; } else if(rhsIdentity < lhsIdentity) { return false; } string lhsFacet = lhs->ice_getFacet(); string rhsFacet = rhs->ice_getFacet(); if(lhsFacet < rhsFacet) { return true; } else if(rhsFacet < lhsFacet) { return false; } return false; } } bool Ice::proxyIdentityAndFacetEqual(const ObjectPrx& lhs, const ObjectPrx& rhs) { if(!lhs && !rhs) { return true; } else if(!lhs && rhs) { return false; } else if(lhs && !rhs) { return false; } else { Identity lhsIdentity = lhs->ice_getIdentity(); Identity rhsIdentity = rhs->ice_getIdentity(); if(lhsIdentity == rhsIdentity) { string lhsFacet = lhs->ice_getFacet(); string rhsFacet = rhs->ice_getFacet(); if(lhsFacet == rhsFacet) { return true; } } return false; } } void Ice::ice_writeObjectPrx(const OutputStreamPtr& out, const ObjectPrx& v) { out->write(v); } void Ice::ice_readObjectPrx(const InputStreamPtr& in, ObjectPrx& v) { in->read(v); } Ice-3.5.1/cpp/src/Ice/TcpAcceptor.cpp0000644000076400007640000001406712223561476015366 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #ifdef ICE_USE_IOCP # include #endif using namespace std; using namespace Ice; using namespace IceInternal; NativeInfoPtr IceInternal::TcpAcceptor::getNativeInfo() { return this; } #ifdef ICE_USE_IOCP AsyncInfo* # ifndef NDEBUG IceInternal::TcpAcceptor::getAsyncInfo(SocketOperation op) # else IceInternal::TcpAcceptor::getAsyncInfo(SocketOperation) # endif { assert(op == SocketOperationRead); return &_info; } #endif void IceInternal::TcpAcceptor::close() { if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "stopping to accept tcp connections at " << toString(); } SOCKET fd = _fd; _fd = INVALID_SOCKET; closeSocket(fd); } void IceInternal::TcpAcceptor::listen() { try { doListen(_fd, _backlog); } catch(...) { _fd = INVALID_SOCKET; throw; } if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "listening for tcp connections at " << toString(); vector interfaces = getHostsForEndpointExpand(inetAddrToString(_addr), _instance->protocolSupport(), true); if(!interfaces.empty()) { out << "\nlocal interfaces: "; out << IceUtilInternal::joinString(interfaces, ", "); } } } #ifdef ICE_USE_IOCP void IceInternal::TcpAcceptor::startAccept() { LPFN_ACCEPTEX AcceptEx = NULL; // a pointer to the 'AcceptEx()' function GUID GuidAcceptEx = WSAID_ACCEPTEX; // The Guid DWORD dwBytes; if(WSAIoctl(_fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &GuidAcceptEx, sizeof(GuidAcceptEx), &AcceptEx, sizeof(AcceptEx), &dwBytes, NULL, NULL) == SOCKET_ERROR) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } assert(_acceptFd == INVALID_SOCKET); _acceptFd = createSocket(false, _addr); const int sz = static_cast(_acceptBuf.size() / 2); if(!AcceptEx(_fd, _acceptFd, &_acceptBuf[0], 0, sz, sz, &_info.count, &_info)) { if(!wouldBlock()) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } } void IceInternal::TcpAcceptor::finishAccept() { if(static_cast(_info.count) == SOCKET_ERROR || _fd == INVALID_SOCKET) { closeSocketNoThrow(_acceptFd); _acceptFd = INVALID_SOCKET; _acceptError = _info.error; } } #endif TransceiverPtr IceInternal::TcpAcceptor::accept() { #ifdef ICE_USE_IOCP if(_acceptFd == INVALID_SOCKET) { SocketException ex(__FILE__, __LINE__); ex.error = _acceptError; throw ex; } if(setsockopt(_acceptFd, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char*)&_acceptFd, sizeof(_acceptFd)) == SOCKET_ERROR) { closeSocketNoThrow(_acceptFd); _acceptFd = INVALID_SOCKET; SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } SOCKET fd = _acceptFd; _acceptFd = INVALID_SOCKET; #else SOCKET fd = doAccept(_fd); #endif if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "accepted tcp connection\n" << fdToString(fd); } return new TcpTransceiver(_instance, fd); } string IceInternal::TcpAcceptor::toString() const { return addrToString(_addr); } int IceInternal::TcpAcceptor::effectivePort() const { return getPort(_addr); } IceInternal::TcpAcceptor::TcpAcceptor(const InstancePtr& instance, const string& host, int port) : _instance(instance), _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger), _addr(getAddressForServer(host, port, _instance->protocolSupport(), instance->preferIPv6())) #ifdef ICE_USE_IOCP , _acceptFd(INVALID_SOCKET), _info(SocketOperationRead) #endif { #ifdef SOMAXCONN _backlog = instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.TCP.Backlog", SOMAXCONN); #else _backlog = instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511); #endif _fd = createServerSocket(false, _addr, instance->protocolSupport()); #ifdef ICE_USE_IOCP _acceptBuf.resize((sizeof(sockaddr_storage) + 16) * 2); #endif setBlock(_fd, false); setTcpBufSize(_fd, _instance->initializationData().properties, _logger); #ifndef _WIN32 // // Enable SO_REUSEADDR on Unix platforms to allow re-using the // socket even if it's in the TIME_WAIT state. On Windows, // this doesn't appear to be necessary and enabling // SO_REUSEADDR would actually not be a good thing since it // allows a second process to bind to an address even it's // already bound by another process. // // TODO: using SO_EXCLUSIVEADDRUSE on Windows would probably // be better but it's only supported by recent Windows // versions (XP SP2, Windows Server 2003). // setReuseAddress(_fd, true); #endif if(_traceLevels->network >= 2) { Trace out(_logger, _traceLevels->networkCat); out << "attempting to bind to tcp socket " << toString(); } const_cast(_addr) = doBind(_fd, _addr); } IceInternal::TcpAcceptor::~TcpAcceptor() { assert(_fd == INVALID_SOCKET); #ifdef ICE_USE_IOCP assert(_acceptFd == INVALID_SOCKET); #endif } Ice-3.5.1/cpp/src/Ice/UdpTransceiver.cpp0000644000076400007640000010556612223561476016122 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #ifdef ICE_OS_WINRT # include // For Concurrency::task #endif using namespace std; using namespace Ice; using namespace IceInternal; #ifdef ICE_OS_WINRT using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Storage::Streams; using namespace Windows::Networking; using namespace Windows::Networking::Sockets; #endif NativeInfoPtr IceInternal::UdpTransceiver::getNativeInfo() { return this; } #if defined(ICE_USE_IOCP) AsyncInfo* IceInternal::UdpTransceiver::getAsyncInfo(SocketOperation status) { switch(status) { case SocketOperationRead: return &_read; case SocketOperationWrite: return &_write; default: assert(false); return 0; } } #elif defined(ICE_OS_WINRT) void IceInternal::UdpTransceiver::setCompletedHandler(SocketOperationCompletedHandler^ handler) { _completedHandler = handler; _writeOperationCompletedHandler = ref new AsyncOperationCompletedHandler( [=] (IAsyncOperation^ operation, Windows::Foundation::AsyncStatus status) { if(status != Windows::Foundation::AsyncStatus::Completed) { _write.count = SOCKET_ERROR; _write.error = operation->ErrorCode.Value; } else { _write.count = static_cast(operation->GetResults()); } _completedHandler(SocketOperationWrite); }); } #endif SocketOperation IceInternal::UdpTransceiver::initialize(Buffer& /*readBuffer*/, Buffer& /*writeBuffer*/) { if(_state == StateNeedConnect) { _state = StateConnectPending; return SocketOperationConnect; } else if(_state <= StateConnectPending) { try { #if defined(ICE_USE_IOCP) doFinishConnectAsync(_fd, _write); #elif defined(ICE_OS_WINRT) if(_write.count == SOCKET_ERROR) { checkConnectErrorCode(__FILE__, __LINE__, _write.error, _addr.host); } #else doFinishConnect(_fd); #endif _state = StateConnected; } catch(const Ice::LocalException& ex) { if(_traceLevels->network >= 2) { Trace out(_logger, _traceLevels->networkCat); out << "failed to connect udp socket\n" << toString() << "\n" << ex; } throw; } } if(_state == StateConnected) { if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "starting to send udp packets\n" << toString(); } } assert(_state >= StateConnected); return SocketOperationNone; } void IceInternal::UdpTransceiver::close() { if(_state >= StateConnected && _traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "closing udp connection\n" << toString(); } #ifdef ICE_OS_WINRT IceUtil::Mutex::Lock lock(_mutex); if(_readPending) { assert(_received.empty()); _completedHandler(SocketOperationRead); _readPending = false; } _received.clear(); #endif assert(_fd != INVALID_SOCKET); closeSocket(_fd); _fd = INVALID_SOCKET; } #ifdef ICE_OS_WINRT bool IceInternal::UdpTransceiver::write(Buffer&) { return false; } #else bool IceInternal::UdpTransceiver::write(Buffer& buf) { assert(buf.i == buf.b.begin()); assert(_fd != INVALID_SOCKET && _state >= StateConnected); // The caller is supposed to check the send size before by calling checkSendSize assert(min(_maxPacketSize, _sndSize - _udpOverhead) >= static_cast(buf.b.size())); repeat: ssize_t ret; if(_state == StateConnected) { # ifdef _WIN32 ret = ::send(_fd, reinterpret_cast(&buf.b[0]), static_cast(buf.b.size()), 0); # else ret = ::send(_fd, reinterpret_cast(&buf.b[0]), buf.b.size(), 0); # endif } else { socklen_t len = static_cast(sizeof(sockaddr_storage)); if(_peerAddr.saStorage.ss_family == AF_INET) { len = static_cast(sizeof(sockaddr_in)); } else if(_peerAddr.saStorage.ss_family == AF_INET6) { len = static_cast(sizeof(sockaddr_in6)); } else { // No peer has sent a datagram yet. SocketException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } # ifdef _WIN32 ret = ::sendto(_fd, reinterpret_cast(&buf.b[0]), static_cast(buf.b.size()), 0, &_peerAddr.sa, len); # else ret = ::sendto(_fd, reinterpret_cast(&buf.b[0]), buf.b.size(), 0, &_peerAddr.sa, len); # endif } if(ret == SOCKET_ERROR) { if(interrupted()) { goto repeat; } if(wouldBlock()) { return false; } SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } if(_traceLevels->network >= 3) { Trace out(_logger, _traceLevels->networkCat); out << "sent " << ret << " bytes via udp\n" << toString(); } if(_stats) { _stats->bytesSent(type(), static_cast(ret)); } assert(ret == static_cast(buf.b.size())); buf.i = buf.b.end(); return true; } #endif #ifdef ICE_OS_WINRT bool IceInternal::UdpTransceiver::read(Buffer&) { return false; } #else bool IceInternal::UdpTransceiver::read(Buffer& buf) { assert(buf.i == buf.b.begin()); assert(_fd != INVALID_SOCKET); const int packetSize = min(_maxPacketSize, _rcvSize - _udpOverhead); buf.b.resize(packetSize); buf.i = buf.b.begin(); repeat: ssize_t ret; if(_state == StateConnected) { ret = ::recv(_fd, reinterpret_cast(&buf.b[0]), packetSize, 0); } else { assert(_incoming); Address peerAddr; memset(&peerAddr.saStorage, 0, sizeof(sockaddr_storage)); socklen_t len = static_cast(sizeof(sockaddr_storage)); ret = recvfrom(_fd, reinterpret_cast(&buf.b[0]), packetSize, 0, &peerAddr.sa, &len); if(ret != SOCKET_ERROR) { _peerAddr = peerAddr; } } if(ret == SOCKET_ERROR) { if(recvTruncated()) { // The message was truncated and the whole buffer is filled. We ignore // this error here, it will be detected at the connection level when // the Ice message size is checked against the buffer size. ret = static_cast(buf.b.size()); } else { if(interrupted()) { goto repeat; } if(wouldBlock()) { return false; } if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } } if(_state == StateNeedConnect) { // // If we must connect, we connect to the first peer that sends us a packet. // assert(_incoming); // Client connections should always be connected at this point. # ifndef NDEBUG bool connected = doConnect(_fd, _peerAddr); assert(connected); # else doConnect(_fd, _peerAddr); # endif _state = StateConnected; if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "connected udp socket\n" << toString(); } } if(_traceLevels->network >= 3) { Trace out(_logger, _traceLevels->networkCat); out << "received " << ret << " bytes via udp\n" << toString(); } if(_stats) { _stats->bytesReceived(type(), static_cast(ret)); } buf.b.resize(ret); buf.i = buf.b.end(); return true; } #endif #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) bool IceInternal::UdpTransceiver::startWrite(Buffer& buf) { assert(buf.i == buf.b.begin()); // The caller is supposed to check the send size before by calling checkSendSize assert(min(_maxPacketSize, _sndSize - _udpOverhead) >= static_cast(buf.b.size())); assert(_fd != INVALID_SOCKET); #ifdef ICE_OS_WINRT if(_state < StateConnected) { try { bool multicast = isMulticast(_addr) || isAddressValid(_mcastAddr); if(!multicast) { auto operation = safe_cast(_fd)->ConnectAsync(_addr.host, _addr.port); if(!checkIfErrorOrCompleted(SocketOperationConnect, operation)) { operation->Completed = ref new AsyncActionCompletedHandler( [=] (IAsyncAction^ info, Windows::Foundation::AsyncStatus status) { if(status != Windows::Foundation::AsyncStatus::Completed) { _write.count = SOCKET_ERROR; _write.error = info->ErrorCode.Value; } else { _write.count = 0; _writer = ref new DataWriter(safe_cast(_fd)->OutputStream); } _completedHandler(SocketOperationConnect); }); } else { _write.count = 0; _writer = ref new DataWriter(safe_cast(_fd)->OutputStream); } } else { auto operation = safe_cast(_fd)->GetOutputStreamAsync(_addr.host, _addr.port); if(!checkIfErrorOrCompleted(SocketOperationConnect, operation)) { operation->Completed = ref new AsyncOperationCompletedHandler( [=] (IAsyncOperation^ info, Windows::Foundation::AsyncStatus status) { if(status != Windows::Foundation::AsyncStatus::Completed) { _write.count = SOCKET_ERROR; _write.error = info->ErrorCode.Value; } else { _write.count = 0; _writer = ref new DataWriter(info->GetResults()); } if(_mcastAddr.host != nullptr) { setMcastGroup(_fd, _mcastAddr, ""); } _completedHandler(SocketOperationConnect); }); } else { _write.count = 0; _writer = ref new DataWriter(operation->GetResults()); if(_mcastAddr.host != nullptr) { setMcastGroup(_fd, _mcastAddr, ""); } } } } catch(Platform::Exception^ ex) { checkConnectErrorCode(__FILE__, __LINE__, ex->HResult, _addr.host); } return false; } else if(_state == StateNotConnected) { try { DatagramSocket^ fd = safe_cast(_fd); concurrency::create_task(fd->GetOutputStreamAsync(_peerAddr.host, _peerAddr.port)).then( [=,&buf](concurrency::task task) { try { DataWriter^ writer = ref new DataWriter(task.get()); writer->WriteBytes(ref new Array(&*buf.i, static_cast(buf.b.size()))); DataWriterStoreOperation^ operation = writer->StoreAsync(); Windows::Foundation::AsyncStatus status = operation->Status; if(status == Windows::Foundation::AsyncStatus::Completed) { // // NOTE: unlike other methods, it's important to modify _write.count // _before_ calling checkIfErrorOrCompleted since this isn't called // with the connection mutex but from a Windows thread pool thread. // So we can't modify the _write structure after calling the // completed callback. // _write.count = operation->GetResults(); _completedHandler(SocketOperationWrite); } else if(status == Windows::Foundation::AsyncStatus::Started) { operation->Completed = _writeOperationCompletedHandler; } else { if(_state < StateConnected) { checkConnectErrorCode(__FILE__, __LINE__, operation->ErrorCode.Value, _addr.host); } else { checkErrorCode(__FILE__, __LINE__, operation->ErrorCode.Value); } } } catch(Platform::Exception^ pex) { _write.count = SOCKET_ERROR; _write.error = pex->HResult; _completedHandler(SocketOperationWrite); } }); } catch(Platform::Exception^ ex) { checkErrorCode(__FILE__, __LINE__, ex->HResult); } return true; } else { try { _writer->WriteBytes(ref new Array(&*buf.i, static_cast(buf.b.size()))); DataWriterStoreOperation^ operation = _writer->StoreAsync(); if(checkIfErrorOrCompleted(SocketOperationWrite, operation)) { _write.count = operation->GetResults(); } else { operation->Completed = _writeOperationCompletedHandler; } } catch(Platform::Exception^ ex) { checkErrorCode(__FILE__, __LINE__, ex->HResult); } return true; } #else _write.buf.len = static_cast(buf.b.size()); _write.buf.buf = reinterpret_cast(&*buf.i); int err; if(_state == StateConnected) { err = WSASend(_fd, &_write.buf, 1, &_write.count, 0, &_write, NULL); } else { socklen_t len = static_cast(sizeof(sockaddr_storage)); if(_peerAddr.saStorage.ss_family == AF_INET) { len = sizeof(sockaddr_in); } else if(_peerAddr.saStorage.ss_family == AF_INET6) { len = sizeof(sockaddr_in6); } else { // No peer has sent a datagram yet. SocketException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } err = WSASendTo(_fd, &_write.buf, 1, &_write.count, 0, &_peerAddr.sa, len, &_write, NULL); } if(err == SOCKET_ERROR) { if(!wouldBlock()) { if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } } #endif return true; } void IceInternal::UdpTransceiver::finishWrite(Buffer& buf) { if(_state < StateConnected) { return; } if(static_cast(_write.count) == SOCKET_ERROR) { #ifndef ICE_OS_WINRT WSASetLastError(_write.error); if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } #else checkErrorCode(__FILE__, __LINE__, _write.error); #endif } if(_traceLevels->network >= 3) { Trace out(_logger, _traceLevels->networkCat); out << "sent " << _write.count << " bytes via udp\n" << toString(); } if(_stats) { _stats->bytesSent(type(), static_cast(_write.count)); } assert(_write.count == buf.b.size()); buf.i = buf.b.end(); } void IceInternal::UdpTransceiver::startRead(Buffer& buf) { const int packetSize = min(_maxPacketSize, _rcvSize - _udpOverhead); buf.b.resize(packetSize); buf.i = buf.b.begin(); assert(!buf.b.empty() && buf.i != buf.b.end()); #ifndef ICE_OS_WINRT _read.buf.len = packetSize; _read.buf.buf = reinterpret_cast(&*buf.i); int err; if(_state == StateConnected) { err = WSARecv(_fd, &_read.buf, 1, &_read.count, &_read.flags, &_read, NULL); } else { memset(&_readAddr.saStorage, 0, sizeof(struct sockaddr_storage)); _readAddrLen = static_cast(sizeof(sockaddr_storage)); err = WSARecvFrom(_fd, &_read.buf, 1, &_read.count, &_read.flags, &_readAddr.sa, &_readAddrLen, &_read, NULL); } if(err == SOCKET_ERROR) { if(recvTruncated()) { // Nothing to do. } else if(!wouldBlock()) { if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } } #else IceUtil::Mutex::Lock lock(_mutex); assert(!_readPending); if(!_received.empty()) { _completedHandler(SocketOperationRead); } else { _readPending = true; } #endif } void IceInternal::UdpTransceiver::finishRead(Buffer& buf) { #ifdef ICE_OS_WINRT IceUtil::Mutex::Lock lock(_mutex); assert(!_readPending && (!_received.empty() || _fd == INVALID_SOCKET)); if(_fd == INVALID_SOCKET) { return; } DatagramSocketMessageReceivedEventArgs^ args = _received.front(); _received.pop_front(); int ret; try { DataReader^ reader = args->GetDataReader(); ret = min(static_cast(reader->UnconsumedBufferLength), static_cast(buf.b.size())); // Truncate received data if too large. Array^ data = ref new Array(ret); reader->ReadBytes(data); memcpy(&*buf.i, data->Data, ret); if(_state == StateNotConnected) { _peerAddr.host = args->RemoteAddress; _peerAddr.port = args->RemotePort; } } catch(Platform::Exception^ ex) { checkErrorCode(__FILE__, __LINE__, ex->HResult); } #else if(static_cast(_read.count) == SOCKET_ERROR) { WSASetLastError(_read.error); if(recvTruncated()) { // The message was truncated and the whole buffer is filled. We ignore // this error here, it will be detected at the connection level when // the Ice message size is checked against the buffer size. _read.count = static_cast(buf.b.size()); } else { if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } } if(_state == StateNotConnected) { _peerAddr = _readAddr; } int ret = _read.count; #endif if(_traceLevels->network >= 3) { Trace out(_logger, _traceLevels->networkCat); out << "received " << ret << " bytes via udp\n" << toString(); } if(_stats) { _stats->bytesReceived(type(), static_cast(ret)); } buf.b.resize(ret); buf.i = buf.b.end(); } #endif string IceInternal::UdpTransceiver::type() const { return "udp"; } string IceInternal::UdpTransceiver::toString() const { if(_fd == INVALID_SOCKET) { return ""; } ostringstream s; if(_state == StateNotConnected) { Address localAddr; fdToLocalAddress(_fd, localAddr); s << "local address = " << addrToString(localAddr); if(isAddressValid(_peerAddr)) { s << "\nremote address = " << addrToString(_peerAddr); } } else { #ifndef ICE_OS_WINRT s << fdToString(_fd); #else Address localAddr; fdToLocalAddress(_fd, localAddr); s << "local address = " << addrToString(localAddr); s << "\nremote address = " << addrToString(_addr); #endif } if(isAddressValid(_mcastAddr)) { s << "\nmulticast address = " + addrToString(_mcastAddr); } return s.str(); } Ice::ConnectionInfoPtr IceInternal::UdpTransceiver::getInfo() const { Ice::UDPConnectionInfoPtr info = new Ice::UDPConnectionInfo(); #if defined(ICE_OS_WINRT) if(isMulticast(_addr) || isAddressValid(_mcastAddr)) { info->remotePort = 0; info->localPort = 0; info->mcastPort = 0; return info; } #endif if(_fd == INVALID_SOCKET) { return info; } if(_state == StateNotConnected) { Address localAddr; fdToLocalAddress(_fd, localAddr); addrToAddressAndPort(localAddr, info->localAddress, info->localPort); if(isAddressValid(_peerAddr)) { addrToAddressAndPort(_peerAddr, info->remoteAddress, info->remotePort); } else { info->remotePort = 0; } } else { fdToAddressAndPort(_fd, info->localAddress, info->localPort, info->remoteAddress, info->remotePort); } if(isAddressValid(_mcastAddr)) { addrToAddressAndPort(_mcastAddr, info->mcastAddress, info->mcastPort); } else { info->mcastPort = 0; } return info; } void IceInternal::UdpTransceiver::checkSendSize(const Buffer& buf, size_t messageSizeMax) { if(buf.b.size() > messageSizeMax) { Ex::throwMemoryLimitException(__FILE__, __LINE__, buf.b.size(), messageSizeMax); } // // The maximum packetSize is either the maximum allowable UDP packet size, or // the UDP send buffer size (which ever is smaller). // const int packetSize = min(_maxPacketSize, _sndSize - _udpOverhead); if(packetSize < static_cast(buf.b.size())) { throw DatagramLimitException(__FILE__, __LINE__); } } int IceInternal::UdpTransceiver::effectivePort() const { return getPort(_addr); } IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const Address& addr, #ifdef ICE_OS_WINRT const string&, int #else const string& mcastInterface, int mcastTtl #endif ) : _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger), _stats(instance->initializationData().stats), _incoming(false), _addr(addr), _state(StateNeedConnect) #if defined(ICE_USE_IOCP) , _read(SocketOperationRead), _write(SocketOperationWrite) #elif defined(ICE_OS_WINRT) , _readPending(false) #endif { _fd = createSocket(true, _addr); setBufSize(instance); setBlock(_fd, false); #ifndef ICE_OS_WINRT _mcastAddr.saStorage.ss_family = AF_UNSPEC; _peerAddr.saStorage.ss_family = AF_UNSPEC; // Not initialized yet. // // NOTE: setting the multicast interface before performing the // connect is important for some OS such as OS X. // if(isMulticast(_addr)) { if(mcastInterface.length() > 0) { setMcastInterface(_fd, mcastInterface, _addr); } if(mcastTtl != -1) { setMcastTtl(_fd, mcastTtl, _addr); } } // // In general, connecting a datagram socket should be non-blocking as this just setups // the default destination address for the socket. However, on some OS, connect sometime // returns EWOULDBLOCK. If that's the case, we keep the state as StateNeedConnect. This // will make sure the transceiver is notified when the socket is ready for sending (see // the initialize() implementation). // if(doConnect(_fd, _addr)) { _state = StateConnected; } #else DatagramSocket^ socket = safe_cast(_fd); socket->MessageReceived += ref new TypedEventHandler( [=](DatagramSocket^ fd, DatagramSocketMessageReceivedEventArgs^ args) { this->appendMessage(args); }); #endif #ifdef ICE_USE_IOCP // // On Windows when using IOCP, we must make sure that the socket is connected without // blocking as there's no way to do a non-blocking datagram socket conection (ConnectEx // only supports connection oriented sockets). According to Microsoft documentation of // the connect() call, this should always be the case. // assert(_state == StateConnected); #endif } IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const string& host, int port, const string& mcastInterface, bool connect) : _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger), _stats(instance->initializationData().stats), _incoming(true), _addr(getAddressForServer(host, port, instance->protocolSupport(), instance->preferIPv6())), _state(connect ? StateNeedConnect : StateNotConnected) #ifdef ICE_OS_WINRT , _readPending(false) #elif defined(ICE_USE_IOCP) , _read(SocketOperationRead), _write(SocketOperationWrite) #endif { _fd = createServerSocket(true, _addr, instance->protocolSupport()); setBufSize(instance); setBlock(_fd, false); #ifndef ICE_OS_WINRT memset(&_mcastAddr.saStorage, 0, sizeof(sockaddr_storage)); memset(&_peerAddr.saStorage, 0, sizeof(sockaddr_storage)); _peerAddr.saStorage.ss_family = AF_UNSPEC; _mcastAddr.saStorage.ss_family = AF_UNSPEC; #else DatagramSocket^ socket = safe_cast(_fd); socket->MessageReceived += ref new TypedEventHandler( [=](DatagramSocket^ fd, DatagramSocketMessageReceivedEventArgs^ args) { this->appendMessage(args); }); #endif if(_traceLevels->network >= 2) { Trace out(_logger, _traceLevels->networkCat); out << "attempting to bind to udp socket " << addrToString(_addr); } if(isMulticast(_addr)) { setReuseAddress(_fd, true); _mcastAddr = _addr; #ifdef _WIN32 // // Windows does not allow binding to the mcast address itself // so we bind to INADDR_ANY (0.0.0.0) instead. As a result, // bi-directional connection won't work because the source // address won't be the multicast address and the client will // therefore reject the datagram. // const_cast(_addr) = getAddressForServer("", port, getProtocolSupport(_addr), false); #endif const_cast(_addr) = doBind(_fd, _addr); if(getPort(_mcastAddr) == 0) { setPort(_mcastAddr, getPort(_addr)); } setMcastGroup(_fd, _mcastAddr, mcastInterface); } else { #ifndef _WIN32 // // Enable SO_REUSEADDR on Unix platforms to allow re-using // the socket even if it's in the TIME_WAIT state. On // Windows, this doesn't appear to be necessary and // enabling SO_REUSEADDR would actually not be a good // thing since it allows a second process to bind to an // address even it's already bound by another process. // // TODO: using SO_EXCLUSIVEADDRUSE on Windows would // probably be better but it's only supported by recent // Windows versions (XP SP2, Windows Server 2003). // setReuseAddress(_fd, true); #endif const_cast(_addr) = doBind(_fd, _addr); } if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "starting to receive udp packets\n" << toString(); vector interfaces = getHostsForEndpointExpand(inetAddrToString(_addr), instance->protocolSupport(), true); if(!interfaces.empty()) { out << "\nlocal interfaces: "; out << IceUtilInternal::joinString(interfaces, ", "); } } } IceInternal::UdpTransceiver::~UdpTransceiver() { assert(_fd == INVALID_SOCKET); } // // Set UDP receive and send buffer sizes. // void IceInternal::UdpTransceiver::setBufSize(const InstancePtr& instance) { assert(_fd != INVALID_SOCKET); for(int i = 0; i < 2; ++i) { string direction; string prop; int* addr; int dfltSize; if(i == 0) { direction = "receive"; prop = "Ice.UDP.RcvSize"; addr = &_rcvSize; dfltSize = getRecvBufferSize(_fd); } else { direction = "send"; prop = "Ice.UDP.SndSize"; addr = &_sndSize; dfltSize = getSendBufferSize(_fd); } if(dfltSize <= 0) { dfltSize = _maxPacketSize; } *addr = dfltSize; // // Get property for buffer size and check for sanity. // Int sizeRequested = instance->initializationData().properties->getPropertyAsIntWithDefault(prop, dfltSize); if(sizeRequested < (_udpOverhead + headerSize)) { Warning out(_logger); out << "Invalid " << prop << " value of " << sizeRequested << " adjusted to " << dfltSize; sizeRequested = dfltSize; } if(sizeRequested != dfltSize) { // // Try to set the buffer size. The kernel will silently adjust // the size to an acceptable value. Then read the size back to // get the size that was actually set. // if(i == 0) { setRecvBufferSize(_fd, sizeRequested); *addr = getRecvBufferSize(_fd); } else { setSendBufferSize(_fd, sizeRequested); *addr = getSendBufferSize(_fd); } // // Warn if the size that was set is less than the requested size. // if(*addr == 0) // set buffer size not supported. { *addr = sizeRequested; } else if(*addr < sizeRequested) { Warning out(_logger); out << "UDP " << direction << " buffer size: requested size of " << sizeRequested << " adjusted to " << *addr; } } } } #ifdef ICE_OS_WINRT bool IceInternal::UdpTransceiver::checkIfErrorOrCompleted(SocketOperation op, IAsyncInfo^ info) { // // NOTE: It's important to only check for info->Status once as it // might change during the checks below (the Status can be changed // by the Windows thread pool concurrently). // // We consider that a canceled async status is the same as an // error. A canceled async status can occur if there's a timeout // and the socket is closed. // Windows::Foundation::AsyncStatus status = info->Status; if(status == Windows::Foundation::AsyncStatus::Completed) { _completedHandler(op); return true; } else if(status == Windows::Foundation::AsyncStatus::Started) { return false; } else { if(_state < StateConnected) { checkConnectErrorCode(__FILE__, __LINE__, info->ErrorCode.Value, _addr.host); } else { checkErrorCode(__FILE__, __LINE__, info->ErrorCode.Value); } return true; // Prevent compiler warning. } } void IceInternal::UdpTransceiver::appendMessage(DatagramSocketMessageReceivedEventArgs^ args) { IceUtil::Mutex::Lock lock(_mutex); if(_fd == INVALID_SOCKET) // Transceiver was closed. { return; } _received.push_back(args); // // If the transceiver is waiting to read a message, notify the // selector that the transceiver is ready for read. This will in // turn cause finishRead() to be called. If the transceiver is // ready for read, we just queue the message. It will be picked // up by startRead() when it is invoked. // if(_readPending) { _completedHandler(SocketOperationRead); _readPending = false; } } #endif // // The maximum IP datagram size is 65535. Subtract 20 bytes for the IP header and 8 bytes for the UDP header // to get the maximum payload. // const int IceInternal::UdpTransceiver::_udpOverhead = 20 + 8; const int IceInternal::UdpTransceiver::_maxPacketSize = 65535 - _udpOverhead; Ice-3.5.1/cpp/src/Ice/MetricsObserverI.cpp0000644000076400007640000000065712223561476016406 0ustar mesmes// ********************************************************************** // // 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 #include #include Ice-3.5.1/cpp/src/Ice/ReferenceFactoryF.h0000644000076400007640000000112112223561476016143 0ustar mesmes// ********************************************************************** // // 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 ICE_REFERENCE_FACTORY_F_H #define ICE_REFERENCE_FACTORY_F_H #include namespace IceInternal { class ReferenceFactory; IceUtil::Shared* upCast(ReferenceFactory*); typedef Handle ReferenceFactoryPtr; } #endif Ice-3.5.1/cpp/src/Ice/MetricsAdminI.cpp0000644000076400007640000004317512223561476015651 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; using namespace IceMX; namespace { const string suffixes[] = { "Disabled", "GroupBy", "Accept.*", "Reject.*", "RetainDetached", "Map.*", }; void validateProperties(const string& prefix, const PropertiesPtr& properties) { vector unknownProps; PropertyDict props = properties->getPropertiesForPrefix(prefix); for(PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p) { bool valid = false; for(size_t i = 0; i < sizeof(suffixes) / sizeof(*suffixes); ++i) { string prop = prefix + suffixes[i]; if(IceUtilInternal::match(p->first, prop)) { valid = true; break; } } if(!valid) { unknownProps.push_back(p->first); } } if(!unknownProps.empty() && properties->getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0) { Warning out(getProcessLogger()); out << "found unknown IceMX properties for '" << prefix.substr(0, prefix.size() - 1) << "':"; for(vector::const_iterator p = unknownProps.begin(); p != unknownProps.end(); ++p) { out << "\n " << *p; properties->setProperty(*p, ""); // Clear the known property to prevent further warnings. } } } vector parseRule(const PropertiesPtr& properties, const string& name) { vector regexps; PropertyDict rules = properties->getPropertiesForPrefix(name + '.'); for(PropertyDict::const_iterator p = rules.begin(); p != rules.end(); ++p) { try { regexps.push_back(new MetricsMapI::RegExp(p->first.substr(name.length() + 1), p->second)); } catch(const std::exception&) { throw "invalid regular expression `" + p->second + "' for `" + p->first + "'"; } } return regexps; } } MetricsMapI::RegExp::RegExp(const string& attribute, const string& regexp) : _attribute(attribute) { #ifdef __MINGW32__ // // No regexp support with MinGW, when MinGW C++11 mode is not experimental // we can use std::regex. // #elif !defined(ICE_CPP11_REGEXP) if(regcomp(&_preg, regexp.c_str(), REG_EXTENDED | REG_NOSUB) != 0) { throw SyscallException(__FILE__, __LINE__); } #else # if _MSC_VER < 1600 _regex = std::tr1::regex(regexp, std::tr1::regex_constants::extended | std::tr1::regex_constants::nosubs); # else _regex = regex(regexp, std::regex_constants::extended | std::regex_constants::nosubs); # endif #endif } MetricsMapI::RegExp::~RegExp() { #ifdef __MINGW32__ // // No regexp support with MinGW, when MinGW C++11 mode is not experimental // we can use std::regex. // #elif !defined(ICE_CPP11_REGEXP) regfree(&_preg); #endif } bool MetricsMapI::RegExp::match(const string& value) { #ifdef __MINGW32__ // // No regexp support with MinGW, when MinGW C++11 mode is not experimental // we can use std::regex. // return false; #elif !defined(ICE_CPP11_REGEXP) return regexec(&_preg, value.c_str(), 0, 0, 0) == 0; #else # if _MSC_VER < 1600 return std::tr1::regex_match(value, _regex); # else return regex_match(value, _regex); # endif #endif } MetricsMapI::MetricsMapI(const std::string& mapPrefix, const PropertiesPtr& properties) : _properties(properties->getPropertiesForPrefix(mapPrefix)), _retain(properties->getPropertyAsIntWithDefault(mapPrefix + "RetainDetached", 10)), _accept(parseRule(properties, mapPrefix + "Accept")), _reject(parseRule(properties, mapPrefix + "Reject")) { validateProperties(mapPrefix, properties); string groupBy = properties->getPropertyWithDefault(mapPrefix + "GroupBy", "id"); vector& groupByAttributes = const_cast&>(_groupByAttributes); vector& groupBySeparators = const_cast&>(_groupBySeparators); if(!groupBy.empty()) { string v; bool attribute = IceUtilInternal::isAlpha(groupBy[0]) || IceUtilInternal::isDigit(groupBy[0]); if(!attribute) { groupByAttributes.push_back(""); } for(string::const_iterator p = groupBy.begin(); p != groupBy.end(); ++p) { bool isAlphaNum = IceUtilInternal::isAlpha(*p) || IceUtilInternal::isDigit(*p) || *p == '.'; if(attribute && !isAlphaNum) { groupByAttributes.push_back(v); v = *p; attribute = false; } else if(!attribute && isAlphaNum) { groupBySeparators.push_back(v); v = *p; attribute = true; } else { v += *p; } } if(attribute) { groupByAttributes.push_back(v); } else { groupBySeparators.push_back(v); } } } MetricsMapI::MetricsMapI(const MetricsMapI& map) : _properties(map._properties), _groupByAttributes(map._groupByAttributes), _groupBySeparators(map._groupBySeparators), _retain(map._retain), _accept(map._accept), _reject(map._reject) { } const ::Ice::PropertyDict& MetricsMapI::getProperties() const { return _properties; } MetricsMapFactory::MetricsMapFactory(Updater* updater) : _updater(updater) { } void MetricsMapFactory::update() { assert(_updater); _updater->update(); } MetricsViewI::MetricsViewI(const string& name) : _name(name) { } void MetricsViewI::destroy() { for(map::const_iterator p = _maps.begin(); p != _maps.end(); ++p) { p->second->destroy(); } } bool MetricsViewI::addOrUpdateMap(const PropertiesPtr& properties, const string& mapName, const MetricsMapFactoryPtr& factory, const ::Ice::LoggerPtr& logger) { const string viewPrefix = "IceMX.Metrics." + _name + "."; const string mapsPrefix = viewPrefix + "Map."; PropertyDict mapsProps = properties->getPropertiesForPrefix(mapsPrefix); string mapPrefix; PropertyDict mapProps; if(!mapsProps.empty()) { mapPrefix = mapsPrefix + mapName + "."; mapProps = properties->getPropertiesForPrefix(mapPrefix); if(mapProps.empty()) { // This map isn't configured for this view. map::iterator q = _maps.find(mapName); if(q != _maps.end()) { q->second->destroy(); _maps.erase(q); return true; } return false; } } else { mapPrefix = viewPrefix; mapProps = properties->getPropertiesForPrefix(mapPrefix); } if(properties->getPropertyAsInt(mapPrefix + "Disabled") > 0) { // This map is disabled for this view. map::iterator q = _maps.find(mapName); if(q != _maps.end()) { q->second->destroy(); _maps.erase(q); return true; } return false; } map::iterator q = _maps.find(mapName); if(q != _maps.end() && q->second->getProperties() == mapProps) { return false; // The map configuration didn't change, no need to re-create. } if(q != _maps.end()) { // Destroy the previous map q->second->destroy(); _maps.erase(q); } try { _maps.insert(make_pair(mapName, factory->create(mapPrefix, properties))); } catch(const std::exception& ex) { ::Ice::Warning warn(logger); warn << "unexpected exception while creating metrics map:\n" << ex; } catch(const string& msg) { ::Ice::Warning warn(logger); warn << msg; } return true; } bool MetricsViewI::removeMap(const string& mapName) { map::iterator q = _maps.find(mapName); if(q != _maps.end()) { q->second->destroy(); _maps.erase(q); return true; } return false; } MetricsView MetricsViewI::getMetrics() { MetricsView metrics; for(map::const_iterator p = _maps.begin(); p != _maps.end(); ++p) { metrics.insert(make_pair(p->first, p->second->getMetrics())); } return metrics; } MetricsFailuresSeq MetricsViewI::getFailures(const string& mapName) { map::const_iterator p = _maps.find(mapName); if(p != _maps.end()) { return p->second->getFailures(); } return MetricsFailuresSeq(); } MetricsFailures MetricsViewI::getFailures(const string& mapName, const string& id) { map::const_iterator p = _maps.find(mapName); if(p != _maps.end()) { return p->second->getFailures(id); } return MetricsFailures(); } vector MetricsViewI::getMaps() const { vector maps; for(map::const_iterator p = _maps.begin(); p != _maps.end(); ++p) { maps.push_back(p->first); } return maps; } MetricsMapIPtr MetricsViewI::getMap(const string& mapName) const { map::const_iterator p = _maps.find(mapName); if(p != _maps.end()) { return p->second; } return 0; } MetricsAdminI::MetricsAdminI(const PropertiesPtr& properties, const LoggerPtr& logger) : _logger(logger), _properties(properties) { updateViews(); } void MetricsAdminI::destroy() { Lock sync(*this); for(map::const_iterator p = _views.begin(); p != _views.end(); ++p) { p->second->destroy(); } } void MetricsAdminI::updateViews() { set updatedMaps; { Lock sync(*this); const string viewsPrefix = "IceMX.Metrics."; PropertyDict viewsProps = _properties->getPropertiesForPrefix(viewsPrefix); map views; _disabledViews.clear(); for(PropertyDict::const_iterator p = viewsProps.begin(); p != viewsProps.end(); ++p) { string viewName = p->first.substr(viewsPrefix.size()); string::size_type dotPos = viewName.find('.'); if(dotPos != string::npos) { viewName = viewName.substr(0, dotPos); } if(views.find(viewName) != views.end() || _disabledViews.find(viewName) != _disabledViews.end()) { continue; // View already configured. } validateProperties(viewsPrefix + viewName + ".", _properties); if(_properties->getPropertyAsIntWithDefault(viewsPrefix + viewName + ".Disabled", 0) > 0) { _disabledViews.insert(viewName); continue; // The view is disabled } // // Create the view or update it. // map::const_iterator q = _views.find(viewName); if(q == _views.end()) { q = views.insert(map::value_type(viewName, new MetricsViewI(viewName))).first; } else { q = views.insert(make_pair(viewName, q->second)).first; } for(map::const_iterator p = _factories.begin(); p != _factories.end(); ++p) { if(q->second->addOrUpdateMap(_properties, p->first, p->second, _logger)) { updatedMaps.insert(p->second); } } } _views.swap(views); // // Go through removed views to collect maps to update. // for(map::const_iterator p = views.begin(); p != views.end(); ++p) { if(_views.find(p->first) == _views.end()) { vector maps = p->second->getMaps(); for(vector::const_iterator q = maps.begin(); q != maps.end(); ++q) { updatedMaps.insert(_factories[*q]); } p->second->destroy(); } } } // // Call the updaters to update the maps. // for(set::const_iterator p = updatedMaps.begin(); p != updatedMaps.end(); ++p) { (*p)->update(); } } void MetricsAdminI::unregisterMap(const std::string& mapName) { bool updated; MetricsMapFactoryPtr factory; { Lock sync(*this); map::iterator p = _factories.find(mapName); if(p == _factories.end()) { return; } factory = p->second; _factories.erase(p); updated = removeMap(mapName); } if(updated) { factory->update(); } } Ice::StringSeq MetricsAdminI::getMetricsViewNames(Ice::StringSeq& disabledViews, const Current&) { Ice::StringSeq enabledViews; Lock sync(*this); for(map::const_iterator p = _views.begin(); p != _views.end(); ++p) { enabledViews.push_back(p->first); } #if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES) for(set::const_iterator p = _disabledViews.begin(); p != _disabledViews.end(); ++p) { disabledViews.push_back(*p); } #else disabledViews.insert(disabledViews.end(), _disabledViews.begin(), _disabledViews.end()); #endif return enabledViews; } void MetricsAdminI::enableMetricsView(const string& viewName, const Current&) { { Lock sync(*this); getMetricsView(viewName); // Throws if unkonwn metrics view. _properties->setProperty("IceMX.Metrics." + viewName + ".Disabled", "0"); } updateViews(); } void MetricsAdminI::disableMetricsView(const string& viewName, const Current&) { { Lock sync(*this); getMetricsView(viewName); // Throws if unkonwn metrics view. _properties->setProperty("IceMX.Metrics." + viewName + ".Disabled", "1"); } updateViews(); } MetricsView MetricsAdminI::getMetricsView(const string& viewName, ::Ice::Long& timestamp, const Current&) { Lock sync(*this); MetricsViewIPtr view = getMetricsView(viewName); timestamp = IceUtil::Time::now().toMilliSeconds(); if(view) { return view->getMetrics(); } return MetricsView(); } MetricsFailuresSeq MetricsAdminI::getMapMetricsFailures(const string& viewName, const string& map, const Current&) { Lock sync(*this); MetricsViewIPtr view = getMetricsView(viewName); if(view) { return view->getFailures(map); } return MetricsFailuresSeq(); } MetricsFailures MetricsAdminI::getMetricsFailures(const string& viewName, const string& map, const string& id, const Current&) { Lock sync(*this); MetricsViewIPtr view = getMetricsView(viewName); if(view) { return view->getFailures(map, id); } return MetricsFailures(); } vector MetricsAdminI::getMaps(const string& mapName) const { Lock sync(*this); vector maps; for(std::map::const_iterator p = _views.begin(); p != _views.end(); ++p) { MetricsMapIPtr map = p->second->getMap(mapName); if(map) { maps.push_back(map); } } return maps; } const LoggerPtr& MetricsAdminI::getLogger() const { return _logger; } void MetricsAdminI::setProperties(const ::Ice::PropertiesPtr& properties) { _properties = properties; } MetricsViewIPtr MetricsAdminI::getMetricsView(const std::string& name) { std::map::const_iterator p = _views.find(name); if(p == _views.end()) { if(_disabledViews.find(name) == _disabledViews.end()) { throw UnknownMetricsView(); } return 0; } return p->second; } void MetricsAdminI::updated(const PropertyDict& props) { for(PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p) { if(p->first.find("IceMX.") == 0) { // Udpate the metrics views using the new configuration. try { updateViews(); } catch(const std::exception& ex) { ::Ice::Warning warn(_logger); warn << "unexpected exception while updating metrics view configuration:\n" << ex.what(); } return; } } } bool MetricsAdminI::addOrUpdateMap(const std::string& mapName, const MetricsMapFactoryPtr& factory) { bool updated = false; for(std::map::const_iterator p = _views.begin(); p != _views.end(); ++p) { updated |= p->second->addOrUpdateMap(_properties, mapName, factory, _logger); } return updated; } bool MetricsAdminI::removeMap(const std::string& mapName) { bool updated = false; for(std::map::const_iterator p = _views.begin(); p != _views.end(); ++p) { updated |= p->second->removeMap(mapName); } return updated; } Ice-3.5.1/cpp/src/Ice/StreamI.h0000644000076400007640000001307712223561476014170 0ustar mesmes// ********************************************************************** // // 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 ICE_STREAM_I_H #define ICE_STREAM_I_H #include namespace IceInternal { // Forward declaration. class BasicStream; }; namespace Ice { // // Implement InputStream as a wrapper around BasicStream. // class InputStreamI : public InputStream { public: InputStreamI(const CommunicatorPtr&, const std::pair&, bool); InputStreamI(const CommunicatorPtr&, const std::pair&, const EncodingVersion&, bool); virtual ~InputStreamI(); virtual CommunicatorPtr communicator() const; virtual void sliceObjects(bool); virtual Int readSize(); virtual Int readAndCheckSeqSize(int); virtual ObjectPrx readProxy(); virtual void readObject(const ReadObjectCallbackPtr&); virtual void throwException(); virtual void throwException(const UserExceptionReaderFactoryPtr&); virtual void startObject(); virtual SlicedDataPtr endObject(bool); virtual void startException(); virtual SlicedDataPtr endException(bool); virtual std::string startSlice(); virtual void endSlice(); virtual void skipSlice(); virtual EncodingVersion startEncapsulation(); virtual void endEncapsulation(); virtual EncodingVersion skipEncapsulation(); virtual EncodingVersion getEncoding() const; virtual void readPendingObjects(); virtual void rewind(); virtual void skip(Int); virtual void skipSize(); virtual void read(bool&); virtual void read(Byte&); virtual void read(Short&); virtual void read(Int&); virtual void read(Long&); virtual void read(Float&); virtual void read(Double&); virtual void read(std::string&, bool = true); virtual void read(std::vector&, bool); virtual void read(std::wstring&); virtual void read(std::vector&); virtual void read(std::pair&, ::IceUtil::ScopedArray&); virtual void read(std::pair&); virtual void read(std::pair&, ::IceUtil::ScopedArray&); virtual void read(std::pair&, ::IceUtil::ScopedArray&); virtual void read(std::pair&, ::IceUtil::ScopedArray&); virtual void read(std::pair&, ::IceUtil::ScopedArray&); virtual void read(std::pair&, ::IceUtil::ScopedArray&); #ifdef __SUNPRO_CC using InputStream::read; #endif virtual bool readOptional(Int, OptionalFormat); virtual void closure(void*); virtual void* closure() const; private: void initialize(IceInternal::Instance*, const std::pair&, const EncodingVersion&, bool); const CommunicatorPtr _communicator; IceInternal::BasicStream* _is; std::vector< ReadObjectCallbackPtr > _callbacks; void* _closure; }; // // Implement OutputStream as a wrapper around BasicStream. // class OutputStreamI : public OutputStream { public: OutputStreamI(const CommunicatorPtr&); OutputStreamI(const CommunicatorPtr&, const EncodingVersion&); OutputStreamI(const CommunicatorPtr&, IceInternal::BasicStream*); virtual ~OutputStreamI(); virtual CommunicatorPtr communicator() const; virtual void writeObject(const ObjectPtr&); virtual void writeException(const UserException&); virtual void writeProxy(const ObjectPrx&); virtual void writeSize(Int); virtual void write(bool); virtual void write(Byte); virtual void write(Short); virtual void write(Int); virtual void write(Long); virtual void write(Float); virtual void write(Double); virtual void write(const std::string&, bool = true); virtual void write(const std::vector&, bool); virtual void write(const char*, bool = true); virtual void write(const std::wstring&); virtual void write(const std::vector&); virtual void write(const bool*, const bool*); virtual void write(const Byte*, const Byte*); virtual void write(const Short*, const Short*); virtual void write(const Int*, const Int*); virtual void write(const Long*, const Long*); virtual void write(const Float*, const Float*); virtual void write(const Double*, const Double*); #ifdef __SUNPRO_CC using OutputStream::write; #endif virtual bool writeOptional(Int, OptionalFormat); virtual void startObject(const SlicedDataPtr&); virtual void endObject(); virtual void startException(const SlicedDataPtr&); virtual void endException(); virtual void startSlice(const std::string&, int, bool); virtual void endSlice(); virtual void startEncapsulation(const EncodingVersion&, FormatType); virtual void startEncapsulation(); virtual void endEncapsulation(); virtual EncodingVersion getEncoding() const; virtual void writePendingObjects(); virtual void finished(std::vector< Byte >&); virtual std::pair finished(); virtual void reset(bool); virtual size_type pos(); virtual void rewrite(Int, size_type); virtual void startSize(); virtual void endSize(); private: const CommunicatorPtr _communicator; IceInternal::BasicStream* _os; const bool _own; }; } #endif Ice-3.5.1/cpp/src/Ice/SlicedData.cpp0000644000076400007640000000601212223561476015143 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace Ice; IceUtil::Shared* Ice::upCast(SliceInfo* p) { return p; } IceUtil::Shared* Ice::upCast(SlicedData* p) { return p; } IceUtil::Shared* Ice::upCast(UnknownSlicedObject* p) { return p; } Ice::SlicedData::SlicedData(const SliceInfoSeq& seq) : slices(seq) { } void Ice::SlicedData::__gcReachable(IceInternal::GCCountMap& m) const { // // Iterate over the object references in each preserved slice. // for(SliceInfoSeq::const_iterator p = slices.begin(); p != slices.end(); ++p) { for(vector::const_iterator q = (*p)->objects.begin(); q != (*p)->objects.end(); ++q) { (*q)->__addObject(m); } } } void Ice::SlicedData::__gcClear() { // // Iterate over the object references in each preserved slice. // for(SliceInfoSeq::const_iterator p = slices.begin(); p != slices.end(); ++p) { for(vector::iterator q = (*p)->objects.begin(); q != (*p)->objects.end(); ++q) { if((*q)->__usesGC()) { (*q)->__decRefUnsafe(); (*q).__clearHandleUnsafe(); } } (*p)->objects.clear(); } } void Ice::SlicedData::__addObject(IceInternal::GCCountMap& m) { IceInternal::GCCountMap::iterator pos = m.find(this); if(pos == m.end()) { m[this] = 1; } else { ++pos->second; } } Ice::UnknownSlicedObject::UnknownSlicedObject(const string& unknownTypeId) : _unknownTypeId(unknownTypeId) { } const string& Ice::UnknownSlicedObject::getUnknownTypeId() const { return _unknownTypeId; } SlicedDataPtr Ice::UnknownSlicedObject::getSlicedData() const { return _slicedData; } void Ice::UnknownSlicedObject::__addObject(IceInternal::GCCountMap& _c) { IceInternal::GCCountMap::iterator pos = _c.find(this); if(pos == _c.end()) { _c[this] = 1; } else { ++pos->second; } } bool Ice::UnknownSlicedObject::__usesGC() { return true; } void Ice::UnknownSlicedObject::__gcReachable(IceInternal::GCCountMap& _c) const { if(_slicedData) { _slicedData->__addObject(_c); } } void Ice::UnknownSlicedObject::__gcClear() { if(_slicedData) { _slicedData->__decRefUnsafe(); _slicedData.__clearHandleUnsafe(); } } void Ice::UnknownSlicedObject::__write(IceInternal::BasicStream* __os) const { __os->startWriteObject(_slicedData); __os->endWriteObject(); } void Ice::UnknownSlicedObject::__read(IceInternal::BasicStream* __is) { __is->startReadObject(); _slicedData = __is->endReadObject(true); } Ice-3.5.1/cpp/src/Ice/DefaultsAndOverrides.h0000644000076400007640000000254412223561476016676 0ustar mesmes // ********************************************************************** // // 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 ICE_DEFAULTS_AND_OVERRIDES_H #define ICE_DEFAULTS_AND_OVERRIDES_H #include #include #include #include #include #include namespace IceInternal { class DefaultsAndOverrides : public ::IceUtil::Shared { public: DefaultsAndOverrides(const ::Ice::PropertiesPtr&); std::string defaultHost; std::string defaultProtocol; bool defaultCollocationOptimization; Ice::EndpointSelectionType defaultEndpointSelection; int defaultLocatorCacheTimeout; bool defaultPreferSecure; Ice::EncodingVersion defaultEncoding; Ice::FormatType defaultFormat; bool overrideTimeout; Ice::Int overrideTimeoutValue; bool overrideConnectTimeout; Ice::Int overrideConnectTimeoutValue; bool overrideCloseTimeout; Ice::Int overrideCloseTimeoutValue; bool overrideCompress; bool overrideCompressValue; bool overrideSecure; bool overrideSecureValue; }; } #endif Ice-3.5.1/cpp/src/Ice/LoggerUtil.cpp0000644000076400007640000000416612223561476015233 0ustar mesmes // ********************************************************************** // // 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 #include #include #include #include using namespace std; namespace IceUtilInternal { extern bool ICE_DECLSPEC_IMPORT printStackTraces; } string Ice::LoggerOutputBase::str() const { return _str.str(); } ostringstream& Ice::LoggerOutputBase::__str() { return _str; } Ice::LoggerOutputBase& Ice::operator<<(Ice::LoggerOutputBase& out, ios_base& (*val)(ios_base&)) { out.__str() << val; return out; } Ice::LoggerOutputBase& Ice::operator<<(Ice::LoggerOutputBase& out, const std::exception& ex) { if(IceUtilInternal::printStackTraces) { const ::IceUtil::Exception* exception = dynamic_cast(&ex); if(exception) { out.__str() << exception->what() << '\n' << exception->ice_stackTrace(); return out; } } out.__str() << ex.what(); return out; } Ice::Trace::Trace(const LoggerPtr& logger, const string& category) : _logger(logger), _category(category) { } Ice::Trace::~Trace() { flush(); } void Ice::Trace::flush() { string s = __str().str(); if(!s.empty()) { _logger->trace(_category, s); } __str().str(""); } Ice::LoggerPlugin::LoggerPlugin(const CommunicatorPtr& communicator, const LoggerPtr& logger) { if(communicator == 0) { throw PluginInitializationException(__FILE__, __LINE__, "Communicator cannot be null"); } if(logger == 0) { throw PluginInitializationException(__FILE__, __LINE__, "Logger cannot be null"); } IceInternal::InstancePtr instance = IceInternal::getInstance(communicator); instance->setLogger(logger); } void Ice::LoggerPlugin::initialize() { } void Ice::LoggerPlugin::destroy() { } Ice-3.5.1/cpp/src/Ice/Protocol.cpp0000644000076400007640000000716312223561476014757 0ustar mesmes// ********************************************************************** // // 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 #include namespace IceInternal { const Ice::Byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' const Ice::Byte requestHdr[] = { magic[0], magic[1], magic[2], magic[3], protocolMajor, protocolMinor, protocolEncodingMajor, protocolEncodingMinor, requestMsg, 0, // Compression status 0, 0, 0, 0, // Message size (placeholder) 0, 0, 0, 0 // Request id (placeholder) }; const Ice::Byte requestBatchHdr[] = { magic[0], magic[1], magic[2], magic[3], protocolMajor, protocolMinor, protocolEncodingMajor, protocolEncodingMinor, requestBatchMsg, 0, // Compression status 0, 0, 0, 0, // Message size (place holder) 0, 0, 0, 0 // Number of requests in batch (placeholder) }; const Ice::Byte replyHdr[] = { magic[0], magic[1], magic[2], magic[3], protocolMajor, protocolMinor, protocolEncodingMajor, protocolEncodingMinor, replyMsg, 0, // Compression status 0, 0, 0, 0 // Message size (placeholder) }; void stringToMajorMinor(const std::string& str, Ice::Byte& major, Ice::Byte& minor) { std::string::size_type pos = str.find_first_of("."); if(pos == std::string::npos) { Ice::VersionParseException ex(__FILE__, __LINE__); ex.str = "malformed version value `" + str + "'"; throw ex; } std::istringstream majStr(str.substr(0, pos)); Ice::Int majVersion; if(!(majStr >> majVersion) || !majStr.eof()) { Ice::VersionParseException ex(__FILE__, __LINE__); ex.str = "invalid major version value `" + str + "'"; throw ex; } std::istringstream minStr(str.substr(pos + 1, std::string::npos)); Ice::Int minVersion; if(!(minStr >> minVersion) || !minStr.eof()) { Ice::VersionParseException ex(__FILE__, __LINE__); ex.str = "invalid minor version value `" + str + "'"; throw ex; } if(majVersion < 1 || majVersion > 255 || minVersion < 0 || minVersion > 255) { Ice::VersionParseException ex(__FILE__, __LINE__); ex.str = "range error in version `" + str + "'"; throw ex; } major = static_cast(majVersion); minor = static_cast(minVersion); } void throwUnsupportedProtocolException(const char* f, int l, const Ice::ProtocolVersion& v, const Ice::ProtocolVersion& s) { throw Ice::UnsupportedProtocolException(f, l, "", v, s); } void throwUnsupportedEncodingException(const char* f, int l, const Ice::EncodingVersion& v, const Ice::EncodingVersion& s) { throw Ice::UnsupportedEncodingException(f, l, "", v, s); } } namespace Ice { const EncodingVersion currentEncoding = { IceInternal::encodingMajor, IceInternal::encodingMinor }; const ProtocolVersion currentProtocol = { IceInternal::protocolMajor, IceInternal::protocolMinor }; // // The encoding to use for protocol messages, this version is tied to // the protocol version. // const EncodingVersion currentProtocolEncoding = { IceInternal::protocolEncodingMajor, IceInternal::protocolEncodingMinor }; const ProtocolVersion Protocol_1_0 = { 1, 0 }; const EncodingVersion Encoding_1_0 = { 1, 0 }; const EncodingVersion Encoding_1_1 = { 1, 1 }; } Ice-3.5.1/cpp/src/Ice/DefaultsAndOverridesF.h0000644000076400007640000000121012223561476016771 0ustar mesmes// ********************************************************************** // // 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 ICE_DEFAULTS_AND_OVERRIDES_F_H #define ICE_DEFAULTS_AND_OVERRIDES_F_H #include #include namespace IceInternal { class DefaultsAndOverrides; IceUtil::Shared* upCast(DefaultsAndOverrides*); typedef Handle DefaultsAndOverridesPtr; } #endif Ice-3.5.1/cpp/src/Ice/GC.h0000644000076400007640000000254012223561476013106 0ustar mesmes// ********************************************************************** // // 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 ICE_GC_H #define ICE_GC_H #include #include #include #include #include namespace IceInternal { struct GCStats { int examined; int collected; IceUtil::Time time; }; class GC : public ::IceUtil::Thread, public ::IceUtil::Monitor< ::IceUtil::Mutex> { public: typedef void (*StatsCallback)(const ::IceInternal::GCStats&); GC(int, StatsCallback); virtual ~GC(); virtual void run(); void stop(); void collectGarbage(); void updateObserver(const Ice::Instrumentation::CommunicatorObserverPtr&); void clearObserver(const Ice::Instrumentation::CommunicatorObserverPtr&); private: enum State { NotStarted, Started, Stopping, Stopped }; State _state; bool _collecting; int _interval; StatsCallback _statsCallback; Ice::Instrumentation::CommunicatorObserverPtr _communicatorObserver; ObserverHelperT _observer; }; } #endif Ice-3.5.1/cpp/src/Ice/TcpConnector.h0000644000076400007640000000253712223561476015224 0ustar mesmes// ********************************************************************** // // 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 ICE_TCP_CONNECTOR_H #define ICE_TCP_CONNECTOR_H #include #include #include #include #include #include #include namespace IceInternal { class TcpConnector : public Connector { public: virtual TransceiverPtr connect(); virtual Ice::Short type() const; virtual std::string toString() const; virtual bool operator==(const Connector&) const; virtual bool operator!=(const Connector&) const; virtual bool operator<(const Connector&) const; private: TcpConnector(const InstancePtr&, const Address&, const NetworkProxyPtr&, Ice::Int, const std::string&); virtual ~TcpConnector(); friend class TcpEndpointI; const InstancePtr _instance; const TraceLevelsPtr _traceLevels; const ::Ice::LoggerPtr _logger; const Address _addr; const NetworkProxyPtr _proxy; const Ice::Int _timeout; const std::string _connectionId; }; } #endif Ice-3.5.1/cpp/src/Ice/TraceUtil.h0000644000076400007640000000153212223561476014511 0ustar mesmes// ********************************************************************** // // 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 ICE_TRACE_UTIL_H #define ICE_TRACE_UTIL_H #include #include namespace IceInternal { class BasicStream; void traceSend(const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&); void traceRecv(const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&); void trace(const char*, const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&); void traceSlicing(const char*, const ::std::string&, const char *, const ::Ice::LoggerPtr&); } #endif Ice-3.5.1/cpp/src/Ice/Object.cpp0000644000076400007640000002331612223561476014362 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; Object* Ice::upCast(Object* p) { return p; } void Ice::__patch(ObjectPtr& obj, const ObjectPtr& v) { obj = v; } bool Ice::Object::operator==(const Object& r) const { return this == &r; } bool Ice::Object::operator<(const Object& r) const { return this < &r; } Int Ice::Object::ice_getHash() const { return static_cast(reinterpret_cast(this) >> 4); } namespace { const string __Ice__Object_ids[] = { "::Ice::Object" }; } bool Ice::Object::ice_isA(const string& s, const Current&) const { return s == __Ice__Object_ids[0]; } void Ice::Object::ice_ping(const Current&) const { // Nothing to do. } vector Ice::Object::ice_ids(const Current&) const { return vector(&__Ice__Object_ids[0], &__Ice__Object_ids[1]); } const string& Ice::Object::ice_id(const Current&) const { return __Ice__Object_ids[0]; } const ::std::string& Ice::Object::ice_staticId() { return __Ice__Object_ids[0]; } Ice::ObjectPtr Ice::Object::ice_clone() const { throw CloneNotImplementedException(__FILE__, __LINE__); return 0; // avoid warning with some compilers } void Ice::Object::ice_preMarshal() { } void Ice::Object::ice_postUnmarshal() { } DispatchStatus Ice::Object::___ice_isA(Incoming& __inS, const Current& __current) { BasicStream* __is = __inS.startReadParams(); string __id; __is->read(__id, false); __inS.endReadParams(); bool __ret = ice_isA(__id, __current); BasicStream* __os = __inS.__startWriteParams(DefaultFormat); __os->write(__ret); __inS.__endWriteParams(true); return DispatchOK; } DispatchStatus Ice::Object::___ice_ping(Incoming& __inS, const Current& __current) { __inS.readEmptyParams(); ice_ping(__current); __inS.__writeEmptyParams(); return DispatchOK; } DispatchStatus Ice::Object::___ice_ids(Incoming& __inS, const Current& __current) { __inS.readEmptyParams(); vector __ret = ice_ids(__current); BasicStream* __os = __inS.__startWriteParams(DefaultFormat); __os->write(&__ret[0], &__ret[0] + __ret.size(), false); __inS.__endWriteParams(true); return DispatchOK; } DispatchStatus Ice::Object::___ice_id(Incoming& __inS, const Current& __current) { __inS.readEmptyParams(); string __ret = ice_id(__current); BasicStream* __os = __inS.__startWriteParams(DefaultFormat); __os->write(__ret, false); __inS.__endWriteParams(true); return DispatchOK; } Ice::Int Ice::Object::ice_operationAttributes(const string&) const { return 0; } string Ice::Object::__all[] = { "ice_id", "ice_ids", "ice_isA", "ice_ping" }; DispatchStatus Ice::Object::ice_dispatch(Request& request, const DispatchInterceptorAsyncCallbackPtr& cb) { class PushCb { public: PushCb(IceInternal::Incoming& in, const DispatchInterceptorAsyncCallbackPtr& cb) : _in(in), _cb(cb) { if(_cb != 0) { _in.push(_cb); } } ~PushCb() { if(_cb != 0) { _in.pop(); } } private: IceInternal::Incoming& _in; const DispatchInterceptorAsyncCallbackPtr& _cb; }; if(request.isCollocated()) { return __collocDispatch(dynamic_cast(request)); } else { IceInternal::Incoming& in = dynamic_cast(request)._in; PushCb pusbCb(in, cb); in.startOver(); // may raise ResponseSentException return __dispatch(in, in.getCurrent()); } } DispatchStatus Ice::Object::__dispatch(Incoming& in, const Current& current) { pair r = equal_range(__all, __all + sizeof(__all) / sizeof(string), current.operation); if(r.first == r.second) { throw OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); } switch(r.first - __all) { case 0: { return ___ice_id(in, current); } case 1: { return ___ice_ids(in, current); } case 2: { return ___ice_isA(in, current); } case 3: { return ___ice_ping(in, current); } } assert(false); throw OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); } DispatchStatus Ice::Object::__collocDispatch(IceInternal::Direct& request) { return request.run(this); } void Ice::Object::__write(IceInternal::BasicStream* os) const { os->startWriteObject(0); __writeImpl(os); os->endWriteObject(); } void Ice::Object::__read(IceInternal::BasicStream* is) { is->startReadObject(); __readImpl(is); is->endReadObject(false); } void Ice::Object::__write(const OutputStreamPtr& os) const { os->startObject(0); __writeImpl(os); os->endObject(); } void Ice::Object::__read(const InputStreamPtr& is) { is->startObject(); __readImpl(is); is->endObject(false); } void Ice::Object::__writeImpl(const OutputStreamPtr&) const { throw MarshalException(__FILE__, __LINE__, "class was not generated with stream support"); } void Ice::Object::__readImpl(const InputStreamPtr&) { throw MarshalException(__FILE__, __LINE__, "class was not generated with stream support"); } namespace { string operationModeToString(OperationMode mode) { switch(mode) { case Normal: return "::Ice::Normal"; case Nonmutating: return "::Ice::Nonmutating"; case Idempotent: return "::Ice::Idempotent"; } ostringstream os; os << "unknown value (" << mode << ")"; return os.str(); } } void Ice::Object::__checkMode(OperationMode expected, OperationMode received) { if(expected != received) { if(expected == Idempotent && received == Nonmutating) { // // Fine: typically an old client still using the deprecated nonmutating keyword // // // Note that expected == Nonmutating and received == Idempotent is not ok: // the server may still use the deprecated nonmutating keyword to detect updates // and the client should not break this (deprecated) feature. // } else { Ice::MarshalException ex(__FILE__, __LINE__); std::ostringstream __reason; __reason << "unexpected operation mode. expected = " << operationModeToString(expected) << " received = " << operationModeToString(received); ex.reason = __reason.str(); throw ex; } } } DispatchStatus Ice::Blobject::__dispatch(Incoming& in, const Current& current) { const Byte* inEncaps; Int sz; in.readParamEncaps(inEncaps, sz); vector outEncaps; bool ok = ice_invoke(vector(inEncaps, inEncaps + sz), outEncaps, current); if(outEncaps.empty()) { in.__writeParamEncaps(0, 0, ok); } else { in.__writeParamEncaps(&outEncaps[0], static_cast(outEncaps.size()), ok); } if(ok) { return DispatchOK; } else { return DispatchUserException; } } DispatchStatus Ice::BlobjectArray::__dispatch(Incoming& in, const Current& current) { pair inEncaps; Int sz; in.readParamEncaps(inEncaps.first, sz); inEncaps.second = inEncaps.first + sz; vector outEncaps; bool ok = ice_invoke(inEncaps, outEncaps, current); if(outEncaps.empty()) { in.__writeParamEncaps(0, 0, ok); } else { in.__writeParamEncaps(&outEncaps[0], static_cast(outEncaps.size()), ok); } if(ok) { return DispatchOK; } else { return DispatchUserException; } } DispatchStatus Ice::BlobjectAsync::__dispatch(Incoming& in, const Current& current) { const Byte* inEncaps; Int sz; in.readParamEncaps(inEncaps, sz); AMD_Object_ice_invokePtr cb = new ::IceAsync::Ice::AMD_Object_ice_invoke(in); try { ice_invoke_async(cb, vector(inEncaps, inEncaps + sz), current); } catch(const ::std::exception& ex) { cb->ice_exception(ex); } catch(...) { cb->ice_exception(); } return DispatchAsync; } DispatchStatus Ice::BlobjectArrayAsync::__dispatch(Incoming& in, const Current& current) { pair inEncaps; Int sz; in.readParamEncaps(inEncaps.first, sz); inEncaps.second = inEncaps.first + sz; AMD_Object_ice_invokePtr cb = new ::IceAsync::Ice::AMD_Object_ice_invoke(in); try { ice_invoke_async(cb, inEncaps, current); } catch(const ::std::exception& ex) { cb->ice_exception(ex); } catch(...) { cb->ice_exception(); } return DispatchAsync; } void Ice::ice_writeObject(const OutputStreamPtr& out, const ObjectPtr& p) { out->write(p); } void Ice::ice_readObject(const InputStreamPtr& in, ObjectPtr& p) { in->read(p); } Ice-3.5.1/cpp/src/Ice/Selector.cpp0000644000076400007640000006175612223561476014746 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace IceInternal; #ifdef ICE_OS_WINRT using namespace Windows::Foundation; using namespace Windows::Storage::Streams; using namespace Windows::Networking; using namespace Windows::Networking::Sockets; Selector::Selector(const InstancePtr& instance) : _instance(instance) { } void Selector::destroy() { } void Selector::initialize(IceInternal::EventHandler* handler) { handler->__incRef(); handler->getNativeInfo()->setCompletedHandler( ref new SocketOperationCompletedHandler([=](int operation) { completed(handler, static_cast(operation)); })); } void Selector::update(IceInternal::EventHandler* handler, SocketOperation remove, SocketOperation add) { handler->_registered = static_cast(handler->_registered & ~remove); handler->_registered = static_cast(handler->_registered | add); if(add & SocketOperationRead && !(handler->_pending & SocketOperationRead)) { handler->_pending = static_cast(handler->_pending | SocketOperationRead); completed(handler, SocketOperationRead); // Start an asynchrnous read } else if(add & SocketOperationWrite && !(handler->_pending & SocketOperationWrite)) { handler->_pending = static_cast(handler->_pending | SocketOperationWrite); completed(handler, SocketOperationWrite); // Start an asynchrnous write } } void Selector::finish(IceInternal::EventHandler* handler) { handler->_registered = SocketOperationNone; handler->__decRef(); } IceInternal::EventHandler* Selector::getNextHandler(SocketOperation& status, int timeout) { Lock lock(*this); while(_events.empty()) { if(timeout > 0) { timedWait(IceUtil::Time::seconds(timeout)); if(_events.empty()) { throw SelectorTimeoutException(); } } else { wait(); } } assert(!_events.empty()); IceInternal::EventHandler* handler = _events.front().handler; status = _events.front().status; _events.pop_front(); return handler; } void Selector::completed(IceInternal::EventHandler* handler, SocketOperation op) { Lock lock(*this); _events.push_back(SelectEvent(handler, op)); notify(); } #elif defined(ICE_USE_IOCP) Selector::Selector(const InstancePtr& instance) : _instance(instance) { } Selector::~Selector() { } void Selector::setup(int sizeIO) { _handle = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, sizeIO); if(_handle == NULL) { Ice::SocketException ex(__FILE__, __LINE__); ex.error = GetLastError(); throw ex; } } void Selector::destroy() { CloseHandle(_handle); } void Selector::initialize(EventHandler* handler) { HANDLE socket = reinterpret_cast(handler->getNativeInfo()->fd()); if(CreateIoCompletionPort(socket, _handle, reinterpret_cast(handler), 0) == NULL) { Ice::SocketException ex(__FILE__, __LINE__); ex.error = GetLastError(); throw ex; } handler->__incRef(); } void Selector::update(EventHandler* handler, SocketOperation remove, SocketOperation add) { handler->_registered = static_cast(handler->_registered & ~remove); handler->_registered = static_cast(handler->_registered | add); AsyncInfo* info = 0; if(add & SocketOperationRead && !(handler->_pending & SocketOperationRead)) { handler->_pending = static_cast(handler->_pending | SocketOperationRead); info = handler->getNativeInfo()->getAsyncInfo(SocketOperationRead); } else if(add & SocketOperationWrite && !(handler->_pending & SocketOperationWrite)) { handler->_pending = static_cast(handler->_pending | SocketOperationWrite); info = handler->getNativeInfo()->getAsyncInfo(SocketOperationWrite); } if(info) { if(!PostQueuedCompletionStatus(_handle, 0, reinterpret_cast(handler), info)) { Ice::SocketException ex(__FILE__, __LINE__); ex.error = GetLastError(); throw ex; } } } void Selector::finish(EventHandler* handler) { handler->_registered = SocketOperationNone; handler->__decRef(); } EventHandler* Selector::getNextHandler(SocketOperation& status, int timeout) { ULONG_PTR key; LPOVERLAPPED ol; DWORD count; if(!GetQueuedCompletionStatus(_handle, &count, &key, &ol, timeout > 0 ? timeout * 1000 : INFINITE)) { int err = WSAGetLastError(); if(ol == 0) { if(err == WAIT_TIMEOUT) { throw SelectorTimeoutException(); } else { { Ice::SocketException ex(__FILE__, __LINE__, err); Ice::Error out(_instance->initializationData().logger); out << "fatal error: couldn't dequeue packet from completion port:\n" << ex; } abort(); } } AsyncInfo* info = static_cast(ol); status = info->status; info->count = SOCKET_ERROR; info->error = WSAGetLastError(); return reinterpret_cast(key); } assert(ol); AsyncInfo* info = static_cast(ol); status = info->status; info->count = count; info->error = 0; return reinterpret_cast(key); } #elif defined(ICE_USE_KQUEUE) || defined(ICE_USE_EPOLL) Selector::Selector(const InstancePtr& instance) : _instance(instance) { _events.resize(256); #if defined(ICE_USE_EPOLL) _queueFd = epoll_create(1); if(_queueFd < 0) { Ice::SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } #else _queueFd = kqueue(); if(_queueFd < 0) { Ice::SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } _selecting = false; #endif } Selector::~Selector() { } void Selector::destroy() { try { closeSocket(_queueFd); } catch(const Ice::LocalException& ex) { Ice::Error out(_instance->initializationData().logger); out << "exception in selector while calling closeSocket():\n" << ex; } } void Selector::update(EventHandler* handler, SocketOperation remove, SocketOperation add) { SocketOperation previous = handler->_registered; handler->_registered = static_cast(handler->_registered & ~remove); handler->_registered = static_cast(handler->_registered | add); if(previous == handler->_registered) { return; } SOCKET fd = handler->getNativeInfo()->fd(); #if defined(ICE_USE_EPOLL) epoll_event event; memset(&event, 0, sizeof(epoll_event)); event.data.ptr = handler; SocketOperation status = handler->_registered; if(handler->_disabled) { status = static_cast(status & ~handler->_disabled); previous = static_cast(previous & ~handler->_disabled); } event.events |= status & SocketOperationRead ? EPOLLIN : 0; event.events |= status & SocketOperationWrite ? EPOLLOUT : 0; int op; if(!previous && status) { op = EPOLL_CTL_ADD; } else if(previous && !status) { op = EPOLL_CTL_DEL; } else if(previous == status) { return; } else { op = EPOLL_CTL_MOD; } if(epoll_ctl(_queueFd, op, fd, &event) != 0) { Ice::Error out(_instance->initializationData().logger); out << "error while updating selector:\n" << IceUtilInternal::errorToString(IceInternal::getSocketErrno()); } #else // ICE_USE_KQUEUE if(remove & SocketOperationRead) { struct kevent ev; EV_SET(&ev, fd, EVFILT_READ, EV_DELETE, 0, 0, handler); _changes.push_back(ev); } if(remove & SocketOperationWrite) { struct kevent ev; EV_SET(&ev, fd, EVFILT_WRITE, EV_DELETE, 0, 0, handler); _changes.push_back(ev); } if(add & SocketOperationRead) { struct kevent ev; EV_SET(&ev, fd, EVFILT_READ, EV_ADD | (handler->_disabled & SocketOperationRead ? EV_DISABLE : 0), 0, 0, handler); _changes.push_back(ev); } if(add & SocketOperationWrite) { struct kevent ev; EV_SET(&ev, fd, EVFILT_WRITE, EV_ADD | (handler->_disabled & SocketOperationWrite ? EV_DISABLE : 0), 0, 0, handler); _changes.push_back(ev); } if(_selecting) { updateSelector(); } #endif } void Selector::enable(EventHandler* handler, SocketOperation status) { if(!(handler->_disabled & status)) { return; } handler->_disabled = static_cast(handler->_disabled & ~status); if(handler->_registered & status) { SOCKET fd = handler->getNativeInfo()->fd(); #if defined(ICE_USE_EPOLL) SocketOperation previous = static_cast(handler->_registered & ~(handler->_disabled | status)); SocketOperation newStatus = static_cast(handler->_registered & ~handler->_disabled); epoll_event event; memset(&event, 0, sizeof(epoll_event)); event.data.ptr = handler; event.events |= newStatus & SocketOperationRead ? EPOLLIN : 0; event.events |= newStatus & SocketOperationWrite ? EPOLLOUT : 0; if(epoll_ctl(_queueFd, previous ? EPOLL_CTL_MOD : EPOLL_CTL_ADD, fd, &event) != 0) { Ice::Error out(_instance->initializationData().logger); out << "error while updating selector:\n" << IceUtilInternal::errorToString(IceInternal::getSocketErrno()); } #else // ICE_USE_KQUEUE struct kevent ev; EV_SET(&ev, fd, status == SocketOperationRead ? EVFILT_READ : EVFILT_WRITE, EV_ENABLE, 0, 0, handler); _changes.push_back(ev); if(_selecting) { updateSelector(); } #endif } } void Selector::disable(EventHandler* handler, SocketOperation status) { if(handler->_disabled & status) { return; } handler->_disabled = static_cast(handler->_disabled | status); if(handler->_registered & status) { SOCKET fd = handler->getNativeInfo()->fd(); #if defined(ICE_USE_EPOLL) SocketOperation newStatus = static_cast(handler->_registered & ~handler->_disabled); epoll_event event; memset(&event, 0, sizeof(epoll_event)); event.data.ptr = handler; event.events |= newStatus & SocketOperationRead ? EPOLLIN : 0; event.events |= newStatus & SocketOperationWrite ? EPOLLOUT : 0; if(epoll_ctl(_queueFd, newStatus ? EPOLL_CTL_MOD : EPOLL_CTL_DEL, fd, &event) != 0) { Ice::Error out(_instance->initializationData().logger); out << "error while updating selector:\n" << IceUtilInternal::errorToString(IceInternal::getSocketErrno()); } #else // ICE_USE_KQUEUE struct kevent ev; EV_SET(&ev, fd, status == SocketOperationRead ? EVFILT_READ : EVFILT_WRITE, EV_DISABLE, 0, 0, handler); _changes.push_back(ev); if(_selecting) { updateSelector(); } #endif } } void Selector::finish(EventHandler* handler) { if(handler->_registered) { update(handler, handler->_registered, SocketOperationNone); } } #if defined(ICE_USE_KQUEUE) void Selector::updateSelector() { int rs = kevent(_queueFd, &_changes[0], _changes.size(), 0, 0, 0); if(rs < 0) { Ice::Error out(_instance->initializationData().logger); out << "error while updating selector:\n" << IceUtilInternal::errorToString(IceInternal::getSocketErrno()); } _changes.clear(); } #endif void Selector::select(vector >& handlers, int timeout) { int ret = 0; while(true) { #if defined(ICE_USE_EPOLL) ret = epoll_wait(_queueFd, &_events[0], _events.size(), timeout > 0 ? timeout * 1000 : -1); #else assert(!_events.empty()); if(timeout > 0) { struct timespec ts; ts.tv_sec = timeout; ts.tv_nsec = 0; ret = kevent(_queueFd, 0, 0, &_events[0], _events.size(), &ts); } else { ret = kevent(_queueFd, 0, 0, &_events[0], _events.size(), 0); } #endif if(ret == SOCKET_ERROR) { if(interrupted()) { continue; } { Ice::SocketException ex(__FILE__, __LINE__, IceInternal::getSocketErrno()); Ice::Error out(_instance->initializationData().logger); out << "fatal error: selector failed:\n" << ex; } abort(); } break; } if(ret == 0) { throw SelectorTimeoutException(); } assert(ret > 0); handlers.clear(); for(int i = 0; i < ret; ++i) { pair p; #if defined(ICE_USE_EPOLL) struct epoll_event& ev = _events[i]; p.first = reinterpret_cast(ev.data.ptr); p.second = static_cast(((ev.events & EPOLLIN) ? SocketOperationRead : SocketOperationNone) | ((ev.events & EPOLLOUT) ? SocketOperationWrite : SocketOperationNone)); #else struct kevent& ev = _events[i]; if(ev.flags & EV_ERROR) { Ice::Error out(_instance->initializationData().logger); out << "error while updating selector:\n" << IceUtilInternal::errorToString(ev.data); continue; } p.first = reinterpret_cast(ev.udata); p.second = (ev.filter == EVFILT_READ) ? SocketOperationRead : SocketOperationWrite; #endif handlers.push_back(p); } } #elif defined(ICE_USE_SELECT) || defined(ICE_USE_POLL) Selector::Selector(const InstancePtr& instance) : _instance(instance), _selecting(false), _interrupted(false) { SOCKET fds[2]; createPipe(fds); _fdIntrRead = fds[0]; _fdIntrWrite = fds[1]; #if defined(ICE_USE_SELECT) FD_ZERO(&_readFdSet); FD_ZERO(&_writeFdSet); FD_ZERO(&_errorFdSet); FD_SET(_fdIntrRead, &_readFdSet); #else struct pollfd pollFd; pollFd.fd = _fdIntrRead; pollFd.events = POLLIN; _pollFdSet.push_back(pollFd); #endif } Selector::~Selector() { try { closeSocket(_fdIntrWrite); } catch(const Ice::LocalException& ex) { Ice::Error out(_instance->initializationData().logger); out << "exception in selector while calling closeSocket():\n" << ex; } try { closeSocket(_fdIntrRead); } catch(const Ice::LocalException& ex) { Ice::Error out(_instance->initializationData().logger); out << "exception in selector while calling closeSocket():\n" << ex; } } void Selector::destroy() { #if !defined(ICE_USE_SELECT) && !defined(ICE_USE_POLL) assert(_events.empty()); #endif } void Selector::update(EventHandler* handler, SocketOperation remove, SocketOperation add) { SocketOperation previous = handler->_registered; handler->_registered = static_cast(handler->_registered & ~remove); handler->_registered = static_cast(handler->_registered | add); if(previous == handler->_registered) { return; } updateImpl(handler); } void Selector::enable(EventHandler* handler, SocketOperation status) { if(!(handler->_disabled & status)) { return; } handler->_disabled = static_cast(handler->_disabled & ~status); if(handler->_registered & status) { updateImpl(handler); } } void Selector::disable(EventHandler* handler, SocketOperation status) { if(handler->_disabled & status) { return; } handler->_disabled = static_cast(handler->_disabled | status); if(handler->_registered & status) { updateImpl(handler); } } void Selector::finish(EventHandler* handler) { if(handler->_registered) { update(handler, handler->_registered, SocketOperationNone); } } void Selector::startSelect() { if(_interrupted) { char c; while(true) { ssize_t ret; #ifdef _WIN32 ret = ::recv(_fdIntrRead, &c, 1, 0); #else ret = ::read(_fdIntrRead, &c, 1); #endif if(ret == SOCKET_ERROR) { if(interrupted()) { continue; } Ice::SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } break; } _interrupted = false; if(!_changes.empty()) { updateSelector(); } } _selecting = true; } void Selector::finishSelect() { _selecting = false; } void Selector::select(vector >& handlers, int timeout) { int ret = 0; while(true) { #if defined(ICE_USE_SELECT) fd_set* rFdSet = fdSetCopy(_selectedReadFdSet, _readFdSet); fd_set* wFdSet = fdSetCopy(_selectedWriteFdSet, _writeFdSet); fd_set* eFdSet = fdSetCopy(_selectedErrorFdSet, _errorFdSet); if(timeout > 0) { struct timeval tv; tv.tv_sec = timeout; tv.tv_usec = 0; ret = ::select(0, rFdSet, wFdSet, eFdSet, &tv); // The first parameter is ignored on Windows } else { ret = ::select(0, rFdSet, wFdSet, eFdSet, 0); // The first parameter is ignored on Windows } #else ret = poll(&_pollFdSet[0], _pollFdSet.size(), timeout > 0 ? timeout * 1000 : -1); #endif if(ret == SOCKET_ERROR) { if(interrupted()) { continue; } { Ice::SocketException ex(__FILE__, __LINE__, IceInternal::getSocketErrno()); Ice::Error out(_instance->initializationData().logger); out << "fatal error: selector failed:\n" << ex; } abort(); } break; } if(ret == 0) { throw SelectorTimeoutException(); } assert(ret > 0); handlers.clear(); #if defined(ICE_USE_SELECT) if(_selectedReadFdSet.fd_count == 0 && _selectedWriteFdSet.fd_count == 0 && _selectedErrorFdSet.fd_count == 0) { Ice::Error out(_instance->initializationData().logger); out << "select() in selector returned " << ret << " but no filedescriptor is ready"; return; } for(unsigned int i = 0; i < static_cast(ret); ++i) { pair p; // // Round robin for the filedescriptors. // SOCKET fd; p.second = SocketOperationNone; if(i < _selectedReadFdSet.fd_count) { fd = _selectedReadFdSet.fd_array[i]; p.second = static_cast(p.second | SocketOperationRead); } else if(i < _selectedWriteFdSet.fd_count + _selectedReadFdSet.fd_count) { fd = _selectedWriteFdSet.fd_array[i - _selectedReadFdSet.fd_count]; p.second = static_cast(p.second | SocketOperationWrite); } else { fd = _selectedErrorFdSet.fd_array[i - _selectedReadFdSet.fd_count - _selectedWriteFdSet.fd_count]; p.second = static_cast(p.second | SocketOperationConnect); } if(fd == _fdIntrRead) // Interrupted, we have to process the interrupt before returning any handlers { handlers.clear(); return; } assert(_handlers.find(fd) != _handlers.end()); p.first = _handlers[fd]; handlers.push_back(p); } #else if(_pollFdSet[0].revents == POLLIN) // Interrupted, we have to process the interrupt before returning any handlers { return; } for(vector::const_iterator q = _pollFdSet.begin(); q != _pollFdSet.end(); ++q) { pair p; if(q->revents != 0) { SOCKET fd = q->fd; assert(fd != _fdIntrRead); assert(_handlers.find(fd) != _handlers.end()); p.first = _handlers[fd]; p.second = SocketOperationNone; if(q->revents & (POLLIN | POLLERR | POLLHUP)) { p.second = static_cast(p.second | SocketOperationRead); } if(q->revents & POLLOUT) { p.second = static_cast(p.second | SocketOperationWrite); } assert(p.second); handlers.push_back(p); } } #endif } void Selector::updateImpl(EventHandler* handler) { SocketOperation status = static_cast(handler->_registered & ~handler->_disabled); _changes.push_back(make_pair(handler, status)); if(_selecting) { if(!_interrupted) { char c = 0; while(true) { #ifdef _WIN32 if(::send(_fdIntrWrite, &c, 1, 0) == SOCKET_ERROR) #else if(::write(_fdIntrWrite, &c, 1) == SOCKET_ERROR) #endif { if(interrupted()) { continue; } Ice::SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } break; } _interrupted = true; } } else { updateSelector(); } } void Selector::updateSelector() { for(vector >::const_iterator p = _changes.begin(); p != _changes.end(); ++p) { EventHandler* handler = p->first; SocketOperation status = p->second; SOCKET fd = handler->getNativeInfo()->fd(); if(status) { #if defined(ICE_USE_SELECT) if(status & SocketOperationRead) { FD_SET(fd, &_readFdSet); } else { FD_CLR(fd, &_readFdSet); } if(status & SocketOperationWrite) { FD_SET(fd, &_writeFdSet); } else { FD_CLR(fd, &_writeFdSet); } if(status & SocketOperationConnect) { FD_SET(fd, &_writeFdSet); FD_SET(fd, &_errorFdSet); } else { FD_CLR(fd, &_writeFdSet); FD_CLR(fd, &_errorFdSet); } _handlers[fd] = handler; #else short events = 0; if(status & SocketOperationRead) { events |= POLLIN; } if(status & SocketOperationWrite) { events |= POLLOUT; } map::const_iterator q = _handlers.find(fd); if(q == _handlers.end()) { struct pollfd pollFd; pollFd.fd = fd; pollFd.events = events; pollFd.revents = 0; _pollFdSet.push_back(pollFd); _handlers.insert(make_pair(fd, handler)); } else { for(vector::iterator r = _pollFdSet.begin(); r != _pollFdSet.end(); ++r) { if(r->fd == fd) { r->events = events; break; } } } #endif } else { #if defined(ICE_USE_SELECT) FD_CLR(fd, &_readFdSet); FD_CLR(fd, &_writeFdSet); FD_CLR(fd, &_errorFdSet); #else for(vector::iterator r = _pollFdSet.begin(); r != _pollFdSet.end(); ++r) { if(r->fd == fd) { _pollFdSet.erase(r); break; } } #endif _handlers.erase(fd); } } _changes.clear(); } #endif Ice-3.5.1/cpp/src/Ice/DispatchInterceptor.cpp0000644000076400007640000000257212223561476017133 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace Ice; using namespace IceInternal; DispatchStatus Ice::DispatchInterceptor::__dispatch(IceInternal::Incoming& in, const Current& /*current*/) { try { IncomingRequest request(in); DispatchStatus status = dispatch(request); if(status != DispatchAsync) { // // Make sure 'in' owns the connection etc. // in.killAsync(); } return status; } catch(const ResponseSentException&) { return DispatchAsync; } catch(...) { try { in.killAsync(); } catch(const ResponseSentException&) { return DispatchAsync; } throw; } } DispatchStatus Ice::DispatchInterceptor::__collocDispatch(Direct& request) { // // Should only return DispatchOK or DispatchUserException // return dispatch(request); } Ice-3.5.1/cpp/src/Ice/PropertiesAdminI.cpp0000644000076400007640000001265112223561476016372 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; Ice::PropertiesAdminI::PropertiesAdminI(const string& name, const PropertiesPtr& properties, const LoggerPtr& logger) : _name(name), _properties(properties), _logger(logger) { } string Ice::PropertiesAdminI::getProperty(const string& name, const Ice::Current&) { Lock sync(*this); return _properties->getProperty(name); } Ice::PropertyDict Ice::PropertiesAdminI::getPropertiesForPrefix(const string& prefix, const Ice::Current&) { Lock sync(*this); return _properties->getPropertiesForPrefix(prefix); } void Ice::PropertiesAdminI::setProperties_async(const AMD_PropertiesAdmin_setPropertiesPtr& cb, const PropertyDict& props, const Ice::Current&) { Lock sync(*this); PropertyDict old = _properties->getPropertiesForPrefix(""); PropertyDict::const_iterator p; const int traceLevel = _properties->getPropertyAsInt("Ice.Trace.Admin.Properties"); // // Compute the difference between the new property set and the existing property set: // // 1) Any properties in the new set that were not defined in the existing set. // // 2) Any properties that appear in both sets but with different values. // // 3) Any properties not present in the new set but present in the existing set. // In other words, the property has been removed. // PropertyDict added, changed, removed; for(p = props.begin(); p != props.end(); ++p) { PropertyDict::iterator q = old.find(p->first); if(q == old.end()) { if(!p->second.empty()) { // // This property is new. // added.insert(*p); } } else { if(p->second != q->second) { if(p->second.empty()) { // // This property was removed. // removed.insert(*p); } else { // // This property has changed. // changed.insert(*p); } } } } if(traceLevel > 0 && (!added.empty() || !changed.empty() || !removed.empty())) { Trace out(_logger, _name); out << "Summary of property changes"; if(!added.empty()) { out << "\nNew properties:"; for(p = added.begin(); p != added.end(); ++p) { out << "\n " << p->first; if(traceLevel > 1) { out << " = " << p->second; } } } if(!changed.empty()) { out << "\nChanged properties:"; for(p = changed.begin(); p != changed.end(); ++p) { out << "\n " << p->first; if(traceLevel > 1) { out << " = " << p->second << " (old value = " << _properties->getProperty(p->first) << ")"; } } } if(!removed.empty()) { out << "\nRemoved properties:"; for(p = removed.begin(); p != removed.end(); ++p) { out << "\n " << p->first; } } } // // Update the property set. // for(p = added.begin(); p != added.end(); ++p) { _properties->setProperty(p->first, p->second); } for(p = changed.begin(); p != changed.end(); ++p) { _properties->setProperty(p->first, p->second); } for(p = removed.begin(); p != removed.end(); ++p) { _properties->setProperty(p->first, ""); } // // Send the response now so that we do not block the client during // the call to the update callback. // cb->ice_response(); // // Copy the callbacks to allow callbacks to update the callbacks. // vector callbacks = _updateCallbacks; if(!callbacks.empty()) { PropertyDict changes = added; changes.insert(changed.begin(), changed.end()); changes.insert(removed.begin(), removed.end()); for(vector::const_iterator p = callbacks.begin(); p != callbacks.end(); ++p) { try { (*p)->updated(changes); } catch(...) { // Ignore. } } } } void Ice::PropertiesAdminI::addUpdateCallback(const PropertiesAdminUpdateCallbackPtr& cb) { Lock sync(*this); _updateCallbacks.push_back(cb); } void Ice::PropertiesAdminI::removeUpdateCallback(const PropertiesAdminUpdateCallbackPtr& cb) { Lock sync(*this); _updateCallbacks.erase(remove(_updateCallbacks.begin(), _updateCallbacks.end(), cb), _updateCallbacks.end()); } Ice-3.5.1/cpp/src/Ice/ConnectionMonitor.cpp0000644000076400007640000000753612223561476016631 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(ConnectionMonitor* p) { return p; } void IceInternal::ConnectionMonitor::checkIntervalForACM(int acmTimeout) { if(acmTimeout <= 0) { return; } // // If Ice.MonitorConnections isn't set (_interval == 0), the given ACM is used // to determine the check interval: 1/10 of the ACM timeout with a minmal value // of 5 seconds and a maximum value of 5 minutes. // // Note: if Ice.MonitorConnections is set, the timer is schedulded only if ACM // is configured for the communicator or some object adapters. // int interval; if(_interval == 0) { interval = min(300, max(5, (int)acmTimeout / 10)); } else if(_scheduledInterval == _interval) { return; // Nothing to do, the timer is already scheduled. } else { interval = _interval; } // // If no timer is scheduled yet or if the given ACM requires a smaller interval, // we re-schedule the timer. // Lock sync(*this); if(_scheduledInterval == 0 || _scheduledInterval > interval) { _scheduledInterval = interval; _instance->timer()->cancel(this); _instance->timer()->scheduleRepeated(this, IceUtil::Time::seconds(interval)); } } void IceInternal::ConnectionMonitor::destroy() { IceUtil::Mutex::Lock sync(*this); assert(_instance); _instance = 0; _connections.clear(); } void IceInternal::ConnectionMonitor::add(const ConnectionIPtr& connection) { IceUtil::Mutex::Lock sync(*this); assert(_instance); _connections.insert(connection); } void IceInternal::ConnectionMonitor::remove(const ConnectionIPtr& connection) { IceUtil::Mutex::Lock sync(*this); assert(_instance); _connections.erase(connection); } IceInternal::ConnectionMonitor::ConnectionMonitor(const InstancePtr& instance, int interval) : _instance(instance), _interval(interval), _scheduledInterval(0) { } IceInternal::ConnectionMonitor::~ConnectionMonitor() { assert(!_instance); assert(_connections.empty()); } void IceInternal::ConnectionMonitor::runTimerTask() { set connections; { IceUtil::Mutex::Lock sync(*this); if(!_instance) { return; } connections = _connections; } // // Monitor connections outside the thread synchronization, so // that connections can be added or removed during monitoring. // IceUtil::Time now = IceUtil::Time::now(IceUtil::Time::Monotonic); for(set::const_iterator p = connections.begin(); p != connections.end(); ++p) { try { (*p)->monitor(now); } catch(const exception& ex) { IceUtil::Mutex::Lock sync(*this); if(!_instance) { return; } Error out(_instance->initializationData().logger); out << "exception in connection monitor:\n" << ex.what(); } catch(...) { IceUtil::Mutex::Lock sync(*this); if(!_instance) { return; } Error out(_instance->initializationData().logger); out << "unknown exception in connection monitor"; } } } Ice-3.5.1/cpp/src/Ice/ProxyFactory.h0000644000076400007640000000273412223561476015273 0ustar mesmes// ********************************************************************** // // 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 ICE_PROXY_FACTORY_H #define ICE_PROXY_FACTORY_H #include #include #include #include #include #include #include #include #include namespace IceInternal { class BasicStream; class ProxyFactory : public IceUtil::Shared { public: Ice::ObjectPrx stringToProxy(const std::string&) const; std::string proxyToString(const Ice::ObjectPrx&) const; Ice::ObjectPrx propertyToProxy(const std::string&) const; Ice::PropertyDict proxyToProperty(const Ice::ObjectPrx&, const std::string&) const; Ice::ObjectPrx streamToProxy(BasicStream*) const; void proxyToStream(const Ice::ObjectPrx&, BasicStream*) const; Ice::ObjectPrx referenceToProxy(const ReferencePtr&) const; int checkRetryAfterException(const Ice::LocalException&, const ReferencePtr&, bool, int&) const; private: ProxyFactory(const InstancePtr&); virtual ~ProxyFactory(); friend class Instance; InstancePtr _instance; std::vector _retryIntervals; }; } #endif Ice-3.5.1/cpp/src/Ice/TraceLevels.h0000644000076400007640000000173112223561476015027 0ustar mesmes// ********************************************************************** // // 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 ICE_TRACE_LEVELS_H #define ICE_TRACE_LEVELS_H #include #include #include namespace IceInternal { class TraceLevels : public ::IceUtil::Shared { public: TraceLevels(const ::Ice::PropertiesPtr&); const int network; const char* networkCat; const int protocol; const char* protocolCat; const int retry; const char* retryCat; const int location; const char* locationCat; const int slicing; const char* slicingCat; const int gc; const char* gcCat; const int threadPool; const char* threadPoolCat; }; } #endif Ice-3.5.1/cpp/src/Ice/ServantManager.h0000644000076400007640000000427512223561476015541 0ustar mesmes// ********************************************************************** // // 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 ICE_SERVANT_MANAGER_H #define ICE_SERVANT_MANAGER_H #include #include #include #include #include #include #include namespace Ice { class ObjectAdapterI; } namespace IceInternal { class ServantManager : public IceUtil::Shared, public IceUtil::Mutex { public: void addServant(const Ice::ObjectPtr&, const Ice::Identity&, const std::string&); void addDefaultServant(const Ice::ObjectPtr&, const std::string&); Ice::ObjectPtr removeServant(const Ice::Identity&, const std::string&); Ice::ObjectPtr removeDefaultServant(const std::string&); Ice::FacetMap removeAllFacets(const Ice::Identity&); Ice::ObjectPtr findServant(const Ice::Identity&, const std::string&) const; Ice::ObjectPtr findDefaultServant(const std::string&) const; Ice::FacetMap findAllFacets(const Ice::Identity&) const; bool hasServant(const Ice::Identity&) const; void addServantLocator(const Ice::ServantLocatorPtr& locator, const std::string&); Ice::ServantLocatorPtr removeServantLocator(const std::string&); Ice::ServantLocatorPtr findServantLocator(const std::string&) const; private: ServantManager(const InstancePtr&, const std::string&); ~ServantManager(); void destroy(); friend class Ice::ObjectAdapterI; InstancePtr _instance; const std::string _adapterName; typedef std::map ServantMapMap; typedef std::map DefaultServantMap; ServantMapMap _servantMapMap; mutable ServantMapMap::iterator _servantMapMapHint; DefaultServantMap _defaultServantMap; std::map _locatorMap; mutable std::map::iterator _locatorMapHint; }; } #endif Ice-3.5.1/cpp/src/Ice/SliceChecksums.cpp0000644000076400007640000000301412223561476016052 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace Ice; namespace { SliceChecksumDict* _sliceChecksums = 0; IceUtil::Mutex* _mutex = 0; class Init { public: Init() { _mutex = new IceUtil::Mutex; } ~Init() { delete _mutex; _mutex = 0; } }; Init init; class SliceChecksumDictDestroyer { public: ~SliceChecksumDictDestroyer() { delete _sliceChecksums; _sliceChecksums = 0; } }; SliceChecksumDictDestroyer destroyer; } SliceChecksumDict Ice::sliceChecksums() { IceUtilInternal::MutexPtrLock lock(_mutex); if(_sliceChecksums == 0) { _sliceChecksums = new SliceChecksumDict(); } return *_sliceChecksums; } IceInternal::SliceChecksumInit::SliceChecksumInit(const char* checksums[]) { IceUtilInternal::MutexPtrLock lock(_mutex); if(_sliceChecksums == 0) { _sliceChecksums = new SliceChecksumDict(); } for(int i = 0; checksums[i] != 0; i += 2) { _sliceChecksums->insert(SliceChecksumDict::value_type(checksums[i], checksums[i + 1])); } } Ice-3.5.1/cpp/src/Ice/LocatorInfo.cpp0000644000076400007640000006506012223561476015375 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(LocatorManager* p) { return p; } IceUtil::Shared* IceInternal::upCast(LocatorInfo* p) { return p; } IceUtil::Shared* IceInternal::upCast(LocatorTable* p) { return p; } namespace { class ObjectRequest : public LocatorInfo::Request { public: ObjectRequest(const LocatorInfoPtr& locatorInfo, const ReferencePtr& ref) : LocatorInfo::Request(locatorInfo, ref) { assert(ref->isWellKnown()); } virtual void send(bool async) { try { if(async) { _locatorInfo->getLocator()->begin_findObjectById( _ref->getIdentity(), newCallback_Locator_findObjectById(static_cast(this), &LocatorInfo::Request::response, &LocatorInfo::Request::exception)); } else { response(_locatorInfo->getLocator()->findObjectById(_ref->getIdentity())); } } catch(const Ice::Exception& ex) { exception(ex); } } }; class AdapterRequest : public LocatorInfo::Request { public: AdapterRequest(const LocatorInfoPtr& locatorInfo, const ReferencePtr& ref) : LocatorInfo::Request(locatorInfo, ref) { assert(ref->isIndirect() && !ref->isWellKnown()); } virtual void send(bool async) { try { if(async) { _locatorInfo->getLocator()->begin_findAdapterById( _ref->getAdapterId(), newCallback_Locator_findAdapterById(static_cast(this), &LocatorInfo::Request::response, &LocatorInfo::Request::exception)); } else { response(_locatorInfo->getLocator()->findAdapterById(_ref->getAdapterId())); } } catch(const Ice::Exception& ex) { exception(ex); } } }; } IceInternal::LocatorManager::LocatorManager(const Ice::PropertiesPtr& properties) : _background(properties->getPropertyAsInt("Ice.BackgroundLocatorCacheUpdates") > 0), _tableHint(_table.end()) { } void IceInternal::LocatorManager::destroy() { IceUtil::Mutex::Lock sync(*this); for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun(&LocatorInfo::destroy)); _table.clear(); _tableHint = _table.end(); _locatorTables.clear(); } LocatorInfoPtr IceInternal::LocatorManager::get(const LocatorPrx& loc) { if(!loc) { return 0; } LocatorPrx locator = LocatorPrx::uncheckedCast(loc->ice_locator(0)); // The locator can't be located. // // TODO: reap unused locator info objects? // IceUtil::Mutex::Lock sync(*this); map::iterator p = _table.end(); if(_tableHint != _table.end()) { if(_tableHint->first == locator) { p = _tableHint; } } if(p == _table.end()) { p = _table.find(locator); } if(p == _table.end()) { // // Rely on locator identity for the adapter table. We want to // have only one table per locator (not one per locator // proxy). // pair locatorKey(locator->ice_getIdentity(), locator->ice_getEncodingVersion()); map, LocatorTablePtr>::iterator t = _locatorTables.find(locatorKey); if(t == _locatorTables.end()) { t = _locatorTables.insert(_locatorTables.begin(), pair, LocatorTablePtr>( locatorKey, new LocatorTable())); } _tableHint = _table.insert(_tableHint, pair(locator, new LocatorInfo(locator, t->second, _background))); } else { _tableHint = p; } return _tableHint->second; } IceInternal::LocatorTable::LocatorTable() { } void IceInternal::LocatorTable::clear() { IceUtil::Mutex::Lock sync(*this); _adapterEndpointsMap.clear(); _objectMap.clear(); } bool IceInternal::LocatorTable::getAdapterEndpoints(const string& adapter, int ttl, vector& endpoints) { if(ttl == 0) // No locator cache. { return false; } IceUtil::Mutex::Lock sync(*this); map > >::iterator p = _adapterEndpointsMap.find(adapter); if(p != _adapterEndpointsMap.end()) { endpoints = p->second.second; return checkTTL(p->second.first, ttl); } return false; } void IceInternal::LocatorTable::addAdapterEndpoints(const string& adapter, const vector& endpoints) { IceUtil::Mutex::Lock sync(*this); map > >::iterator p = _adapterEndpointsMap.find(adapter); if(p != _adapterEndpointsMap.end()) { p->second = make_pair(IceUtil::Time::now(IceUtil::Time::Monotonic), endpoints); } else { _adapterEndpointsMap.insert( make_pair(adapter, make_pair(IceUtil::Time::now(IceUtil::Time::Monotonic), endpoints))); } } vector IceInternal::LocatorTable::removeAdapterEndpoints(const string& adapter) { IceUtil::Mutex::Lock sync(*this); map > >::iterator p = _adapterEndpointsMap.find(adapter); if(p == _adapterEndpointsMap.end()) { return vector(); } vector endpoints = p->second.second; _adapterEndpointsMap.erase(p); return endpoints; } bool IceInternal::LocatorTable::getObjectReference(const Identity& id, int ttl, ReferencePtr& ref) { if(ttl == 0) // No locator cache { return false; } IceUtil::Mutex::Lock sync(*this); map >::iterator p = _objectMap.find(id); if(p != _objectMap.end()) { ref = p->second.second; return checkTTL(p->second.first, ttl); } return false; } void IceInternal::LocatorTable::addObjectReference(const Identity& id, const ReferencePtr& ref) { IceUtil::Mutex::Lock sync(*this); map >::iterator p = _objectMap.find(id); if(p != _objectMap.end()) { p->second = make_pair(IceUtil::Time::now(IceUtil::Time::Monotonic), ref); } else { _objectMap.insert(make_pair(id, make_pair(IceUtil::Time::now(IceUtil::Time::Monotonic), ref))); } } ReferencePtr IceInternal::LocatorTable::removeObjectReference(const Identity& id) { IceUtil::Mutex::Lock sync(*this); map >::iterator p = _objectMap.find(id); if(p == _objectMap.end()) { return 0; } ReferencePtr ref = p->second.second; _objectMap.erase(p); return ref; } bool IceInternal::LocatorTable::checkTTL(const IceUtil::Time& time, int ttl) const { assert(ttl != 0); if (ttl < 0) // TTL = infinite { return true; } else { return IceUtil::Time::now(IceUtil::Time::Monotonic) - time <= IceUtil::Time::seconds(ttl); } } void IceInternal::LocatorInfo::RequestCallback::response(const LocatorInfoPtr& locatorInfo, const Ice::ObjectPrx& proxy) { vector endpoints; if(proxy) { ReferencePtr r = proxy->__reference(); if(_ref->isWellKnown() && !isSupported(_ref->getEncoding(), r->getEncoding())) { // // If a well-known proxy and the returned proxy encoding // isn't supported, we're done: there's no compatible // endpoint we can use. // } else if(!r->isIndirect()) { endpoints = r->getEndpoints(); } else if(_ref->isWellKnown() && !r->isWellKnown()) { // // We're resolving the endpoints of a well-known object and the proxy returned // by the locator is an indirect proxy. We now need to resolve the endpoints // of this indirect proxy. // locatorInfo->getEndpoints(r, _ref, _ttl, _callback); return; } } if(_ref->getInstance()->traceLevels()->location >= 1) { locatorInfo->getEndpointsTrace(_ref, endpoints, false); } if(_callback) { _callback->setEndpoints(endpoints, false); } } void IceInternal::LocatorInfo::RequestCallback::exception(const LocatorInfoPtr& locatorInfo, const Ice::Exception& exc) { try { locatorInfo->getEndpointsException(_ref, exc); // This throws. } catch(const Ice::LocalException& ex) { if(_callback) { _callback->setException(ex); } } } IceInternal::LocatorInfo::RequestCallback::RequestCallback(const ReferencePtr& ref, int ttl, const GetEndpointsCallbackPtr& cb) : _ref(ref), _ttl(ttl), _callback(cb) { } void IceInternal::LocatorInfo::Request::addCallback(const ReferencePtr& ref, const ReferencePtr& wellKnownRef, int ttl, const GetEndpointsCallbackPtr& cb) { IceUtil::Monitor::Lock sync(_monitor); RequestCallbackPtr callback = new RequestCallback(ref, ttl, cb); if(_response) { callback->response(_locatorInfo, _proxy); } else if(_exception.get()) { callback->exception(_locatorInfo, *_exception.get()); } else { _callbacks.push_back(callback); if(wellKnownRef) // This request is to resolve the endpoints of a cached well-known object reference { _wellKnownRefs.push_back(wellKnownRef); } if(!_sent) { _sent = true; sync.release(); send(true); // send() might call exception() from this thread so we need to release the mutex. } } } vector IceInternal::LocatorInfo::Request::getEndpoints(const ReferencePtr& ref, const ReferencePtr& wellKnownRef, int ttl, bool& cached) { IceUtil::Monitor::Lock sync(_monitor); if(!_response || _exception.get()) { if(wellKnownRef) // This request is to resolve the endpoints of a cached well-known object reference { _wellKnownRefs.push_back(wellKnownRef); } if(!_sent) { _sent = true; sync.release(); send(true); // send() might call exception() from this thread so we need to release the mutex. sync.acquire(); } while(!_response && !_exception.get()) { _monitor.wait(); } } if(_exception.get()) { _locatorInfo->getEndpointsException(ref, *_exception.get()); // This throws. } assert(_response); vector endpoints; if(_proxy) { ReferencePtr r = _proxy->__reference(); if(!r->isIndirect()) { endpoints = r->getEndpoints(); } else if(ref->isWellKnown() && !r->isWellKnown()) { // // We're resolving the endpoints of a well-known object and the proxy returned // by the locator is an indirect proxy. We now need to resolve the endpoints // of this indirect proxy. // return _locatorInfo->getEndpoints(r, ref, ttl, cached); } } cached = false; if(_ref->getInstance()->traceLevels()->location >= 1) { _locatorInfo->getEndpointsTrace(ref, endpoints, false); } return endpoints; } IceInternal::LocatorInfo::Request::Request(const LocatorInfoPtr& locatorInfo, const ReferencePtr& ref) : _locatorInfo(locatorInfo), _ref(ref), _sent(false), _response(false) { } void IceInternal::LocatorInfo::Request::response(const Ice::ObjectPrx& proxy) { IceUtil::Monitor::Lock sync(_monitor); _locatorInfo->finishRequest(_ref, _wellKnownRefs, proxy, false); _response = true; _proxy = proxy; for(vector::const_iterator p = _callbacks.begin(); p != _callbacks.end(); ++p) { (*p)->response(_locatorInfo, proxy); } _monitor.notifyAll(); } void IceInternal::LocatorInfo::Request::exception(const Ice::Exception& ex) { if(dynamic_cast(&ex)) { send(false); // Use synchronous collocation optimized locator request instead. return; } IceUtil::Monitor::Lock sync(_monitor); _locatorInfo->finishRequest(_ref, _wellKnownRefs, 0, dynamic_cast(&ex)); _exception.reset(ex.ice_clone()); for(vector::const_iterator p = _callbacks.begin(); p != _callbacks.end(); ++p) { (*p)->exception(_locatorInfo, ex); } _monitor.notifyAll(); } IceInternal::LocatorInfo::LocatorInfo(const LocatorPrx& locator, const LocatorTablePtr& table, bool background) : _locator(locator), _table(table), _background(background) { assert(_locator); assert(_table); } void IceInternal::LocatorInfo::destroy() { IceUtil::Mutex::Lock sync(*this); _locatorRegistry = 0; _table->clear(); } bool IceInternal::LocatorInfo::operator==(const LocatorInfo& rhs) const { return _locator == rhs._locator; } bool IceInternal::LocatorInfo::operator!=(const LocatorInfo& rhs) const { return _locator != rhs._locator; } bool IceInternal::LocatorInfo::operator<(const LocatorInfo& rhs) const { return _locator < rhs._locator; } LocatorRegistryPrx IceInternal::LocatorInfo::getLocatorRegistry() { { IceUtil::Mutex::Lock sync(*this); if(_locatorRegistry) { return _locatorRegistry; } } // // Do not make locator calls from within sync. // LocatorRegistryPrx locatorRegistry = _locator->getRegistry(); { IceUtil::Mutex::Lock sync(*this); // // The locator registry can't be located. // _locatorRegistry = LocatorRegistryPrx::uncheckedCast(locatorRegistry->ice_locator(0)); return _locatorRegistry; } } vector IceInternal::LocatorInfo::getEndpoints(const ReferencePtr& ref, const ReferencePtr& wellKnownRef, int ttl, bool& cached) { assert(ref->isIndirect()); vector endpoints; if(!ref->isWellKnown()) { if(!_table->getAdapterEndpoints(ref->getAdapterId(), ttl, endpoints)) { if(_background && !endpoints.empty()) { getAdapterRequest(ref)->addCallback(ref, wellKnownRef, ttl, 0); } else { return getAdapterRequest(ref)->getEndpoints(ref, wellKnownRef, ttl, cached); } } } else { ReferencePtr r; if(!_table->getObjectReference(ref->getIdentity(), ttl, r)) { if(_background && r) { getObjectRequest(ref)->addCallback(ref, 0, ttl, 0); } else { return getObjectRequest(ref)->getEndpoints(ref, 0, ttl, cached); } } if(!r->isIndirect()) { endpoints = r->getEndpoints(); } else if(!r->isWellKnown()) { return getEndpoints(r, ref, ttl, cached); } } assert(!endpoints.empty()); cached = true; if(ref->getInstance()->traceLevels()->location >= 1) { getEndpointsTrace(ref, endpoints, true); } return endpoints; } void IceInternal::LocatorInfo::getEndpoints(const ReferencePtr& ref, const ReferencePtr& wellKnownRef, int ttl, const GetEndpointsCallbackPtr& callback) { assert(ref->isIndirect()); vector endpoints; if(!ref->isWellKnown()) { if(!_table->getAdapterEndpoints(ref->getAdapterId(), ttl, endpoints)) { if(_background && !endpoints.empty()) { getAdapterRequest(ref)->addCallback(ref, wellKnownRef, ttl, 0); } else { getAdapterRequest(ref)->addCallback(ref, wellKnownRef, ttl, callback); return; } } } else { ReferencePtr r; if(!_table->getObjectReference(ref->getIdentity(), ttl, r)) { if(_background && r) { getObjectRequest(ref)->addCallback(ref, 0, ttl, 0); } else { getObjectRequest(ref)->addCallback(ref, 0, ttl, callback); return; } } if(!r->isIndirect()) { endpoints = r->getEndpoints(); } else if(!r->isWellKnown()) { getEndpoints(r, ref, ttl, callback); return; } } assert(!endpoints.empty()); if(ref->getInstance()->traceLevels()->location >= 1) { getEndpointsTrace(ref, endpoints, true); } if(callback) { callback->setEndpoints(endpoints, true); } } void IceInternal::LocatorInfo::clearCache(const ReferencePtr& ref) { assert(ref->isIndirect()); if(!ref->isWellKnown()) { vector endpoints = _table->removeAdapterEndpoints(ref->getAdapterId()); if(!endpoints.empty() && ref->getInstance()->traceLevels()->location >= 2) { trace("removed endpoints from locator table", ref, endpoints); } } else { ReferencePtr r = _table->removeObjectReference(ref->getIdentity()); if(r) { if(!r->isIndirect()) { if(ref->getInstance()->traceLevels()->location >= 2) { trace("removed endpoints from locator table", ref, r->getEndpoints()); } } else if(!r->isWellKnown()) { clearCache(r); } } } } void IceInternal::LocatorInfo::getEndpointsException(const ReferencePtr& ref, const Ice::Exception& exc) { assert(ref->isIndirect()); try { exc.ice_throw(); } catch(const AdapterNotFoundException&) { if(ref->getInstance()->traceLevels()->location >= 1) { Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); out << "adapter not found" << "\n"; out << "adapter = " << ref->getAdapterId(); } NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "object adapter"; ex.id = ref->getAdapterId(); throw ex; } catch(const ObjectNotFoundException&) { if(ref->getInstance()->traceLevels()->location >= 1) { Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); out << "object not found" << "\n"; out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()); } NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "object"; ex.id = ref->getInstance()->identityToString(ref->getIdentity()); throw ex; } catch(const NotRegisteredException&) { throw; } catch(const LocalException& ex) { if(ref->getInstance()->traceLevels()->location >= 1) { Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); out << "couldn't contact the locator to retrieve adapter endpoints\n"; if(ref->getAdapterId().empty()) { out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n"; } else { out << "adapter = " << ref->getAdapterId() << "\n"; } out << "reason = " << ex; } throw; } } void IceInternal::LocatorInfo::getEndpointsTrace(const ReferencePtr& ref, const vector& endpoints, bool cached) { if(!endpoints.empty()) { if(cached) { trace("found endpoints in locator table", ref, endpoints); } else { trace("retrieved endpoints from locator, adding to locator table", ref, endpoints); } } else { Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); out << "no endpoints configured for "; if(ref->getAdapterId().empty()) { out << "object\n"; out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()); } else { out << "adapter\n"; out << "adapter = " << ref->getAdapterId(); } } } void IceInternal::LocatorInfo::trace(const string& msg, const ReferencePtr& ref, const vector& endpoints) { assert(ref->isIndirect()); Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); out << msg << '\n'; if(!ref->isWellKnown()) { out << "adapter = " << ref->getAdapterId() << '\n'; } else { out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << '\n'; } const char* sep = endpoints.size() > 1 ? ":" : ""; ostringstream o; transform(endpoints.begin(), endpoints.end(), ostream_iterator(o, sep), Ice::constMemFun(&Endpoint::toString)); out << "endpoints = " << o.str(); } IceInternal::LocatorInfo::RequestPtr IceInternal::LocatorInfo::getAdapterRequest(const ReferencePtr& ref) { IceUtil::Mutex::Lock sync(*this); if(ref->getInstance()->traceLevels()->location >= 1) { Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); out << "searching for adapter by id\nadapter = " << ref->getAdapterId(); } map::const_iterator p = _adapterRequests.find(ref->getAdapterId()); if(p != _adapterRequests.end()) { return p->second; } RequestPtr request = new AdapterRequest(this, ref); _adapterRequests.insert(make_pair(ref->getAdapterId(), request)); return request; } IceInternal::LocatorInfo::RequestPtr IceInternal::LocatorInfo::getObjectRequest(const ReferencePtr& ref) { IceUtil::Mutex::Lock sync(*this); if(ref->getInstance()->traceLevels()->location >= 1) { Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); out << "searching for object by id\nobject = " << ref->getInstance()->identityToString(ref->getIdentity()); } map::const_iterator p = _objectRequests.find(ref->getIdentity()); if(p != _objectRequests.end()) { return p->second; } RequestPtr request = new ObjectRequest(this, ref); _objectRequests.insert(make_pair(ref->getIdentity(), request)); return request; } void IceInternal::LocatorInfo::finishRequest(const ReferencePtr& ref, const vector& wellKnownRefs, const Ice::ObjectPrx& proxy, bool notRegistered) { if(!proxy || proxy->__reference()->isIndirect()) { // // Remove the cached references of well-known objects for which we tried // to resolved the endpoints if these endpoints are empty. // for(vector::const_iterator q = wellKnownRefs.begin(); q != wellKnownRefs.end(); ++q) { _table->removeObjectReference((*q)->getIdentity()); } } if(!ref->isWellKnown()) { if(proxy && !proxy->__reference()->isIndirect()) // Cache the adapter endpoints. { _table->addAdapterEndpoints(ref->getAdapterId(), proxy->__reference()->getEndpoints()); } else if(notRegistered) // If the adapter isn't registered anymore, remove it from the cache. { _table->removeAdapterEndpoints(ref->getAdapterId()); } IceUtil::Mutex::Lock sync(*this); assert(_adapterRequests.find(ref->getAdapterId()) != _adapterRequests.end()); _adapterRequests.erase(ref->getAdapterId()); } else { if(proxy && !proxy->__reference()->isWellKnown()) // Cache the well-known object reference. { _table->addObjectReference(ref->getIdentity(), proxy->__reference()); } else if(notRegistered) // If the well-known object isn't registered anymore, remove it from the cache. { _table->removeObjectReference(ref->getIdentity()); } IceUtil::Mutex::Lock sync(*this); assert(_objectRequests.find(ref->getIdentity()) != _objectRequests.end()); _objectRequests.erase(ref->getIdentity()); } } Ice-3.5.1/cpp/src/Ice/EndpointI.h0000644000076400007640000001440512223561476014511 0ustar mesmes// ********************************************************************** // // 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 ICE_ENDPOINT_I_H #define ICE_ENDPOINT_I_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef ICE_OS_WINRT # include #endif namespace IceInternal { class BasicStream; class ICE_API EndpointI_connectors : public virtual IceUtil::Shared { public: virtual ~EndpointI_connectors() { } virtual void connectors(const std::vector&) = 0; virtual void exception(const Ice::LocalException&) = 0; }; typedef IceUtil::Handle EndpointI_connectorsPtr; class ICE_API EndpointI : public Ice::Endpoint { public: // // Marshal the endpoint. // virtual void streamWrite(BasicStream*) const = 0; // // Return the endpoint type. // virtual Ice::Short type() const = 0; // // Return the protocol name // virtual std::string protocol() const = 0; // // Return the timeout for the endpoint in milliseconds. 0 means // non-blocking, -1 means no timeout. // virtual Ice::Int timeout() const = 0; // // Return a new endpoint with a different timeout value, provided // that timeouts are supported by the endpoint. Otherwise the same // endpoint is returned. // virtual EndpointIPtr timeout(Ice::Int) const = 0; // // Return a new endpoint with a different connection id. // virtual EndpointIPtr connectionId(const ::std::string&) const = 0; // // Return true if the endpoints support bzip2 compress, or false // otherwise. // virtual bool compress() const = 0; // // Return a new endpoint with a different compression value, // provided that compression is supported by the // endpoint. Otherwise the same endpoint is returned. // virtual EndpointIPtr compress(bool) const = 0; // // Return true if the endpoint is datagram-based. // virtual bool datagram() const = 0; // // Return true if the endpoint is secure. // virtual bool secure() const = 0; // // Return a server side transceiver for this endpoint, or null if a // transceiver can only be created by an acceptor. In case a // transceiver is created, this operation also returns a new // "effective" endpoint, which might differ from this endpoint, // for example, if a dynamic port number is assigned. // virtual TransceiverPtr transceiver(EndpointIPtr&) const = 0; // // Return connectors for this endpoint, or empty vector if no // connector is available. Implementation is responsible for // returning connectors sorted according to the endpoint selection // type. // virtual std::vector connectors(Ice::EndpointSelectionType) const = 0; virtual void connectors_async(Ice::EndpointSelectionType, const EndpointI_connectorsPtr&) const = 0; // // Return an acceptor for this endpoint, or null if no acceptors // is available. In case an acceptor is created, this operation // also returns a new "effective" endpoint, which might differ // from this endpoint, for example, if a dynamic port number is // assigned. // virtual AcceptorPtr acceptor(EndpointIPtr&, const std::string&) const = 0; // // Expand endpoint out in to separate endpoints for each local // host if listening on INADDR_ANY on server side. // virtual std::vector expand() const = 0; // // Check whether the endpoint is equivalent to another one. // virtual bool equivalent(const EndpointIPtr&) const = 0; virtual std::vector connectors(const std::vector
          &, const NetworkProxyPtr&) const; // // Compare endpoints for sorting purposes. // virtual bool operator==(const Ice::LocalObject&) const = 0; virtual bool operator<(const Ice::LocalObject&) const = 0; const std::string& connectionId() const; protected: virtual ::Ice::Int internal_getHash() const; friend class EndpointHostResolver; EndpointI(const std::string&); EndpointI(); virtual ::Ice::Int hashInit() const = 0; const std::string _connectionId; private: mutable bool _hashInitialized; mutable Ice::Int _hashValue; }; inline bool operator==(const EndpointI& l, const EndpointI& r) { return static_cast(l) == static_cast(r); } inline bool operator<(const EndpointI& l, const EndpointI& r) { return static_cast(l) < static_cast(r); } #ifndef ICE_OS_WINRT class ICE_API EndpointHostResolver : public IceUtil::Thread, public IceUtil::Monitor #else class ICE_API EndpointHostResolver : public IceUtil::Shared #endif { public: EndpointHostResolver(const InstancePtr&); std::vector resolve(const std::string&, int, Ice::EndpointSelectionType, const EndpointIPtr&); void resolve(const std::string&, int, Ice::EndpointSelectionType, const EndpointIPtr&, const EndpointI_connectorsPtr&); void destroy(); virtual void run(); void updateObserver(); private: #ifndef ICE_OS_WINRT struct ResolveEntry { std::string host; int port; Ice::EndpointSelectionType selType; EndpointIPtr endpoint; EndpointI_connectorsPtr callback; Ice::Instrumentation::ObserverPtr observer; }; const InstancePtr _instance; const IceInternal::ProtocolSupport _protocol; const bool _preferIPv6; bool _destroyed; std::deque _queue; ObserverHelperT _observer; #else const InstancePtr _instance; #endif }; } #endif Ice-3.5.1/cpp/src/Ice/LocalObject.cpp0000644000076400007640000000144012223561476015327 0ustar mesmes// ********************************************************************** // // 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 using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* Ice::upCast(LocalObject* obj) { return obj; } bool Ice::LocalObject::operator==(const LocalObject& r) const { return this == &r; } bool Ice::LocalObject::operator<(const LocalObject& r) const { return this < &r; } Int Ice::LocalObject::internal_getHash() const { return static_cast(reinterpret_cast(this) >> 4); } Ice-3.5.1/cpp/src/Ice/EventHandler.cpp0000644000076400007640000000157712223561476015540 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(EventHandler* p) { return p; } IceInternal::EventHandler::EventHandler() : #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) _ready(SocketOperationNone), _pending(SocketOperationNone), _started(SocketOperationNone), _finish(false), #else _disabled(SocketOperationNone), #endif _registered(SocketOperationNone) { } IceInternal::EventHandler::~EventHandler() { } Ice-3.5.1/cpp/src/Ice/Base64.cpp0000644000076400007640000001156012223561476014176 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; string IceInternal::Base64::encode(const vector& plainSeq) { string retval; if(plainSeq.size() == 0) { return retval; } // Reserve enough space for the returned base64 string size_t base64Bytes = (((plainSeq.size() * 4) / 3) + 1); size_t newlineBytes = (((base64Bytes * 2) / 76) + 1); size_t totalBytes = base64Bytes + newlineBytes; retval.reserve(totalBytes); unsigned char by1 = 0; unsigned char by2 = 0; unsigned char by3 = 0; unsigned char by4 = 0; unsigned char by5 = 0; unsigned char by6 = 0; unsigned char by7 = 0; for(size_t i = 0; i < plainSeq.size(); i += 3) { by1 = plainSeq[i]; by2 = 0; by3 = 0; if((i + 1) < plainSeq.size()) { by2 = plainSeq[i+1]; } if((i + 2) < plainSeq.size()) { by3 = plainSeq[i+2]; } by4 = by1 >> 2; by5 = ((by1 & 0x3) << 4) | (by2 >> 4); by6 = ((by2 & 0xf) << 2) | (by3 >> 6); by7 = by3 & 0x3f; retval += encode(by4); retval += encode(by5); if((i + 1) < plainSeq.size()) { retval += encode(by6); } else { retval += "="; } if((i + 2) < plainSeq.size()) { retval += encode(by7); } else { retval += "="; } } string outString; outString.reserve(totalBytes); string::iterator iter = retval.begin(); while((retval.end() - iter) > 76) { copy(iter, iter+76, back_inserter(outString)); outString += "\r\n"; iter += 76; } copy(iter, retval.end(), back_inserter(outString)); return outString; } vector IceInternal::Base64::decode(const string& str) { string newStr; newStr.reserve(str.length()); for(size_t j = 0; j < str.length(); j++) { if(isBase64(str[j])) { newStr += str[j]; } } vector retval; if(newStr.length() == 0) { return retval; } // Note: This is how we were previously computing the size of the return // sequence. The method below is more efficient (and correct). // size_t lines = str.size() / 78; // size_t totalBytes = (lines * 76) + (((str.size() - (lines * 78)) * 3) / 4); // Figure out how long the final sequence is going to be. size_t totalBytes = (newStr.size() * 3 / 4) + 1; retval.reserve(totalBytes); unsigned char by1 = 0; unsigned char by2 = 0; unsigned char by3 = 0; unsigned char by4 = 0; char c1, c2, c3, c4; for(size_t i = 0; i < newStr.length(); i += 4) { c1 = 'A'; c2 = 'A'; c3 = 'A'; c4 = 'A'; c1 = newStr[i]; if((i + 1) < newStr.length()) { c2 = newStr[i + 1]; } if((i + 2) < newStr.length()) { c3 = newStr[i + 2]; } if((i + 3) < newStr.length()) { c4 = newStr[i + 3]; } by1 = decode(c1); by2 = decode(c2); by3 = decode(c3); by4 = decode(c4); retval.push_back((by1 << 2) | (by2 >> 4)); if(c3 != '=') { retval.push_back(((by2 & 0xf) << 4) | (by3 >> 2)); } if(c4 != '=') { retval.push_back(((by3 & 0x3) << 6) | by4); } } return retval; } bool IceInternal::Base64::isBase64(char c) { if(c >= 'A' && c <= 'Z') { return true; } if(c >= 'a' && c <= 'z') { return true; } if(c >= '0' && c <= '9') { return true; } if(c == '+') { return true; } if(c == '/') { return true; } if(c == '=') { return true; } return false; } char IceInternal::Base64::encode(unsigned char uc) { if(uc < 26) { return 'A' + uc; } if(uc < 52) { return 'a' + (uc - 26); } if(uc < 62) { return '0' + (uc - 52); } if(uc == 62) { return '+'; } return '/'; } unsigned char IceInternal::Base64::decode(char c) { if(c >= 'A' && c <= 'Z') { return c - 'A'; } if(c >= 'a' && c <= 'z') { return c - 'a' + 26; } if(c >= '0' && c <= '9') { return c - '0' + 52; } if(c == '+') { return 62; } return 63; } Ice-3.5.1/cpp/src/Ice/LocatorInfoF.h0000644000076400007640000000145612223561476015147 0ustar mesmes// ********************************************************************** // // 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 ICE_LOCATOR_INFO_F_H #define ICE_LOCATOR_INFO_F_H #include #include namespace IceInternal { class LocatorManager; IceUtil::Shared* upCast(LocatorManager*); typedef Handle LocatorManagerPtr; class LocatorInfo; IceUtil::Shared* upCast(LocatorInfo*); typedef Handle LocatorInfoPtr; class LocatorTable; IceUtil::Shared* upCast(LocatorTable*); typedef Handle LocatorTablePtr; } #endif Ice-3.5.1/cpp/src/Ice/SysLoggerI.cpp0000644000076400007640000000672712223561476015212 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace Ice; using namespace IceInternal; Ice::SysLoggerI::SysLoggerI(const string& prefix, const string& facilityString) { if(facilityString == "LOG_KERN") { _facility = LOG_KERN; } else if(facilityString == "LOG_USER") { _facility = LOG_USER; } else if(facilityString == "LOG_MAIL") { _facility = LOG_MAIL; } else if(facilityString == "LOG_DAEMON") { _facility = LOG_DAEMON; } else if(facilityString == "LOG_AUTH") { _facility = LOG_AUTH; } else if(facilityString == "LOG_SYSLOG") { _facility = LOG_SYSLOG; } else if(facilityString == "LOG_LPR") { _facility = LOG_LPR; } else if(facilityString == "LOG_NEWS") { _facility = LOG_NEWS; } else if(facilityString == "LOG_UUCP") { _facility = LOG_UUCP; } else if(facilityString == "LOG_CRON") { _facility = LOG_CRON; } #ifdef LOG_AUTHPRIV else if(facilityString == "LOG_AUTHPRIV") { _facility = LOG_AUTHPRIV; } #endif #ifdef LOG_FTP else if(facilityString == "LOG_FTP") { _facility = LOG_FTP; } #endif else if(facilityString == "LOG_LOCAL0") { _facility = LOG_LOCAL0; } else if(facilityString == "LOG_LOCAL1") { _facility = LOG_LOCAL1; } else if(facilityString == "LOG_LOCAL2") { _facility = LOG_LOCAL2; } else if(facilityString == "LOG_LOCAL3") { _facility = LOG_LOCAL3; } else if(facilityString == "LOG_LOCAL4") { _facility = LOG_LOCAL4; } else if(facilityString == "LOG_LOCAL5") { _facility = LOG_LOCAL5; } else if(facilityString == "LOG_LOCAL6") { _facility = LOG_LOCAL6; } else if(facilityString == "LOG_LOCAL7") { _facility = LOG_LOCAL7; } else { throw InitializationException(__FILE__, __LINE__, "Invalid value for Ice.SyslogFacility: " + facilityString); } int logopt = LOG_PID | LOG_CONS; openlog(prefix.c_str(), logopt, _facility); } Ice::SysLoggerI::SysLoggerI(const string& prefix, int facility) : _facility(facility) { int logopt = LOG_PID | LOG_CONS; openlog(prefix.c_str(), logopt, facility); } Ice::SysLoggerI::~SysLoggerI() { closelog(); } void Ice::SysLoggerI::print(const string& message) { IceUtil::Mutex::Lock sync(*this); syslog(LOG_INFO, "%s", message.c_str()); } void Ice::SysLoggerI::trace(const string& category, const string& message) { IceUtil::Mutex::Lock sync(*this); string s = category + ": " + message; syslog(LOG_INFO, "%s", s.c_str()); } void Ice::SysLoggerI::warning(const string& message) { IceUtil::Mutex::Lock sync(*this); syslog(LOG_WARNING, "%s", message.c_str()); } void Ice::SysLoggerI::error(const string& message) { IceUtil::Mutex::Lock sync(*this); syslog(LOG_ERR, "%s", message.c_str()); } Ice::LoggerPtr Ice::SysLoggerI::cloneWithPrefix(const string& prefix) { return new SysLoggerI(prefix, _facility); } Ice-3.5.1/cpp/src/Ice/TcpEndpointI.h0000644000076400007640000000534112223561476015157 0ustar mesmes// ********************************************************************** // // 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 ICE_TCP_ENDPOINT_I_H #define ICE_TCP_ENDPOINT_I_H #include #include #include #include // for IceIternal::Address namespace IceInternal { class TcpEndpointI : public EndpointI { public: TcpEndpointI(const InstancePtr&, const std::string&, Ice::Int, Ice::Int, const std::string&, bool); TcpEndpointI(const InstancePtr&, const std::string&, bool); TcpEndpointI(BasicStream*); virtual void streamWrite(BasicStream*) const; virtual std::string toString() const; virtual Ice::EndpointInfoPtr getInfo() const; virtual Ice::Short type() const; virtual std::string protocol() const; virtual Ice::Int timeout() const; virtual EndpointIPtr timeout(Ice::Int) const; virtual EndpointIPtr connectionId(const ::std::string&) const; virtual bool compress() const; virtual EndpointIPtr compress(bool) const; virtual bool datagram() const; virtual bool secure() const; virtual TransceiverPtr transceiver(EndpointIPtr&) const; virtual std::vector connectors(Ice::EndpointSelectionType) const; virtual void connectors_async(Ice::EndpointSelectionType, const EndpointI_connectorsPtr&) const; virtual AcceptorPtr acceptor(EndpointIPtr&, const std::string&) const; virtual std::vector expand() const; virtual bool equivalent(const EndpointIPtr&) const; virtual std::vector connectors(const std::vector
          &, const NetworkProxyPtr&) const; virtual bool operator==(const Ice::LocalObject&) const; virtual bool operator<(const Ice::LocalObject&) const; #ifdef __SUNPRO_CC using EndpointI::connectionId; #endif private: virtual ::Ice::Int hashInit() const; // // All members are const, because endpoints are immutable. // const InstancePtr _instance; const std::string _host; const Ice::Int _port; const Ice::Int _timeout; const bool _compress; }; class TcpEndpointFactory : public EndpointFactory { public: virtual ~TcpEndpointFactory(); virtual Ice::Short type() const; virtual std::string protocol() const; virtual EndpointIPtr create(const std::string&, bool) const; virtual EndpointIPtr read(BasicStream*) const; virtual void destroy(); private: TcpEndpointFactory(const InstancePtr&); friend class Instance; InstancePtr _instance; }; } #endif Ice-3.5.1/cpp/src/Ice/ObjectFactoryManager.h0000644000076400007640000000206012223561476016643 0ustar mesmes// ********************************************************************** // // 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 ICE_OBJECT_FACTORY_MANAGER_H #define ICE_OBJECT_FACTORY_MANAGER_H #include #include #include #include namespace IceInternal { class ObjectFactoryManager : public ::IceUtil::Shared, public ::IceUtil::Mutex { public: void add(const ::Ice::ObjectFactoryPtr&, const std::string&); void remove(const std::string&); ::Ice::ObjectFactoryPtr find(const std::string&) const; typedef std::map FactoryMap; private: ObjectFactoryManager(); void destroy(); friend class Instance; FactoryMap _factoryMap; mutable FactoryMap::iterator _factoryMapHint; }; } #endif Ice-3.5.1/cpp/src/Ice/TraceLevelsF.h0000644000076400007640000000113012223561476015126 0ustar mesmes// ********************************************************************** // // 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 ICE_TRACE_LEVELS_F_H #define ICE_TRACE_LEVELS_F_H #include #include namespace IceInternal { class TraceLevels; ICE_API IceUtil::Shared* upCast(TraceLevels*); typedef Handle TraceLevelsPtr; } #endif Ice-3.5.1/cpp/src/Ice/OpaqueEndpointI.cpp0000644000076400007640000002465712223561476016231 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceInternal::OpaqueEndpointI::OpaqueEndpointI(const string& str) : EndpointI(""), _rawEncoding(Encoding_1_0) { const string delim = " \t\n\r"; string::size_type beg; string::size_type end = 0; int topt = 0; int vopt = 0; while(true) { beg = str.find_first_not_of(delim, end); if(beg == string::npos) { break; } end = str.find_first_of(delim, beg); if(end == string::npos) { end = str.length(); } string option = str.substr(beg, end - beg); if(option.length() != 2 || option[0] != '-') { EndpointParseException ex(__FILE__, __LINE__); ex.str = "expected an endpoint option but found `" + option + "' in endpoint `opaque " + str + "'"; throw ex; } string argument; string::size_type argumentBeg = str.find_first_not_of(delim, end); if(argumentBeg != string::npos && str[argumentBeg] != '-') { beg = argumentBeg; end = str.find_first_of(delim, beg); if(end == string::npos) { end = str.length(); } argument = str.substr(beg, end - beg); } switch(option[1]) { case 't': { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -t option in endpoint `opaque " + str + "'"; throw ex; } istringstream p(argument); Ice::Int t; if(!(p >> t) || !p.eof()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid type value `" + argument + "' in endpoint `opaque " + str + "'"; throw ex; } else if(t < 0 || t > 65535) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "type value `" + argument + "' out of range in endpoint `opaque " + str + "'"; throw ex; } _type = static_cast(t); ++topt; if(topt > 1) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "multiple -t options in endpoint `opaque " + str + "'"; throw ex; } break; } case 'v': { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -v option in endpoint `opaque " + str + "'"; throw ex; } for(string::size_type i = 0; i < argument.size(); ++i) { if(!Base64::isBase64(argument[i])) { EndpointParseException ex(__FILE__, __LINE__); ostringstream ostr; ostr << "invalid base64 character `" << argument[i] << "' (ordinal " << (int)argument[i] << ") in endpoint `opaque " << str << "'"; ex.str = ostr.str(); throw ex; } } const_cast&>(_rawBytes) = Base64::decode(argument); ++vopt; if(vopt > 1) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "multiple -v options in endpoint `opaque " + str + "'"; throw ex; } break; } case 'e': { if(argument.empty()) { Ice::EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -e option in endpoint `opaque " + str + "'"; throw ex; } try { _rawEncoding = Ice::stringToEncodingVersion(argument); } catch(const Ice::VersionParseException& e) { Ice::EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid encoding version `" + argument + "' in endpoint `opaque " + str + "':\n" + e.str; throw ex; } break; } default: { EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid option `" + option + "' in endpoint `opaque " + str + "'"; throw ex; } } } if(topt != 1) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no -t option in endpoint `opaque " + str + "'"; throw ex; } if(vopt != 1) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no -v option in endpoint `opaque " + str + "'"; throw ex; } } IceInternal::OpaqueEndpointI::OpaqueEndpointI(Short type, BasicStream* s) : EndpointI(""), _type(type) { _rawEncoding = s->startReadEncaps(); Int sz = s->getReadEncapsSize(); s->readBlob(const_cast&>(_rawBytes), sz); s->endReadEncaps(); } void IceInternal::OpaqueEndpointI::streamWrite(BasicStream* s) const { s->write(_type); s->startWriteEncaps(_rawEncoding, DefaultFormat); s->writeBlob(_rawBytes); s->endWriteEncaps(); } string IceInternal::OpaqueEndpointI::toString() const { ostringstream s; string val = Base64::encode(_rawBytes); s << "opaque -t " << _type << " -e " << _rawEncoding << " -v " << val; return s.str(); } namespace { class InfoI : public Ice::OpaqueEndpointInfo { public: InfoI(Ice::Short type, const Ice::EncodingVersion& rawEncoding, const Ice::ByteSeq& rawByes); virtual Ice::Short type() const { return _type; } virtual bool datagram() const { return false; } virtual bool secure() const { return false; } private: Ice::Short _type; }; // // COMPILERFIX: inlining this constructor causes crashes with gcc 4.0.1. // InfoI::InfoI(Ice::Short type, const Ice::EncodingVersion& rawEncoding, const Ice::ByteSeq& rawBytes) : Ice::OpaqueEndpointInfo(-1, false, rawEncoding, rawBytes), _type(type) { } } Ice::EndpointInfoPtr IceInternal::OpaqueEndpointI::getInfo() const { return new InfoI(_type, _rawEncoding, _rawBytes); } Short IceInternal::OpaqueEndpointI::type() const { return _type; } std::string IceInternal::OpaqueEndpointI::protocol() const { return "opaque"; } Int IceInternal::OpaqueEndpointI::timeout() const { return -1; } EndpointIPtr IceInternal::OpaqueEndpointI::timeout(Int) const { return const_cast(this); } EndpointIPtr IceInternal::OpaqueEndpointI::connectionId(const string&) const { return const_cast(this); } bool IceInternal::OpaqueEndpointI::compress() const { return false; } EndpointIPtr IceInternal::OpaqueEndpointI::compress(bool) const { return const_cast(this); } bool IceInternal::OpaqueEndpointI::datagram() const { return false; } bool IceInternal::OpaqueEndpointI::secure() const { return false; } TransceiverPtr IceInternal::OpaqueEndpointI::transceiver(EndpointIPtr& endp) const { endp = const_cast(this); return 0; } vector IceInternal::OpaqueEndpointI::connectors(Ice::EndpointSelectionType) const { vector ret; return ret; } void IceInternal::OpaqueEndpointI::connectors_async(Ice::EndpointSelectionType, const EndpointI_connectorsPtr& cb) const { cb->connectors(vector()); } AcceptorPtr IceInternal::OpaqueEndpointI::acceptor(EndpointIPtr& endp, const string&) const { endp = const_cast(this); return 0; } vector IceInternal::OpaqueEndpointI::expand() const { vector endps; endps.push_back(const_cast(this)); return endps; } bool IceInternal::OpaqueEndpointI::equivalent(const EndpointIPtr&) const { return false; } bool IceInternal::OpaqueEndpointI::operator==(const LocalObject& r) const { const OpaqueEndpointI* p = dynamic_cast(&r); if(!p) { return false; } if(this == p) { return true; } if(_type != p->_type) { return false; } if(_rawEncoding != p->_rawEncoding) { return false; } if(_rawBytes != p->_rawBytes) { return false; } return true; } bool IceInternal::OpaqueEndpointI::operator<(const LocalObject& r) const { const OpaqueEndpointI* p = dynamic_cast(&r); if(!p) { const EndpointI* e = dynamic_cast(&r); if(!e) { return false; } return type() < e->type(); } if(this == p) { return false; } if(_type < p->_type) { return true; } else if(p->_type < _type) { return false; } if(_rawEncoding < p->_rawEncoding) { return true; } else if(p->_rawEncoding < _rawEncoding) { return false; } if(_rawBytes < p->_rawBytes) { return true; } else if(p->_rawBytes < _rawBytes) { return false; } return false; } Ice::Int IceInternal::OpaqueEndpointI::hashInit() const { Ice::Int h = 5381; hashAdd(h, _type); hashAdd(h, _rawEncoding.major); hashAdd(h, _rawEncoding.minor); hashAdd(h, _rawBytes); return h; } Ice-3.5.1/cpp/src/Ice/RetryQueue.cpp0000644000076400007640000000420712223561476015264 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(RetryQueue* p) { return p; } IceInternal::RetryTask::RetryTask(const RetryQueuePtr& queue, const OutgoingAsyncPtr& outAsync) : _queue(queue), _outAsync(outAsync) { } void IceInternal::RetryTask::runTimerTask() { if(_queue->remove(this)) { try { _outAsync->__send(false); } catch(const Ice::LocalException& ex) { _outAsync->__exceptionAsync(ex); } } } void IceInternal::RetryTask::destroy() { _outAsync->__exceptionAsync(CommunicatorDestroyedException(__FILE__, __LINE__)); } bool IceInternal::RetryTask::operator<(const RetryTask& rhs) const { return this < &rhs; } IceInternal::RetryQueue::RetryQueue(const InstancePtr& instance) : _instance(instance) { } void IceInternal::RetryQueue::add(const OutgoingAsyncPtr& out, int interval) { Lock sync(*this); RetryTaskPtr task = new RetryTask(this, out); try { _instance->timer()->schedule(task, IceUtil::Time::milliSeconds(interval)); } catch(const IceUtil::IllegalArgumentException&) // Expected if the communicator destroyed the timer. { throw CommunicatorDestroyedException(__FILE__, __LINE__); } _requests.insert(task); } void IceInternal::RetryQueue::destroy() { Lock sync(*this); for(set::const_iterator p = _requests.begin(); p != _requests.end(); ++p) { _instance->timer()->cancel(*p); (*p)->destroy(); } _requests.clear(); } bool IceInternal::RetryQueue::remove(const RetryTaskPtr& task) { Lock sync(*this); return _requests.erase(task) > 0; } Ice-3.5.1/cpp/src/Ice/ObjectAdapterFactory.h0000644000076400007640000000266512223561476016664 0ustar mesmes// ********************************************************************** // // 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 ICE_OBJECT_ADAPTER_FACTORY_H #define ICE_OBJECT_ADAPTER_FACTORY_H #include #include #include #include namespace IceInternal { class ObjectAdapterFactory : public ::IceUtil::Shared, public ::IceUtil::Monitor< ::IceUtil::RecMutex> { public: void shutdown(); void waitForShutdown(); bool isShutdown() const; void destroy(); void updateObservers(void (Ice::ObjectAdapterI::*)()); ::Ice::ObjectAdapterPtr createObjectAdapter(const std::string&, const Ice::RouterPrx&); ::Ice::ObjectAdapterPtr findObjectAdapter(const ::Ice::ObjectPrx&); void removeObjectAdapter(const ::Ice::ObjectAdapterPtr&); void flushAsyncBatchRequests(const CommunicatorBatchOutgoingAsyncPtr&) const; private: ObjectAdapterFactory(const InstancePtr&, const ::Ice::CommunicatorPtr&); virtual ~ObjectAdapterFactory(); friend class Instance; InstancePtr _instance; ::Ice::CommunicatorPtr _communicator; std::set _adapterNamesInUse; std::list _adapters; }; } #endif Ice-3.5.1/cpp/src/Ice/ThreadPoolF.h0000644000076400007640000000136712223561476014772 0ustar mesmes// ********************************************************************** // // 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 ICE_THREAD_POOL_F_H #define ICE_THREAD_POOL_F_H #include #include namespace IceInternal { class ThreadPool; ICE_API IceUtil::Shared* upCast(ThreadPool*); typedef Handle ThreadPoolPtr; class ThreadPoolWorkItem; ICE_API IceUtil::Shared* upCast(ThreadPoolWorkItem*); typedef Handle ThreadPoolWorkItemPtr; class ThreadPoolCurrent; } #endif Ice-3.5.1/cpp/src/Ice/Instance.h0000644000076400007640000001356512223561476014372 0ustar mesmes// ********************************************************************** // // 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 ICE_INSTANCE_H #define ICE_INSTANCE_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace Ice { class CommunicatorI; } namespace IceInternal { class MetricsAdminI; typedef IceUtil::Handle MetricsAdminIPtr; class Instance : public IceUtil::Shared, public IceUtil::RecMutex { public: bool destroyed() const; const Ice::InitializationData& initializationData() const { return _initData; } void stats(const Ice::StatsPtr&); TraceLevelsPtr traceLevels() const; DefaultsAndOverridesPtr defaultsAndOverrides() const; RouterManagerPtr routerManager() const; LocatorManagerPtr locatorManager() const; ReferenceFactoryPtr referenceFactory() const; ProxyFactoryPtr proxyFactory() const; OutgoingConnectionFactoryPtr outgoingConnectionFactory() const; ConnectionMonitorPtr connectionMonitor() const; ObjectFactoryManagerPtr servantFactoryManager() const; ObjectAdapterFactoryPtr objectAdapterFactory() const; ProtocolSupport protocolSupport() const; bool preferIPv6() const; NetworkProxyPtr networkProxy() const; ThreadPoolPtr clientThreadPool(); ThreadPoolPtr serverThreadPool(bool create = true); EndpointHostResolverPtr endpointHostResolver(); RetryQueuePtr retryQueue(); IceUtil::TimerPtr timer(); EndpointFactoryManagerPtr endpointFactoryManager() const; DynamicLibraryListPtr dynamicLibraryList() const; Ice::PluginManagerPtr pluginManager() const; size_t messageSizeMax() const { return _messageSizeMax; } Ice::Int clientACM() const; Ice::Int serverACM() const; Ice::Identity stringToIdentity(const std::string&) const; std::string identityToString(const Ice::Identity&) const; Ice::ObjectPrx getAdmin(); void addAdminFacet(const Ice::ObjectPtr&, const std::string&); Ice::ObjectPtr removeAdminFacet(const std::string&); Ice::ObjectPtr findAdminFacet(const std::string&); const Ice::Instrumentation::CommunicatorObserverPtr& getObserver() const { return _observer; } const Ice::ImplicitContextIPtr& getImplicitContext() const { return _implicitContext; } void setDefaultLocator(const Ice::LocatorPrx&); void setDefaultRouter(const Ice::RouterPrx&); void setStringConverter(const Ice::StringConverterPtr&); void setWstringConverter(const Ice::WstringConverterPtr&); void setLogger(const Ice::LoggerPtr&); void setThreadHook(const Ice::ThreadNotificationPtr&); private: Instance(const Ice::CommunicatorPtr&, const Ice::InitializationData&); virtual ~Instance(); void finishSetup(int&, char*[]); bool destroy(); friend class Ice::CommunicatorI; void updateConnectionObservers(); void updateThreadObservers(); friend class ObserverUpdaterI; enum State { StateActive, StateDestroyInProgress, StateDestroyed }; State _state; Ice::InitializationData _initData; const TraceLevelsPtr _traceLevels; // Immutable, not reset by destroy(). const DefaultsAndOverridesPtr _defaultsAndOverrides; // Immutable, not reset by destroy(). const size_t _messageSizeMax; // Immutable, not reset by destroy(). const Ice::Int _clientACM; // Immutable, not reset by destroy(). const Ice::Int _serverACM; // Immutable, not reset by destroy(). RouterManagerPtr _routerManager; LocatorManagerPtr _locatorManager; ReferenceFactoryPtr _referenceFactory; ProxyFactoryPtr _proxyFactory; OutgoingConnectionFactoryPtr _outgoingConnectionFactory; ConnectionMonitorPtr _connectionMonitor; ObjectFactoryManagerPtr _servantFactoryManager; ObjectAdapterFactoryPtr _objectAdapterFactory; ProtocolSupport _protocolSupport; bool _preferIPv6; NetworkProxyPtr _networkProxy; ThreadPoolPtr _clientThreadPool; ThreadPoolPtr _serverThreadPool; EndpointHostResolverPtr _endpointHostResolver; RetryQueuePtr _retryQueue; IceUtil::TimerPtr _timer; EndpointFactoryManagerPtr _endpointFactoryManager; DynamicLibraryListPtr _dynamicLibraryList; Ice::PluginManagerPtr _pluginManager; const Ice::ImplicitContextIPtr _implicitContext; Ice::ObjectAdapterPtr _adminAdapter; Ice::FacetMap _adminFacets; Ice::Identity _adminIdentity; std::set _adminFacetFilter; IceInternal::MetricsAdminIPtr _metricsAdmin; Ice::Instrumentation::CommunicatorObserverPtr _observer; }; class ProcessI : public Ice::Process { public: ProcessI(const Ice::CommunicatorPtr&); virtual void shutdown(const Ice::Current&); virtual void writeMessage(const std::string&, Ice::Int, const Ice::Current&); private: const Ice::CommunicatorPtr _communicator; }; } #endif Ice-3.5.1/cpp/src/Ice/ProxyFactory.cpp0000644000076400007640000002044512223561476015625 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(ProxyFactory* p) { return p; } ObjectPrx IceInternal::ProxyFactory::stringToProxy(const string& str) const { ReferencePtr ref = _instance->referenceFactory()->create(str, ""); return referenceToProxy(ref); } string IceInternal::ProxyFactory::proxyToString(const ObjectPrx& proxy) const { if(proxy) { return proxy->__reference()->toString(); } else { return ""; } } ObjectPrx IceInternal::ProxyFactory::propertyToProxy(const string& prefix) const { string proxy = _instance->initializationData().properties->getProperty(prefix); ReferencePtr ref = _instance->referenceFactory()->create(proxy, prefix); return referenceToProxy(ref); } PropertyDict IceInternal::ProxyFactory::proxyToProperty(const ObjectPrx& proxy, const string& prefix) const { if(proxy) { return proxy->__reference()->toProperty(prefix); } else { return PropertyDict(); } } ObjectPrx IceInternal::ProxyFactory::streamToProxy(BasicStream* s) const { Identity ident; s->read(ident); ReferencePtr ref = _instance->referenceFactory()->create(ident, s); return referenceToProxy(ref); } void IceInternal::ProxyFactory::proxyToStream(const ObjectPrx& proxy, BasicStream* s) const { if(proxy) { s->write(proxy->__reference()->getIdentity()); proxy->__reference()->streamWrite(s); } else { Identity ident; s->write(ident); } } ObjectPrx IceInternal::ProxyFactory::referenceToProxy(const ReferencePtr& ref) const { if(ref) { ObjectPrx proxy = new ::IceProxy::Ice::Object; proxy->setup(ref); return proxy; } else { return 0; } } int IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, const ReferencePtr& ref, bool sleep, int& cnt) const { TraceLevelsPtr traceLevels = _instance->traceLevels(); LoggerPtr logger = _instance->initializationData().logger; // // We don't retry batch requests because the exception might have caused // the all the requests batched with the connection to be aborted and we // want the application to be notified. // if(ref->getMode() == Reference::ModeBatchOneway || ref->getMode() == Reference::ModeBatchDatagram) { ex.ice_throw(); } const ObjectNotExistException* one = dynamic_cast(&ex); if(one) { if(ref->getRouterInfo() && one->operation == "ice_add_proxy") { // // If we have a router, an ObjectNotExistException with an // operation name "ice_add_proxy" indicates to the client // that the router isn't aware of the proxy (for example, // because it was evicted by the router). In this case, we // must *always* retry, so that the missing proxy is added // to the router. // ref->getRouterInfo()->clearCache(ref); if(traceLevels->retry >= 1) { Trace out(logger, traceLevels->retryCat); out << "retrying operation call to add proxy to router\n" << ex; } return 0; // We must always retry, so we don't look at the retry count. } else if(ref->isIndirect()) { // // We retry ObjectNotExistException if the reference is // indirect. // if(ref->isWellKnown()) { LocatorInfoPtr li = ref->getLocatorInfo(); if(li) { li->clearCache(ref); } } } else { // // For all other cases, we don't retry // ObjectNotExistException. // ex.ice_throw(); } } else if(dynamic_cast(&ex)) { // // We don't retry other *NotExistException, which are all // derived from RequestFailedException. // ex.ice_throw(); } // // There is no point in retrying an operation that resulted in a // MarshalException. This must have been raised locally (because // if it happened in a server it would result in an // UnknownLocalException instead), which means there was a problem // in this process that will not change if we try again. // // The most likely cause for a MarshalException is exceeding the // maximum message size, which is represented by the subclass // MemoryLimitException. For example, a client can attempt to send // a message that exceeds the maximum memory size, or accumulate // enough batch requests without flushing that the maximum size is // reached. // // This latter case is especially problematic, because if we were // to retry a batch request after a MarshalException, we would in // fact silently discard the accumulated requests and allow new // batch requests to accumulate. If the subsequent batched // requests do not exceed the maximum message size, it appears to // the client that all of the batched requests were accepted, when // in reality only the last few are actually sent. // if(dynamic_cast(&ex)) { ex.ice_throw(); } ++cnt; assert(cnt > 0); int interval = -1; if(cnt == static_cast(_retryIntervals.size() + 1) && dynamic_cast(&ex)) { // // A close connection exception is always retried at least once, even if the retry // limit is reached. // interval = 0; } else if(cnt > static_cast(_retryIntervals.size())) { if(traceLevels->retry >= 1) { Trace out(logger, traceLevels->retryCat); out << "cannot retry operation call because retry limit has been exceeded\n" << ex; } ex.ice_throw(); } else { interval = _retryIntervals[cnt - 1]; } if(traceLevels->retry >= 1) { Trace out(logger, traceLevels->retryCat); out << "retrying operation call"; if(interval > 0) { out << " in " << interval << "ms"; } out << " because of exception\n" << ex; } if(sleep && interval > 0) { // // Sleep before retrying. // IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(interval)); } return interval; } IceInternal::ProxyFactory::ProxyFactory(const InstancePtr& instance) : _instance(instance) { StringSeq retryValues = _instance->initializationData().properties->getPropertyAsList("Ice.RetryIntervals"); if(retryValues.size() == 0) { _retryIntervals.push_back(0); } else { for(StringSeq::const_iterator p = retryValues.begin(); p != retryValues.end(); ++p) { istringstream value(*p); int v; if(!(value >> v) || !value.eof()) { v = 0; } // // If -1 is the first value, no retry and wait intervals. // if(v == -1 && _retryIntervals.empty()) { break; } _retryIntervals.push_back(v > 0 ? v : 0); } } } IceInternal::ProxyFactory::~ProxyFactory() { } Ice-3.5.1/cpp/src/Ice/InstrumentationI.cpp0000644000076400007640000005633212223561476016474 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; using namespace Ice::Instrumentation; using namespace IceMX; namespace { Context emptyCtx; int ThreadMetrics::* getThreadStateMetric(ThreadState s) { switch(s) { case ThreadStateIdle: return 0; case ThreadStateInUseForIO: return &ThreadMetrics::inUseForIO; case ThreadStateInUseForUser: return &ThreadMetrics::inUseForUser; case ThreadStateInUseForOther: return &ThreadMetrics::inUseForOther; default: assert(false); return 0; } } struct ThreadStateChanged { ThreadStateChanged(ThreadState oldState, ThreadState newState) : oldState(oldState), newState(newState) { } void operator()(const ThreadMetricsPtr& v) { if(oldState != ThreadStateIdle) { --(v.get()->*getThreadStateMetric(oldState)); } if(newState != ThreadStateIdle) { ++(v.get()->*getThreadStateMetric(newState)); } } ThreadState oldState; ThreadState newState; }; class ConnectionHelper : public MetricsHelperT { public: class Attributes : public AttributeResolverT { public: Attributes() { add("parent", &ConnectionHelper::getParent); add("id", &ConnectionHelper::getId); add("state", &ConnectionHelper::getState); addConnectionAttributes(*this); } }; static Attributes attributes; ConnectionHelper(const ConnectionInfoPtr& con, const EndpointPtr& endpt, ConnectionState state) : _connectionInfo(con), _endpoint(endpt), _state(state) { } virtual string operator()(const string& attribute) const { return attributes(this, attribute); } const string& getId() const { if(_id.empty()) { ostringstream os; IPConnectionInfoPtr info = IPConnectionInfoPtr::dynamicCast(_connectionInfo); if(info) { os << info->localAddress << ':' << info->localPort; os << " -> "; os << info->remoteAddress << ':' << info->remotePort; } else { os << "connection-" << _connectionInfo.get(); } if(!_connectionInfo->connectionId.empty()) { os << " [" << _connectionInfo->connectionId << "]"; } _id = os.str(); } return _id; } string getState() const { switch(_state) { case ConnectionStateValidating: return "validating"; case ConnectionStateHolding: return "holding"; case ConnectionStateActive: return "active"; case ConnectionStateClosing: return "closing"; case ConnectionStateClosed: return "closed"; default: assert(false); return ""; } } string getParent() const { if(!_connectionInfo->adapterName.empty()) { return _connectionInfo->adapterName; } else { return "Communicator"; } } const ConnectionInfoPtr& getConnectionInfo() const { return _connectionInfo; } const EndpointPtr& getEndpoint() const { return _endpoint; } const EndpointInfoPtr& getEndpointInfo() const { if(!_endpointInfo) { _endpointInfo = _endpoint->getInfo(); } return _endpointInfo; } private: const ConnectionInfoPtr& _connectionInfo; const EndpointPtr& _endpoint; const ConnectionState _state; mutable string _id; mutable EndpointInfoPtr _endpointInfo; }; ConnectionHelper::Attributes ConnectionHelper::attributes; class DispatchHelper : public MetricsHelperT { public: class Attributes : public AttributeResolverT { public: Attributes() { add("parent", &DispatchHelper::getParent); add("id", &DispatchHelper::getId); add("connection", &DispatchHelper::getConnection); addConnectionAttributes(*this); add("operation", &DispatchHelper::getCurrent, &Current::operation); add("identity", &DispatchHelper::getIdentity); add("facet", &DispatchHelper::getCurrent, &Current::facet); add("mode", &DispatchHelper::getMode); add("requestId", &DispatchHelper::getCurrent, &Current::requestId); setDefault(&DispatchHelper::resolve); } }; static Attributes attributes; DispatchHelper(const Current& current, int size) : _current(current), _size(size) { } virtual string operator()(const string& attribute) const { return attributes(this, attribute); } virtual void initMetrics(const DispatchMetricsPtr& v) const { v->size += _size; } string resolve(const string& attribute) const { if(attribute.compare(0, 8, "context.") == 0) { Context::const_iterator p = _current.ctx.find(attribute.substr(8)); if(p != _current.ctx.end()) { return p->second; } } throw invalid_argument(attribute); } string getMode() const { return _current.requestId == 0 ? "oneway" : "twoway"; } const string& getId() const { if(_id.empty()) { ostringstream os; if(!_current.id.category.empty()) { os << _current.id.category << '/'; } os << _current.id.name << " [" << _current.operation << ']'; _id = os.str(); } return _id; } string getParent() const { return _current.adapter->getName(); } ConnectionInfoPtr getConnectionInfo() const { return _current.con->getInfo(); } EndpointPtr getEndpoint() const { return _current.con->getEndpoint(); } const ConnectionPtr& getConnection() const { return _current.con; } const EndpointInfoPtr& getEndpointInfo() const { if(!_endpointInfo) { _endpointInfo = _current.con->getEndpoint()->getInfo(); } return _endpointInfo; } const Current& getCurrent() const { return _current; } string getIdentity() const { return _current.adapter->getCommunicator()->identityToString(_current.id); } private: const Current& _current; const int _size; mutable string _id; mutable EndpointInfoPtr _endpointInfo; }; DispatchHelper::Attributes DispatchHelper::attributes; class InvocationHelper : public MetricsHelperT { public: class Attributes : public AttributeResolverT { public: Attributes() { add("parent", &InvocationHelper::getParent); add("id", &InvocationHelper::getId); add("operation", &InvocationHelper::getOperation); add("identity", &InvocationHelper::getIdentity); add("facet", &InvocationHelper::getProxy, &IceProxy::Ice::Object::ice_getFacet); add("encoding", &InvocationHelper::getProxy, &IceProxy::Ice::Object::ice_getEncodingVersion); add("mode", &InvocationHelper::getMode); add("proxy", &InvocationHelper::getProxy); setDefault(&InvocationHelper::resolve); } }; static Attributes attributes; InvocationHelper(const ObjectPrx& proxy, const string& op, const Context& ctx = emptyCtx) : _proxy(proxy), _operation(op), _context(ctx) { } string resolve(const string& attribute) const { if(attribute.compare(0, 8, "context.") == 0) { Context::const_iterator p = _context.find(attribute.substr(8)); if(p != _context.end()) { return p->second; } } throw invalid_argument(attribute); } virtual string operator()(const string& attribute) const { return attributes(this, attribute); } string getMode() const { if(!_proxy) { throw invalid_argument("mode"); } if(_proxy->ice_isTwoway()) { return "twoway"; } else if(_proxy->ice_isOneway()) { return "oneway"; } else if(_proxy->ice_isBatchOneway()) { return "batch-oneway"; } else if(_proxy->ice_isDatagram()) { return "datagram"; } else if(_proxy->ice_isBatchDatagram()) { return "batch-datagram"; } else { throw invalid_argument("mode"); } } const string& getId() const { if(_id.empty()) { ostringstream os; if(_proxy) { try { os << _proxy->ice_endpoints(Ice::EndpointSeq()) << " [" << _operation << ']'; } catch(const Exception&) { // Either a fixed proxy or the communicator is destroyed. os << _proxy->ice_getCommunicator()->identityToString(_proxy->ice_getIdentity()); os << " [" << _operation << ']'; } } else { os << _operation; } _id = os.str(); } return _id; } string getParent() const { return "Communicator"; } const ObjectPrx& getProxy() const { return _proxy; } string getIdentity() const { if(_proxy) { return _proxy->ice_getCommunicator()->identityToString(_proxy->ice_getIdentity()); } else { return ""; } } const string& getOperation() const { return _operation; } private: const ObjectPrx& _proxy; const string& _operation; const Context& _context; mutable string _id; }; InvocationHelper::Attributes InvocationHelper::attributes; class RemoteInvocationHelper : public MetricsHelperT { public: class Attributes : public AttributeResolverT { public: Attributes() { add("parent", &RemoteInvocationHelper::getParent); add("id", &RemoteInvocationHelper::getId); add("requestId", &RemoteInvocationHelper::_requestId); addConnectionAttributes(*this); } }; static Attributes attributes; RemoteInvocationHelper(const ConnectionInfoPtr& con, const EndpointPtr& endpt, int requestId, int size) : _connectionInfo(con), _endpoint(endpt), _requestId(requestId), _size(size) { } virtual string operator()(const string& attribute) const { return attributes(this, attribute); } virtual void initMetrics(const RemoteMetricsPtr& v) const { v->size += _size; } const string& getId() const { if(_id.empty()) { _id = _endpoint->toString(); if(!_connectionInfo->connectionId.empty()) { _id += " [" + _connectionInfo->connectionId + "]"; } } return _id; } string getParent() const { if(!_connectionInfo->adapterName.empty()) { return _connectionInfo->adapterName; } else { return "Communicator"; } } const ConnectionInfoPtr& getConnectionInfo() const { return _connectionInfo; } const EndpointPtr& getEndpoint() const { return _endpoint; } const EndpointInfoPtr& getEndpointInfo() const { if(!_endpointInfo) { _endpointInfo = _endpoint->getInfo(); } return _endpointInfo; } private: const ConnectionInfoPtr& _connectionInfo; const EndpointPtr& _endpoint; protected: // // COMPILERFIX: Clang 4.2 reports unused-private-field for the _requestId // field that is only used in the nested Attributes class. // const int _requestId; private: const int _size; mutable string _id; mutable EndpointInfoPtr _endpointInfo; }; RemoteInvocationHelper::Attributes RemoteInvocationHelper::attributes; class ThreadHelper : public MetricsHelperT { public: class Attributes : public AttributeResolverT { public: Attributes() { add("parent", &ThreadHelper::_parent); add("id", &ThreadHelper::_id); } }; static Attributes attributes; ThreadHelper(const string& parent, const string& id, ThreadState state) : _parent(parent), _id(id), _state(state) { } virtual string operator()(const string& attribute) const { return attributes(this, attribute); } virtual void initMetrics(const ThreadMetricsPtr& v) const { if(_state != ThreadStateIdle) { ++(v.get()->*getThreadStateMetric(_state)); } } private: const string _parent; const string _id; const ThreadState _state; }; ThreadHelper::Attributes ThreadHelper::attributes; class EndpointHelper : public MetricsHelperT { public: class Attributes : public AttributeResolverT { public: Attributes() { add("parent", &EndpointHelper::getParent); add("id", &EndpointHelper::getId); addEndpointAttributes(*this); } }; static Attributes attributes; EndpointHelper(const EndpointPtr& endpt, const string& id) : _endpoint(endpt), _id(id) { } EndpointHelper(const EndpointPtr& endpt) : _endpoint(endpt) { } virtual string operator()(const string& attribute) const { return attributes(this, attribute); } const EndpointInfoPtr& getEndpointInfo() const { if(!_endpointInfo) { _endpointInfo = _endpoint->getInfo(); } return _endpointInfo; } string getParent() const { return "Communicator"; } const string& getId() const { if(_id.empty()) { _id = _endpoint->toString(); } return _id; } string getEndpoint() const { return _endpoint->toString(); } private: const EndpointPtr _endpoint; mutable string _id; mutable EndpointInfoPtr _endpointInfo; }; EndpointHelper::Attributes EndpointHelper::attributes; } void ConnectionObserverI::sentBytes(Int num) { forEach(add(&ConnectionMetrics::sentBytes, num)); if(_delegate) { _delegate->sentBytes(num); } } void ConnectionObserverI::receivedBytes(Int num) { forEach(add(&ConnectionMetrics::receivedBytes, num)); if(_delegate) { _delegate->receivedBytes(num); } } void ThreadObserverI::stateChanged(ThreadState oldState, ThreadState newState) { forEach(ThreadStateChanged(oldState, newState)); if(_delegate) { _delegate->stateChanged(oldState, newState); } } void DispatchObserverI::userException() { forEach(inc(&DispatchMetrics::userException)); if(_delegate) { _delegate->userException(); } } void DispatchObserverI::reply(Int size) { forEach(add(&DispatchMetrics::replySize, size)); if(_delegate) { _delegate->reply(size); } } void RemoteObserverI::reply(Int size) { forEach(add(&RemoteMetrics::replySize, size)); if(_delegate) { _delegate->reply(size); } } void InvocationObserverI::retried() { forEach(inc(&InvocationMetrics::retry)); if(_delegate) { _delegate->retried(); } } void InvocationObserverI::userException() { forEach(inc(&InvocationMetrics::userException)); if(_delegate) { _delegate->userException(); } } RemoteObserverPtr InvocationObserverI::getRemoteObserver(const ConnectionInfoPtr& connection, const EndpointPtr& endpoint, int requestId, int size) { try { RemoteObserverPtr delegate; if(_delegate) { delegate = _delegate->getRemoteObserver(connection, endpoint, requestId, size); } return getObserverWithDelegate("Remote", RemoteInvocationHelper(connection, endpoint, requestId, size), delegate); } catch(const exception&) { } return 0; } CommunicatorObserverI::CommunicatorObserverI(const IceInternal::MetricsAdminIPtr& metrics, const Ice::Instrumentation::CommunicatorObserverPtr& delegate) : _metrics(metrics), _logger(metrics->getLogger()), _delegate(delegate), _connections(metrics, "Connection"), _dispatch(metrics, "Dispatch"), _invocations(metrics, "Invocation"), _threads(metrics, "Thread"), _connects(metrics, "ConnectionEstablishment"), _endpointLookups(metrics, "EndpointLookup") { _invocations.registerSubMap("Remote", &InvocationMetrics::remotes); } void CommunicatorObserverI::setObserverUpdater(const ObserverUpdaterPtr& updater) { _connections.setUpdater(newUpdater(updater, &ObserverUpdater::updateConnectionObservers)); _threads.setUpdater(newUpdater(updater, &ObserverUpdater::updateThreadObservers)); if(_delegate) { _delegate->setObserverUpdater(updater); } } ObserverPtr CommunicatorObserverI::getConnectionEstablishmentObserver(const EndpointPtr& endpt, const string& connector) { if(_connects.isEnabled()) { try { ObserverPtr delegate; if(_delegate) { delegate = _delegate->getConnectionEstablishmentObserver(endpt, connector); } return _connects.getObserverWithDelegate(EndpointHelper(endpt, connector), delegate); } catch(const exception& ex) { Error error(_logger); error << "unexpected exception trying to obtain observer:\n" << ex; } } return 0; } ObserverPtr CommunicatorObserverI::getEndpointLookupObserver(const EndpointPtr& endpt) { if(_endpointLookups.isEnabled()) { try { ObserverPtr delegate; if(_delegate) { delegate = _delegate->getEndpointLookupObserver(endpt); } return _endpointLookups.getObserverWithDelegate(EndpointHelper(endpt), delegate); } catch(const exception& ex) { Error error(_logger); error << "unexpected exception trying to obtain observer:\n" << ex; } } return 0; } ConnectionObserverPtr CommunicatorObserverI::getConnectionObserver(const ConnectionInfoPtr& con, const EndpointPtr& endpt, ConnectionState state, const ConnectionObserverPtr& observer) { if(_connections.isEnabled()) { try { ConnectionObserverPtr delegate; ConnectionObserverI* o = dynamic_cast(observer.get()); if(_delegate) { delegate = _delegate->getConnectionObserver(con, endpt, state, o ? o->getDelegate() : observer); } return _connections.getObserverWithDelegate(ConnectionHelper(con, endpt, state), delegate, observer); } catch(const exception& ex) { Error error(_logger); error << "unexpected exception trying to obtain observer:\n" << ex; } } return 0; } ThreadObserverPtr CommunicatorObserverI::getThreadObserver(const string& parent, const string& id, ThreadState state, const ThreadObserverPtr& observer) { if(_threads.isEnabled()) { try { ThreadObserverPtr delegate; ThreadObserverI* o = dynamic_cast(observer.get()); if(_delegate) { delegate = _delegate->getThreadObserver(parent, id, state, o ? o->getDelegate() : observer); } return _threads.getObserverWithDelegate(ThreadHelper(parent, id, state), delegate, observer); } catch(const exception& ex) { Error error(_logger); error << "unexpected exception trying to obtain observer:\n" << ex; } } return 0; } InvocationObserverPtr CommunicatorObserverI::getInvocationObserver(const ObjectPrx& proxy, const string& op, const Context& ctx) { if(_invocations.isEnabled()) { try { InvocationObserverPtr delegate; if(_delegate) { delegate = _delegate->getInvocationObserver(proxy, op, ctx); } return _invocations.getObserverWithDelegate(InvocationHelper(proxy, op, ctx), delegate); } catch(const exception& ex) { Error error(_logger); error << "unexpected exception trying to obtain observer:\n" << ex; } } return 0; } DispatchObserverPtr CommunicatorObserverI::getDispatchObserver(const Current& current, int size) { if(_dispatch.isEnabled()) { try { DispatchObserverPtr delegate; if(_delegate) { delegate = _delegate->getDispatchObserver(current, size); } return _dispatch.getObserverWithDelegate(DispatchHelper(current, size), delegate); } catch(const exception& ex) { Error error(_logger); error << "unexpected exception trying to obtain observer:\n" << ex; } } return 0; } const IceInternal::MetricsAdminIPtr& CommunicatorObserverI::getMetricsAdmin() const { assert(_metrics); return _metrics; } void CommunicatorObserverI::destroy() { _metrics = 0; _connections.destroy(); _dispatch.destroy(); _invocations.destroy(); _threads.destroy(); _connects.destroy(); _endpointLookups.destroy(); } Ice-3.5.1/cpp/src/Ice/OpaqueEndpointI.h0000644000076400007640000000407112223561476015662 0ustar mesmes// ********************************************************************** // // 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 ICE_UNKNOWN_ENDPOINT_I_H #define ICE_UNKNOWN_ENDPOINT_I_H #include #include namespace IceInternal { class OpaqueEndpointI : public EndpointI { public: OpaqueEndpointI(const ::std::string&); OpaqueEndpointI(Ice::Short, BasicStream*); virtual void streamWrite(BasicStream*) const; virtual std::string toString() const; virtual Ice::EndpointInfoPtr getInfo() const; virtual Ice::Short type() const; virtual std::string protocol() const; virtual Ice::Int timeout() const; virtual EndpointIPtr timeout(Ice::Int) const; virtual EndpointIPtr connectionId(const ::std::string&) const; virtual bool compress() const; virtual EndpointIPtr compress(bool) const; virtual bool datagram() const; virtual bool secure() const; virtual TransceiverPtr transceiver(EndpointIPtr&) const; virtual std::vector connectors(Ice::EndpointSelectionType) const; virtual void connectors_async(Ice::EndpointSelectionType, const EndpointI_connectorsPtr&) const; virtual AcceptorPtr acceptor(EndpointIPtr&, const std::string&) const; virtual std::vector expand() const; virtual bool equivalent(const EndpointIPtr&) const; virtual bool operator==(const Ice::LocalObject&) const; virtual bool operator<(const Ice::LocalObject&) const; #ifdef __SUNPRO_CC using EndpointI::connectionId; #endif protected: virtual ::Ice::Int hashInit() const; using EndpointI::connectors; private: // // All members are const, because endpoints are immutable. // Ice::Short _type; Ice::EncodingVersion _rawEncoding; // The encoding used for _rawBytes const std::vector _rawBytes; }; } #endif Ice-3.5.1/cpp/src/Ice/ConnectionI.h0000644000076400007640000003103312223561476015024 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECTION_I_H #define ICE_CONNECTION_I_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace IceInternal { class Outgoing; class BatchOutgoing; class OutgoingMessageCallback; class ConnectionReaper : public IceUtil::Mutex, public IceUtil::Shared { public: void add(const Ice::ConnectionIPtr&); void swapConnections(std::vector&); private: std::vector _connections; }; typedef IceUtil::Handle ConnectionReaperPtr; } namespace Ice { class LocalException; class ICE_API ConnectionI : public Connection, public IceInternal::EventHandler, public IceUtil::Monitor { class Observer : public IceInternal::ObserverHelperT { public: Observer(); void startRead(Ice::Byte*); void finishRead(Ice::Byte*); void startWrite(Ice::Byte*); void finishWrite(Ice::Byte*); void attach(const Ice::Instrumentation::ConnectionObserverPtr&); private: Ice::Byte* _readStreamPos; Ice::Byte* _writeStreamPos; }; public: class StartCallback : virtual public IceUtil::Shared { public: virtual void connectionStartCompleted(const ConnectionIPtr&) = 0; virtual void connectionStartFailed(const ConnectionIPtr&, const Ice::LocalException&) = 0; }; typedef IceUtil::Handle StartCallbackPtr; struct SentCallback { #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) SentCallback(const IceInternal::OutgoingAsyncMessageCallbackPtr& outAsync, const IceInternal::OutgoingAsyncPtr& replyOutAsync) : outAsync(outAsync), replyOutAsync(replyOutAsync) { } #else SentCallback(const IceInternal::OutgoingAsyncMessageCallbackPtr& outAsync) : outAsync(outAsync) { } #endif IceInternal::OutgoingAsyncMessageCallbackPtr outAsync; #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) IceInternal::OutgoingAsyncPtr replyOutAsync; #endif }; enum DestructionReason { ObjectAdapterDeactivated, CommunicatorDestroyed }; void start(const StartCallbackPtr&); void activate(); void hold(); void destroy(DestructionReason); virtual void close(bool); // From Connection. bool isActiveOrHolding() const; bool isFinished() const; void throwException() const; // Throws the connection exception if destroyed. void waitUntilHolding() const; void waitUntilFinished(); // Not const, as this might close the connection upon timeout. void updateObserver(); void monitor(const IceUtil::Time&); bool sendRequest(IceInternal::Outgoing*, bool, bool); IceInternal::AsyncStatus sendAsyncRequest(const IceInternal::OutgoingAsyncPtr&, bool, bool); void prepareBatchRequest(IceInternal::BasicStream*); void finishBatchRequest(IceInternal::BasicStream*, bool); void abortBatchRequest(); virtual void flushBatchRequests(); // From Connection. #ifdef ICE_CPP11 virtual ::Ice::AsyncResultPtr begin_flushBatchRequests( const ::IceInternal::Function& exception, const ::IceInternal::Function& sent = ::IceInternal::Function()) { return __begin_flushBatchRequests(new Cpp11FnCallbackNC_Connection_flushBatchRequests(exception, sent), 0); } #endif virtual AsyncResultPtr begin_flushBatchRequests(); virtual AsyncResultPtr begin_flushBatchRequests(const CallbackPtr&, const LocalObjectPtr& = 0); virtual AsyncResultPtr begin_flushBatchRequests(const Callback_Connection_flushBatchRequestsPtr&, const LocalObjectPtr& = 0); virtual void end_flushBatchRequests(const AsyncResultPtr&); bool flushBatchRequests(IceInternal::BatchOutgoing*); IceInternal::AsyncStatus flushAsyncBatchRequests(const IceInternal::BatchOutgoingAsyncPtr&); void sendResponse(IceInternal::BasicStream*, Byte); void sendNoResponse(); IceInternal::EndpointIPtr endpoint() const; IceInternal::ConnectorPtr connector() const; virtual void setAdapter(const ObjectAdapterPtr&); // From Connection. virtual ObjectAdapterPtr getAdapter() const; // From Connection. virtual EndpointPtr getEndpoint() const; // From Connection. virtual ObjectPrx createProxy(const Identity& ident) const; // From Connection. // // Operations from EventHandler // #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) bool startAsync(IceInternal::SocketOperation); bool finishAsync(IceInternal::SocketOperation); #endif virtual void message(IceInternal::ThreadPoolCurrent&); virtual void finished(IceInternal::ThreadPoolCurrent&); virtual std::string toString() const; // From Connection and EvantHandler. virtual IceInternal::NativeInfoPtr getNativeInfo(); void timedOut(); virtual std::string type() const; // From Connection. virtual Ice::Int timeout() const; // From Connection. virtual ConnectionInfoPtr getInfo() const; // From Connection void exception(const LocalException&); void invokeException(const LocalException&, int); void dispatch(const StartCallbackPtr&, const std::vector&, Byte, Int, Int, const IceInternal::ServantManagerPtr&, const ObjectAdapterPtr&, const IceInternal::OutgoingAsyncPtr&, IceInternal::BasicStream&); void finish(); private: friend class IceInternal::ConnectionReaper; enum State { StateNotInitialized, StateNotValidated, StateActive, StateHolding, StateClosing, StateClosed, StateFinished }; struct OutgoingMessage { OutgoingMessage(IceInternal::BasicStream* str, bool comp) : stream(str), out(0), compress(comp), requestId(0), adopted(false), isSent(false) { } OutgoingMessage(IceInternal::OutgoingMessageCallback* o, IceInternal::BasicStream* str, bool comp, int rid) : stream(str), out(o), compress(comp), requestId(rid), adopted(false), isSent(false) { } OutgoingMessage(const IceInternal::OutgoingAsyncMessageCallbackPtr& o, IceInternal::BasicStream* str, bool comp, int rid) : stream(str), out(0), outAsync(o), compress(comp), requestId(rid), adopted(false), isSent(false) { } void adopt(IceInternal::BasicStream*); bool sent(ConnectionI*, bool); void finished(const Ice::LocalException&); IceInternal::BasicStream* stream; IceInternal::OutgoingMessageCallback* out; IceInternal::OutgoingAsyncMessageCallbackPtr outAsync; #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) IceInternal::OutgoingAsyncPtr replyOutAsync; #endif bool compress; int requestId; bool adopted; bool isSent; }; ConnectionI(const Ice::CommunicatorPtr&, const IceInternal::InstancePtr&, const IceInternal::ConnectionReaperPtr&, const IceInternal::TransceiverPtr&, const IceInternal::ConnectorPtr&, const IceInternal::EndpointIPtr&, const ObjectAdapterPtr&); virtual ~ConnectionI(); friend class IceInternal::IncomingConnectionFactory; friend class IceInternal::OutgoingConnectionFactory; void setState(State, const LocalException&); void setState(State); void initiateShutdown(); bool initialize(IceInternal::SocketOperation = IceInternal::SocketOperationNone); bool validate(IceInternal::SocketOperation = IceInternal::SocketOperationNone); void sendNextMessage(std::vector&); IceInternal::AsyncStatus sendMessage(OutgoingMessage&); #ifndef ICE_OS_WINRT void doCompress(IceInternal::BasicStream&, IceInternal::BasicStream&); void doUncompress(IceInternal::BasicStream&, IceInternal::BasicStream&); #endif void parseMessage(IceInternal::BasicStream&, Int&, Int&, Byte&, IceInternal::ServantManagerPtr&, ObjectAdapterPtr&, IceInternal::OutgoingAsyncPtr&); void invokeAll(IceInternal::BasicStream&, Int, Int, Byte, const IceInternal::ServantManagerPtr&, const ObjectAdapterPtr&); void scheduleTimeout(IceInternal::SocketOperation status, int timeout) { if(timeout < 0) { return; } try { if(status & IceInternal::SocketOperationRead) { _timer->schedule(_readTimeout, IceUtil::Time::milliSeconds(timeout)); _readTimeoutScheduled = true; } if(status & (IceInternal::SocketOperationWrite | IceInternal::SocketOperationConnect)) { _timer->schedule(_writeTimeout, IceUtil::Time::milliSeconds(timeout)); _writeTimeoutScheduled = true; } } catch(const IceUtil::Exception&) { assert(false); } } void unscheduleTimeout(IceInternal::SocketOperation status) { if((status & IceInternal::SocketOperationRead) && _readTimeoutScheduled) { _timer->cancel(_readTimeout); _readTimeoutScheduled = false; } if((status & (IceInternal::SocketOperationWrite | IceInternal::SocketOperationConnect)) && _writeTimeoutScheduled) { _timer->cancel(_writeTimeout); _writeTimeoutScheduled = false; } } int connectTimeout(); int closeTimeout(); Ice::ConnectionInfoPtr initConnectionInfo() const; Ice::Instrumentation::ConnectionState toConnectionState(State) const; AsyncResultPtr __begin_flushBatchRequests(const IceInternal::CallbackBasePtr&, const LocalObjectPtr&); Ice::CommunicatorPtr _communicator; const IceInternal::InstancePtr _instance; const IceInternal::ConnectionReaperPtr _reaper; const IceInternal::TransceiverPtr _transceiver; const std::string _desc; const std::string _type; const IceInternal::ConnectorPtr _connector; const IceInternal::EndpointIPtr _endpoint; mutable Ice::ConnectionInfoPtr _info; ObjectAdapterPtr _adapter; IceInternal::ServantManagerPtr _servantManager; const DispatcherPtr _dispatcher; const LoggerPtr _logger; const IceInternal::TraceLevelsPtr _traceLevels; const IceInternal::ThreadPoolPtr _threadPool; const IceUtil::TimerPtr _timer; const IceUtil::TimerTaskPtr _writeTimeout; bool _writeTimeoutScheduled; const IceUtil::TimerTaskPtr _readTimeout; bool _readTimeoutScheduled; StartCallbackPtr _startCallback; const bool _warn; const bool _warnUdp; const int _acmTimeout; IceUtil::Time _acmAbsoluteTimeout; const int _compressionLevel; Int _nextRequestId; std::map _requests; std::map::iterator _requestsHint; std::map _asyncRequests; std::map::iterator _asyncRequestsHint; IceUtil::UniquePtr _exception; const bool _batchAutoFlush; IceInternal::BasicStream _batchStream; bool _batchStreamInUse; int _batchRequestNum; bool _batchRequestCompress; size_t _batchMarker; std::deque _sendStreams; IceInternal::BasicStream _readStream; bool _readHeader; IceInternal::BasicStream _writeStream; Observer _observer; int _dispatchCount; State _state; // The current state. bool _shutdownInitiated; bool _validated; }; } #endif Ice-3.5.1/cpp/src/Ice/ConnectRequestHandler.h0000644000076400007640000000505012223561476017054 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECT_REQUEST_HANDLER_H #define ICE_CONNECT_REQUEST_HANDLER_H #include #include #include #include #include #include #include #include #include namespace IceInternal { class ConnectRequestHandler : public RequestHandler, public Reference::GetConnectionCallback, public RouterInfo::AddProxyCallback, public IceUtil::Monitor { public: ConnectRequestHandler(const ReferencePtr&, const Ice::ObjectPrx&, const Handle< ::IceDelegate::Ice::Object>&); virtual ~ConnectRequestHandler(); RequestHandlerPtr connect(); virtual void prepareBatchRequest(BasicStream*); virtual void finishBatchRequest(BasicStream*); virtual void abortBatchRequest(); virtual Ice::ConnectionI* sendRequest(Outgoing*); virtual AsyncStatus sendAsyncRequest(const OutgoingAsyncPtr&); virtual bool flushBatchRequests(BatchOutgoing*); virtual AsyncStatus flushAsyncBatchRequests(const BatchOutgoingAsyncPtr&); virtual Ice::ConnectionIPtr getConnection(bool); virtual void setConnection(const Ice::ConnectionIPtr&, bool); virtual void setException(const Ice::LocalException&); virtual void addedProxy(); void flushRequestsWithException(const Ice::LocalException&); void flushRequestsWithException(const LocalExceptionWrapper&); private: bool initialized(); void flushRequests(); struct Request { OutgoingAsyncPtr out; BatchOutgoingAsyncPtr batchOut; BasicStream* os; }; Ice::ObjectPrx _proxy; Handle< ::IceDelegate::Ice::Object> _delegate; const bool _batchAutoFlush; Ice::ConnectionIPtr _connection; bool _compress; IceUtil::UniquePtr _exception; bool _initialized; bool _flushing; std::deque _requests; bool _batchRequestInProgress; size_t _batchRequestsSize; BasicStream _batchStream; bool _updateRequestHandler; }; typedef IceUtil::Handle ConnectRequestHandlerPtr; } #endif Ice-3.5.1/cpp/src/Ice/GC.cpp0000644000076400007640000002501212223561476013440 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace IceUtil; using namespace Ice::Instrumentation; namespace { Mutex* numCollectorsMutex = 0; int numCollectors = 0; typedef std::set GCObjectSet; GCObjectSet* gcObjects = 0; // Set of pointers to all existing classes with class data members. RecMutex* gcRecMutex = 0; class Init { public: Init() { numCollectorsMutex = new IceUtil::Mutex; gcObjects = new GCObjectSet(); gcRecMutex = new RecMutex(); } ~Init() { delete numCollectorsMutex; numCollectorsMutex = 0; delete gcRecMutex; gcRecMutex = 0; delete gcObjects; gcObjects = 0; } }; Init init; } namespace IceInternal { void recursivelyReachable(GCShared* p, GCObjectSet& o) { if(o.find(p) == o.end()) { assert(p); o.insert(p); GCCountMap tmp; p->__gcReachable(tmp); for(GCCountMap::const_iterator i = tmp.begin(); i != tmp.end(); ++i) { recursivelyReachable(i->first, o); } } } } using namespace IceInternal; // // GCShared // void IceInternal::GCShared::__incRef() { IceUtilInternal::MutexPtrLock lock(gcRecMutex); assert(_ref >= 0); if(_ref == 0 && gcObjects != 0) { #ifdef NDEBUG // To avoid annoying warnings about variables that are not used... gcObjects->insert(this); #else std::pair rc = gcObjects->insert(this); assert(rc.second); #endif } ++_ref; } void IceInternal::GCShared::__decRef() { IceUtilInternal::MutexPtrLock lock(gcRecMutex); bool doDelete = false; assert(_ref > 0); if(--_ref == 0 && gcObjects != 0) { doDelete = !_noDelete; _noDelete = true; #ifdef NDEBUG // To avoid annoying warnings about variables that are not used... gcObjects->erase(this); #else GCObjectSet::size_type num = gcObjects->erase(this); assert(num == 1); #endif } lock.release(); if(doDelete) { delete this; } } int IceInternal::GCShared::__getRef() const { IceUtilInternal::MutexPtrLock lock(gcRecMutex); return _ref; } void IceInternal::GCShared::__setNoDelete(bool b) { IceUtilInternal::MutexPtrLock lock(gcRecMutex); _noDelete = b; } // // GC // IceInternal::GC::GC(int interval, StatsCallback cb) : Thread("Ice.GC") { IceUtilInternal::MutexPtrLock sync(numCollectorsMutex); if(numCollectors++ > 0) { abort(); // Enforce singleton. } _state = NotStarted; _collecting = false; _interval = interval; _statsCallback = cb; } IceInternal::GC::~GC() { IceUtilInternal::MutexPtrLock sync(numCollectorsMutex); --numCollectors; } void IceInternal::GC::run() { assert(_interval > 0); { Monitor::Lock sync(*this); _state = Started; notify(); } Time waitTime = Time::seconds(_interval); while(true) { bool collect = false; ThreadObserverPtr observer; { Monitor::Lock sync(*this); if(_state == Stopping) { _state = Stopped; return; } if(!timedWait(waitTime)) { collect = true; } observer = _observer.get(); } if(collect) { if(observer) { observer->stateChanged(ThreadStateIdle, ThreadStateInUseForOther); collectGarbage(); observer->stateChanged(ThreadStateInUseForOther, ThreadStateIdle); } else { collectGarbage(); } } } _observer.detach(); } void IceInternal::GC::stop() { { Monitor::Lock sync(*this); if(_state >= Stopping) { return; // Don't attempt to stop the thread twice. } // // Wait until the thread is actually started. (If we don't do this, we // can get a problem if a call to stop() immediately follows a call to start(): // the call to stop() may happen before pthread_create() has scheduled the thread's run() // function, and then the notify() that is used to tell the thread to stop can be lost. // while(_state < Started) { wait(); } } // // Tell the thread to stop. // { Monitor::Lock sync(*this); _state = Stopping; notify(); } getThreadControl().join(); assert(_state == Stopped); } void IceInternal::GC::collectGarbage() { // // Do nothing if the collector is running already. // { Monitor::Lock sync(*this); if(_collecting) { return; } _collecting = true; assert(gcObjects != 0); } // Prevent any further class reference count activity. IceUtilInternal::MutexPtrLock lock(gcRecMutex); Time t; GCStats stats; if(_statsCallback) { t = Time::now(IceUtil::Time::Monotonic); stats.examined = static_cast(gcObjects->size()); } GCCountMap counts; { // // gcObjects contains the set of class instances that have at least one member of class type, // that is, gcObjects contains all those instances that can point at other instances. // // Create a map that, for each object in gcObjects, contains an pair. // In addition, for each object in gcObjects, add the objects that are immediately (not // recursively) reachable from that object to a reachable map that counts how many times // the object is pointed at. // GCCountMap reachable; { for(GCObjectSet::const_iterator i = gcObjects->begin(); i != gcObjects->end(); ++i) { counts.insert(GCCountMap::value_type(*i, (*i)->__getRefUnsafe())); (*i)->__gcReachable(reachable); } } // // Decrement the reference count for each object in the counts map by the count in the reachable // map. This drops the reference count of each object in the counts map by the number of times that // the object is pointed at by other objects in the counts map. // { for(GCCountMap::const_iterator i = reachable.begin(); i != reachable.end(); ++i) { GCCountMap::iterator pos = counts.find(i->first); assert(pos != counts.end()); pos->second -= i->second; } } } { // // Any instances in the counts map with a ref count > 0 are referenced from outside the objects in // gcObjects (and are therefore reachable from the program, for example, via Ptr variable on the stack). // The set of live objects therefore are all the objects with a reference count > 0, as well as all // objects that are (recursively) reachable from these objects. // GCObjectSet liveObjects; { for(GCCountMap::const_iterator i = counts.begin(); i != counts.end(); ++i) { if(i->second > 0) { recursivelyReachable(i->first, liveObjects); } } } // // Remove all live objects from the counts map. // { for(GCObjectSet::const_iterator i = liveObjects.begin(); i != liveObjects.end(); ++i) { #ifndef NDEBUG size_t erased = #endif counts.erase(*i); assert(erased != 0); } } } // // What is left in the counts map can be garbage collected. // for(GCCountMap::const_iterator i = counts.begin(); i != counts.end(); ++i) { // // For classes with members that point at potentially-cyclic instances, __gcClear() // decrements the reference count of the pointed-at instances as many times as they are // pointed at and clears the corresponding Ptr members in the pointing class. // For classes that cannot be part of a cycle (because they do not contain class members) // and are therefore true leaves, __gcClear() assigns 0 to the corresponding class member, // which either decrements the ref count or, if it reaches zero, deletes the instance as usual. // i->first->__gcClear(); } for(GCCountMap::const_iterator i = counts.begin(); i != counts.end(); ++i) { gcObjects->erase(i->first); // Remove this object from candidate set. delete i->first; // Delete this object. } if(_statsCallback) { stats.time = Time::now(IceUtil::Time::Monotonic) - t; stats.collected = static_cast(counts.size()); _statsCallback(stats); } // // We clear explicitly under protection of the lock, instead of waiting for the // counts destructor. This avoids lots of lock contention later because, otherwise, // the destructor of each object in the counts set would acquire and release // gcRecMutex._m. // counts.clear(); { Monitor::Lock sync(*this); _collecting = false; } } void IceInternal::GC::updateObserver(const CommunicatorObserverPtr& observer) { Monitor::Lock sync(*this); if(!observer) { return; } // Only the first communicator can observe the GC thread. if(!_communicatorObserver) { _communicatorObserver = observer; } if(observer == _communicatorObserver) { _observer.attach(observer->getThreadObserver("Communicator", name(), ThreadStateIdle, _observer.get())); } } void IceInternal::GC::clearObserver(const CommunicatorObserverPtr& observer) { Monitor::Lock sync(*this); assert(observer); if(observer == _communicatorObserver) { _communicatorObserver = 0; _observer.detach(); } } Ice-3.5.1/cpp/src/Ice/ConnectionRequestHandler.h0000644000076400007640000000241412223561476017563 0ustar mesmes// ********************************************************************** // // 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 ICE_CONNECTION_REQUEST_HANDLER_H #define ICE_CONNECTION_REQUEST_HANDLER_H #include #include #include namespace IceInternal { class ConnectionRequestHandler : public RequestHandler { public: ConnectionRequestHandler(const ReferencePtr&, const Ice::ObjectPrx&); ConnectionRequestHandler(const ReferencePtr&, const Ice::ConnectionIPtr&, bool); virtual void prepareBatchRequest(BasicStream*); virtual void finishBatchRequest(BasicStream*); virtual void abortBatchRequest(); virtual Ice::ConnectionI* sendRequest(Outgoing*); virtual AsyncStatus sendAsyncRequest(const OutgoingAsyncPtr&); virtual bool flushBatchRequests(BatchOutgoing*); virtual AsyncStatus flushAsyncBatchRequests(const BatchOutgoingAsyncPtr&); virtual Ice::ConnectionIPtr getConnection(bool); private: Ice::ConnectionIPtr _connection; bool _compress; }; } #endif Ice-3.5.1/cpp/src/Ice/ReplyStatus.h0000644000076400007640000000151512223561476015115 0ustar mesmes// ********************************************************************** // // 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 ICE_REPLY_STATUS_H #define ICE_REPLY_STATUS_H #include namespace IceInternal { static const Ice::Byte replyOK = 0; static const Ice::Byte replyUserException = 1; static const Ice::Byte replyObjectNotExist = 2; static const Ice::Byte replyFacetNotExist = 3; static const Ice::Byte replyOperationNotExist = 4; static const Ice::Byte replyUnknownLocalException = 5; static const Ice::Byte replyUnknownUserException = 6; static const Ice::Byte replyUnknownException = 7; } #endif Ice-3.5.1/cpp/src/Ice/Selector.h0000644000076400007640000001114712223561476014400 0ustar mesmes// ********************************************************************** // // 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 ICE_SELECTOR_H #define ICE_SELECTOR_H #include #include #include #include #include #include #if defined(ICE_USE_EPOLL) # include #elif defined(ICE_USE_KQUEUE) # include #elif defined(ICE_USE_IOCP) // Nothing to include #elif defined(ICE_USE_POLL) # include #endif #if defined(ICE_OS_WINRT) # include #endif namespace IceInternal { // // Exception raised if select times out. // class SelectorTimeoutException { }; #if defined(ICE_OS_WINRT) struct SelectEvent { SelectEvent(IceInternal::EventHandler* handler, SocketOperation status) : handler(handler), status(status) { } IceInternal::EventHandler* handler; SocketOperation status; }; class Selector : IceUtil::Monitor { public: Selector(const InstancePtr&); void destroy(); void initialize(IceInternal::EventHandler*); void update(IceInternal::EventHandler*, SocketOperation, SocketOperation); void finish(IceInternal::EventHandler*); IceInternal::EventHandler* getNextHandler(SocketOperation&, int); void completed(IceInternal::EventHandler*, SocketOperation); private: const InstancePtr _instance; std::deque _events; }; #elif defined(ICE_USE_IOCP) class Selector { public: Selector(const InstancePtr&); ~Selector(); void setup(int); void destroy(); void initialize(EventHandler*); void update(EventHandler*, SocketOperation, SocketOperation); void finish(EventHandler*); EventHandler* getNextHandler(SocketOperation&, int); HANDLE getIOCPHandle() { return _handle; } private: const InstancePtr _instance; HANDLE _handle; }; #elif defined(ICE_USE_KQUEUE) || defined(ICE_USE_EPOLL) class Selector { public: Selector(const InstancePtr&); ~Selector(); void destroy(); void initialize(EventHandler*) { // Nothing to do } void update(EventHandler*, SocketOperation, SocketOperation); void enable(EventHandler*, SocketOperation); void disable(EventHandler*, SocketOperation); void finish(EventHandler*); #if defined(ICE_USE_KQUEUE) void updateSelector(); #endif void startSelect() { #ifdef ICE_USE_KQUEUE _selecting = true; if(!_changes.empty()) { updateSelector(); } #endif } void finishSelect() { #ifdef ICE_USE_KQUEUE _selecting = false; #endif } void select(std::vector >&, int); private: const InstancePtr _instance; #if defined(ICE_USE_EPOLL) std::vector _events; #else std::vector _events; std::vector _changes; bool _selecting; #endif int _queueFd; }; #elif defined(ICE_USE_SELECT) || defined(ICE_USE_POLL) class Selector { public: Selector(const InstancePtr&); ~Selector(); void destroy(); void initialize(EventHandler*) { // Nothing to do } void update(EventHandler*, SocketOperation, SocketOperation); void enable(EventHandler*, SocketOperation); void disable(EventHandler*, SocketOperation); void finish(EventHandler*); void startSelect(); void finishSelect(); void select(std::vector >&, int); private: void updateSelector(); void updateImpl(EventHandler*); const InstancePtr _instance; SOCKET _fdIntrRead; SOCKET _fdIntrWrite; bool _selecting; bool _interrupted; std::vector > _changes; std::map _handlers; #if defined(ICE_USE_SELECT) fd_set _readFdSet; fd_set _writeFdSet; fd_set _errorFdSet; fd_set _selectedReadFdSet; fd_set _selectedWriteFdSet; fd_set _selectedErrorFdSet; fd_set* fdSetCopy(fd_set& dest, fd_set& src) { if(src.fd_count > 0) { dest.fd_count = src.fd_count; memcpy(dest.fd_array, src.fd_array, sizeof(SOCKET) * src.fd_count); return &dest; } return 0; } #else std::vector _pollFdSet; #endif }; #endif } #endif Ice-3.5.1/cpp/src/Ice/Incoming.cpp0000644000076400007640000004741412223561476014724 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace Ice::Instrumentation; using namespace IceInternal; namespace IceUtilInternal { extern bool ICE_DECLSPEC_IMPORT printStackTraces; } IceInternal::IncomingBase::IncomingBase(Instance* instance, ConnectionI* connection, const ObjectAdapterPtr& adapter, bool response, Byte compress, Int requestId) : _response(response), _compress(compress), _os(instance, Ice::currentProtocolEncoding), _connection(connection) { _current.adapter = adapter; _current.con = _connection; _current.requestId = requestId; } IceInternal::IncomingBase::IncomingBase(IncomingBase& in) : _current(in._current), // copy _os(in._os.instance(), Ice::currentProtocolEncoding), _interceptorAsyncCallbackQueue(in._interceptorAsyncCallbackQueue) // copy { __adopt(in); // adopt everything else } void IceInternal::IncomingBase::__adopt(IncomingBase& other) { _observer.adopt(other._observer); _servant = other._servant; other._servant = 0; _locator = other._locator; other._locator = 0; _cookie = other._cookie; other._cookie = 0; _response = other._response; other._response = false; _compress = other._compress; other._compress = 0; _os.swap(other._os); _connection = other._connection; other._connection = 0; } BasicStream* IncomingBase::__startWriteParams(FormatType format) { if(_response) { assert(_os.b.size() == headerSize + 4); // Reply status position. assert(_current.encoding >= Ice::Encoding_1_0); // Encoding for reply is known. _os.write(static_cast(0)); _os.startWriteEncaps(_current.encoding, format); } // // We still return the stream even if no response is expected. The // servant code might still write some out parameters if for // example a method with out parameters somehow and erroneously // invoked as oneway (or if the invocation is invoked on a // blobject and the blobject erroneously writes a response). // return &_os; } void IncomingBase::__endWriteParams(bool ok) { if(!ok) { _observer.userException(); } if(_response) { *(_os.b.begin() + headerSize + 4) = ok ? replyOK : replyUserException; // Reply status position. _os.endWriteEncaps(); } } void IncomingBase::__writeEmptyParams() { if(_response) { assert(_os.b.size() == headerSize + 4); // Reply status position. assert(_current.encoding >= Ice::Encoding_1_0); // Encoding for reply is known. _os.write(replyOK); _os.writeEmptyEncaps(_current.encoding); } } void IncomingBase::__writeParamEncaps(const Byte* v, Ice::Int sz, bool ok) { if(!ok) { _observer.userException(); } if(_response) { assert(_os.b.size() == headerSize + 4); // Reply status position. assert(_current.encoding >= Ice::Encoding_1_0); // Encoding for reply is known. _os.write(ok ? replyOK : replyUserException); if(sz == 0) { _os.writeEmptyEncaps(_current.encoding); } else { _os.writeEncaps(v, sz); } } } void IncomingBase::__writeUserException(const Ice::UserException& ex, Ice::FormatType format) { ::IceInternal::BasicStream* __os = __startWriteParams(format); __os->write(ex); __endWriteParams(false); } void IceInternal::IncomingBase::__warning(const Exception& ex) const { Warning out(_os.instance()->initializationData().logger); out << "dispatch exception: " << ex; out << "\nidentity: " << _os.instance()->identityToString(_current.id); out << "\nfacet: " << IceUtilInternal::escapeString(_current.facet, ""); out << "\noperation: " << _current.operation; if(_connection) { Ice::ConnectionInfoPtr connInfo = _connection->getInfo(); Ice::IPConnectionInfoPtr ipConnInfo = Ice::IPConnectionInfoPtr::dynamicCast(connInfo); if(ipConnInfo) { out << "\nremote host: " << ipConnInfo->remoteAddress << " remote port: " << ipConnInfo->remotePort; } } } void IceInternal::IncomingBase::__warning(const string& msg) const { Warning out(_os.instance()->initializationData().logger); out << "dispatch exception: " << msg; out << "\nidentity: " << _os.instance()->identityToString(_current.id); out << "\nfacet: " << IceUtilInternal::escapeString(_current.facet, ""); out << "\noperation: " << _current.operation; if(_connection) { Ice::ConnectionInfoPtr connInfo = _connection->getInfo(); Ice::IPConnectionInfoPtr ipConnInfo = Ice::IPConnectionInfoPtr::dynamicCast(connInfo); if(ipConnInfo) { out << "\nremote host: " << ipConnInfo->remoteAddress << " remote port: " << ipConnInfo->remotePort; } } } bool IceInternal::IncomingBase::__servantLocatorFinished() { assert(_locator && _servant); try { _locator->finished(_current, _servant, _cookie); return true; } catch(const UserException& ex) { assert(_connection); _observer.userException(); // // The operation may have already marshaled a reply; we must overwrite that reply. // if(_response) { _os.b.resize(headerSize + 4); // Reply status position. _os.write(replyUserException); _os.startWriteEncaps(_current.encoding, DefaultFormat); _os.write(ex); _os.endWriteEncaps(); _observer.reply(static_cast(_os.b.size() - headerSize - 4)); _connection->sendResponse(&_os, _compress); } else { _connection->sendNoResponse(); } _observer.detach(); _connection = 0; } catch(const std::exception& ex) { __handleException(ex); } catch(...) { __handleException(); } return false; } void IceInternal::IncomingBase::__handleException(const std::exception& exc) { assert(_connection); if(dynamic_cast(&exc)) { RequestFailedException* rfe = const_cast(dynamic_cast(&exc)); if(rfe->id.name.empty()) { rfe->id = _current.id; } if(rfe->facet.empty() && !_current.facet.empty()) { rfe->facet = _current.facet; } if(rfe->operation.empty() && !_current.operation.empty()) { rfe->operation = _current.operation; } if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) { __warning(*rfe); } if(_observer) { _observer.failed(rfe->ice_name()); } if(_response) { _os.b.resize(headerSize + 4); // Reply status position. if(dynamic_cast(rfe)) { _os.write(replyObjectNotExist); } else if(dynamic_cast(rfe)) { _os.write(replyFacetNotExist); } else if(dynamic_cast(rfe)) { _os.write(replyOperationNotExist); } else { assert(false); } _os.write(rfe->id); // // For compatibility with the old FacetPath. // if(rfe->facet.empty()) { _os.write(static_cast(0), static_cast(0)); } else { _os.write(&rfe->facet, &rfe->facet + 1); } _os.write(rfe->operation, false); _observer.reply(static_cast(_os.b.size() - headerSize - 4)); _connection->sendResponse(&_os, _compress); } else { _connection->sendNoResponse(); } } else if(const Exception* ex = dynamic_cast(&exc)) { if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) { __warning(*ex); } if(_observer) { _observer.failed(ex->ice_name()); } if(_response) { _os.b.resize(headerSize + 4); // Reply status position. if(const UnknownLocalException* ule = dynamic_cast(&exc)) { _os.write(replyUnknownLocalException); _os.write(ule->unknown, false); } else if(const UnknownUserException* uue = dynamic_cast(&exc)) { _os.write(replyUnknownUserException); _os.write(uue->unknown, false); } else if(const UnknownException* ue = dynamic_cast(&exc)) { _os.write(replyUnknownException); _os.write(ue->unknown, false); } else if(const LocalException* le = dynamic_cast(&exc)) { _os.write(replyUnknownLocalException); ostringstream str; str << *le; if(IceUtilInternal::printStackTraces) { str << '\n' << ex->ice_stackTrace(); } _os.write(str.str(), false); } else if(const UserException* ue = dynamic_cast(&exc)) { _os.write(replyUnknownUserException); ostringstream str; str << *ue; if(IceUtilInternal::printStackTraces) { str << '\n' << ex->ice_stackTrace(); } _os.write(str.str(), false); } else { _os.write(replyUnknownException); ostringstream str; str << *ex; if(IceUtilInternal::printStackTraces) { str << '\n' << ex->ice_stackTrace(); } _os.write(str.str(), false); } _observer.reply(static_cast(_os.b.size() - headerSize - 4)); _connection->sendResponse(&_os, _compress); } else { _connection->sendNoResponse(); } } else { if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) { __warning(string("std::exception: ") + exc.what()); } if(_observer) { _observer.failed(typeid(exc).name()); } if(_response) { _os.b.resize(headerSize + 4); // Reply status position. _os.write(replyUnknownException); ostringstream str; str << "std::exception: " << exc.what(); _os.write(str.str(), false); _observer.reply(static_cast(_os.b.size() - headerSize - 4)); _connection->sendResponse(&_os, _compress); } else { _connection->sendNoResponse(); } } _observer.detach(); _connection = 0; } void IceInternal::IncomingBase::__handleException() { if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) { __warning("unknown c++ exception"); } assert(_connection); if(_observer) { _observer.failed("unknown"); } if(_response) { _os.b.resize(headerSize + 4); // Reply status position. _os.write(replyUnknownException); string reason = "unknown c++ exception"; _os.write(reason, false); _observer.reply(static_cast(_os.b.size() - headerSize - 4)); _connection->sendResponse(&_os, _compress); } else { _connection->sendNoResponse(); } _observer.detach(); _connection = 0; } IceInternal::Incoming::Incoming(Instance* instance, ConnectionI* connection, const ObjectAdapterPtr& adapter, bool response, Byte compress, Int requestId) : IncomingBase(instance, connection, adapter, response, compress, requestId), _inParamPos(0) { // // Prepare the response if necessary. // if(response) { _os.writeBlob(replyHdr, sizeof(replyHdr)); // // Add the request ID. // _os.write(requestId); } } void IceInternal::Incoming::push(const Ice::DispatchInterceptorAsyncCallbackPtr& cb) { _interceptorAsyncCallbackQueue.push_front(cb); } void IceInternal::Incoming::pop() { _interceptorAsyncCallbackQueue.pop_front(); } void IceInternal::Incoming::startOver() { if(_inParamPos == 0) { // // That's the first startOver, so almost nothing to do // _inParamPos = _is->i; } else { killAsync(); // // Let's rewind _is and clean-up _os // _is->i = _inParamPos; _os.b.resize(headerSize + 4); // Reply status position. } } void IceInternal::Incoming::killAsync() { // // Always runs in the dispatch thread // if(_cb != 0) { // // May raise ResponseSentException // _cb->__deactivate(*this); _cb = 0; } } void IceInternal::Incoming::setActive(IncomingAsync& cb) { assert(_cb == 0); _cb = &cb; // acquires a ref-count } void IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager, BasicStream* stream) { _is = stream; BasicStream::Container::iterator start = _is->i; // // Read the current. // _is->read(_current.id); // // For compatibility with the old FacetPath. // string facet; { vector facetPath; _is->read(facetPath); if(!facetPath.empty()) { if(facetPath.size() > 1) { throw MarshalException(__FILE__, __LINE__); } facet.swap(facetPath[0]); } } _current.facet.swap(facet); _is->read(_current.operation, false); Byte b; _is->read(b); _current.mode = static_cast(b); Int sz = _is->readSize(); while(sz--) { pair pr; _is->read(const_cast(pr.first)); _is->read(pr.second); _current.ctx.insert(_current.ctx.end(), pr); } const CommunicatorObserverPtr& obsv = _is->instance()->getObserver(); if(obsv) { // Read the parameter encapsulation size. Ice::Int sz; _is->read(sz); _is->i -= 4; _observer.attach(obsv->getDispatchObserver(_current, static_cast(_is->i - start + sz))); } // // Don't put the code above into the try block below. Exceptions // in the code above are considered fatal, and must propagate to // the caller of this operation. // if(servantManager) { _servant = servantManager->findServant(_current.id, _current.facet); if(!_servant) { _locator = servantManager->findServantLocator(_current.id.category); if(!_locator && !_current.id.category.empty()) { _locator = servantManager->findServantLocator(""); } if(_locator) { try { _servant = _locator->locate(_current, _cookie); } catch(const UserException& ex) { Ice::EncodingVersion encoding = _is->skipEncaps(); // Required for batch requests. _observer.userException(); if(_response) { _os.write(replyUserException); _os.startWriteEncaps(encoding, DefaultFormat); _os.write(ex); _os.endWriteEncaps(); _observer.reply(static_cast(_os.b.size() - headerSize - 4)); _connection->sendResponse(&_os, _compress); } else { _connection->sendNoResponse(); } _observer.detach(); _connection = 0; return; } catch(const std::exception& ex) { _is->skipEncaps(); // Required for batch requests. __handleException(ex); return; } catch(...) { _is->skipEncaps(); // Required for batch requests. __handleException(); return; } } } } try { if(_servant) { // // DispatchAsync is a "pseudo dispatch status", used internally only // to indicate async dispatch. // if(_servant->__dispatch(*this, _current) == DispatchAsync) { return; } if(_locator && !__servantLocatorFinished()) { return; } } else { // // Skip the input parameters, this is required for reading // the next batch request if dispatching batch requests. // _is->skipEncaps(); if(servantManager && servantManager->hasServant(_current.id)) { throw FacetNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation); } else { throw ObjectNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation); } } } catch(const std::exception& ex) { if(_servant && _locator && !__servantLocatorFinished()) { return; } __handleException(ex); return; } catch(...) { if(_servant && _locator && !__servantLocatorFinished()) { return; } __handleException(); return; } // // Don't put the code below into the try block above. Exceptions // in the code below are considered fatal, and must propagate to // the caller of this operation. // if(_response) { _observer.reply(static_cast(_os.b.size() - headerSize - 4)); _connection->sendResponse(&_os, _compress); } else { _connection->sendNoResponse(); } _observer.detach(); _connection = 0; } bool IceInternal::IncomingRequest::isCollocated() { return false; } const Current& IceInternal::IncomingRequest::getCurrent() { return _in.getCurrent(); } Ice-3.5.1/cpp/src/Ice/Reference.cpp0000644000076400007640000015253612223561476015061 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(IceInternal::Reference* p) { return p; } namespace { IceUtil::Mutex* hashMutex = 0; class Init { public: Init() { hashMutex = new IceUtil::Mutex; } ~Init() { delete hashMutex; hashMutex = 0; } }; Init init; struct RandomNumberGenerator : public std::unary_function { ptrdiff_t operator()(ptrdiff_t d) { return IceUtilInternal::random(static_cast(d)); } }; } CommunicatorPtr IceInternal::Reference::getCommunicator() const { return _communicator; } ReferencePtr IceInternal::Reference::changeContext(const Context& newContext) const { ReferencePtr r = _instance->referenceFactory()->copy(this); r->_context = new SharedContext(newContext); return r; } ReferencePtr IceInternal::Reference::changeMode(Mode newMode) const { if(newMode == _mode) { return ReferencePtr(const_cast(this)); } ReferencePtr r = _instance->referenceFactory()->copy(this); r->_mode = newMode; return r; } ReferencePtr IceInternal::Reference::changeSecure(bool newSecure) const { if(newSecure == _secure) { return ReferencePtr(const_cast(this)); } ReferencePtr r = _instance->referenceFactory()->copy(this); r->_secure = newSecure; return r; } ReferencePtr IceInternal::Reference::changeIdentity(const Identity& newIdentity) const { if(newIdentity == _identity) { return ReferencePtr(const_cast(this)); } ReferencePtr r = _instance->referenceFactory()->copy(this); r->_identity = newIdentity; return r; } ReferencePtr IceInternal::Reference::changeFacet(const string& newFacet) const { if(newFacet == _facet) { return ReferencePtr(const_cast(this)); } ReferencePtr r = _instance->referenceFactory()->copy(this); r->_facet = newFacet; return r; } ReferencePtr IceInternal::Reference::changeEncoding(const Ice::EncodingVersion& encoding) const { if(_encoding == encoding) { return ReferencePtr(const_cast(this)); } ReferencePtr r = _instance->referenceFactory()->copy(this); r->_encoding = encoding; return r; } ReferencePtr IceInternal::Reference::changeCompress(bool newCompress) const { if(_overrideCompress && newCompress == _compress) { return ReferencePtr(const_cast(this)); } ReferencePtr r = _instance->referenceFactory()->copy(this); r->_compress = newCompress; r->_overrideCompress = true; return r; } Int Reference::hash() const { IceUtilInternal::MutexPtrLock lock(hashMutex); if(!_hashInitialized) { _hashValue = hashInit(); _hashInitialized = true; } return _hashValue; } void IceInternal::Reference::streamWrite(BasicStream* s) const { // // Don't write the identity here. Operations calling streamWrite // write the identity. // // // For compatibility with the old FacetPath. // if(_facet.empty()) { s->write(static_cast(0), static_cast(0)); } else { s->write(&_facet, &_facet + 1); } s->write(static_cast(_mode)); s->write(_secure); if(s->getWriteEncoding() != Ice::Encoding_1_0) { s->write(_protocol); s->write(_encoding); } // Derived class writes the remainder of the reference. } string IceInternal::Reference::toString() 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 the encoded identity string contains characters which // the reference parser uses as separators, then we enclose // the identity string in quotes. // string id = _instance->identityToString(_identity); if(id.find_first_of(" :@") != string::npos) { s << '"' << id << '"'; } else { s << id; } if(!_facet.empty()) { s << " -f "; // // If the encoded facet string contains characters which // the reference parser uses as separators, then we enclose // the facet string in quotes. // string fs = Ice::nativeToUTF8(_instance->initializationData().stringConverter, _facet); fs = IceUtilInternal::escapeString(fs, ""); if(fs.find_first_of(" :@") != string::npos) { s << '"' << fs << '"'; } else { s << fs; } } switch(_mode) { case ModeTwoway: { s << " -t"; break; } case ModeOneway: { s << " -o"; break; } case ModeBatchOneway: { s << " -O"; break; } case ModeDatagram: { s << " -d"; break; } case ModeBatchDatagram: { s << " -D"; break; } } if(_secure) { s << " -s"; } if(_protocol != Ice::Protocol_1_0) { // // We only print the protocol if it's not 1.0. It's fine as // long as we don't add Ice.Default.ProtocolVersion, a // stringified proxy will convert back to the same proxy with // stringToProxy. // s << " -p " << _protocol; } // // Always print the encoding version to ensure a stringified proxy // will convert back to a proxy with the same encoding with // stringToProxy (and won't use Ice.Default.EncodingVersion). // s << " -e " << _encoding; return s.str(); // Derived class writes the remainder of the string. } bool IceInternal::Reference::operator==(const Reference& r) const { // // Note: if(this == &r) test is performed by each non-abstract derived class. // if(_mode != r._mode) { return false; } if(_secure != r._secure) { return false; } if(_identity != r._identity) { return false; } if(_context->getValue() != r._context->getValue()) { return false; } if(_facet != r._facet) { return false; } if((_overrideCompress != r._overrideCompress) || (_overrideCompress && _compress != r._compress)) { return false; } if(_protocol != r._protocol) { return false; } if(_encoding != r._encoding) { return false; } return true; } bool IceInternal::Reference::operator!=(const Reference& r) const { return !operator==(r); } bool IceInternal::Reference::operator<(const Reference& r) const { // // Note: if(this == &r) test is performed by each non-abstract derived class. // if(_mode < r._mode) { return true; } else if(r._mode < _mode) { return false; } if(_identity < r._identity) { return true; } else if(r._identity < _identity) { return false; } if(_context->getValue() < r._context->getValue()) { return true; } else if(r._context->getValue() < _context->getValue()) { return false; } if(_facet < r._facet) { return true; } else if(r._facet < _facet) { return false; } if(!_overrideCompress && r._overrideCompress) { return true; } else if(r._overrideCompress < _overrideCompress) { return false; } else if(_overrideCompress) { if(!_compress && r._compress) { return true; } else if(r._compress < _compress) { return false; } } if(!_secure && r._secure) { return true; } else if(r._secure < _secure) { return false; } if(_protocol < r._protocol) { return true; } else if(r._protocol < _protocol) { return false; } if(_encoding < r._encoding) { return true; } else if(r._encoding < _encoding) { return false; } return false; } class ConnectionIsDatagram : public unary_function { public: bool operator()(ConnectionIPtr p) const { return p->endpoint()->datagram(); } }; class ConnectionIsSecure : public unary_function { public: bool operator()(ConnectionIPtr p) const { return p->endpoint()->secure(); } }; IceInternal::Reference::Reference(const InstancePtr& instance, const CommunicatorPtr& communicator, const Identity& id, const string& facet, Mode mode, bool secure, const ProtocolVersion& protocol, const EncodingVersion& encoding) : _hashInitialized(false), _instance(instance), _communicator(communicator), _mode(mode), _secure(secure), _identity(id), _context(new SharedContext), _facet(facet), _protocol(protocol), _encoding(encoding), _overrideCompress(false), _compress(false) { } IceInternal::Reference::Reference(const Reference& r) : _hashInitialized(false), _instance(r._instance), _communicator(r._communicator), _mode(r._mode), _secure(r._secure), _identity(r._identity), _context(r._context), _facet(r._facet), _protocol(r._protocol), _encoding(r._encoding), _overrideCompress(r._overrideCompress), _compress(r._compress) { } int IceInternal::Reference::hashInit() const { Int h = 5381; hashAdd(h, static_cast(_mode)); hashAdd(h, _secure); hashAdd(h, _identity.name); hashAdd(h, _identity.category); hashAdd(h, _context->getValue()); hashAdd(h, _facet); hashAdd(h, _overrideCompress); if(_overrideCompress) { hashAdd(h, _compress); } hashAdd(h, _protocol.major); hashAdd(h, _protocol.minor); hashAdd(h, _encoding.major); hashAdd(h, _encoding.minor); return h; } IceUtil::Shared* IceInternal::upCast(IceInternal::FixedReference* p) { return p; } IceInternal::FixedReference::FixedReference(const InstancePtr& instance, const CommunicatorPtr& communicator, const Identity& id, const string& facet, Mode mode, bool secure, const EncodingVersion& encoding, const ConnectionIPtr& fixedConnection) : Reference(instance, communicator, id, facet, mode, secure, Ice::Protocol_1_0, encoding), _fixedConnection(fixedConnection) { } vector IceInternal::FixedReference::getEndpoints() const { return vector(); } string IceInternal::FixedReference::getAdapterId() const { return string(); } bool IceInternal::FixedReference::getCollocationOptimized() const { return false; } bool IceInternal::FixedReference::getCacheConnection() const { return true; } bool IceInternal::FixedReference::getPreferSecure() const { return false; } Ice::EndpointSelectionType IceInternal::FixedReference::getEndpointSelection() const { return Random; } int IceInternal::FixedReference::getLocatorCacheTimeout() const { return 0; } string IceInternal::FixedReference::getConnectionId() const { return string(); } ReferencePtr IceInternal::FixedReference::changeEndpoints(const vector& /*newEndpoints*/) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } ReferencePtr IceInternal::FixedReference::changeAdapterId(const string& /*newAdapterId*/) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } ReferencePtr IceInternal::FixedReference::changeLocator(const LocatorPrx&) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } ReferencePtr IceInternal::FixedReference::changeRouter(const RouterPrx&) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } ReferencePtr IceInternal::FixedReference::changeCollocationOptimized(bool) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } ReferencePtr IceInternal::FixedReference::changeCacheConnection(bool) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } ReferencePtr IceInternal::FixedReference::changePreferSecure(bool) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } ReferencePtr IceInternal::FixedReference::changeEndpointSelection(EndpointSelectionType) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } ReferencePtr IceInternal::FixedReference::changeLocatorCacheTimeout(int) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } ReferencePtr IceInternal::FixedReference::changeTimeout(int) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } ReferencePtr IceInternal::FixedReference::changeConnectionId(const string&) const { throw FixedProxyException(__FILE__, __LINE__); return 0; // Keep the compiler happy. } bool IceInternal::FixedReference::isIndirect() const { return false; } bool IceInternal::FixedReference::isWellKnown() const { return false; } void IceInternal::FixedReference::streamWrite(BasicStream*) const { throw FixedProxyException(__FILE__, __LINE__); } string IceInternal::FixedReference::toString() const { throw FixedProxyException(__FILE__, __LINE__); assert(false); // Cannot be reached. return string(); // To keep the compiler from complaining. } PropertyDict IceInternal::FixedReference::toProperty(const string&) const { throw FixedProxyException(__FILE__, __LINE__); assert(false); // Cannot be reached. return PropertyDict(); // To keep the compiler from complaining. } ConnectionIPtr IceInternal::FixedReference::getConnection(bool& compress) const { switch(getMode()) { case Reference::ModeTwoway: case Reference::ModeOneway: case Reference::ModeBatchOneway: { if(_fixedConnection->endpoint()->datagram()) { throw NoEndpointException(__FILE__, __LINE__, ""); } break; } case Reference::ModeDatagram: case Reference::ModeBatchDatagram: { if(!_fixedConnection->endpoint()->datagram()) { throw NoEndpointException(__FILE__, __LINE__, ""); } break; } } // // If a secure connection is requested or secure overrides is set, // check if the connection is secure. // bool secure; DefaultsAndOverridesPtr defaultsAndOverrides = getInstance()->defaultsAndOverrides(); if(defaultsAndOverrides->overrideSecure) { secure = defaultsAndOverrides->overrideSecureValue; } else { secure = getSecure(); } if(secure && !_fixedConnection->endpoint()->secure()) { throw NoEndpointException(__FILE__, __LINE__, ""); } _fixedConnection->throwException(); // Throw in case our connection is already destroyed. if(defaultsAndOverrides->overrideCompress) { compress = defaultsAndOverrides->overrideCompressValue; } else if(_overrideCompress) { compress = _compress; } else { compress = _fixedConnection->endpoint()->compress(); } return _fixedConnection; } void IceInternal::FixedReference::getConnection(const GetConnectionCallbackPtr& callback) const { try { bool compress; ConnectionIPtr connection = getConnection(compress); callback->setConnection(connection, compress); } catch(const Ice::LocalException& ex) { callback->setException(ex); } } bool IceInternal::FixedReference::operator==(const Reference& r) const { if(this == &r) { return true; } const FixedReference* rhs = dynamic_cast(&r); if(!rhs || !Reference::operator==(r)) { return false; } return _fixedConnection == rhs->_fixedConnection; } bool IceInternal::FixedReference::operator!=(const Reference& r) const { return !operator==(r); } bool IceInternal::FixedReference::operator<(const Reference& r) const { if(this == &r) { return false; } if(Reference::operator<(r)) { return true; } if(!Reference::operator==(r)) { return false; } const FixedReference* rhs = dynamic_cast(&r); if(!rhs) { assert(dynamic_cast(&r)); return false; // As a rule, routable references are superior to fixed references. } return _fixedConnection < rhs->_fixedConnection; } ReferencePtr IceInternal::FixedReference::clone() const { return new FixedReference(*this); } IceInternal::FixedReference::FixedReference(const FixedReference& r) : Reference(r), _fixedConnection(r._fixedConnection) { } IceUtil::Shared* IceInternal::upCast(IceInternal::RoutableReference* p) { return p; } IceInternal::RoutableReference::RoutableReference(const InstancePtr& instance, const CommunicatorPtr& communicator, const Identity& id, const string& facet, Mode mode, bool secure, const ProtocolVersion& protocol, const EncodingVersion& encoding, const vector& endpoints, const string& adapterId, const LocatorInfoPtr& locatorInfo, const RouterInfoPtr& routerInfo, bool collocationOptimized, bool cacheConnection, bool preferSecure, EndpointSelectionType endpointSelection, int locatorCacheTimeout) : Reference(instance, communicator, id, facet, mode, secure, protocol, encoding), _endpoints(endpoints), _adapterId(adapterId), _locatorInfo(locatorInfo), _routerInfo(routerInfo), _collocationOptimized(collocationOptimized), _cacheConnection(cacheConnection), _preferSecure(preferSecure), _endpointSelection(endpointSelection), _locatorCacheTimeout(locatorCacheTimeout), _overrideTimeout(false), _timeout(-1) { assert(_adapterId.empty() || _endpoints.empty()); } vector IceInternal::RoutableReference::getEndpoints() const { return _endpoints; } string IceInternal::RoutableReference::getAdapterId() const { return _adapterId; } LocatorInfoPtr IceInternal::RoutableReference::getLocatorInfo() const { return _locatorInfo; } RouterInfoPtr IceInternal::RoutableReference::getRouterInfo() const { return _routerInfo; } bool IceInternal::RoutableReference::getCollocationOptimized() const { return _collocationOptimized; } bool IceInternal::RoutableReference::getCacheConnection() const { return _cacheConnection; } bool IceInternal::RoutableReference::getPreferSecure() const { return _preferSecure; } Ice::EndpointSelectionType IceInternal::RoutableReference::getEndpointSelection() const { return _endpointSelection; } int IceInternal::RoutableReference::getLocatorCacheTimeout() const { return _locatorCacheTimeout; } string IceInternal::RoutableReference::getConnectionId() const { return _connectionId; } ReferencePtr IceInternal::RoutableReference::changeEncoding(const Ice::EncodingVersion& encoding) const { ReferencePtr r = Reference::changeEncoding(encoding); if(r.get() != const_cast(this)) { LocatorInfoPtr& locInfo = RoutableReferencePtr::dynamicCast(r)->_locatorInfo; if(locInfo && locInfo->getLocator()->ice_getEncodingVersion() != encoding) { locInfo = getInstance()->locatorManager()->get(locInfo->getLocator()->ice_encodingVersion(encoding)); } } return r; } ReferencePtr IceInternal::RoutableReference::changeCompress(bool newCompress) const { ReferencePtr r = Reference::changeCompress(newCompress); // Also override the compress flag on the endpoints if it was updated. if(r.get() != const_cast(this) && !_endpoints.empty()) { vector newEndpoints; for(vector::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p) { newEndpoints.push_back((*p)->compress(newCompress)); } RoutableReferencePtr::dynamicCast(r)->_endpoints = newEndpoints; } return r; } ReferencePtr IceInternal::RoutableReference::changeEndpoints(const vector& newEndpoints) const { if(newEndpoints == _endpoints) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_endpoints = newEndpoints; r->applyOverrides(r->_endpoints); r->_adapterId.clear(); return r; } ReferencePtr IceInternal::RoutableReference::changeAdapterId(const string& newAdapterId) const { if(newAdapterId == _adapterId) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_adapterId = newAdapterId; r->_endpoints.clear(); return r; } ReferencePtr IceInternal::RoutableReference::changeLocator(const LocatorPrx& newLocator) const { LocatorInfoPtr newLocatorInfo = getInstance()->locatorManager()->get(newLocator); if(newLocatorInfo == _locatorInfo) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_locatorInfo = newLocatorInfo; return r; } ReferencePtr IceInternal::RoutableReference::changeRouter(const RouterPrx& newRouter) const { RouterInfoPtr newRouterInfo = getInstance()->routerManager()->get(newRouter); if(newRouterInfo == _routerInfo) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_routerInfo = newRouterInfo; return r; } ReferencePtr IceInternal::RoutableReference::changeCollocationOptimized(bool newCollocationOptimized) const { if(newCollocationOptimized == _collocationOptimized) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_collocationOptimized = newCollocationOptimized; return r; } ReferencePtr IceInternal::RoutableReference::changeCacheConnection(bool newCache) const { if(newCache == _cacheConnection) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_cacheConnection = newCache; return r; } ReferencePtr IceInternal::RoutableReference::changePreferSecure(bool newPreferSecure) const { if(newPreferSecure == _preferSecure) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_preferSecure = newPreferSecure; return r; } ReferencePtr IceInternal::RoutableReference::changeEndpointSelection(EndpointSelectionType newType) const { if(newType == _endpointSelection) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_endpointSelection = newType; return r; } ReferencePtr IceInternal::RoutableReference::changeLocatorCacheTimeout(int timeout) const { if(timeout == _locatorCacheTimeout) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_locatorCacheTimeout = timeout; return r; } ReferencePtr IceInternal::RoutableReference::changeTimeout(int newTimeout) const { if(_overrideTimeout && newTimeout == _timeout) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_timeout = newTimeout; r->_overrideTimeout = true; if(!_endpoints.empty()) // Also override the timeout on the endpoints. { vector newEndpoints; for(vector::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p) { newEndpoints.push_back((*p)->timeout(newTimeout)); } r->_endpoints = newEndpoints; } return r; } ReferencePtr IceInternal::RoutableReference::changeConnectionId(const string& id) const { if(id == _connectionId) { return RoutableReferencePtr(const_cast(this)); } RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); r->_connectionId = id; if(!_endpoints.empty()) // Also override the connection id on the endpoints. { vector newEndpoints; for(vector::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p) { newEndpoints.push_back((*p)->connectionId(id)); } r->_endpoints = newEndpoints; } return r; } bool IceInternal::RoutableReference::isIndirect() const { return _endpoints.empty(); } bool IceInternal::RoutableReference::isWellKnown() const { return _endpoints.empty() && _adapterId.empty(); } void IceInternal::RoutableReference::streamWrite(BasicStream* s) const { Reference::streamWrite(s); Int sz = static_cast(_endpoints.size()); s->writeSize(sz); if(sz) { assert(_adapterId.empty()); for(vector::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p) { (*p)->streamWrite(s); } } else { s->write(_adapterId); } } string IceInternal::RoutableReference::toString() 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. // string result = Reference::toString(); if(!_endpoints.empty()) { for(vector::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p) { string endp = (*p)->toString(); if(!endp.empty()) { result.append(":"); result.append(endp); } } } else if(!_adapterId.empty()) { result.append(" @ "); // // If the encoded adapter id string contains characters which the // reference parser uses as separators, then we enclose the // adapter id string in quotes. // string a = Ice::nativeToUTF8(getInstance()->initializationData().stringConverter, _adapterId); a = IceUtilInternal::escapeString(a, ""); if(a.find_first_of(" :@") != string::npos) { result.append("\""); result.append(a); result.append("\""); } else { result.append(a); } } else { return result; } return result; } PropertyDict IceInternal::RoutableReference::toProperty(const string& prefix) const { Ice::PropertyDict properties; properties[prefix] = toString(); properties[prefix + ".CollocationOptimized"] = _collocationOptimized ? "1" : "0"; properties[prefix + ".ConnectionCached"] = _cacheConnection ? "1" : "0"; properties[prefix + ".PreferSecure"] = _preferSecure ? "1" : "0"; properties[prefix + ".EndpointSelection"] = _endpointSelection == Random ? "Random" : "Ordered"; ostringstream s; s << _locatorCacheTimeout; properties[prefix + ".LocatorCacheTimeout"] = s.str(); if(_routerInfo) { PropertyDict routerProperties = _routerInfo->getRouter()->__reference()->toProperty(prefix + ".Router"); for(PropertyDict::const_iterator p = routerProperties.begin(); p != routerProperties.end(); ++p) { properties[p->first] = p->second; } } if(_locatorInfo) { PropertyDict locatorProperties = _locatorInfo->getLocator()->__reference()->toProperty(prefix + ".Locator"); for(PropertyDict::const_iterator p = locatorProperties.begin(); p != locatorProperties.end(); ++p) { properties[p->first] = p->second; } } return properties; } int IceInternal::RoutableReference::hashInit() const { int value = Reference::hashInit(); hashAdd(value, _adapterId); return value; } bool IceInternal::RoutableReference::operator==(const Reference& r) const { // // Note: if(this == &r) test is performed by each non-abstract derived class. // if(this == &r) { return true; } const RoutableReference* rhs = dynamic_cast(&r); if(!rhs || !Reference::operator==(r)) { return false; } if(_preferSecure != rhs->_preferSecure) { return false; } if(_collocationOptimized != rhs->_collocationOptimized) { return false; } if(_cacheConnection != rhs->_cacheConnection) { return false; } if(_endpointSelection != rhs->_endpointSelection) { return false; } if(_connectionId != rhs->_connectionId) { return false; } if((_overrideTimeout != rhs->_overrideTimeout) || (_overrideTimeout && _timeout != rhs->_timeout)) { return false; } if(_routerInfo != rhs->_routerInfo) { return false; } if(_locatorInfo != rhs->_locatorInfo) { return false; } if(_endpoints != rhs->_endpoints) { return false; } if(_adapterId != rhs->_adapterId) { return false; } if(_locatorCacheTimeout != rhs->_locatorCacheTimeout) { return false; } return true; } bool IceInternal::RoutableReference::operator!=(const Reference& r) const { return !operator==(r); } bool IceInternal::RoutableReference::operator<(const Reference& r) const { if(this == &r) { return false; } if(Reference::operator<(r)) { return true; } else if(!Reference::operator==(r)) { return false; } const RoutableReference* rhs = dynamic_cast(&r); if(!rhs) { assert(dynamic_cast(&r)); return true; // As a rule, routable references are superior to fixed references. } if(!_preferSecure && rhs->_preferSecure) { return true; } else if(rhs->_preferSecure < _preferSecure) { return false; } if(!_collocationOptimized && rhs->_collocationOptimized) { return true; } else if(rhs->_collocationOptimized < _collocationOptimized) { return false; } if(!_cacheConnection && rhs->_cacheConnection) { return true; } else if(rhs->_cacheConnection < _cacheConnection) { return false; } if(_endpointSelection < rhs->_endpointSelection) { return true; } else if(rhs->_endpointSelection < _endpointSelection) { return false; } if(_connectionId < rhs->_connectionId) { return true; } else if(rhs->_connectionId < _connectionId) { return false; } if(!_overrideTimeout && rhs->_overrideTimeout) { return true; } else if(rhs->_overrideTimeout < _overrideTimeout) { return false; } else if(_overrideTimeout) { if(_timeout < rhs->_timeout) { return true; } else if(rhs->_timeout < _timeout) { return false; } } if(_routerInfo < rhs->_routerInfo) { return true; } else if(rhs->_routerInfo < _routerInfo) { return false; } if(_locatorInfo < rhs->_locatorInfo) { return true; } else if(rhs->_locatorInfo < _locatorInfo) { return false; } if(_adapterId < rhs->_adapterId) { return true; } else if(rhs->_adapterId < _adapterId) { return false; } if(_endpoints < rhs->_endpoints) { return true; } else if(rhs->_endpoints < _endpoints) { return false; } if(_locatorCacheTimeout < rhs->_locatorCacheTimeout) { return true; } else if(rhs->_locatorCacheTimeout < _locatorCacheTimeout) { return false; } return false; } ReferencePtr IceInternal::RoutableReference::clone() const { return new RoutableReference(*this); } ConnectionIPtr IceInternal::RoutableReference::getConnection(bool& comp) const { if(_routerInfo) { // // If we route, we send everything to the router's client // proxy endpoints. // vector endpts = _routerInfo->getClientEndpoints(); if(!endpts.empty()) { applyOverrides(endpts); return createConnection(endpts, comp); } } if(!_endpoints.empty()) { return createConnection(_endpoints, comp); } while(true) { bool cached = false; vector endpts; if(_locatorInfo) { endpts = _locatorInfo->getEndpoints(const_cast(this), _locatorCacheTimeout, cached); applyOverrides(endpts); } if(endpts.empty()) { throw Ice::NoEndpointException(__FILE__, __LINE__, toString()); } try { return createConnection(endpts, comp); } catch(const NoEndpointException&) { throw; // No need to retry if there's no endpoints. } catch(const LocalException& ex) { assert(_locatorInfo); _locatorInfo->clearCache(const_cast(this)); if(cached) { // COMPILERFIX: Braces needed to prevent BCB from causing TraceLevels refCount from // being decremented twice when loop continues. { TraceLevelsPtr traceLevels = getInstance()->traceLevels(); if(traceLevels->retry >= 2) { Trace out(getInstance()->initializationData().logger, traceLevels->retryCat); out << "connection to cached endpoints failed\n" << "removing endpoints from cache and trying one more time\n" << ex; } } continue; } throw; } } assert(false); return 0; } void IceInternal::RoutableReference::getConnection(const GetConnectionCallbackPtr& callback) const { class Callback : public RouterInfo::GetClientEndpointsCallback { public: virtual void setEndpoints(const vector& endpoints) { vector endpts = endpoints; if(!endpts.empty()) { _reference->applyOverrides(endpts); _reference->createConnection(endpts, _callback); return; } _reference->getConnectionNoRouterInfo(_callback); } virtual void setException(const Ice::LocalException& ex) { _callback->setException(ex); } Callback(const RoutableReferencePtr& reference, const GetConnectionCallbackPtr& callback) : _reference(reference), _callback(callback) { } private: const RoutableReferencePtr _reference; const GetConnectionCallbackPtr _callback; }; if(_routerInfo) { // // If we route, we send everything to the router's client // proxy endpoints. // _routerInfo->getClientEndpoints(new Callback(const_cast(this), callback)); return; } getConnectionNoRouterInfo(callback); } void IceInternal::RoutableReference::getConnectionNoRouterInfo(const GetConnectionCallbackPtr& callback) const { class Callback : public LocatorInfo::GetEndpointsCallback { public: class Callback2 : public Reference::GetConnectionCallback { public: virtual void setConnection(const Ice::ConnectionIPtr& connection, bool compress) { _callback->setConnection(connection, compress); } virtual void setException(const Ice::LocalException& exc) { try { exc.ice_throw(); } catch(const Ice::NoEndpointException& ex) { _callback->setException(ex); // No need to retry if there's no endpoints. } catch(const Ice::LocalException& ex) { LocatorInfoPtr locatorInfo = _reference->getLocatorInfo(); assert(locatorInfo); locatorInfo->clearCache(_reference); if(_cached) { TraceLevelsPtr traceLvls = _reference->getInstance()->traceLevels(); if(traceLvls->retry >= 2) { Trace out(_reference->getInstance()->initializationData().logger, traceLvls->retryCat); out << "connection to cached endpoints failed\n" << "removing endpoints from cache and trying one more time\n" << ex; } _reference->getConnectionNoRouterInfo(_callback); // Retry. return; } _callback->setException(ex); } } Callback2(const RoutableReferencePtr& reference, const GetConnectionCallbackPtr& cb, bool cached) : _reference(reference), _callback(cb), _cached(cached) { } private: const RoutableReferencePtr _reference; const GetConnectionCallbackPtr _callback; const bool _cached; }; virtual void setEndpoints(const vector& endpoints, bool cached) { if(endpoints.empty()) { _callback->setException(Ice::NoEndpointException(__FILE__, __LINE__, _reference->toString())); return; } vector endpts = endpoints; _reference->applyOverrides(endpts); _reference->createConnection(endpts, new Callback2(_reference, _callback, cached)); } virtual void setException(const Ice::LocalException& ex) { _callback->setException(ex); } Callback(const RoutableReferencePtr& reference, const GetConnectionCallbackPtr& callback) : _reference(reference), _callback(callback) { } private: const RoutableReferencePtr _reference; const GetConnectionCallbackPtr _callback; }; if(!_endpoints.empty()) { createConnection(_endpoints, callback); return; } if(_locatorInfo) { RoutableReference* self = const_cast(this); _locatorInfo->getEndpoints(self, _locatorCacheTimeout, new Callback(self, callback)); } else { callback->setException(Ice::NoEndpointException(__FILE__, __LINE__, toString())); } } ConnectionIPtr IceInternal::RoutableReference::createConnection(const vector& allEndpoints, bool& comp) const { vector endpoints = filterEndpoints(allEndpoints); if(endpoints.empty()) { throw Ice::NoEndpointException(__FILE__, __LINE__, toString()); } OutgoingConnectionFactoryPtr factory = getInstance()->outgoingConnectionFactory(); Ice::ConnectionIPtr connection; if(getCacheConnection() || endpoints.size() == 1) { // // Get an existing connection or create one if there's no // existing connection to one of the given endpoints. // connection = factory->create(endpoints, false, getEndpointSelection(), comp); } else { // // Go through the list of endpoints and try to create the // connection until it succeeds. This is different from just // calling create() with the given endpoints since this might // create a new connection even if there's an existing // connection for one of the endpoints. // IceUtil::UniquePtr exception; vector endpoint; endpoint.push_back(0); for(vector::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { try { endpoint.back() = *p; connection = factory->create(endpoint, p + 1 == endpoints.end(), getEndpointSelection(), comp); break; } catch(const LocalException& ex) { exception.reset(ex.ice_clone()); } } if(!connection) { assert(exception.get()); exception->ice_throw(); } } assert(connection); // // If we have a router, set the object adapter for this router // (if any) to the new connection, so that callbacks from the // router can be received over this new connection. // if(_routerInfo && _routerInfo->getAdapter()) { connection->setAdapter(_routerInfo->getAdapter()); } return connection; } void IceInternal::RoutableReference::createConnection(const vector& allEndpoints, const GetConnectionCallbackPtr& callback) const { vector endpoints = filterEndpoints(allEndpoints); if(endpoints.empty()) { callback->setException(Ice::NoEndpointException(__FILE__, __LINE__, toString())); return; } // // Finally, create the connection. // OutgoingConnectionFactoryPtr factory = getInstance()->outgoingConnectionFactory(); if(getCacheConnection() || endpoints.size() == 1) { class CB1 : public OutgoingConnectionFactory::CreateConnectionCallback { public: virtual void setConnection(const Ice::ConnectionIPtr& connection, bool compress) { // // If we have a router, set the object adapter for this router // (if any) to the new connection, so that callbacks from the // router can be received over this new connection. // if(_routerInfo && _routerInfo->getAdapter()) { connection->setAdapter(_routerInfo->getAdapter()); } _callback->setConnection(connection, compress); } virtual void setException(const Ice::LocalException& ex) { _callback->setException(ex); } CB1(const RouterInfoPtr& routerInfo, const GetConnectionCallbackPtr& callback) : _routerInfo(routerInfo), _callback(callback) { } private: const RouterInfoPtr _routerInfo; const GetConnectionCallbackPtr _callback; }; // // Get an existing connection or create one if there's no // existing connection to one of the given endpoints. // factory->create(endpoints, false, getEndpointSelection(), new CB1(_routerInfo, callback)); return; } else { class CB2 : public OutgoingConnectionFactory::CreateConnectionCallback { public: virtual void setConnection(const Ice::ConnectionIPtr& connection, bool compress) { // // If we have a router, set the object adapter for this router // (if any) to the new connection, so that callbacks from the // router can be received over this new connection. // if(_reference->getRouterInfo() && _reference->getRouterInfo()->getAdapter()) { connection->setAdapter(_reference->getRouterInfo()->getAdapter()); } _callback->setConnection(connection, compress); } virtual void setException(const Ice::LocalException& ex) { if(!_exception.get()) { _exception.reset(ex.ice_clone()); } if(++_i == _endpoints.size()) { _callback->setException(*_exception.get()); return; } const bool more = _i != _endpoints.size() - 1; vector endpoint; endpoint.push_back(_endpoints[_i]); OutgoingConnectionFactoryPtr factory = _reference->getInstance()->outgoingConnectionFactory(); factory->create(endpoint, more, _reference->getEndpointSelection(), this); } CB2(const RoutableReferencePtr& reference, const vector& endpoints, const GetConnectionCallbackPtr& callback) : _reference(reference), _endpoints(endpoints), _callback(callback), _i(0) { } private: const RoutableReferencePtr _reference; const vector _endpoints; const GetConnectionCallbackPtr _callback; size_t _i; IceUtil::UniquePtr _exception; }; // // Go through the list of endpoints and try to create the // connection until it succeeds. This is different from just // calling create() with the given endpoints since this might // create a new connection even if there's an existing // connection for one of the endpoints. // vector endpt; endpt.push_back(endpoints[0]); RoutableReference* self = const_cast(this); factory->create(endpt, true, getEndpointSelection(), new CB2(self, endpoints, callback)); return; } } void IceInternal::RoutableReference::applyOverrides(vector& endpoints) const { for(vector::iterator p = endpoints.begin(); p != endpoints.end(); ++p) { *p = (*p)->connectionId(_connectionId); if(_overrideCompress) { *p = (*p)->compress(_compress); } if(_overrideTimeout) { *p = (*p)->timeout(_timeout); } } } IceInternal::RoutableReference::RoutableReference(const RoutableReference& r) : Reference(r), _endpoints(r._endpoints), _adapterId(r._adapterId), _locatorInfo(r._locatorInfo), _routerInfo(r._routerInfo), _collocationOptimized(r._collocationOptimized), _cacheConnection(r._cacheConnection), _preferSecure(r._preferSecure), _endpointSelection(r._endpointSelection), _locatorCacheTimeout(r._locatorCacheTimeout), _overrideTimeout(r._overrideTimeout), _timeout(r._timeout), _connectionId(r._connectionId) { } namespace { struct EndpointIsOpaque : public unary_function { public: bool operator()(EndpointIPtr p) const { return dynamic_cast(p.get()) != 0; } }; } vector IceInternal::RoutableReference::filterEndpoints(const vector& allEndpoints) const { vector endpoints = allEndpoints; // // Filter out unknown endpoints. // endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), EndpointIsOpaque()), endpoints.end()); // // Filter out endpoints according to the mode of the reference. // switch(getMode()) { case Reference::ModeTwoway: case Reference::ModeOneway: case Reference::ModeBatchOneway: { // // Filter out datagram endpoints. // endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), Ice::constMemFun(&EndpointI::datagram)), endpoints.end()); break; } case Reference::ModeDatagram: case Reference::ModeBatchDatagram: { // // Filter out non-datagram endpoints. // endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), not1(Ice::constMemFun(&EndpointI::datagram))), endpoints.end()); break; } } // // Sort the endpoints according to the endpoint selection type. // switch(getEndpointSelection()) { case Random: { RandomNumberGenerator rng; random_shuffle(endpoints.begin(), endpoints.end(), rng); break; } case Ordered: { // Nothing to do. break; } default: { assert(false); break; } } // // If a secure connection is requested or secure overrides is set, // remove all non-secure endpoints. Otherwise if preferSecure is set // make secure endpoints prefered. By default make non-secure // endpoints preferred over secure endpoints. // DefaultsAndOverridesPtr overrides = getInstance()->defaultsAndOverrides(); if(overrides->overrideSecure ? overrides->overrideSecureValue : getSecure()) { endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), not1(Ice::constMemFun(&EndpointI::secure))), endpoints.end()); } else if(getPreferSecure()) { // // We must use stable_partition() instead of just simply // partition(), because otherwise some STL implementations // order our now randomized endpoints. // stable_partition(endpoints.begin(), endpoints.end(), Ice::constMemFun(&EndpointI::secure)); } else { // // We must use stable_partition() instead of just simply // partition(), because otherwise some STL implementations // order our now randomized endpoints. // stable_partition(endpoints.begin(), endpoints.end(), not1(Ice::constMemFun(&EndpointI::secure))); } return endpoints; } Ice-3.5.1/cpp/src/Ice/FactoryTableInit.cpp0000644000076400007640000000352512223561476016357 0ustar mesmes// ********************************************************************** // // 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 #include #include #include namespace IceInternal { // // Single global instance of the factory table for non-local // exceptions and non-abstract classes. // ICE_DECLSPEC_EXPORT FactoryTable* factoryTable; } namespace { int initCount = 0; // Initialization count IceUtil::Mutex* initCountMutex = 0; class Init { public: Init() { initCountMutex = new IceUtil::Mutex; } ~Init() { delete initCountMutex; initCountMutex = 0; } }; Init init; } // // This constructor initializes the single global // IceInternal::factoryTable instance from the outside (if it hasn't // been initialized yet). The constructor here is triggered by a // file-static instance of FactoryTable in each slice2cpp-generated // header file that uses non-local exceptions or non-abstract classes. // This ensures that IceInternal::factoryTable is always initialized // before it is used. // IceInternal::FactoryTableInit::FactoryTableInit() { IceUtilInternal::MutexPtrLock lock(initCountMutex); if(0 == initCount++) { factoryTable = new FactoryTable; } } // // The destructor decrements the reference count and, once the // count drops to zero, deletes the table. // IceInternal::FactoryTableInit::~FactoryTableInit() { IceUtilInternal::MutexPtrLock lock(initCountMutex); if(0 == --initCount) { delete factoryTable; } } Ice-3.5.1/cpp/src/Ice/Outgoing.cpp0000644000076400007640000004314512223561476014751 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace Ice::Instrumentation; using namespace IceInternal; IceInternal::LocalExceptionWrapper::LocalExceptionWrapper(const LocalException& ex, bool r) : _retry(r) { _ex.reset(ex.ice_clone()); } IceInternal::LocalExceptionWrapper::LocalExceptionWrapper(const LocalExceptionWrapper& ex) : _retry(ex._retry) { _ex.reset(ex.get()->ice_clone()); } void IceInternal::LocalExceptionWrapper::throwWrapper(const std::exception& ex) { const UserException* ue = dynamic_cast(&ex); if(ue) { stringstream s; s << *ue; throw LocalExceptionWrapper(UnknownUserException(__FILE__, __LINE__, s.str()), false); } const LocalException* le = dynamic_cast(&ex); if(le) { if(dynamic_cast(le) || dynamic_cast(le) || dynamic_cast(le) || dynamic_cast(le)) { throw LocalExceptionWrapper(*le, false); } stringstream s; s << *le; #ifdef __GNUC__ s << "\n" << le->ice_stackTrace(); #endif throw LocalExceptionWrapper(UnknownLocalException(__FILE__, __LINE__, s.str()), false); } string msg = "std::exception: "; throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, msg + ex.what()), false); } const LocalException* IceInternal::LocalExceptionWrapper::get() const { assert(_ex.get()); return _ex.get(); } bool IceInternal::LocalExceptionWrapper::retry() const { return _retry; } IceInternal::Outgoing::Outgoing(RequestHandler* handler, const string& operation, OperationMode mode, const Context* context, InvocationObserver& observer) : _handler(handler), _observer(observer), _state(StateUnsent), _encoding(getCompatibleEncoding(handler->getReference()->getEncoding())), _is(handler->getReference()->getInstance().get(), Ice::currentProtocolEncoding), _os(handler->getReference()->getInstance().get(), Ice::currentProtocolEncoding), _sent(false) { checkSupportedProtocol(getCompatibleProtocol(handler->getReference()->getProtocol())); switch(_handler->getReference()->getMode()) { case Reference::ModeTwoway: case Reference::ModeOneway: case Reference::ModeDatagram: { _os.writeBlob(requestHdr, sizeof(requestHdr)); break; } case Reference::ModeBatchOneway: case Reference::ModeBatchDatagram: { _handler->prepareBatchRequest(&_os); break; } } try { _os.write(_handler->getReference()->getIdentity()); // // For compatibility with the old FacetPath. // if(_handler->getReference()->getFacet().empty()) { _os.write(static_cast(0), static_cast(0)); } else { string facet = _handler->getReference()->getFacet(); _os.write(&facet, &facet + 1); } _os.write(operation, false); _os.write(static_cast(mode)); if(context != 0) { // // Explicit context // _os.write(*context); } else { // // Implicit context // const ImplicitContextIPtr& implicitContext = _handler->getReference()->getInstance()->getImplicitContext(); const Context& prxContext = _handler->getReference()->getContext()->getValue(); if(implicitContext == 0) { _os.write(prxContext); } else { implicitContext->write(prxContext, &_os); } } } catch(const LocalException& ex) { abort(ex); } } Outgoing::~Outgoing() { } bool IceInternal::Outgoing::invoke() { assert(_state == StateUnsent); switch(_handler->getReference()->getMode()) { case Reference::ModeTwoway: { _state = StateInProgress; Ice::ConnectionI* connection = _handler->sendRequest(this); assert(connection); bool timedOut = false; { IceUtil::Monitor::Lock sync(_monitor); // // If the request is being sent in the background we first wait for the // sent notification. // while(_state != StateFailed && !_sent) { _monitor.wait(); } // // Wait until the request has completed, or until the request times out. // Int timeout = connection->timeout(); while(_state == StateInProgress && !timedOut) { if(timeout >= 0) { _monitor.timedWait(IceUtil::Time::milliSeconds(timeout)); if(_state == StateInProgress) { timedOut = true; } } else { _monitor.wait(); } } } if(timedOut) { // // Must be called outside the synchronization of this // object. // connection->exception(TimeoutException(__FILE__, __LINE__)); // // We must wait until the exception set above has // propagated to this Outgoing object. // { IceUtil::Monitor::Lock sync(_monitor); while(_state == StateInProgress) { _monitor.wait(); } } } if(_exception.get()) { // // A CloseConnectionException indicates graceful // server shutdown, and is therefore always repeatable // without violating "at-most-once". That's because by // sending a close connection message, the server // guarantees that all outstanding requests can safely // be repeated. // // An ObjectNotExistException can always be retried as // well without violating "at-most-once" (see the // implementation of the checkRetryAfterException // method of the ProxyFactory class for the reasons // why it can be useful). // if(!_sent || dynamic_cast(_exception.get()) || dynamic_cast(_exception.get())) { _exception->ice_throw(); } // // Throw the exception wrapped in a LocalExceptionWrapper, // to indicate that the request cannot be resent without // potentially violating the "at-most-once" principle. // throw LocalExceptionWrapper(*_exception.get(), false); } if(_state == StateUserException) { return false; } else { assert(_state == StateOK); return true; } } case Reference::ModeOneway: case Reference::ModeDatagram: { _state = StateInProgress; if(_handler->sendRequest(this)) { // // If the handler returns the connection, we must wait for the sent callback. // IceUtil::Monitor::Lock sync(_monitor); while(_state != StateFailed && !_sent) { _monitor.wait(); } if(_exception.get()) { _exception->ice_throw(); } } return true; } case Reference::ModeBatchOneway: case Reference::ModeBatchDatagram: { // // For batch oneways and datagrams, the same rules as for // regular oneways and datagrams (see comment above) // apply. // _state = StateInProgress; _handler->finishBatchRequest(&_os); return true; } } assert(false); return false; } void IceInternal::Outgoing::abort(const LocalException& ex) { assert(_state == StateUnsent); // // If we didn't finish a batch oneway or datagram request, we must // notify the connection about that we give up ownership of the // batch stream. // if(_handler->getReference()->getMode() == Reference::ModeBatchOneway || _handler->getReference()->getMode() == Reference::ModeBatchDatagram) { _handler->abortBatchRequest(); } ex.ice_throw(); } void IceInternal::Outgoing::sent(bool notify) { if(_handler->getReference()->getMode() != Reference::ModeTwoway) { _remoteObserver.detach(); } if(notify) { IceUtil::Monitor::Lock sync(_monitor); _sent = true; _monitor.notify(); } else { // // No synchronization is necessary if called from sendRequest() because the connection // send mutex is locked and no other threads can call on Outgoing until it's released. // _sent = true; } // // NOTE: At this point the stack allocated Outgoing object can be destroyed // since the notify() on the monitor will release the thread waiting on the // synchronous Ice call. // } void IceInternal::Outgoing::finished(BasicStream& is) { IceUtil::Monitor::Lock sync(_monitor); assert(_handler->getReference()->getMode() == Reference::ModeTwoway); // Can only be called for twoways. assert(_state <= StateInProgress); if(_remoteObserver) { _remoteObserver->reply(static_cast(is.b.size() - headerSize - 4)); } _remoteObserver.detach(); _is.swap(is); Byte replyStatus; _is.read(replyStatus); switch(replyStatus) { case replyOK: { _state = StateOK; // The state must be set last, in case there is an exception. break; } case replyUserException: { _observer.userException(); _state = StateUserException; // The state must be set last, in case there is an exception. break; } case replyObjectNotExist: case replyFacetNotExist: case replyOperationNotExist: { // // Don't read the exception members directly into the // exception. Otherwise if reading fails and raises an // exception, you will have a memory leak. // Identity ident; _is.read(ident); // // For compatibility with the old FacetPath. // vector facetPath; _is.read(facetPath); string facet; if(!facetPath.empty()) { if(facetPath.size() > 1) { throw MarshalException(__FILE__, __LINE__); } facet.swap(facetPath[0]); } string operation; _is.read(operation, false); RequestFailedException* ex; switch(replyStatus) { case replyObjectNotExist: { ex = new ObjectNotExistException(__FILE__, __LINE__); break; } case replyFacetNotExist: { ex = new FacetNotExistException(__FILE__, __LINE__); break; } case replyOperationNotExist: { ex = new OperationNotExistException(__FILE__, __LINE__); break; } default: { ex = 0; // To keep the compiler from complaining. assert(false); break; } } ex->id = ident; ex->facet = facet; ex->operation = operation; _exception.reset(ex); _state = StateLocalException; // The state must be set last, in case there is an exception. break; } case replyUnknownException: case replyUnknownLocalException: case replyUnknownUserException: { // // Don't read the exception members directly into the // exception. Otherwise if reading fails and raises an // exception, you will have a memory leak. // string unknown; _is.read(unknown, false); UnknownException* ex; switch(replyStatus) { case replyUnknownException: { ex = new UnknownException(__FILE__, __LINE__); break; } case replyUnknownLocalException: { ex = new UnknownLocalException(__FILE__, __LINE__); break; } case replyUnknownUserException: { ex = new UnknownUserException(__FILE__, __LINE__); break; } default: { ex = 0; // To keep the compiler from complaining. assert(false); break; } } ex->unknown = unknown; _exception.reset(ex); _state = StateLocalException; // The state must be set last, in case there is an exception. break; } default: { _exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__)); _state = StateLocalException; break; } } _monitor.notify(); } void IceInternal::Outgoing::finished(const LocalException& ex, bool sent) { IceUtil::Monitor::Lock sync(_monitor); assert(_state <= StateInProgress); _remoteObserver.failed(ex.ice_name()); _remoteObserver.detach(); _state = StateFailed; _exception.reset(ex.ice_clone()); _sent = sent; _monitor.notify(); } void IceInternal::Outgoing::throwUserException() { try { _is.startReadEncaps(); _is.throwException(); } catch(const Ice::UserException&) { _is.endReadEncaps(); throw; } } IceInternal::BatchOutgoing::BatchOutgoing(RequestHandler* handler, InvocationObserver& observer) : _handler(handler), _connection(0), _sent(false), _os(handler->getReference()->getInstance().get(), Ice::currentProtocolEncoding), _observer(observer) { checkSupportedProtocol(handler->getReference()->getProtocol()); } IceInternal::BatchOutgoing::BatchOutgoing(ConnectionI* connection, Instance* instance, InvocationObserver& observer) : _handler(0), _connection(connection), _sent(false), _os(instance, Ice::currentProtocolEncoding), _observer(observer) { } void IceInternal::BatchOutgoing::invoke() { assert(_handler || _connection); if((_handler && !_handler->flushBatchRequests(this)) || (_connection && !_connection->flushBatchRequests(this))) { IceUtil::Monitor::Lock sync(_monitor); while(!_exception.get() && !_sent) { _monitor.wait(); } if(_exception.get()) { _exception->ice_throw(); } } } void IceInternal::BatchOutgoing::sent(bool notify) { _remoteObserver.detach(); if(notify) { IceUtil::Monitor::Lock sync(_monitor); _sent = true; _monitor.notify(); } else { _sent = true; } // // NOTE: At this point the stack allocated BatchOutgoing object // can be destroyed since the notify() on the monitor will release // the thread waiting on the synchronous Ice call. // } void IceInternal::BatchOutgoing::finished(const Ice::LocalException& ex, bool) { IceUtil::Monitor::Lock sync(_monitor); _remoteObserver.failed(ex.ice_name()); _remoteObserver.detach(); _exception.reset(ex.ice_clone()); _monitor.notify(); } Ice-3.5.1/cpp/src/Ice/EventLoggerMsg.h0000644000076400007640000000234312223561476015506 0ustar mesmes // ********************************************************************** // // 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. // // ********************************************************************** // // Values are 32 bit values laid out as follows: // // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 // +---+-+-+-----------------------+-------------------------------+ // |Sev|C|R| Facility | Code | // +---+-+-+-----------------------+-------------------------------+ // // where // // Sev - is the severity code // // 00 - Success // 01 - Informational // 10 - Warning // 11 - Error // // C - is the Customer code flag // // R - is a reserved bit // // Facility - is the facility code // // Code - is the facility's status code // // // Define the facility codes // // // Define the severity codes // // // MessageId: EVENT_LOGGER_MSG // // MessageText: // // %1 // #define EVENT_LOGGER_MSG 0x00000000L Ice-3.5.1/cpp/src/Ice/PropertiesAdminI.h0000644000076400007640000000270312223561476016034 0ustar mesmes// ********************************************************************** // // 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 ICE_PROPERTIES_ADMIN_I_H #define ICE_PROPERTIES_ADMIN_I_H #include #include #include #include #include namespace Ice { class ICE_API PropertiesAdminI : public PropertiesAdmin, public NativePropertiesAdmin, private IceUtil::RecMutex { public: PropertiesAdminI(const std::string&, const PropertiesPtr&, const LoggerPtr&); virtual std::string getProperty(const std::string&, const Current&); virtual PropertyDict getPropertiesForPrefix(const std::string&, const Current&); virtual void setProperties_async(const AMD_PropertiesAdmin_setPropertiesPtr&, const PropertyDict&, const Current&); virtual void addUpdateCallback(const PropertiesAdminUpdateCallbackPtr&); virtual void removeUpdateCallback(const PropertiesAdminUpdateCallbackPtr&); private: const std::string _name; const PropertiesPtr _properties; const LoggerPtr _logger; std::vector _updateCallbacks; }; typedef IceUtil::Handle PropertiesAdminIPtr; } #endif Ice-3.5.1/cpp/src/Ice/Service.cpp0000644000076400007640000012506412223561476014557 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef _WIN32 # include # include #else # include # include # include # include # include #endif using namespace std; using namespace Ice; Ice::Service* Ice::Service::_instance = 0; static IceUtil::CtrlCHandler* _ctrlCHandler = 0; // // Callback for IceUtil::CtrlCHandler. // static void ctrlCHandlerCallback(int sig) { Ice::Service* service = Ice::Service::instance(); assert(service != 0); service->handleInterrupt(sig); } #ifdef _WIN32 // // Main function for Win32 service. // void WINAPI Ice_Service_ServiceMain(DWORD argc, LPWSTR* argv) { Ice::Service* service = Ice::Service::instance(); assert(service != 0); service->serviceMain(argc, argv); } // // Win32 service control handler. // void WINAPI Ice_Service_CtrlHandler(DWORD ctrl) { Ice::Service* service = Ice::Service::instance(); assert(service != 0); service->control(ctrl); } namespace { class ServiceStatusManager : public IceUtil::Monitor { public: ServiceStatusManager(SERVICE_STATUS_HANDLE); // // Start a thread to provide regular status updates to the SCM. // void startUpdate(DWORD); // // Stop the update thread. // void stopUpdate(); // // Change the service status and report it (once). // void changeStatus(DWORD, DWORD); // // Report the current status. // void reportStatus(); private: void run(); class StatusThread : public IceUtil::Thread { public: StatusThread(ServiceStatusManager* manager) : IceUtil::Thread("Ice service status manager thread"), _manager(manager) { } virtual void run() { _manager->run(); } private: ServiceStatusManager* _manager; }; friend class StatusThread; SERVICE_STATUS_HANDLE _handle; SERVICE_STATUS _status; IceUtil::ThreadPtr _thread; bool _stopped; }; static ServiceStatusManager* serviceStatusManager; // // Interface implemented by SMEventLoggerI and called from // SMEventLoggerIWrapper. // class SMEventLogger : public IceUtil::Shared { public: virtual void print(const string&, const string&) = 0; virtual void trace(const string&, const string&, const string&) = 0; virtual void warning(const string&, const string&) = 0; virtual void error(const string&, const string&) = 0; }; typedef IceUtil::Handle SMEventLoggerPtr; class SMEventLoggerIWrapper : public Ice::Logger { public: SMEventLoggerIWrapper(const SMEventLoggerPtr& logger, const string& prefix) : _logger(logger), _prefix(prefix) { assert(_logger); } virtual void print(const string& message) { _logger->print(_prefix, message); } void trace(const string& category, const string& message) { _logger->trace(_prefix, category, message); } virtual void warning(const string& message) { _logger->warning(_prefix, message); } virtual void error(const string& message) { _logger->error(_prefix, message); } virtual Ice::LoggerPtr cloneWithPrefix(const string& prefix) { return new SMEventLoggerIWrapper(_logger, prefix); } private: SMEventLoggerPtr _logger; string _prefix; }; class SMEventLoggerI : public Ice::Logger, public SMEventLogger { public: SMEventLoggerI(const string& source, const StringConverterPtr& stringConverter) : _stringConverter(stringConverter) { _source = RegisterEventSourceW(0, IceUtil::stringToWstring( nativeToUTF8(_stringConverter, mangleSource(source))).c_str()); if(_source == 0) { SyscallException ex(__FILE__, __LINE__); ex.error = GetLastError(); throw ex; } } ~SMEventLoggerI() { assert(_source != 0); DeregisterEventSource(_source); } static void addKeys(const string& source, const StringConverterPtr& stringConverter) { HKEY hKey; DWORD d; LONG err = RegCreateKeyExW(HKEY_LOCAL_MACHINE, IceUtil::stringToWstring(nativeToUTF8(stringConverter, createKey(source))).c_str(), 0, const_cast(L"REG_SZ"), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, &d); if(err != ERROR_SUCCESS) { SyscallException ex(__FILE__, __LINE__); ex.error = err; throw ex; } // // Get the filename of this DLL. // wchar_t path[_MAX_PATH]; assert(_module != 0); if(!GetModuleFileNameW(_module, path, _MAX_PATH)) { RegCloseKey(hKey); SyscallException ex(__FILE__, __LINE__); ex.error = GetLastError(); throw ex; } // // The event resources are bundled into this DLL, therefore // the "EventMessageFile" key should contain the path to this // DLL. // err = RegSetValueExW(hKey, L"EventMessageFile", 0, REG_EXPAND_SZ, reinterpret_cast(path), static_cast((wcslen(path) * sizeof(wchar_t)) + 1)); if(err == ERROR_SUCCESS) { // // The "TypesSupported" key indicates the supported event // types. // DWORD typesSupported = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; err = RegSetValueExW(hKey, L"TypesSupported", 0, REG_DWORD, reinterpret_cast(&typesSupported), sizeof(typesSupported)); } if(err != ERROR_SUCCESS) { RegCloseKey(hKey); SyscallException ex(__FILE__, __LINE__); ex.error = err; throw ex; } RegCloseKey(hKey); } static void removeKeys(const string& source, const StringConverterPtr& stringConverter) { LONG err = RegDeleteKeyW(HKEY_LOCAL_MACHINE, IceUtil::stringToWstring(nativeToUTF8(stringConverter, createKey(source))).c_str()); if(err != ERROR_SUCCESS) { SyscallException ex(__FILE__, __LINE__); ex.error = err; throw ex; } } virtual void print(const string& prefix, const string& message) { string s; if(!prefix.empty()) { s = prefix; s.append(": "); } s.append(message); print(s); } virtual void print(const string& message) { wstring msg = IceUtil::stringToWstring(nativeToUTF8(_stringConverter, message)); const wchar_t* messages[1]; messages[0] = msg.c_str(); // // We ignore any failures from ReportEvent since there isn't // anything we can do about it. // ReportEventW(_source, EVENTLOG_INFORMATION_TYPE, 0, EVENT_LOGGER_MSG, 0, 1, 0, messages, 0); } virtual void trace(const string& prefix, const string& category, const string& message) { string s; if(!category.empty()) { s = category; s.append(": "); } s.append(message); trace(prefix, s); } virtual void trace(const string& category, const string& message) { string s; if(!category.empty()) { s = category; s.append(": "); } s.append(message); wstring msg = IceUtil::stringToWstring(nativeToUTF8(_stringConverter, s)); const wchar_t* messages[1]; messages[0] = msg.c_str(); // // We ignore any failures from ReportEvent since there isn't // anything we can do about it. // ReportEventW(_source, EVENTLOG_INFORMATION_TYPE, 0, EVENT_LOGGER_MSG, 0, 1, 0, messages, 0); } virtual void warning(const string& prefix, const string& message) { string s; if(!prefix.empty()) { s = prefix; s.append(": "); } s.append(message); warning(s); } virtual void warning(const string& message) { wstring msg = IceUtil::stringToWstring(nativeToUTF8(_stringConverter, message)); const wchar_t* messages[1]; messages[0] = msg.c_str(); // // We ignore any failures from ReportEvent since there isn't // anything we can do about it. // ReportEventW(_source, EVENTLOG_WARNING_TYPE, 0, EVENT_LOGGER_MSG, 0, 1, 0, messages, 0); } virtual void error(const string& prefix, const string& message) { string s; if(!prefix.empty()) { s = prefix; s.append(": "); } s.append(message); error(s); } virtual void error(const string& message) { wstring msg = IceUtil::stringToWstring(nativeToUTF8(_stringConverter, message)); const wchar_t* messages[1]; messages[0] = msg.c_str(); // // We ignore any failures from ReportEvent since there isn't // anything we can do about it. // ReportEventW(_source, EVENTLOG_ERROR_TYPE, 0, EVENT_LOGGER_MSG, 0, 1, 0, messages, 0); } virtual Ice::LoggerPtr cloneWithPrefix(const string& prefix) { return new SMEventLoggerIWrapper(this, prefix); } static void setModuleHandle(HMODULE module) { _module = module; } private: static string mangleSource(string name) { // // The source name cannot contain backslashes. // string::size_type pos = 0; while((pos = name.find('\\', pos)) != string::npos) { name[pos] = '/'; } return name; } static string createKey(string name) { // // The registry key is: // // HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application. // return "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\" + mangleSource(name); } StringConverterPtr _stringConverter; HANDLE _source; static HMODULE _module; }; HMODULE SMEventLoggerI::_module = 0; } #endif Ice::Service::Service() { assert(_instance == 0); _nohup = true; _service = false; _instance = this; #ifndef _WIN32 _changeDirectory = true; _closeFiles = true; #endif } Ice::Service::~Service() { _instance = 0; delete _ctrlCHandler; } bool Ice::Service::shutdown() { if(_communicator) { try { _communicator->shutdown(); } catch(const CommunicatorDestroyedException&) { // // Expected if the service communicator is being destroyed. // } catch(const std::exception& ex) { ServiceWarning warn(this); warn << "exception during shutdown:\n" << ex; } catch(...) { warning("unknown exception during shutdown"); } } return true; } void Ice::Service::interrupt() { shutdown(); } int Ice::Service::main(int& argc, char* argv[], const InitializationData& initializationData) { _name = ""; if(argc > 0) { _name = argv[0]; } // // We parse the properties here to extract Ice.ProgramName and // Ice.EventLog.Source on Windows. // InitializationData initData = initializationData; try { initData.properties = createProperties(argc, argv, initData.properties, initData.stringConverter); } catch(const Ice::Exception& ex) { ServiceError err(this); err << "createProperties failed: " << ex; return EXIT_FAILURE; } #ifdef _WIN32 // // First check for the --service option. // string name; string eventLogSource; int idx = 1; while(idx < argc) { if(strcmp(argv[idx], "--service") == 0) { if(idx + 1 >= argc) { error("service name argument expected for `" + string(argv[idx]) + "'"); return EXIT_FAILURE; } name = argv[idx + 1]; // // If the process logger is the default logger then we use // our own logger. // _logger = getProcessLogger(); if(LoggerIPtr::dynamicCast(_logger)) { string eventLogSource = initData.properties->getPropertyWithDefault("Ice.EventLog.Source", name); _logger = new SMEventLoggerIWrapper(new SMEventLoggerI(eventLogSource, initData.stringConverter), ""); setProcessLogger(_logger); } for(int i = idx; i + 2 < argc; ++i) { argv[i] = argv[i + 2]; } argc -= 2; } else { ++idx; } } if(!name.empty()) { configureService(name); } #else // // Check for --daemon, --noclose, --nochdir and --pidfile. // bool daemonize = false; bool closeFiles = true; bool changeDirectory = true; string pidFile; int idx = 1; while(idx < argc) { if(strcmp(argv[idx], "--daemon") == 0) { for(int i = idx; i + 1 < argc; ++i) { argv[i] = argv[i + 1]; } argc -= 1; daemonize = true; } else if(strcmp(argv[idx], "--noclose") == 0) { for(int i = idx; i + 1 < argc; ++i) { argv[i] = argv[i + 1]; } argc -= 1; closeFiles = false; } else if(strcmp(argv[idx], "--nochdir") == 0) { for(int i = idx; i + 1 < argc; ++i) { argv[i] = argv[i + 1]; } argc -= 1; changeDirectory = false; } else if(strcmp(argv[idx], "--pidfile") == 0) { if(idx + 1 < argc) { pidFile = argv[idx + 1]; } else { if(argv[0]) { cerr << argv[0] << ": "; } cerr << "--pidfile must be followed by an argument" << endl; return EXIT_FAILURE; } for(int i = idx; i + 2 < argc; ++i) { argv[i] = argv[i + 2]; } argc -= 2; } else { ++idx; } } if(!closeFiles && !daemonize) { if(argv[0]) { cerr << argv[0] << ": "; } cerr << "--noclose must be used with --daemon" << endl; return EXIT_FAILURE; } if(pidFile.size() > 0 && !daemonize) { if(argv[0]) { cerr << argv[0] << ": "; } cerr << "--pidfile must be used with --daemon" << endl; return EXIT_FAILURE; } if(daemonize) { configureDaemon(changeDirectory, closeFiles, pidFile); } #endif // // If no logger has been set yet, we set it to the process logger. If the // process logger is the default logger, we change it to a logger which is // using the program name for the prefix. // if(!_logger) { _logger = getProcessLogger(); if(LoggerIPtr::dynamicCast(_logger)) { _logger = new LoggerI(initData.properties->getProperty("Ice.ProgramName"), ""); setProcessLogger(_logger); } } return run(argc, argv, initData); } int Ice::Service::main(int argc, char* const argv[], const InitializationData& initializationData) { IceUtilInternal::ArgVector av(argc, argv); return main(av.argc, av.argv, initializationData); } #ifdef _WIN32 int Ice::Service::main(int& argc, wchar_t* argv[], const InitializationData& initializationData) { # ifdef __MINGW32__ // COMPILER FIX // // MinGW doesn't see the main overload if we don't create the temp args object here. // Ice::StringSeq args = Ice::argsToStringSeq(argc, argv, initializationData.stringConverter); return main(args, initializationData); # else return main(Ice::argsToStringSeq(argc, argv, initializationData.stringConverter), initializationData); # endif } #endif int Ice::Service::main(StringSeq& args, const InitializationData& initData) { IceUtilInternal::ArgVector av(args); return main(av.argc, av.argv, initData); } Ice::CommunicatorPtr Ice::Service::communicator() const { return _communicator; } Ice::Service* Ice::Service::instance() { return _instance; } bool Ice::Service::service() const { return _service; } string Ice::Service::name() const { return _name; } bool Ice::Service::checkSystem() const { #ifdef _WIN32 // // Check Windows version. // OSVERSIONINFO ver; ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&ver); return (ver.dwPlatformId == VER_PLATFORM_WIN32_NT); #else return true; #endif } #ifdef _WIN32 int Ice::Service::run(int& argc, wchar_t* argv[], const InitializationData& initData) { StringSeq args = Ice::argsToStringSeq(argc, argv, initData.stringConverter); IceUtilInternal::ArgVector av(args); return run(av.argc, av.argv, initData); } #endif int Ice::Service::run(int& argc, char* argv[], const InitializationData& initData) { if(_service) { #ifdef _WIN32 return runService(argc, argv, initData); #else return runDaemon(argc, argv, initData); #endif } // // Run as a foreground process. // int status = EXIT_FAILURE; try { // // Create the CtrlCHandler after any potential forking so that signals // are initialized properly. We do this before initializing the // communicator because we need to ensure that this is done before any // additional threads are created. // _ctrlCHandler = new IceUtil::CtrlCHandler; // // Initialize the communicator. // _communicator = initializeCommunicator(argc, argv, initData); // // Use the configured logger. // _logger = _communicator->getLogger(); // // Determines whether we ignore SIGHUP/CTRL_LOGOFF_EVENT. // _nohup = _communicator->getProperties()->getPropertyAsIntWithDefault("Ice.Nohup", 1) > 0; // // Start the service. // if(start(argc, argv, status)) { // // Wait for service shutdown. // waitForShutdown(); // // Stop the service. // if(stop()) { status = EXIT_SUCCESS; } } } catch(const std::exception& ex) { ServiceError err(this); err << "service caught unhandled exception:\n" << ex; } catch(const std::string& msg) { ServiceError err(this); err << "service caught unhandled exception:\n" << msg; } catch(const char* msg) { ServiceError err(this); err << "service caught unhandled exception:\n" << msg; } catch(...) { error("service caught unhandled C++ exception"); } if(_communicator) { try { _communicator->destroy(); } catch(...) { } } return status; } #ifdef _WIN32 void Ice::Service::configureService(const string& name) { _service = true; _name = name; } void Ice::Service::setModuleHandle(HMODULE module) { SMEventLoggerI::setModuleHandle(module); } #else void Ice::Service::configureDaemon(bool changeDirectory, bool closeFiles, const string& pidFile) { _service = true; _changeDirectory = changeDirectory; _closeFiles = closeFiles; _pidFile = pidFile; } #endif void Ice::Service::handleInterrupt(int sig) { #ifdef _WIN32 if(_nohup && sig == CTRL_LOGOFF_EVENT) { return; } #else if(_nohup && sig == SIGHUP) { return; } #endif interrupt(); } void Ice::Service::waitForShutdown() { if(_communicator) { enableInterrupt(); _communicator->waitForShutdown(); disableInterrupt(); } } bool Ice::Service::stop() { return true; } Ice::CommunicatorPtr Ice::Service::initializeCommunicator(int& argc, char* argv[], const InitializationData& initData) { return Ice::initialize(argc, argv, initData); } void Ice::Service::syserror(const string& msg) { string errmsg = IceUtilInternal::lastErrorToString(); if(_logger) { ostringstream ostr; if(!msg.empty()) { ostr << msg << endl; } if(!errmsg.empty()) { ostr << errmsg; } _logger->error(ostr.str()); } else { if(!_name.empty()) { cerr << _name << ": "; } if(!msg.empty()) { cerr << msg << endl; } if(!errmsg.empty()) { cerr << errmsg; } } } void Ice::Service::error(const string& msg) { if(_logger) { _logger->error(msg); } else { if(!_name.empty()) { cerr << _name << ": "; } cerr << "error: " << msg << endl; } } void Ice::Service::warning(const string& msg) { if(_logger) { _logger->warning(msg); } else { if(!_name.empty()) { cerr << _name << ": "; } cerr << "warning: " << msg << endl; } } void Ice::Service::trace(const string& msg) { if(_logger) { _logger->trace("", msg); } else { cerr << msg << endl; } } void Ice::Service::print(const string& msg) { if(_logger) { _logger->print(msg); } else { cerr << msg << endl; } } void Ice::Service::enableInterrupt() { _ctrlCHandler->setCallback(ctrlCHandlerCallback); } void Ice::Service::disableInterrupt() { _ctrlCHandler->setCallback(0); } #ifdef _WIN32 int Ice::Service::runService(int argc, char* argv[], const InitializationData& initData) { assert(_service); if(!checkSystem()) { error("Win32 service not supported on Windows 9x/ME"); return EXIT_FAILURE; } if(_name.empty()) { error("invalid name for Win32 service"); return EXIT_FAILURE; } // // Arguments passed to the executable are not passed to the service's main function, // so save them now and serviceMain will merge them later. // for(int idx = 1; idx < argc; ++idx) { _serviceArgs.push_back(argv[idx]); } _initData = initData; SERVICE_TABLE_ENTRYW ste[] = { { const_cast(IceUtil::stringToWstring(nativeToUTF8(_initData.stringConverter, _name)).c_str()), Ice_Service_ServiceMain }, { 0, 0 }, }; // // Start the service. // if(!StartServiceCtrlDispatcherW(ste)) { syserror("unable to start service control dispatcher"); return EXIT_FAILURE; } return EXIT_SUCCESS; } void Ice::Service::terminateService(DWORD exitCode) { serviceStatusManager->stopUpdate(); delete serviceStatusManager; serviceStatusManager = 0; SERVICE_STATUS status; status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; status.dwCurrentState = SERVICE_STOPPED; status.dwControlsAccepted = 0; if(exitCode != 0) { status.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR; } else { status.dwWin32ExitCode = 0; } status.dwServiceSpecificExitCode = exitCode; status.dwCheckPoint = 0; status.dwWaitHint = 0; SetServiceStatus(_statusHandle, &status); } bool Ice::Service::waitForServiceState(SC_HANDLE hService, DWORD pendingState, SERVICE_STATUS& status) { if(!QueryServiceStatus(hService, &status)) { return false; } // // Save the tick count and initial checkpoint. // DWORD startTickCount = GetTickCount(); DWORD oldCheckPoint = status.dwCheckPoint; // // Loop while the service is in the pending state. // while(status.dwCurrentState == pendingState) { // // Do not wait longer than the wait hint. A good interval is // one tenth the wait hint, but no less than 1 second and no // more than 10 seconds. // DWORD waitTime = status.dwWaitHint / 10; if(waitTime < 1000) { waitTime = 1000; } else if(waitTime > 10000) { waitTime = 10000; } Sleep(waitTime); // // Check the status again. // if(!QueryServiceStatus(hService, &status)) { return false; } if(status.dwCheckPoint > oldCheckPoint) { // // The service is making progress. // startTickCount = GetTickCount(); oldCheckPoint = status.dwCheckPoint; } else { if(GetTickCount() - startTickCount > status.dwWaitHint) { // // No progress made within the wait hint. // break; } } } return true; } void Ice::Service::showServiceStatus(const string& msg, SERVICE_STATUS& status) { string state; switch(status.dwCurrentState) { case SERVICE_STOPPED: state = "STOPPED"; break; case SERVICE_START_PENDING: state = "START PENDING"; break; case SERVICE_STOP_PENDING: state = "STOP PENDING"; break; case SERVICE_RUNNING: state = "RUNNING"; break; case SERVICE_CONTINUE_PENDING: state = "CONTINUE PENDING"; break; case SERVICE_PAUSE_PENDING: state = "PAUSE PENDING"; break; case SERVICE_PAUSED: state = "PAUSED"; break; default: state = "UNKNOWN"; break; } ServiceTrace tr(this); tr << msg << "\n Current state: " << state << "\n Exit code: " << status.dwWin32ExitCode << "\n Service specific exit code: " << status.dwServiceSpecificExitCode << "\n Check point: " << status.dwCheckPoint << "\n Wait hint: " << status.dwWaitHint; } void Ice::Service::serviceMain(int argc, wchar_t* argv[]) { _ctrlCHandler = new IceUtil::CtrlCHandler; // // Register the control handler function. // _statusHandle = RegisterServiceCtrlHandlerW(argv[0], Ice_Service_CtrlHandler); if(_statusHandle == (SERVICE_STATUS_HANDLE)0) { syserror("unable to register service control handler"); return; } // // Create the service status manager and start a thread to periodically // update the service's status with the service control manager (SCM). // The SCM must receive periodic updates otherwise it assumes that // initialization failed and terminates the service. // serviceStatusManager = new ServiceStatusManager(_statusHandle); serviceStatusManager->startUpdate(SERVICE_START_PENDING); // // Merge the executable's arguments with the service's arguments. // char** args = new char*[_serviceArgs.size() + argc]; args[0] = const_cast(UTF8ToNative(_initData.stringConverter, IceUtil::wstringToString(argv[0])).c_str()); int i = 1; for(vector::iterator p = _serviceArgs.begin(); p != _serviceArgs.end(); ++p) { args[i++] = const_cast(p->c_str()); } for(int j = 1; j < argc; ++j) { args[i++] = const_cast(UTF8ToNative(_initData.stringConverter, IceUtil::wstringToString(argv[j])).c_str()); } argc += static_cast(_serviceArgs.size()); // // If we can't initialize a communicator, then stop immediately. // try { _communicator = initializeCommunicator(argc, args, _initData); } catch(const Ice::Exception& ex) { delete[] args; { ServiceError err(this); err << "exception occurred while initializing a communicator:\n" << ex; } terminateService(EXIT_FAILURE); return; } catch(...) { delete[] args; error("unknown exception occurred while initializing a communicator"); terminateService(EXIT_FAILURE); return; } // // Use the configured logger. // _logger = _communicator->getLogger(); // // Determines whether we ignore SIGHUP/CTRL_LOGOFF_EVENT. // _nohup = _communicator->getProperties()->getPropertyAsIntWithDefault("Ice.Nohup", 1) > 0; DWORD status = EXIT_FAILURE; try { int tmpStatus = EXIT_FAILURE; if(start(argc, args, tmpStatus)) { trace("Service started successfully."); // // Change the current status from START_PENDING to RUNNING. // serviceStatusManager->stopUpdate(); serviceStatusManager->changeStatus(SERVICE_RUNNING, SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); // // Wait for the service to be shut down. // waitForShutdown(); // // Give the service a chance to clean up. // if(stop()) { status = EXIT_SUCCESS; } } else { status = tmpStatus; } } catch(const std::exception& ex) { ServiceError err(this); err << "service caught unhandled std::exception:\n" << ex; } catch(...) { error("service caught unhandled C++ exception"); } delete[] args; try { assert(_communicator); _communicator->destroy(); } catch(...) { } terminateService(status); } void Ice::Service::control(int ctrl) { assert(serviceStatusManager); switch(ctrl) { case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_STOP: { serviceStatusManager->startUpdate(SERVICE_STOP_PENDING); shutdown(); break; } default: { if(ctrl != SERVICE_CONTROL_INTERROGATE) { ServiceError err(this); err << "unrecognized service control code " << ctrl; } serviceStatusManager->reportStatus(); break; } } } ServiceStatusManager::ServiceStatusManager(SERVICE_STATUS_HANDLE handle) : _handle(handle), _stopped(false) { _status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; _status.dwControlsAccepted = 0; _status.dwWin32ExitCode = 0; _status.dwServiceSpecificExitCode = 0; _status.dwCheckPoint = 0; _status.dwWaitHint = 0; } void ServiceStatusManager::startUpdate(DWORD state) { Lock sync(*this); assert(state == SERVICE_START_PENDING || state == SERVICE_STOP_PENDING); assert(!_thread); _status.dwCurrentState = state; _status.dwControlsAccepted = 0; // Don't accept any other control messages while pending. _stopped = false; _thread = new StatusThread(this); _thread->start(); } void ServiceStatusManager::stopUpdate() { IceUtil::ThreadPtr thread; { Lock sync(*this); if(_thread) { _stopped = true; notify(); thread = _thread; _thread = 0; } } if(thread) { thread->getThreadControl().join(); } } void ServiceStatusManager::changeStatus(DWORD state, DWORD controlsAccepted) { Lock sync(*this); _status.dwCurrentState = state; _status.dwControlsAccepted = controlsAccepted; SetServiceStatus(_handle, &_status); } void ServiceStatusManager::reportStatus() { Lock sync(*this); SetServiceStatus(_handle, &_status); } void ServiceStatusManager::run() { Lock sync(*this); IceUtil::Time delay = IceUtil::Time::milliSeconds(1000); _status.dwWaitHint = 2000; _status.dwCheckPoint = 0; while(!_stopped) { _status.dwCheckPoint++; SetServiceStatus(_handle, &_status); timedWait(delay); } } #else int Ice::Service::runDaemon(int argc, char* argv[], const InitializationData& initData) { assert(_service); // // Create a pipe that is used to notify the parent when the child is ready. // SOCKET fds[2]; IceInternal::createPipe(fds); // // Fork the child. // pid_t pid = fork(); if(pid < 0) { if(argv[0]) { cerr << argv[0] << ": "; } cerr << strerror(errno) << endl; return EXIT_FAILURE; } if(pid != 0) { // // Parent process. // // // Close an unused end of the pipe. // close(fds[1]); // // Wait for the child to write a byte to the pipe to indicate that it // is ready to receive requests, or that an error occurred. // char c = 0; while(true) { if(read(fds[0], &c, 1) == -1) { if(IceInternal::interrupted()) { continue; } if(argv[0]) { cerr << argv[0] << ": "; } cerr << strerror(errno) << endl; _exit(EXIT_FAILURE); } break; } if(c != 0) { // // Read an error message. // char msg[1024]; size_t pos = 0; while(pos < sizeof(msg)) { ssize_t n = read(fds[0], &msg[pos], sizeof(msg) - pos); if(n == -1) { if(IceInternal::interrupted()) { continue; } if(argv[0]) { cerr << ": "; } cerr << "I/O error while reading error message from child:\n" << strerror(errno) << endl; _exit(EXIT_FAILURE); } pos += n; break; } if(argv[0]) { cerr << argv[0] << ": "; } cerr << "failure occurred in daemon"; if(strlen(msg) > 0) { cerr << ':' << endl << msg; } cerr << endl; _exit(EXIT_FAILURE); } _exit(EXIT_SUCCESS); } // // Child process. // string errMsg; int status = EXIT_FAILURE; try { // // Become a session and process group leader. // if(setsid() == -1) { SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } // // Ignore SIGHUP so that the grandchild process is not sent SIGHUP when this // process exits. // signal(SIGHUP, SIG_IGN); // // Fork again to eliminate the possibility of acquiring a controlling terminal. // pid = fork(); if(pid < 0) { SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } if(pid != 0) { exit(0); } if(_changeDirectory) { // // Change the working directory. // if(chdir("/") != 0) { SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } } vector fdsToClose; if(_closeFiles) { // // Take a snapshot of the open file descriptors. We don't actually close these // descriptors until after the communicator is initialized, so that plug-ins // have an opportunity to use stdin/stdout/stderr if necessary. This also // conveniently allows the Ice.PrintProcessId property to work as expected. // int fdMax = static_cast(sysconf(_SC_OPEN_MAX)); if(fdMax <= 0) { SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } for(int i = 0; i < fdMax; ++i) { if(fcntl(i, F_GETFL) != -1) { // // Don't close the write end of the pipe. // if(i != fds[1]) { fdsToClose.push_back(i); } } } } // // Create the CtrlCHandler after forking the child so that signals are initialized // properly. We do this before initializing the communicator because we need to // ensure that signals are initialized before additional threads are created. The // communicator thread pools currently use lazy initialization, but a thread can // be created to monitor connections. // _ctrlCHandler = new IceUtil::CtrlCHandler; // // Initialize the communicator. // _communicator = initializeCommunicator(argc, argv, initData); if(_closeFiles) { // // Close unnecessary file descriptors. // PropertiesPtr properties = _communicator->getProperties(); string stdOut = properties->getProperty("Ice.StdOut"); string stdErr = properties->getProperty("Ice.StdErr"); for(vector::const_iterator p = fdsToClose.begin(); p != fdsToClose.end(); ++p) { // // NOTE: Do not close stdout if Ice.StdOut is defined. Likewise for Ice.StdErr. // if((*p == 1 && !stdOut.empty()) || (*p == 2 && !stdErr.empty())) { continue; } close(*p); } // // Associate stdin, stdout and stderr with /dev/null. // int fd = open("/dev/null", O_RDWR); assert(fd == 0); if(fd != 0) { SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } if(stdOut.empty()) { fd = dup2(0, 1); assert(fd == 1); if(fd != 1) { SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } } if(stdErr.empty()) { fd = dup2(1, 2); assert(fd == 2); if(fd != 2) { SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } } } // // Write PID // if(_pidFile.size() > 0) { IceUtilInternal::ofstream of(Ice::nativeToUTF8(_communicator, _pidFile)); of << getpid() << endl; if(!of) { warning("Could not write PID file " + _pidFile); } } // // Use the configured logger. // _logger = _communicator->getLogger(); // // Start the service. // if(start(argc, argv, status)) { // // Notify the parent that the child is ready. // char c = 0; while(true) { if(write(fds[1], &c, 1) == -1) { if(IceInternal::interrupted()) { continue; } } break; } close(fds[1]); fds[1] = -1; // // Wait for service shutdown. // waitForShutdown(); // // Stop the service. // if(stop()) { status = EXIT_SUCCESS; } } } catch(const std::exception& ex) { ServiceError err(this); err << "service caught unhandled std::exception:\n" << ex; errMsg = err.str(); } catch(...) { errMsg = "service caught unhandled C++ exception"; error(errMsg); } // // If the service failed and the pipe to the parent is still open, // then send an error notification to the parent. // if(status != EXIT_SUCCESS && fds[1] != -1) { char c = 1; while(true) { if(write(fds[1], &c, 1) == -1) { if(IceInternal::interrupted()) { continue; } } break; } const char* msg = errMsg.c_str(); size_t len = strlen(msg) + 1; // Include null byte size_t pos = 0; while(len > 0) { ssize_t n = write(fds[1], &msg[pos], len); if(n == -1) { if(IceInternal::interrupted()) { continue; } else { break; } } len -= n; pos += n; } close(fds[1]); } if(_communicator) { try { _communicator->destroy(); } catch(...) { } } return status; } #endif Ice-3.5.1/cpp/src/Ice/DynamicLibrary.cpp0000644000076400007640000001417412223561476016067 0ustar mesmes// ********************************************************************** // // 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 #include #include #ifndef _WIN32 # include #endif using namespace Ice; using namespace IceInternal; using namespace std; IceUtil::Shared* IceInternal::upCast(DynamicLibrary* p) { return p; } IceUtil::Shared* IceInternal::upCast(DynamicLibraryList* p) { return p; } IceInternal::DynamicLibrary::DynamicLibrary(const Ice::StringConverterPtr& stringConverter) : _hnd(0), _stringConverter(stringConverter) { } IceInternal::DynamicLibrary::~DynamicLibrary() { /* * Closing the library here can cause a crash at program exit if * the application holds references to library resources in global * or static variables. Instead, we let the process discard the * library. * if(_hnd != 0) { #ifdef _WIN32 FreeLibrary(_hnd); #else dlclose(_hnd); #endif } */ } IceInternal::DynamicLibrary::symbol_type IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIceVersion) { string::size_type colon = entryPoint.rfind(':'); #ifdef _WIN32 const string driveLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; if(colon == 1 && driveLetters.find(entryPoint[0]) != string::npos && (entryPoint[2] == '\\' || entryPoint[2] == '/')) { // // The only colon we found is in the drive specification, as in "C:\MyDir". // This means the function name is missing. // colon = string::npos; } #endif if(colon == string::npos || colon == entryPoint.size() - 1) { _err = "invalid entry point format `" + entryPoint + "'"; return 0; } string libSpec = entryPoint.substr(0, colon); string funcName = entryPoint.substr(colon + 1); string libPath, libName, version, debug; #ifdef _WIN32 string::size_type separator = libSpec.find_last_of("/\\"); #else string::size_type separator = libSpec.rfind('/'); #endif if(separator != string::npos) { libPath = libSpec.substr(0, separator + 1); libSpec = libSpec.substr(separator + 1); } string::size_type comma = libSpec.find(','); if(comma == string::npos) { libName = libSpec; if(useIceVersion) { int majorVersion = (ICE_INT_VERSION / 10000); int minorVersion = (ICE_INT_VERSION / 100) - majorVersion * 100; ostringstream os; os << majorVersion * 10 + minorVersion; int patchVersion = ICE_INT_VERSION % 100; if(patchVersion > 50) { os << 'b'; if(patchVersion >= 52) { os << (patchVersion - 50); } } version = os.str(); } } else { if(comma == libSpec.size() - 1) { _err = "invalid entry point format `" + entryPoint + "'"; return 0; } libName = libSpec.substr(0, comma); version = libSpec.substr(comma + 1); } string lib = libPath; #ifdef _WIN32 lib += libName; lib += version; # if defined(_DEBUG) && !defined(__MINGW32__) lib += 'd'; # endif # ifdef COMPSUFFIX lib += COMPSUFFIX; # endif lib += ".dll"; #elif defined(__APPLE__) lib += "lib" + libName; if(!version.empty()) { lib += "." + version; } #elif defined(__hpux) lib += "lib" + libName; if(!version.empty()) { lib += "." + version; } else { lib += ".sl"; } #elif defined(_AIX) lib += "lib" + libName + ".a(lib" + libName + ".so"; if(!version.empty()) { lib += "." + version; } lib += ")"; #else lib += "lib" + libName + ".so"; if(!version.empty()) { lib += "." + version; } #endif #ifdef __APPLE__ // // On OS X fallback to .so and .bundle extensions, if the default // .dylib fails. // if(!load(lib + ".dylib")) { string errMsg = _err; if(!load(lib + ".so")) { errMsg += "; " + _err; if(!load(lib + ".bundle")) { _err = errMsg + "; " + _err; return 0; } } _err = ""; } #else if(!load(lib)) { return 0; } #endif return getSymbol(funcName); } bool IceInternal::DynamicLibrary::load(const string& lib) { #ifdef ICE_OS_WINRT _hnd = LoadPackagedLibrary(IceUtil::stringToWstring(nativeToUTF8(_stringConverter, lib)).c_str(), 0); #elif defined(_WIN32) _hnd = LoadLibraryW(IceUtil::stringToWstring(nativeToUTF8(_stringConverter, lib)).c_str()); #else int flags = RTLD_NOW | RTLD_GLOBAL; #ifdef _AIX flags |= RTLD_MEMBER; #endif _hnd = dlopen(lib.c_str(), flags); #endif if(_hnd == 0) { // // Remember the most recent error in _err. // #ifdef _WIN32 _err = IceUtilInternal::lastErrorToString(); #else const char* err = dlerror(); if(err) { _err = err; } #endif } return _hnd != 0; } IceInternal::DynamicLibrary::symbol_type IceInternal::DynamicLibrary::getSymbol(const string& name) { assert(_hnd != 0); #ifdef _WIN32 symbol_type result = GetProcAddress(_hnd, name.c_str()); #else symbol_type result = dlsym(_hnd, name.c_str()); #endif if(result == 0) { // // Remember the most recent error in _err. // #ifdef _WIN32 _err = IceUtilInternal::lastErrorToString(); #else const char* err = dlerror(); if(err) { _err = err; } #endif } return result; } const string& IceInternal::DynamicLibrary::getErrorMessage() const { return _err; } void IceInternal::DynamicLibraryList::add(const DynamicLibraryPtr& library) { _libraries.push_back(library); } Ice-3.5.1/cpp/src/Ice/TcpTransceiver.cpp0000644000076400007640000004073412223561476016113 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; NativeInfoPtr IceInternal::TcpTransceiver::getNativeInfo() { return this; } #ifdef ICE_USE_IOCP AsyncInfo* IceInternal::TcpTransceiver::getAsyncInfo(SocketOperation status) { switch(status) { case SocketOperationRead: return &_read; case SocketOperationWrite: return &_write; default: assert(false); return 0; } } #endif SocketOperation IceInternal::TcpTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer) { try { if(_state == StateNeedConnect) { _state = StateConnectPending; return SocketOperationConnect; } else if(_state <= StateConnectPending) { #ifdef ICE_USE_IOCP doFinishConnectAsync(_fd, _write); #else doFinishConnect(_fd); #endif _desc = fdToString(_fd, _proxy, _addr, true); if(_proxy) { // // Prepare the read & write buffers in advance. // _proxy->beginWriteConnectRequest(_addr, writeBuffer); _proxy->beginReadConnectRequestResponse(readBuffer); #ifdef ICE_USE_IOCP // // Return SocketOperationWrite to indicate we need to start a write. // _state = StateProxyConnectRequest; // Send proxy connect request return IceInternal::SocketOperationWrite; #else // // Write the proxy connection message. // if(write(writeBuffer)) { // // Write completed without blocking. // _proxy->endWriteConnectRequest(writeBuffer); // // Try to read the response. // if(read(readBuffer)) { // // Read completed without blocking - fall through. // _proxy->endReadConnectRequestResponse(readBuffer); } else { // // Return SocketOperationRead to indicate we need to complete the read. // _state = StateProxyConnectRequestPending; // Wait for proxy response return SocketOperationRead; } } else { // // Return SocketOperationWrite to indicate we need to complete the write. // _state = StateProxyConnectRequest; // Send proxy connect request return SocketOperationWrite; } #endif } _state = StateConnected; } else if(_state == StateProxyConnectRequest) { // // Write completed. // _proxy->endWriteConnectRequest(writeBuffer); _state = StateProxyConnectRequestPending; // Wait for proxy response return SocketOperationRead; } else if(_state == StateProxyConnectRequestPending) { // // Read completed. // _proxy->endReadConnectRequestResponse(readBuffer); _state = StateConnected; } } catch(const Ice::LocalException& ex) { if(_traceLevels->network >= 2) { Trace out(_logger, _traceLevels->networkCat); out << "failed to establish tcp connection\n" << fdToString(_fd, _proxy, _addr, false) << "\n" << ex; } throw; } assert(_state == StateConnected); if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "tcp connection established\n" << _desc; } return SocketOperationNone; } void IceInternal::TcpTransceiver::close() { // // If the transceiver is not connected, its description is simply "not connected", // which isn't very helpful. // if(_state == StateConnected && _traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "closing tcp connection\n" << toString(); } assert(_fd != INVALID_SOCKET); try { closeSocket(_fd); _fd = INVALID_SOCKET; } catch(const SocketException&) { _fd = INVALID_SOCKET; throw; } } bool IceInternal::TcpTransceiver::write(Buffer& buf) { // // It's impossible for packetSize to be more than an Int. // int packetSize = static_cast(buf.b.end() - buf.i); #ifdef ICE_USE_IOCP // // Limit packet size to avoid performance problems on WIN32 // if(_maxSendPacketSize > 0 && packetSize > _maxSendPacketSize) { packetSize = _maxSendPacketSize; } #endif while(buf.i != buf.b.end()) { assert(_fd != INVALID_SOCKET); ssize_t ret = ::send(_fd, reinterpret_cast(&*buf.i), packetSize, 0); if(ret == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } if(ret == SOCKET_ERROR) { if(interrupted()) { continue; } if(noBuffers() && packetSize > 1024) { packetSize /= 2; continue; } if(wouldBlock()) { return false; } if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } if(_traceLevels->network >= 3) { Trace out(_logger, _traceLevels->networkCat); out << "sent " << ret << " of " << packetSize << " bytes via tcp\n" << toString(); } if(_stats) { _stats->bytesSent(type(), static_cast(ret)); } buf.i += ret; if(packetSize > buf.b.end() - buf.i) { packetSize = static_cast(buf.b.end() - buf.i); } } return true; } bool IceInternal::TcpTransceiver::read(Buffer& buf) { // // It's impossible for packetSize to be more than an Int. // int packetSize = static_cast(buf.b.end() - buf.i); while(buf.i != buf.b.end()) { assert(_fd != INVALID_SOCKET); ssize_t ret = ::recv(_fd, reinterpret_cast(&*buf.i), packetSize, 0); if(ret == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } if(ret == SOCKET_ERROR) { if(interrupted()) { continue; } if(noBuffers() && packetSize > 1024) { packetSize /= 2; continue; } if(wouldBlock()) { return false; } if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } if(_traceLevels->network >= 3) { Trace out(_logger, _traceLevels->networkCat); out << "received " << ret << " of " << packetSize << " bytes via tcp\n" << toString(); } if(_stats) { _stats->bytesReceived(type(), static_cast(ret)); } buf.i += ret; packetSize = static_cast(buf.b.end() - buf.i); } return true; } #ifdef ICE_USE_IOCP bool IceInternal::TcpTransceiver::startWrite(Buffer& buf) { if(_state == StateConnectPending) { Address addr = _proxy ? _proxy->getAddress() : _addr; doConnectAsync(_fd, addr, _write); return false; } assert(!buf.b.empty()); assert(buf.i != buf.b.end()); int packetSize = static_cast(buf.b.end() - buf.i); if(_maxSendPacketSize > 0 && packetSize > _maxSendPacketSize) { packetSize = _maxSendPacketSize; } assert(packetSize > 0); _write.buf.len = packetSize; _write.buf.buf = reinterpret_cast(&*buf.i); int err = WSASend(_fd, &_write.buf, 1, &_write.count, 0, &_write, NULL); if(err == SOCKET_ERROR) { if(!wouldBlock()) { if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } } return packetSize == static_cast(buf.b.end() - buf.i); } void IceInternal::TcpTransceiver::finishWrite(Buffer& buf) { if(_state < StateConnected && _state != StateProxyConnectRequest) { return; } if(static_cast(_write.count) == SOCKET_ERROR) { WSASetLastError(_write.error); if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } if(_traceLevels->network >= 3) { int packetSize = static_cast(buf.b.end() - buf.i); if(_maxSendPacketSize > 0 && packetSize > _maxSendPacketSize) { packetSize = _maxSendPacketSize; } Trace out(_logger, _traceLevels->networkCat); out << "sent " << _write.count << " of " << packetSize << " bytes via tcp\n" << toString(); } if(_stats) { _stats->bytesSent(type(), _write.count); } buf.i += _write.count; } void IceInternal::TcpTransceiver::startRead(Buffer& buf) { int packetSize = static_cast(buf.b.end() - buf.i); if(_maxReceivePacketSize > 0 && packetSize > _maxReceivePacketSize) { packetSize = _maxReceivePacketSize; } assert(!buf.b.empty() && buf.i != buf.b.end()); _read.buf.len = packetSize; _read.buf.buf = reinterpret_cast(&*buf.i); int err = WSARecv(_fd, &_read.buf, 1, &_read.count, &_read.flags, &_read, NULL); if(err == SOCKET_ERROR) { if(!wouldBlock()) { if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } } } void IceInternal::TcpTransceiver::finishRead(Buffer& buf) { if(static_cast(_read.count) == SOCKET_ERROR) { WSASetLastError(_read.error); if(connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } } else if(_read.count == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } if(_traceLevels->network >= 3) { int packetSize = static_cast(buf.b.end() - buf.i); if(_maxReceivePacketSize > 0 && packetSize > _maxReceivePacketSize) { packetSize = _maxReceivePacketSize; } Trace out(_logger, _traceLevels->networkCat); out << "received " << _read.count << " of " << packetSize << " bytes via tcp\n" << toString(); } if(_stats) { _stats->bytesReceived(type(), static_cast(_read.count)); } buf.i += _read.count; } #endif string IceInternal::TcpTransceiver::type() const { return "tcp"; } string IceInternal::TcpTransceiver::toString() const { return _desc; } Ice::ConnectionInfoPtr IceInternal::TcpTransceiver::getInfo() const { Ice::TCPConnectionInfoPtr info = new Ice::TCPConnectionInfo(); fdToAddressAndPort(_fd, info->localAddress, info->localPort, info->remoteAddress, info->remotePort); return info; } void IceInternal::TcpTransceiver::checkSendSize(const Buffer& buf, size_t messageSizeMax) { if(buf.b.size() > messageSizeMax) { Ex::throwMemoryLimitException(__FILE__, __LINE__, buf.b.size(), messageSizeMax); } } IceInternal::TcpTransceiver::TcpTransceiver(const InstancePtr& instance, SOCKET fd, const NetworkProxyPtr& proxy, const Address& addr) : NativeInfo(fd), _proxy(proxy), _addr(addr), _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger), _stats(instance->initializationData().stats), _state(StateNeedConnect) #ifdef ICE_USE_IOCP , _read(SocketOperationRead), _write(SocketOperationWrite) #endif { setBlock(_fd, false); setTcpBufSize(_fd, instance->initializationData().properties, _logger); #ifdef ICE_USE_IOCP // // On Windows, limiting the buffer size is important to prevent // poor throughput performances when transfering large amount of // data. See Microsoft KB article KB823764. // _maxSendPacketSize = IceInternal::getSendBufferSize(fd) / 2; if(_maxSendPacketSize < 512) { _maxSendPacketSize = 0; } _maxReceivePacketSize = IceInternal::getRecvBufferSize(fd); if(_maxReceivePacketSize < 512) { _maxReceivePacketSize = 0; } #endif } IceInternal::TcpTransceiver::TcpTransceiver(const InstancePtr& instance, SOCKET fd) : NativeInfo(fd), _addr(Address()), _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger), _stats(instance->initializationData().stats), _state(StateConnected), _desc(fdToString(_fd)) #ifdef ICE_USE_IOCP , _read(SocketOperationRead), _write(SocketOperationWrite) #endif { setBlock(_fd, false); setTcpBufSize(_fd, instance->initializationData().properties, _logger); #ifdef ICE_USE_IOCP // // On Windows, limiting the buffer size is important to prevent // poor throughput performances when transfering large amount of // data. See Microsoft KB article KB823764. // _maxSendPacketSize = IceInternal::getSendBufferSize(fd) / 2; if(_maxSendPacketSize < 512) { _maxSendPacketSize = 0; } _maxReceivePacketSize = IceInternal::getRecvBufferSize(fd); if(_maxReceivePacketSize < 512) { _maxReceivePacketSize = 0; } #endif } IceInternal::TcpTransceiver::~TcpTransceiver() { assert(_fd == INVALID_SOCKET); } void IceInternal::TcpTransceiver::connect() { #ifndef ICE_USE_IOCP try { Address addr = _proxy ? _proxy->getAddress() : _addr; if(doConnect(_fd, addr)) { _state = StateConnected; _desc = fdToString(_fd, _proxy, _addr, true); if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "tcp connection established\n" << _desc; } } else { _desc = fdToString(_fd, _proxy, _addr, true); } } catch(...) { _fd = INVALID_SOCKET; throw; } #endif } Ice-3.5.1/cpp/src/Ice/StreamI.cpp0000644000076400007640000003161612223561476014522 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** // // We disable deprecation warning here, to allow clean compilation of // of deprecated methods. // #ifdef _MSC_VER # pragma warning( disable : 4996 ) #endif #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; namespace { // // This class implements the internal interface UserExceptionFactory and delegates to // the user-supplied instance of UserExceptionReaderFactory. // class UserExceptionFactoryI : public IceInternal::UserExceptionFactory { public: UserExceptionFactoryI(const UserExceptionReaderFactoryPtr& factory) : _factory(factory) { } virtual void createAndThrow(const string& id) { _factory->createAndThrow(id); } private: const UserExceptionReaderFactoryPtr _factory; }; } // // UserExceptionReader // UserExceptionReader::UserExceptionReader(const CommunicatorPtr& communicator) : _communicator(communicator) { } UserExceptionReader::~UserExceptionReader() throw() { } void UserExceptionReader::__write(BasicStream*) const { assert(false); } void UserExceptionReader::__read(BasicStream* is) { InputStreamI* stream = reinterpret_cast(is->closure()); assert(stream); read(stream); } // // InputStreamI // InputStreamI::InputStreamI(const CommunicatorPtr& communicator, const pair& data, bool copyData) : _communicator(communicator), _closure(0) { Instance* instance = getInstance(communicator).get(); initialize(instance, data, instance->defaultsAndOverrides()->defaultEncoding, copyData); } InputStreamI::InputStreamI(const CommunicatorPtr& communicator, const pair& data, const EncodingVersion& v, bool copyData) : _communicator(communicator), _closure(0) { initialize(getInstance(communicator).get(), data, v, copyData); } InputStreamI::~InputStreamI() { delete _is; } CommunicatorPtr InputStreamI::communicator() const { return _communicator; } void InputStreamI::sliceObjects(bool b) { _is->sliceObjects(b); } Int InputStreamI::readSize() { return _is->readSize(); } Int InputStreamI::readAndCheckSeqSize(int minSize) { return _is->readAndCheckSeqSize(minSize); } ObjectPrx InputStreamI::readProxy() { ObjectPrx v; _is->read(v); return v; } namespace { void patchObject(void* addr, const ObjectPtr& v) { ReadObjectCallback* cb = static_cast(addr); assert(cb); cb->invoke(v); } } void InputStreamI::readObject(const ReadObjectCallbackPtr& cb) { _callbacks.push_back(cb); // Keep reference to callback. _is->read(patchObject, cb.get()); } void InputStreamI::read(bool& v) { _is->read(v); } void InputStreamI::read(Byte& v) { _is->read(v); } void InputStreamI::read(Short& v) { _is->read(v); } void InputStreamI::read(Int& v) { _is->read(v); } void InputStreamI::read(Long& v) { _is->read(v); } void InputStreamI::read(Float& v) { _is->read(v); } void InputStreamI::read(Double& v) { _is->read(v); } void InputStreamI::read(string& v, bool convert) { _is->read(v, convert); } void InputStreamI::read(vector& v, bool convert) { _is->read(v, convert); } void InputStreamI::read(wstring& v) { _is->read(v); } void InputStreamI::read(vector& v) { _is->read(v); } void InputStreamI::read(pair& p, ::IceUtil::ScopedArray& result) { _is->read(p, result); } void InputStreamI::read(pair& p) { _is->read(p); } void InputStreamI::read(pair& p, ::IceUtil::ScopedArray& result) { _is->read(p, result); } void InputStreamI::read(pair& p, ::IceUtil::ScopedArray& result) { _is->read(p, result); } void InputStreamI::read(pair& p, ::IceUtil::ScopedArray& result) { _is->read(p, result); } void InputStreamI::read(pair& p, ::IceUtil::ScopedArray& result) { _is->read(p, result); } void InputStreamI::read(pair& p, ::IceUtil::ScopedArray& result) { _is->read(p, result); } bool InputStreamI::readOptional(Int tag, OptionalFormat format) { return _is->readOpt(tag, format); } void InputStreamI::throwException() { _is->throwException(); } void InputStreamI::throwException(const UserExceptionReaderFactoryPtr& factory) { UserExceptionFactoryPtr del = new UserExceptionFactoryI(factory); _is->throwException(del); } void InputStreamI::startObject() { _is->startReadObject(); } SlicedDataPtr InputStreamI::endObject(bool preserve) { return _is->endReadObject(preserve); } void InputStreamI::startException() { _is->startReadException(); } SlicedDataPtr InputStreamI::endException(bool preserve) { return _is->endReadException(preserve); } string InputStreamI::startSlice() { return _is->startReadSlice(); } void InputStreamI::endSlice() { _is->endReadSlice(); } void InputStreamI::skipSlice() { _is->skipSlice(); } EncodingVersion InputStreamI::startEncapsulation() { return _is->startReadEncaps(); } void InputStreamI::endEncapsulation() { _is->endReadEncapsChecked(); } EncodingVersion InputStreamI::skipEncapsulation() { return _is->skipEncaps(); } EncodingVersion InputStreamI::getEncoding() const { return _is->getReadEncoding(); } void InputStreamI::readPendingObjects() { _is->readPendingObjects(); } void InputStreamI::rewind() { _is->clear(); _is->i = _is->b.begin(); } void InputStreamI::skip(Int sz) { _is->skip(sz); } void InputStreamI::skipSize() { _is->skipSize(); } void InputStreamI::closure(void* p) { _closure = p; } void* InputStreamI::closure() const { return _closure; } void InputStreamI::initialize(Instance* instance, const pair& buf, const EncodingVersion& v, bool copyData) { if(copyData) { _is = new BasicStream(instance, v, true); _is->writeBlob(buf.first, buf.second - buf.first); _is->i = _is->b.begin(); } else { _is = new BasicStream(instance, v, buf.first, buf.second); } _is->closure(this); } // // OutputStreamI // OutputStreamI::OutputStreamI(const CommunicatorPtr& communicator) : _communicator(communicator), _own(true) { Instance* instance = getInstance(communicator).get(); _os = new BasicStream(instance, instance->defaultsAndOverrides()->defaultEncoding, true); _os->closure(this); } OutputStreamI::OutputStreamI(const CommunicatorPtr& communicator, const EncodingVersion& v) : _communicator(communicator), _own(true) { Instance* instance = getInstance(communicator).get(); _os = new BasicStream(instance, v, true); _os->closure(this); } OutputStreamI::OutputStreamI(const CommunicatorPtr& communicator, BasicStream* os) : _communicator(communicator), _os(os), _own(false) { assert(os); _os->closure(this); } OutputStreamI::~OutputStreamI() { if(_own) { delete _os; } } CommunicatorPtr OutputStreamI::communicator() const { return _communicator; } void OutputStreamI::writeObject(const ObjectPtr& v) { _os->write(v); } void OutputStreamI::writeException(const UserException& v) { _os->write(v); } void OutputStreamI::writeProxy(const ObjectPrx& v) { _os->write(v); } void OutputStreamI::writeSize(Int sz) { if(sz < 0) { throw MarshalException(__FILE__, __LINE__); } _os->writeSize(sz); } void OutputStreamI::write(bool v) { _os->write(v); } void OutputStreamI::write(Byte v) { _os->write(v); } void OutputStreamI::write(Short v) { _os->write(v); } void OutputStreamI::write(Int v) { _os->write(v); } void OutputStreamI::write(Long v) { _os->write(v); } void OutputStreamI::write(Float v) { _os->write(v); } void OutputStreamI::write(Double v) { _os->write(v); } void OutputStreamI::write(const string& v, bool convert) { _os->write(v, convert); } void OutputStreamI::write(const char* v, bool convert) { _os->write(v, convert); } void OutputStreamI::write(const vector& v, bool convert) { if(v.size() == 0) { _os->writeSize(0); } else { _os->write(&v[0], &v[0] + v.size(), convert); } } void OutputStreamI::write(const wstring& v) { _os->write(v); } void OutputStreamI::write(const vector& v) { _os->write(v); } void OutputStreamI::write(const bool* begin, const bool* end) { _os->write(begin, end); } void OutputStreamI::write(const Byte* begin, const Byte* end) { _os->write(begin, end); } void OutputStreamI::write(const Short* begin, const Short* end) { _os->write(begin, end); } void OutputStreamI::write(const Int* begin, const Int* end) { _os->write(begin, end); } void OutputStreamI::write(const Long* begin, const Long* end) { _os->write(begin, end); } void OutputStreamI::write(const Float* begin, const Float* end) { _os->write(begin, end); } void OutputStreamI::write(const Double* begin, const Double* end) { _os->write(begin, end); } bool OutputStreamI::writeOptional(Int tag, OptionalFormat format) { return _os->writeOpt(tag, format); } void OutputStreamI::startObject(const SlicedDataPtr& slicedData) { _os->startWriteObject(slicedData); } void OutputStreamI::endObject() { _os->endWriteObject(); } void OutputStreamI::startException(const SlicedDataPtr& slicedData) { _os->startWriteException(slicedData); } void OutputStreamI::endException() { _os->endWriteException(); } void OutputStreamI::startSlice(const string& typeId, int compactId, bool lastSlice) { _os->startWriteSlice(typeId, compactId, lastSlice); } void OutputStreamI::endSlice() { _os->endWriteSlice(); } void OutputStreamI::startEncapsulation(const EncodingVersion& version, FormatType format) { _os->startWriteEncaps(version, format); } void OutputStreamI::startEncapsulation() { _os->startWriteEncaps(); } void OutputStreamI::endEncapsulation() { _os->endWriteEncapsChecked(); } EncodingVersion OutputStreamI::getEncoding() const { return _os->getWriteEncoding(); } void OutputStreamI::writePendingObjects() { _os->writePendingObjects(); } void OutputStreamI::finished(vector& bytes) { vector(_os->b.begin(), _os->b.end()).swap(bytes); } pair OutputStreamI::finished() { if(_os->b.empty()) { return pair(reinterpret_cast(0), reinterpret_cast(0)); } else { return pair(&_os->b[0], &_os->b[0] + _os->b.size()); } } void OutputStreamI::reset(bool clearBuffer) { _os->clear(); if(clearBuffer) { _os->b.clear(); } else { _os->b.reset(); } _os->i = _os->b.begin(); } OutputStream::size_type OutputStreamI::pos() { return _os->pos(); } void OutputStreamI::rewrite(Int sz, size_type p) { _os->rewrite(sz, p); } void OutputStreamI::startSize() { _os->startSize(); } void OutputStreamI::endSize() { _os->endSize(); } // // ObjectReader // void ObjectReader::__write(BasicStream*) const { assert(false); } void ObjectReader::__read(BasicStream* is) { InputStreamI* stream = reinterpret_cast(is->closure()); assert(stream); read(stream); } void ObjectReader::__write(const OutputStreamPtr&) const { assert(false); } void ObjectReader::__read(const InputStreamPtr&) { assert(false); } // // ObjectWriter // void ObjectWriter::__write(BasicStream* os) const { OutputStreamI* stream = reinterpret_cast(os->closure()); assert(stream); write(stream); } void ObjectWriter::__read(BasicStream*) { assert(false); } void ObjectWriter::__write(const OutputStreamPtr&) const { assert(false); } void ObjectWriter::__read(const InputStreamPtr&) { assert(false); } // // UserExceptionWriter // UserExceptionWriter::UserExceptionWriter(const CommunicatorPtr& communicator) : _communicator(communicator) { } UserExceptionWriter::~UserExceptionWriter() throw() { } void UserExceptionWriter::__write(BasicStream* os) const { OutputStreamI* stream = reinterpret_cast(os->closure()); if(!stream) { // // Required for IcePy usage // stream = new OutputStreamI(_communicator, os); } write(stream); } void UserExceptionWriter::__read(BasicStream*) { assert(false); } Ice-3.5.1/cpp/src/Ice/Transceiver.h0000644000076400007640000000237612223561476015111 0ustar mesmes// ********************************************************************** // // 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 ICE_TRANSCEIVER_H #define ICE_TRANSCEIVER_H #include #include #include #include namespace IceInternal { class Buffer; class ICE_API Transceiver : virtual public ::IceUtil::Shared { public: virtual NativeInfoPtr getNativeInfo() = 0; virtual SocketOperation initialize(Buffer&, Buffer&) = 0; virtual void close() = 0; virtual bool write(Buffer&) = 0; virtual bool read(Buffer&) = 0; #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) virtual bool startWrite(Buffer&) = 0; virtual void finishWrite(Buffer&) = 0; virtual void startRead(Buffer&) = 0; virtual void finishRead(Buffer&) = 0; #endif virtual std::string type() const = 0; virtual std::string toString() const = 0; virtual Ice::ConnectionInfoPtr getInfo() const = 0; virtual void checkSendSize(const Buffer&, size_t) = 0; }; } #endif Ice-3.5.1/cpp/src/Ice/ThreadPool.h0000644000076400007640000002205612223561476014662 0ustar mesmes// ********************************************************************** // // 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 ICE_THREAD_POOL_H #define ICE_THREAD_POOL_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace IceInternal { class ThreadPoolCurrent; class ThreadPoolWorkQueue; typedef IceUtil::Handle ThreadPoolWorkQueuePtr; class ThreadPool : public IceUtil::Shared, public IceUtil::Monitor { class EventHandlerThread : public IceUtil::Thread { public: EventHandlerThread(const ThreadPoolPtr&, const std::string&); virtual void run(); void updateObserver(); void setState(Ice::Instrumentation::ThreadState); private: ThreadPoolPtr _pool; ObserverHelperT _observer; Ice::Instrumentation::ThreadState _state; }; typedef IceUtil::Handle EventHandlerThreadPtr; public: ThreadPool(const InstancePtr&, const std::string&, int); virtual ~ThreadPool(); void destroy(); void updateObservers(); void initialize(const EventHandlerPtr&); void _register(const EventHandlerPtr& handler, SocketOperation status) { update(handler, SocketOperationNone, status); } void update(const EventHandlerPtr&, SocketOperation, SocketOperation); void unregister(const EventHandlerPtr& handler, SocketOperation status) { update(handler, status, SocketOperationNone); } void finish(const EventHandlerPtr&); void execute(const ThreadPoolWorkItemPtr&); void joinWithAllThreads(); std::string prefix() const; private: void run(const EventHandlerThreadPtr&); bool ioCompleted(ThreadPoolCurrent&); #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) bool startMessage(ThreadPoolCurrent&); void finishMessage(ThreadPoolCurrent&); #else void promoteFollower(ThreadPoolCurrent&); bool followerWait(ThreadPoolCurrent&); #endif std::string nextThreadId(); const InstancePtr _instance; ThreadPoolWorkQueuePtr _workQueue; bool _destroyed; const std::string _prefix; Selector _selector; int _nextThreadId; friend class EventHandlerThread; friend class ThreadPoolCurrent; const int _size; // Number of threads that are pre-created. const int _sizeIO; // Maximum number of threads that can concurrently perform IO. const int _sizeMax; // Maximum number of threads. const int _sizeWarn; // If _inUse reaches _sizeWarn, a "low on threads" warning will be printed. const bool _serialize; // True if requests need to be serialized over the connection. const bool _hasPriority; const int _priority; const int _serverIdleTime; const int _threadIdleTime; const size_t _stackSize; std::set _threads; // All threads, running or not. int _inUse; // Number of threads that are currently in use. #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) int _inUseIO; // Number of threads that are currently performing IO. std::vector > _handlers; std::vector >::const_iterator _nextHandler; #endif bool _promote; }; class ThreadPoolCurrent { public: ThreadPoolCurrent(const InstancePtr&, const ThreadPoolPtr&, const ThreadPool::EventHandlerThreadPtr&); SocketOperation operation; BasicStream stream; // A per-thread stream to be used by event handlers for optimization. bool ioCompleted() const { return _threadPool->ioCompleted(const_cast(*this)); } #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) bool startMessage() { return _threadPool->startMessage(const_cast(*this)); } void finishMessage() { _threadPool->finishMessage(const_cast(*this)); } #endif private: ThreadPool* _threadPool; ThreadPool::EventHandlerThreadPtr _thread; EventHandlerPtr _handler; bool _ioCompleted; #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) bool _leader; #endif friend class ThreadPool; }; class ThreadPoolWorkItem : virtual public IceUtil::Shared { public: virtual void execute(ThreadPoolCurrent&) = 0; }; class DispatchWorkItem : public ThreadPoolWorkItem, public Ice::DispatcherCall { public: DispatchWorkItem(const InstancePtr&); virtual void execute(ThreadPoolCurrent&); private: const InstancePtr _instance; }; class ThreadPoolWorkQueue : public EventHandler, public IceUtil::Mutex { public: ThreadPoolWorkQueue(const InstancePtr&, Selector&); ~ThreadPoolWorkQueue(); void destroy(); void queue(const ThreadPoolWorkItemPtr&); #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) bool startAsync(SocketOperation); bool finishAsync(SocketOperation); #endif virtual void message(ThreadPoolCurrent&); virtual void finished(ThreadPoolCurrent&); virtual std::string toString() const; virtual NativeInfoPtr getNativeInfo(); virtual void postMessage(); private: const InstancePtr _instance; Selector& _selector; bool _destroyed; #ifdef ICE_USE_IOCP AsyncInfo _info; #elif !defined(ICE_OS_WINRT) SOCKET _fdIntrRead; SOCKET _fdIntrWrite; #endif std::list _workItems; }; // // The ThreadPoolMessage class below hides the IOCP implementation details from // the event handler implementations. Only event handler implementation that // require IO need to use this class. // // An instance of the IOScope subclass must be created within the synchronization // of the event handler. It takes care of calling startMessage/finishMessage for // the IOCP implementation and ensures that finishMessage isn't called multiple // times. // #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) template class ThreadPoolMessage { public: class IOScope { public: IOScope(ThreadPoolMessage& message) : _message(message) { // Nothing to do. } ~IOScope() { // Nothing to do. } operator bool() { return true; } void completed() { _message._current.ioCompleted(); } private: ThreadPoolMessage& _message; }; friend class IOScope; ThreadPoolMessage(ThreadPoolCurrent& current, const T&) : _current(current) { } ~ThreadPoolMessage() { // Nothing to do. } private: ThreadPoolCurrent& _current; }; #else template class ThreadPoolMessage { public: class IOScope { public: IOScope(ThreadPoolMessage& message) : _message(message) { // This must be called with the handler locked. _finish = _message._current.startMessage(); } ~IOScope() { if(_finish) { // This must be called with the handler locked. _message._current.finishMessage(); } } operator bool() { return _finish; } void completed() { // // Call finishMessage once IO is completed only if serialization is not enabled. // Otherwise, finishMessage will be called when the event handler is done with // the message (it will be called from ~ThreadPoolMessage below). // assert(_finish); if(_message._current.ioCompleted()) { _finish = false; _message._finish = true; } } private: ThreadPoolMessage& _message; bool _finish; }; friend class IOScope; ThreadPoolMessage(ThreadPoolCurrent& current, const T& mutex) : _current(current), _mutex(mutex), _finish(false) { } ~ThreadPoolMessage() { if(_finish) { // // A ThreadPoolMessage instance must be created outside the synchronization // of the event handler. We need to lock the event handler here to call // finishMessage. // #if defined(__MINGW32__) IceUtil::LockT sync(_mutex); #else IceUtil::LockT sync(_mutex); #endif _current.finishMessage(); } } private: ThreadPoolCurrent& _current; const T& _mutex; bool _finish; }; #endif }; #endif Ice-3.5.1/cpp/src/Ice/Transceiver.cpp0000644000076400007640000000077712223561476015447 0ustar mesmes// ********************************************************************** // // 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 using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(Transceiver* p) { return p; } Ice-3.5.1/cpp/src/Ice/ConnectionI.cpp0000644000076400007640000025752712223561476015401 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include // For getThreadPool() and getServantManager(). #include #include #include #include #include #include // For createProxy(). #include // For createProxy(). #ifndef ICE_OS_WINRT # include #endif using namespace std; using namespace Ice; using namespace Ice::Instrumentation; using namespace IceInternal; Ice::LocalObject* Ice::upCast(ConnectionI* p) { return p; } namespace { const ::std::string __flushBatchRequests_name = "flushBatchRequests"; class TimeoutCallback : public IceUtil::TimerTask { public: TimeoutCallback(Ice::ConnectionI* connection) : _connection(connection) { } void runTimerTask() { _connection->timedOut(); } private: Ice::ConnectionI* _connection; }; class DispatchDispatcherCall : public DispatcherCall { public: DispatchDispatcherCall(const ConnectionIPtr& connection, const ConnectionI::StartCallbackPtr& startCB, const vector& sentCBs, Byte compress, Int requestId, Int invokeNum, const ServantManagerPtr& servantManager, const ObjectAdapterPtr& adapter, const OutgoingAsyncPtr& outAsync, BasicStream& stream) : _connection(connection), _startCB(startCB), _sentCBs(sentCBs), _compress(compress), _requestId(requestId), _invokeNum(invokeNum), _servantManager(servantManager), _adapter(adapter), _outAsync(outAsync), _stream(stream.instance(), currentProtocolEncoding) { _stream.swap(stream); } virtual void run() { _connection->dispatch(_startCB, _sentCBs, _compress, _requestId, _invokeNum, _servantManager, _adapter, _outAsync, _stream); } private: ConnectionIPtr _connection; ConnectionI::StartCallbackPtr _startCB; vector _sentCBs; Byte _compress; Int _requestId; Int _invokeNum; ServantManagerPtr _servantManager; ObjectAdapterPtr _adapter; OutgoingAsyncPtr _outAsync; BasicStream _stream; }; class FinishDispatcherCall : public DispatcherCall { public: FinishDispatcherCall(const Ice::ConnectionIPtr& connection) : _connection(connection) { } virtual void run() { _connection->finish(); } private: ConnectionIPtr _connection; }; ConnectionState connectionStateMap[] = { ConnectionStateValidating, // StateNotInitialized ConnectionStateValidating, // StateNotValidated ConnectionStateActive, // StateActive ConnectionStateHolding, // StateHolding ConnectionStateClosing, // StateClosing ConnectionStateClosed, // StateClosed ConnectionStateClosed, // StateFinished }; } void IceInternal::ConnectionReaper::add(const ConnectionIPtr& connection) { Lock sync(*this); _connections.push_back(connection); if(connection->_observer) { connection->_observer.detach(); } } void IceInternal::ConnectionReaper::swapConnections(vector& connections) { Lock sync(*this); _connections.swap(connections); } Ice::ConnectionI::Observer::Observer() : _readStreamPos(0), _writeStreamPos(0) { } void Ice::ConnectionI::Observer::startRead(Ice::Byte* i) { if(_readStreamPos) { _observer->receivedBytes(static_cast(i - _readStreamPos)); } _readStreamPos = i; } void Ice::ConnectionI::Observer::finishRead(Ice::Byte* i) { if(_readStreamPos == 0) { return; } assert(i >= _readStreamPos); _observer->receivedBytes(static_cast(i - _readStreamPos)); _readStreamPos = 0; } void Ice::ConnectionI::Observer::startWrite(Ice::Byte* i) { if(_writeStreamPos) { _observer->sentBytes(static_cast(i - _writeStreamPos)); } _writeStreamPos = i; } void Ice::ConnectionI::Observer::finishWrite(Ice::Byte* i) { if(_writeStreamPos == 0) { return; } assert(i >= _writeStreamPos); _observer->sentBytes(static_cast(i - _writeStreamPos)); _writeStreamPos = 0; } void Ice::ConnectionI::Observer::attach(const Ice::Instrumentation::ConnectionObserverPtr& observer) { ObserverHelperT::attach(observer); if(!observer) { _writeStreamPos = 0; _readStreamPos = 0; } } void Ice::ConnectionI::OutgoingMessage::adopt(BasicStream* str) { if(adopted) { if(str) { delete stream; stream = 0; adopted = false; } else { return; // Stream is already adopted. } } else if(!str) { if(out || outAsync) { return; // Adopting request stream is not necessary. } else { str = stream; // Adopt this stream stream = 0; } } assert(str); stream = new BasicStream(str->instance(), currentProtocolEncoding); stream->swap(*str); adopted = true; } bool Ice::ConnectionI::OutgoingMessage::sent(ConnectionI* connection, bool notify) { isSent = true; // The message is sent. if(adopted) { delete stream; stream = 0; } if(out) { out->sent(notify); // true = notify the waiting thread that the request was sent. return false; } else if(outAsync) { return outAsync->__sent(connection); } else { return false; } } void Ice::ConnectionI::OutgoingMessage::finished(const Ice::LocalException& ex) { if(out) { out->finished(ex, isSent); } else if(outAsync) { outAsync->__finished(ex, isSent); } if(adopted) { delete stream; stream = 0; } } void Ice::ConnectionI::start(const StartCallbackPtr& callback) { try { IceUtil::Monitor::Lock sync(*this); if(_state >= StateClosed) // The connection might already be closed if the communicator was destroyed. { assert(_exception.get()); _exception->ice_throw(); } if(!initialize() || !validate()) { if(callback) { _startCallback = callback; return; } // // Wait for the connection to be validated. // while(_state <= StateNotValidated) { wait(); } if(_state >= StateClosing) { assert(_exception.get()); _exception->ice_throw(); } } // // We start out in holding state. // setState(StateHolding); } catch(const Ice::LocalException& ex) { exception(ex); if(callback) { callback->connectionStartFailed(this, *_exception.get()); return; } else { waitUntilFinished(); throw; } } if(callback) { callback->connectionStartCompleted(this); } } void Ice::ConnectionI::activate() { IceUtil::Monitor::Lock sync(*this); if(_state <= StateNotValidated) { return; } if(_acmTimeout > 0) { _acmAbsoluteTimeout = IceUtil::Time::now(IceUtil::Time::Monotonic) + IceUtil::Time::seconds(_acmTimeout); } setState(StateActive); } void Ice::ConnectionI::hold() { IceUtil::Monitor::Lock sync(*this); if(_state <= StateNotValidated) { return; } setState(StateHolding); } void Ice::ConnectionI::destroy(DestructionReason reason) { IceUtil::Monitor::Lock sync(*this); switch(reason) { case ObjectAdapterDeactivated: { setState(StateClosing, ObjectAdapterDeactivatedException(__FILE__, __LINE__)); break; } case CommunicatorDestroyed: { setState(StateClosing, CommunicatorDestroyedException(__FILE__, __LINE__)); break; } } } void Ice::ConnectionI::close(bool force) { IceUtil::Monitor::Lock sync(*this); if(force) { setState(StateClosed, ForcedCloseConnectionException(__FILE__, __LINE__)); } else { // // If we do a graceful shutdown, then we wait until all // outstanding requests have been completed. Otherwise, the // CloseConnectionException will cause all outstanding // requests to be retried, regardless of whether the server // has processed them or not. // while(!_requests.empty() || !_asyncRequests.empty()) { wait(); } setState(StateClosing, CloseConnectionException(__FILE__, __LINE__)); } } bool Ice::ConnectionI::isActiveOrHolding() const { // // We can not use trylock here, otherwise the outgoing connection // factory might return destroyed (closing or closed) connections, // resulting in connection retry exhaustion. // IceUtil::Monitor::Lock sync(*this); return _state > StateNotValidated && _state < StateClosing; } bool Ice::ConnectionI::isFinished() const { // // We can use trylock here, because as long as there are still // threads operating in this connection object, connection // destruction is considered as not yet finished. // IceUtil::Monitor::TryLock sync(*this); if(!sync.acquired()) { return false; } if(_state != StateFinished || _dispatchCount != 0) { return false; } assert(_state == StateFinished); return true; } void Ice::ConnectionI::throwException() const { IceUtil::Monitor::Lock sync(*this); if(_exception.get()) { assert(_state >= StateClosing); _exception->ice_throw(); } } void Ice::ConnectionI::waitUntilHolding() const { IceUtil::Monitor::Lock sync(*this); while(_state < StateHolding || _dispatchCount > 0) { wait(); } } void Ice::ConnectionI::waitUntilFinished() { IceUtil::Monitor::Lock sync(*this); // // We wait indefinitely until the connection is finished and all // outstanding requests are completed. Otherwise we couldn't // guarantee that there are no outstanding calls when deactivate() // is called on the servant locators. // while(_state < StateFinished || _dispatchCount > 0) { wait(); } assert(_state == StateFinished); // // Clear the OA. See bug 1673 for the details of why this is necessary. // _adapter = 0; } void Ice::ConnectionI::updateObserver() { IceUtil::Monitor::Lock sync(*this); if(_state < StateNotValidated || _state > StateClosed) { return; } assert(_instance->getObserver()); _observer.attach(_instance->getObserver()->getConnectionObserver(initConnectionInfo(), _endpoint, toConnectionState(_state), _observer.get())); } void Ice::ConnectionI::monitor(const IceUtil::Time& now) { IceUtil::Monitor::TryLock sync(*this); if(!sync.acquired()) { return; } if(_state != StateActive) { return; } // // Active connection management for idle connections. // if(_acmTimeout <= 0 || !_requests.empty() || !_asyncRequests.empty() || _dispatchCount > 0 || static_cast(_readStream.b.size()) > headerSize || !_writeStream.b.empty() || !_batchStream.b.empty()) { return; } if(now >= _acmAbsoluteTimeout) { setState(StateClosing, ConnectionTimeoutException(__FILE__, __LINE__)); } } bool Ice::ConnectionI::sendRequest(Outgoing* out, bool compress, bool response) { BasicStream* os = out->os(); IceUtil::Monitor::Lock sync(*this); if(_exception.get()) { // // If the connection is closed before we even have a chance // to send our request, we always try to send the request // again. // throw LocalExceptionWrapper(*_exception.get(), true); } assert(_state > StateNotValidated); assert(_state < StateClosing); // // Ensure the message isn't bigger than what we can send with the // transport. // _transceiver->checkSendSize(*os, _instance->messageSizeMax()); Int requestId = 0; if(response) { // // Create a new unique request ID. // requestId = _nextRequestId++; if(requestId <= 0) { _nextRequestId = 1; requestId = _nextRequestId++; } // // Fill in the request ID. // const Byte* p = reinterpret_cast(&requestId); #ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), os->b.begin() + headerSize); #else copy(p, p + sizeof(Int), os->b.begin() + headerSize); #endif } out->attachRemoteObserver(initConnectionInfo(), _endpoint, requestId, static_cast(os->b.size() - headerSize - 4)); // // Send the message. If it can't be sent without blocking the message is added // to _sendStreams and it will be sent by the selector thread. // bool sent = false; try { OutgoingMessage message(out, os, compress, requestId); sent = sendMessage(message) & AsyncStatusSent; } catch(const LocalException& ex) { setState(StateClosed, ex); assert(_exception.get()); _exception->ice_throw(); } if(response) { // // Add to the requests map. // _requestsHint = _requests.insert(_requests.end(), pair(requestId, out)); } return sent; } AsyncStatus Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncPtr& out, bool compress, bool response) { BasicStream* os = out->__getOs(); IceUtil::Monitor::Lock sync(*this); if(_exception.get()) { // // If the exception is closed before we even have a chance // to send our request, we always try to send the request // again. // throw LocalExceptionWrapper(*_exception.get(), true); } assert(_state > StateNotValidated); assert(_state < StateClosing); // // Ensure the message isn't bigger than what we can send with the // transport. // _transceiver->checkSendSize(*os, _instance->messageSizeMax()); Int requestId = 0; if(response) { // // Create a new unique request ID. // requestId = _nextRequestId++; if(requestId <= 0) { _nextRequestId = 1; requestId = _nextRequestId++; } // // Fill in the request ID. // const Byte* p = reinterpret_cast(&requestId); #ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), os->b.begin() + headerSize); #else copy(p, p + sizeof(Int), os->b.begin() + headerSize); #endif } out->__attachRemoteObserver(initConnectionInfo(), _endpoint, requestId, static_cast(os->b.size() - headerSize - 4)); AsyncStatus status = AsyncStatusQueued; try { OutgoingMessage message(out, os, compress, requestId); status = sendMessage(message); } catch(const LocalException& ex) { setState(StateClosed, ex); assert(_exception.get()); _exception->ice_throw(); } if(response) { // // Add to the async requests map. // _asyncRequestsHint = _asyncRequests.insert(_asyncRequests.end(), pair(requestId, out)); } return status; } void Ice::ConnectionI::prepareBatchRequest(BasicStream* os) { IceUtil::Monitor::Lock sync(*this); // // Wait if flushing is currently in progress. // while(_batchStreamInUse && !_exception.get()) { wait(); } if(_exception.get()) { // // If there were no batch requests queued when the connection failed, we can safely // retry with a new connection. Otherwise, we must throw to notify the caller that // some previous batch requests were not sent. // if(_batchStream.b.empty()) { throw LocalExceptionWrapper(*_exception.get(), true); } else { _exception->ice_throw(); } } assert(_state > StateNotValidated); assert(_state < StateClosing); if(_batchStream.b.empty()) { try { _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr)); } catch(const LocalException& ex) { setState(StateClosed, ex); ex.ice_throw(); } } _batchStreamInUse = true; _batchMarker = _batchStream.b.size(); _batchStream.swap(*os); // // The batch stream now belongs to the caller, until // finishBatchRequest() or abortBatchRequest() is called. // } void Ice::ConnectionI::finishBatchRequest(BasicStream* os, bool compress) { try { IceUtil::Monitor::Lock sync(*this); // // Get the batch stream back. // _batchStream.swap(*os); if(_exception.get()) { _exception->ice_throw(); } bool flush = false; if(_batchAutoFlush) { // // Throw memory limit exception if the first message added causes us to // go over limit. Otherwise put aside the marshalled message that caused // limit to be exceeded and rollback stream to the marker. // try { _transceiver->checkSendSize(_batchStream, _instance->messageSizeMax()); } catch(const Ice::Exception&) { if(_batchRequestNum > 0) { flush = true; } else { throw; } } } if(flush) { // // Temporarily save the last request. // vector lastRequest(_batchStream.b.begin() + _batchMarker, _batchStream.b.end()); _batchStream.b.resize(_batchMarker); // // Send the batch stream without the last request. // try { // // Fill in the number of requests in the batch. // const Byte* p = reinterpret_cast(&_batchRequestNum); #ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize); #else copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize); #endif OutgoingMessage message(&_batchStream, _batchRequestCompress); sendMessage(message); } catch(const Ice::LocalException& ex) { setState(StateClosed, ex); assert(_exception.get()); _exception->ice_throw(); } // // Reset the batch. // BasicStream dummy(_instance.get(), currentProtocolEncoding, _batchAutoFlush); _batchStream.swap(dummy); _batchRequestNum = 0; _batchRequestCompress = false; _batchMarker = 0; // // Check again if the last request doesn't exceed what we can send with the auto flush // if(sizeof(requestBatchHdr) + lastRequest.size() > _instance->messageSizeMax()) { Ex::throwMemoryLimitException(__FILE__, __LINE__, sizeof(requestBatchHdr) + lastRequest.size(), _instance->messageSizeMax()); } // // Start a new batch with the last message that caused us to go over the limit. // _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr)); _batchStream.writeBlob(&lastRequest[0], lastRequest.size()); } // // Increment the number of requests in the batch. // ++_batchRequestNum; // // We compress the whole batch if there is at least one compressed // message. // if(compress) { _batchRequestCompress = true; } // // Notify about the batch stream not being in use anymore. // assert(_batchStreamInUse); _batchStreamInUse = false; notifyAll(); } catch(const Ice::LocalException&) { abortBatchRequest(); throw; } } void Ice::ConnectionI::abortBatchRequest() { IceUtil::Monitor::Lock sync(*this); BasicStream dummy(_instance.get(), currentProtocolEncoding, _batchAutoFlush); _batchStream.swap(dummy); _batchRequestNum = 0; _batchRequestCompress = false; _batchMarker = 0; assert(_batchStreamInUse); _batchStreamInUse = false; notifyAll(); } void Ice::ConnectionI::flushBatchRequests() { IceInternal::InvocationObserver observer(_instance.get(), __flushBatchRequests_name); BatchOutgoing out(this, _instance.get(), observer); out.invoke(); } AsyncResultPtr Ice::ConnectionI::begin_flushBatchRequests() { return __begin_flushBatchRequests(__dummyCallback, 0); } AsyncResultPtr Ice::ConnectionI::begin_flushBatchRequests(const CallbackPtr& cb, const LocalObjectPtr& cookie) { return __begin_flushBatchRequests(cb, cookie); } AsyncResultPtr Ice::ConnectionI::begin_flushBatchRequests(const Callback_Connection_flushBatchRequestsPtr& cb, const LocalObjectPtr& cookie) { return __begin_flushBatchRequests(cb, cookie); } AsyncResultPtr Ice::ConnectionI::__begin_flushBatchRequests(const CallbackBasePtr& cb, const LocalObjectPtr& cookie) { ConnectionBatchOutgoingAsyncPtr result = new ConnectionBatchOutgoingAsync(this, _communicator, _instance, __flushBatchRequests_name, cb, cookie); try { result->__send(); } catch(const LocalException& __ex) { result->__exceptionAsync(__ex); } return result; } void Ice::ConnectionI::end_flushBatchRequests(const AsyncResultPtr& r) { AsyncResult::__check(r, this, __flushBatchRequests_name); r->__wait(); } bool Ice::ConnectionI::flushBatchRequests(BatchOutgoing* out) { IceUtil::Monitor::Lock sync(*this); while(_batchStreamInUse && !_exception.get()) { wait(); } if(_exception.get()) { _exception->ice_throw(); } if(_batchRequestNum == 0) { out->sent(false); return true; } // // Fill in the number of requests in the batch. // const Byte* p = reinterpret_cast(&_batchRequestNum); #ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize); #else copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize); #endif out->attachRemoteObserver(initConnectionInfo(), _endpoint, static_cast(_batchStream.b.size() - headerSize - 4)); _batchStream.swap(*out->os()); // // Send the batch stream. // bool sent = false; try { OutgoingMessage message(out, out->os(), _batchRequestCompress, 0); sent = sendMessage(message) & AsyncStatusSent; } catch(const Ice::LocalException& ex) { setState(StateClosed, ex); assert(_exception.get()); _exception->ice_throw(); } // // Reset the batch stream. // BasicStream dummy(_instance.get(), Ice::currentProtocolEncoding, _batchAutoFlush); _batchStream.swap(dummy); _batchRequestNum = 0; _batchRequestCompress = false; _batchMarker = 0; return sent; } AsyncStatus Ice::ConnectionI::flushAsyncBatchRequests(const BatchOutgoingAsyncPtr& outAsync) { IceUtil::Monitor::Lock sync(*this); while(_batchStreamInUse && !_exception.get()) { wait(); } if(_exception.get()) { _exception->ice_throw(); } if(_batchRequestNum == 0) { AsyncStatus status = AsyncStatusSent; if(outAsync->__sent(this)) { status = static_cast(status | AsyncStatusInvokeSentCallback); } return status; } // // Fill in the number of requests in the batch. // const Byte* p = reinterpret_cast(&_batchRequestNum); #ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize); #else copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize); #endif outAsync->__attachRemoteObserver(initConnectionInfo(), _endpoint, 0, static_cast(_batchStream.b.size() - headerSize - 4)); _batchStream.swap(*outAsync->__getOs()); // // Send the batch stream. // AsyncStatus status = AsyncStatusQueued; try { OutgoingMessage message(outAsync, outAsync->__getOs(), _batchRequestCompress, 0); status = sendMessage(message); } catch(const Ice::LocalException& ex) { setState(StateClosed, ex); assert(_exception.get()); _exception->ice_throw(); } // // Reset the batch stream. // BasicStream dummy(_instance.get(), Ice::currentProtocolEncoding, _batchAutoFlush); _batchStream.swap(dummy); _batchRequestNum = 0; _batchRequestCompress = false; _batchMarker = 0; return status; } void Ice::ConnectionI::sendResponse(BasicStream* os, Byte compressFlag) { IceUtil::Monitor::Lock sync(*this); assert(_state > StateNotValidated); try { if(--_dispatchCount == 0) { if(_state == StateFinished) { _reaper->add(this); } notifyAll(); } if(_state >= StateClosed) { assert(_exception.get()); _exception->ice_throw(); } OutgoingMessage message(os, compressFlag > 0); sendMessage(message); if(_state == StateClosing && _dispatchCount == 0) { initiateShutdown(); } return; } catch(const LocalException& ex) { setState(StateClosed, ex); } } void Ice::ConnectionI::sendNoResponse() { IceUtil::Monitor::Lock sync(*this); assert(_state > StateNotValidated); try { if(--_dispatchCount == 0) { if(_state == StateFinished) { _reaper->add(this); } notifyAll(); } if(_state >= StateClosed) { assert(_exception.get()); _exception->ice_throw(); } if(_state == StateClosing && _dispatchCount == 0) { initiateShutdown(); } } catch(const LocalException& ex) { setState(StateClosed, ex); } } EndpointIPtr Ice::ConnectionI::endpoint() const { return _endpoint; // No mutex protection necessary, _endpoint is immutable. } ConnectorPtr Ice::ConnectionI::connector() const { return _connector; // No mutex protection necessary, _connector is immutable. } void Ice::ConnectionI::setAdapter(const ObjectAdapterPtr& adapter) { IceUtil::Monitor::Lock sync(*this); if(_state <= StateNotValidated || _state >= StateClosing) { return; } _adapter = adapter; if(_adapter) { _servantManager = dynamic_cast(_adapter.get())->getServantManager(); if(!_servantManager) { _adapter = 0; } } else { _servantManager = 0; } // // We never change the thread pool with which we were initially // registered, even if we add or remove an object adapter. // } ObjectAdapterPtr Ice::ConnectionI::getAdapter() const { IceUtil::Monitor::Lock sync(*this); return _adapter; } EndpointPtr Ice::ConnectionI::getEndpoint() const { return _endpoint; // No mutex protection necessary, _endpoint is immutable. } ObjectPrx Ice::ConnectionI::createProxy(const Identity& ident) const { // // Create a reference and return a reverse proxy for this // reference. // ConnectionIPtr self = const_cast(this); return _instance->proxyFactory()->referenceToProxy(_instance->referenceFactory()->create(ident, self)); } #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) bool Ice::ConnectionI::startAsync(SocketOperation operation) { if(_state >= StateClosed) { return false; } try { if(operation & SocketOperationWrite) { if(_observer) { _observer.startWrite(_writeStream.i); } if(_transceiver->startWrite(_writeStream) && !_sendStreams.empty()) { // The whole message is written, assume it's sent now for at-most-once semantics. _sendStreams.front().isSent = true; } } else if(operation & SocketOperationRead) { if(_observer && !_readHeader) { _observer.startRead(_readStream.i); } _transceiver->startRead(_readStream); } } catch(const Ice::LocalException& ex) { setState(StateClosed, ex); return false; } return true; } bool Ice::ConnectionI::finishAsync(SocketOperation operation) { try { if(operation & SocketOperationWrite) { _transceiver->finishWrite(_writeStream); if(_observer) { _observer.finishWrite(_writeStream.i); } } else if(operation & SocketOperationRead) { _transceiver->finishRead(_readStream); if(_observer && !_readHeader) { _observer.finishRead(_readStream.i); } } } catch(const Ice::LocalException& ex) { setState(StateClosed, ex); } return _state < StateClosed; } #endif void Ice::ConnectionI::message(ThreadPoolCurrent& current) { StartCallbackPtr startCB; vector sentCBs; Byte compress = 0; Int requestId = 0; Int invokeNum = 0; ServantManagerPtr servantManager; ObjectAdapterPtr adapter; OutgoingAsyncPtr outAsync; ThreadPoolMessage msg(current, *this); { IceUtil::Monitor::Lock sync(*this); ThreadPoolMessage::IOScope io(msg); if(!io) { return; } if(_state >= StateClosed) { return; } try { unscheduleTimeout(current.operation); if(current.operation & SocketOperationWrite && !_writeStream.b.empty()) { if(_writeStream.i != _writeStream.b.end()) { if(_observer) { _observer.startWrite(_writeStream.i); } if(!_transceiver->write(_writeStream)) { assert(!_writeStream.b.empty()); scheduleTimeout(SocketOperationWrite, _endpoint->timeout()); return; } if(_observer) { _observer.finishWrite(_writeStream.i); } } assert(_writeStream.i == _writeStream.b.end()); } if(current.operation & SocketOperationRead && !_readStream.b.empty()) { if(_readHeader) // Read header if necessary. { if(_readStream.i != _readStream.b.end() && !_transceiver->read(_readStream)) { return; } assert(_readStream.i == _readStream.b.end()); _readHeader = false; if(_observer) { _observer->receivedBytes(static_cast(headerSize)); } ptrdiff_t pos = _readStream.i - _readStream.b.begin(); if(pos < headerSize) { // // This situation is possible for small UDP packets. // throw IllegalMessageSizeException(__FILE__, __LINE__); } _readStream.i = _readStream.b.begin(); const Byte* m; _readStream.readBlob(m, static_cast(sizeof(magic))); if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3]) { BadMagicException ex(__FILE__, __LINE__); ex.badMagic = Ice::ByteSeq(&m[0], &m[0] + sizeof(magic)); throw ex; } ProtocolVersion pv; _readStream.read(pv); checkSupportedProtocol(pv); EncodingVersion ev; _readStream.read(ev); checkSupportedProtocolEncoding(ev); Byte messageType; _readStream.read(messageType); Byte compress; _readStream.read(compress); Int size; _readStream.read(size); if(size < headerSize) { throw IllegalMessageSizeException(__FILE__, __LINE__); } if(size > static_cast(_instance->messageSizeMax())) { throw MemoryLimitException(__FILE__, __LINE__); } if(size > static_cast(_readStream.b.size())) { _readStream.b.resize(size); } _readStream.i = _readStream.b.begin() + pos; } if(_readStream.i != _readStream.b.end()) { if(_endpoint->datagram()) { throw DatagramLimitException(__FILE__, __LINE__); // The message was truncated. } else { if(_observer) { _observer.startRead(_readStream.i); } if(!_transceiver->read(_readStream)) { assert(!_readStream.b.empty()); scheduleTimeout(SocketOperationRead, _endpoint->timeout()); return; } if(_observer) { _observer.finishRead(_readStream.i); } assert(_readStream.i == _readStream.b.end()); } } } if(_state <= StateNotValidated) { if(_state == StateNotInitialized && !initialize(current.operation)) { return; } if(_state <= StateNotValidated && !validate(current.operation)) { return; } _threadPool->unregister(this, current.operation); // // We start out in holding state. // setState(StateHolding); swap(_startCallback, startCB); } else { assert(_state <= StateClosing); // // We parse messages first, if we receive a close // connection message we won't send more messages. // if(current.operation & SocketOperationRead) { parseMessage(current.stream, invokeNum, requestId, compress, servantManager, adapter, outAsync); } if(current.operation & SocketOperationWrite) { sendNextMessage(sentCBs); } // // We increment the dispatch count to prevent the // communicator destruction during the callback. // if(!sentCBs.empty() || outAsync) { ++_dispatchCount; } } } catch(const DatagramLimitException&) // Expected. { if(_warnUdp) { Warning out(_instance->initializationData().logger); out << "maximum datagram size of " << _readStream.i - _readStream.b.begin() << " exceeded"; } _readStream.resize(headerSize); _readStream.i = _readStream.b.begin(); _readHeader = true; return; } catch(const SocketException& ex) { setState(StateClosed, ex); return; } catch(const LocalException& ex) { if(_endpoint->datagram()) { if(_warn) { Warning out(_instance->initializationData().logger); out << "datagram connection exception:\n" << ex << '\n' << _desc; } _readStream.resize(headerSize); _readStream.i = _readStream.b.begin(); _readHeader = true; } else { setState(StateClosed, ex); } return; } if(_acmTimeout > 0) { _acmAbsoluteTimeout = IceUtil::Time::now(IceUtil::Time::Monotonic) + IceUtil::Time::seconds(_acmTimeout); } io.completed(); } if(_dispatcher) { try { _dispatcher->dispatch(new DispatchDispatcherCall(this, startCB, sentCBs, compress, requestId, invokeNum, servantManager, adapter, outAsync, current.stream), this); } catch(const std::exception& ex) { if(_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) { Warning out(_instance->initializationData().logger); out << "dispatch exception:\n" << ex << '\n' << _desc; } } catch(...) { if(_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) { Warning out(_instance->initializationData().logger); out << "dispatch exception:\nunknown c++ exception" << '\n' << _desc; } } } else { dispatch(startCB, sentCBs, compress, requestId, invokeNum, servantManager, adapter, outAsync, current.stream); } } void ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector& sentCBs, Byte compress, Int requestId, Int invokeNum, const ServantManagerPtr& servantManager, const ObjectAdapterPtr& adapter, const OutgoingAsyncPtr& outAsync, BasicStream& stream) { // // Notify the factory that the connection establishment and // validation has completed. // if(startCB) { startCB->connectionStartCompleted(this); } // // Notify AMI calls that the message was sent. // for(vector::const_iterator p = sentCBs.begin(); p != sentCBs.end(); ++p) { #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) if(p->outAsync) { p->outAsync->__sent(); } if(p->replyOutAsync) { p->replyOutAsync->__finished(); } #else p->outAsync->__sent(); #endif } // // Asynchronous replies must be handled outside the thread // synchronization, so that nested calls are possible. // if(outAsync) { outAsync->__finished(); } // // Method invocation (or multiple invocations for batch messages) // must be done outside the thread synchronization, so that nested // calls are possible. // if(invokeNum) { invokeAll(stream, invokeNum, requestId, compress, servantManager, adapter); } // // Decrease dispatch count. // if(!sentCBs.empty() || outAsync) { IceUtil::Monitor::Lock sync(*this); if(--_dispatchCount == 0) { // // Only initiate shutdown if not already done. It might // have already been done if the sent callback or AMI // callback was dispatched when the connection was already // in the closing state. // if(_state == StateClosing && !_shutdownInitiated) { try { initiateShutdown(); } catch(const LocalException& ex) { setState(StateClosed, ex); } } else if(_state == StateFinished) { _reaper->add(this); } notifyAll(); } } } void Ice::ConnectionI::finished(ThreadPoolCurrent& current) { { IceUtil::Monitor::Lock sync(*this); assert(_state == StateClosed); unscheduleTimeout(static_cast(SocketOperationRead | SocketOperationWrite)); } // // If there are no callbacks to call, we don't call ioCompleted() since we're not going // to call code that will potentially block (this avoids promoting a new leader and // unecessary thread creation, especially if this is called on shutdown). // if(!_startCallback && _sendStreams.empty() && _asyncRequests.empty()) { finish(); return; } if(!_dispatcher) { current.ioCompleted(); finish(); } else { try { _dispatcher->dispatch(new FinishDispatcherCall(this), this); } catch(const std::exception& ex) { if(_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) { Warning out(_instance->initializationData().logger); out << "dispatch exception:\n" << ex << '\n' << _desc; } } catch(...) { if(_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) { Warning out(_instance->initializationData().logger); out << "dispatch exception:\nunknown c++ exception" << '\n' << _desc; } } } } void Ice::ConnectionI::finish() { if(_startCallback) { _startCallback->connectionStartFailed(this, *_exception.get()); _startCallback = 0; } if(!_sendStreams.empty()) { if(!_writeStream.b.empty()) { // // Return the stream to the outgoing call. This is important for // retriable AMI calls which are not marshalled again. // OutgoingMessage* message = &_sendStreams.front(); _writeStream.swap(*message->stream); #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) // // The current message might be sent but not yet removed from _sendStreams. If // the response has been received in the meantime, we remove the message from // _sendStreams to not call finished on a message which is already done. // if(message->requestId > 0 && ((message->out && _requests.find(message->requestId) == _requests.end()) || (message->outAsync && _asyncRequests.find(message->requestId) == _asyncRequests.end()))) { if(message->sent(this, true)) { assert(message->outAsync); message->outAsync->__sent(); } _sendStreams.pop_front(); } #endif } for(deque::iterator o = _sendStreams.begin(); o != _sendStreams.end(); ++o) { o->finished(*_exception.get()); if(o->requestId) // Make sure finished isn't called twice. { if(o->out) { _requests.erase(o->requestId); } else { _asyncRequests.erase(o->requestId); } } } _sendStreams.clear(); // Must be cleared before _requests because of Outgoing* references in OutgoingMessage } for(map::const_iterator p = _requests.begin(); p != _requests.end(); ++p) { p->second->finished(*_exception.get(), true); } _requests.clear(); for(map::const_iterator q = _asyncRequests.begin(); q != _asyncRequests.end(); ++q) { q->second->__finished(*_exception.get(), true); } _asyncRequests.clear(); // // This must be done last as this will cause waitUntilFinished() to return (and communicator // objects such as the timer might be destroyed too). // { IceUtil::Monitor::Lock sync(*this); setState(StateFinished); if(_dispatchCount == 0) { _reaper->add(this); } } } string Ice::ConnectionI::toString() const { return _desc; // No mutex lock, _desc is immutable. } NativeInfoPtr Ice::ConnectionI::getNativeInfo() { return _transceiver->getNativeInfo(); } void Ice::ConnectionI::timedOut() { IceUtil::Monitor::Lock sync(*this); if(_state <= StateNotValidated) { setState(StateClosed, ConnectTimeoutException(__FILE__, __LINE__)); } else if(_state < StateClosing) { setState(StateClosed, TimeoutException(__FILE__, __LINE__)); } else if(_state == StateClosing) { setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__)); } } string Ice::ConnectionI::type() const { return _type; // No mutex lock, _type is immutable. } Ice::Int Ice::ConnectionI::timeout() const { return _endpoint->timeout(); // No mutex lock, _endpoint is immutable. } ConnectionInfoPtr Ice::ConnectionI::getInfo() const { IceUtil::Monitor::Lock sync(*this); if(_state >= StateClosed) { _exception->ice_throw(); } return initConnectionInfo(); } void Ice::ConnectionI::exception(const LocalException& ex) { IceUtil::Monitor::Lock sync(*this); setState(StateClosed, ex); } void Ice::ConnectionI::invokeException(const LocalException& ex, int invokeNum) { // // Fatal exception while invoking a request. Since sendResponse/sendNoResponse isn't // called in case of a fatal exception we decrement _dispatchCount here. // IceUtil::Monitor::Lock sync(*this); setState(StateClosed, ex); if(invokeNum > 0) { assert(_dispatchCount > 0); _dispatchCount -= invokeNum; assert(_dispatchCount >= 0); if(_dispatchCount == 0) { if(_state == StateFinished) { _reaper->add(this); } notifyAll(); } } } Ice::ConnectionI::ConnectionI(const CommunicatorPtr& communicator, const InstancePtr& instance, const ConnectionReaperPtr& reaper, const TransceiverPtr& transceiver, const ConnectorPtr& connector, const EndpointIPtr& endpoint, const ObjectAdapterPtr& adapter) : _communicator(communicator), _instance(instance), _reaper(reaper), _transceiver(transceiver), _desc(transceiver->toString()), _type(transceiver->type()), _connector(connector), _endpoint(endpoint), _adapter(adapter), _dispatcher(_instance->initializationData().dispatcher), // Cached for better performance. _logger(_instance->initializationData().logger), // Cached for better performance. _traceLevels(_instance->traceLevels()), // Cached for better performance. _timer(_instance->timer()), // Cached for better performance. _writeTimeout(new TimeoutCallback(this)), _writeTimeoutScheduled(false), _readTimeout(new TimeoutCallback(this)), _readTimeoutScheduled(false), _warn(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Connections") > 0), _warnUdp(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Datagrams") > 0), _acmTimeout(0), _compressionLevel(1), _nextRequestId(1), _requestsHint(_requests.end()), _asyncRequestsHint(_asyncRequests.end()), _batchAutoFlush( _instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.BatchAutoFlush", 1) > 0), _batchStream(_instance.get(), Ice::currentProtocolEncoding, _batchAutoFlush), _batchStreamInUse(false), _batchRequestNum(0), _batchRequestCompress(false), _batchMarker(0), _readStream(_instance.get(), Ice::currentProtocolEncoding), _readHeader(false), _writeStream(_instance.get(), Ice::currentProtocolEncoding), _dispatchCount(0), _state(StateNotInitialized), _shutdownInitiated(false), _validated(false) { int& compressionLevel = const_cast(_compressionLevel); compressionLevel = _instance->initializationData().properties->getPropertyAsIntWithDefault( "Ice.Compression.Level", 1); if(compressionLevel < 1) { compressionLevel = 1; } else if(compressionLevel > 9) { compressionLevel = 9; } ObjectAdapterI* adapterImpl = _adapter ? dynamic_cast(_adapter.get()) : 0; if(adapterImpl) { _servantManager = adapterImpl->getServantManager(); } Int& acmTimeout = const_cast(_acmTimeout); if(_endpoint->datagram()) { acmTimeout = 0; } else { if(adapterImpl) { acmTimeout = adapterImpl->getACM(); } else { acmTimeout = _instance->clientACM(); } } __setNoDelete(true); try { if(adapterImpl) { const_cast(_threadPool) = adapterImpl->getThreadPool(); } else { const_cast(_threadPool) = _instance->clientThreadPool(); } _threadPool->initialize(this); } catch(const IceUtil::Exception&) { __setNoDelete(false); throw; } __setNoDelete(false); } Ice::ConnectionI::~ConnectionI() { assert(!_startCallback); assert(_state == StateFinished); assert(_dispatchCount == 0); assert(_sendStreams.empty()); assert(_requests.empty()); assert(_asyncRequests.empty()); } void Ice::ConnectionI::setState(State state, const LocalException& ex) { // // If setState() is called with an exception, then only closed and // closing states are permissible. // assert(state >= StateClosing); if(_state == state) // Don't switch twice. { return; } if(!_exception.get()) { // // If we are in closed state, an exception must be set. // assert(_state != StateClosed); _exception.reset(ex.ice_clone()); // // We don't warn if we are not validated. // if(_warn && _validated) { // // Don't warn about certain expected exceptions. // if(!(dynamic_cast(_exception.get()) || dynamic_cast(_exception.get()) || dynamic_cast(_exception.get()) || dynamic_cast(_exception.get()) || dynamic_cast(_exception.get()) || (dynamic_cast(_exception.get()) && _state == StateClosing))) { Warning out(_logger); out << "connection exception:\n" << *_exception.get() << '\n' << _desc; } } } // // We must set the new state before we notify requests of any // exceptions. Otherwise new requests may retry on a connection // that is not yet marked as closed or closing. // setState(state); } void Ice::ConnectionI::setState(State state) { // // We don't want to send close connection messages if the endpoint // only supports oneway transmission from client to server. // if(_endpoint->datagram() && state == StateClosing) { state = StateClosed; } // // Skip graceful shutdown if we are destroyed before validation. // if(_state <= StateNotValidated && state == StateClosing) { state = StateClosed; } if(_state == state) // Don't switch twice. { return; } try { switch(state) { case StateNotInitialized: { assert(false); break; } case StateNotValidated: { if(_state != StateNotInitialized) { assert(_state == StateClosed); return; } break; } case StateActive: { // // Can only switch from holding or not validated to // active. // if(_state != StateHolding && _state != StateNotValidated) { return; } _threadPool->_register(this, SocketOperationRead); break; } case StateHolding: { // // Can only switch from active or not validated to // holding. // if(_state != StateActive && _state != StateNotValidated) { return; } if(_state == StateActive) { _threadPool->unregister(this, SocketOperationRead); } break; } case StateClosing: { // // Can't change back from closed. // if(_state >= StateClosed) { return; } if(_state == StateHolding) { _threadPool->_register(this, SocketOperationRead); // We need to continue to read in closing state. } break; } case StateClosed: { if(_state == StateFinished) { return; } _threadPool->finish(this); #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) _transceiver->close(); #endif break; } case StateFinished: { assert(_state == StateClosed); #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) _transceiver->close(); #endif _communicator = 0; break; } } } catch(const Ice::LocalException& ex) { Error out(_logger); out << "unexpected connection exception:\n" << ex << '\n' << _desc; } // // We only register with the connection monitor if our new state // is StateActive. Otherwise we unregister with the connection // monitor, but only if we were registered before, i.e., if our // old state was StateActive. // if(_acmTimeout > 0) { if(state == StateActive) { _instance->connectionMonitor()->add(this); } else if(_state == StateActive) { _instance->connectionMonitor()->remove(this); } } if(_instance->getObserver()) { ConnectionState oldState = toConnectionState(_state); ConnectionState newState = toConnectionState(state); if(oldState != newState) { _observer.attach(_instance->getObserver()->getConnectionObserver(initConnectionInfo(), _endpoint, newState, _observer.get())); } if(_observer && state == StateClosed && _exception.get()) { if(!(dynamic_cast(_exception.get()) || dynamic_cast(_exception.get()) || dynamic_cast(_exception.get()) || dynamic_cast(_exception.get()) || dynamic_cast(_exception.get()) || (dynamic_cast(_exception.get()) && _state == StateClosing))) { _observer->failed(_exception->ice_name()); } } } _state = state; notifyAll(); if(_state == StateClosing && _dispatchCount == 0) { try { initiateShutdown(); } catch(const LocalException& ex) { setState(StateClosed, ex); } } } void Ice::ConnectionI::initiateShutdown() { assert(_state == StateClosing); assert(_dispatchCount == 0); assert(!_shutdownInitiated); _shutdownInitiated = true; if(!_endpoint->datagram()) { // // Before we shut down, we send a close connection message. // BasicStream os(_instance.get(), Ice::currentProtocolEncoding); os.write(magic[0]); os.write(magic[1]); os.write(magic[2]); os.write(magic[3]); os.write(currentProtocol); os.write(currentProtocolEncoding); os.write(closeConnectionMsg); os.write((Byte)1); // compression status: compression supported but not used. os.write(headerSize); // Message size. OutgoingMessage message(&os, false); if(sendMessage(message) & AsyncStatusSent) { // // Schedule the close timeout to wait for the peer to close the connection. If // the message was queued for sending, sendNextMessage will schedule the timeout // once all messages were sent. // scheduleTimeout(SocketOperationWrite, closeTimeout()); } // // The CloseConnection message should be sufficient. Closing the write // end of the socket is probably an artifact of how things were done // in IIOP. In fact, shutting down the write end of the socket causes // problems on Windows by preventing the peer from using the socket. // For example, the peer is no longer able to continue writing a large // message after the socket is shutdown. // //_transceiver->shutdownWrite(); } } bool Ice::ConnectionI::initialize(SocketOperation operation) { SocketOperation s = _transceiver->initialize(_readStream, _writeStream); if(s != SocketOperationNone) { scheduleTimeout(s, connectTimeout()); _threadPool->update(this, operation, s); return false; } // // Update the connection description once the transceiver is initialized. // const_cast(_desc) = _transceiver->toString(); setState(StateNotValidated); return true; } bool Ice::ConnectionI::validate(SocketOperation operation) { if(!_endpoint->datagram()) // Datagram connections are always implicitly validated. { if(_adapter) // The server side has the active role for connection validation. { if(_writeStream.b.empty()) { _writeStream.write(magic[0]); _writeStream.write(magic[1]); _writeStream.write(magic[2]); _writeStream.write(magic[3]); _writeStream.write(currentProtocol); _writeStream.write(currentProtocolEncoding); _writeStream.write(validateConnectionMsg); _writeStream.write(static_cast(0)); // Compression status (always zero for validate connection). _writeStream.write(headerSize); // Message size. _writeStream.i = _writeStream.b.begin(); traceSend(_writeStream, _logger, _traceLevels); } if(_observer) { _observer.startWrite(_writeStream.i); } if(_writeStream.i != _writeStream.b.end() && !_transceiver->write(_writeStream)) { scheduleTimeout(SocketOperationWrite, connectTimeout()); _threadPool->update(this, operation, SocketOperationWrite); return false; } if(_observer) { _observer.finishWrite(_writeStream.i); } } else // The client side has the passive role for connection validation. { if(_readStream.b.empty()) { _readStream.b.resize(headerSize); _readStream.i = _readStream.b.begin(); } if(_observer) { _observer.startRead(_readStream.i); } if(_readStream.i != _readStream.b.end() && !_transceiver->read(_readStream)) { scheduleTimeout(SocketOperationRead, connectTimeout()); _threadPool->update(this, operation, SocketOperationRead); return false; } if(_observer) { _observer.finishRead(_readStream.i); } assert(_readStream.i == _readStream.b.end()); _readStream.i = _readStream.b.begin(); Byte m[4]; _readStream.read(m[0]); _readStream.read(m[1]); _readStream.read(m[2]); _readStream.read(m[3]); if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3]) { BadMagicException ex(__FILE__, __LINE__); ex.badMagic = Ice::ByteSeq(&m[0], &m[0] + sizeof(magic)); throw ex; } ProtocolVersion pv; _readStream.read(pv); checkSupportedProtocol(pv); EncodingVersion ev; _readStream.read(ev); checkSupportedProtocolEncoding(ev); Byte messageType; _readStream.read(messageType); if(messageType != validateConnectionMsg) { throw ConnectionNotValidatedException(__FILE__, __LINE__); } Byte compress; _readStream.read(compress); // Ignore compression status for validate connection. Int size; _readStream.read(size); if(size != headerSize) { throw IllegalMessageSizeException(__FILE__, __LINE__); } traceRecv(_readStream, _logger, _traceLevels); _validated = true; } } _writeStream.resize(0); _writeStream.i = _writeStream.b.begin(); _readStream.resize(headerSize); _readStream.i = _readStream.b.begin(); _readHeader = true; return true; } void Ice::ConnectionI::sendNextMessage(vector& callbacks) { assert(!_sendStreams.empty()); assert(!_writeStream.b.empty() && _writeStream.i == _writeStream.b.end()); try { while(true) { // // Notify the message that it was sent. // OutgoingMessage* message = &_sendStreams.front(); _writeStream.swap(*message->stream); #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) bool sentCB = message->sent(this, true); if(sentCB || message->replyOutAsync) { if(sentCB) { callbacks.push_back(SentCallback(message->outAsync, message->replyOutAsync)); } else { callbacks.push_back(SentCallback(0, message->replyOutAsync)); } } #else if(message->sent(this, true)) { callbacks.push_back(SentCallback(message->outAsync)); } #endif _sendStreams.pop_front(); // // If there's nothing left to send, we're done. // if(_sendStreams.empty()) { break; } // // If we are in the closed state, don't continue sending. // // The connection can be in the closed state if parseMessage // (called before sendNextMessage by message()) closes the // connection. // if(_state >= StateClosed) { return; } // // Otherwise, prepare the next message stream for writing. // message = &_sendStreams.front(); assert(!message->stream->i); #ifndef ICE_OS_WINRT if(message->compress && message->stream->b.size() >= 100) // Only compress messages > 100 bytes. { // // Message compressed. Request compressed response, if any. // message->stream->b[9] = 2; // // Do compression. // BasicStream stream(_instance.get(), Ice::currentProtocolEncoding); doCompress(*message->stream, stream); if(message->outAsync) { trace("sending asynchronous request", *message->stream, _logger, _traceLevels); } else { traceSend(*message->stream, _logger, _traceLevels); } message->adopt(&stream); // Adopt the compressed stream. message->stream->i = message->stream->b.begin(); } else { #endif if(message->compress) { // // Message not compressed. Request compressed response, if any. // message->stream->b[9] = 1; } // // No compression, just fill in the message size. // Int sz = static_cast(message->stream->b.size()); const Byte* p = reinterpret_cast(&sz); #ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), message->stream->b.begin() + 10); #else copy(p, p + sizeof(Int), message->stream->b.begin() + 10); #endif message->stream->i = message->stream->b.begin(); if(message->outAsync) { trace("sending asynchronous request", *message->stream, _logger, _traceLevels); } else { traceSend(*message->stream, _logger, _traceLevels); } #ifndef ICE_OS_WINRT } #endif _writeStream.swap(*message->stream); // // Send the message. // if(_observer) { _observer.startWrite(_writeStream.i); } assert(_writeStream.i); if(_writeStream.i != _writeStream.b.end() && !_transceiver->write(_writeStream)) { assert(!_writeStream.b.empty()); scheduleTimeout(SocketOperationWrite, _endpoint->timeout()); return; } if(_observer) { _observer.finishWrite(_writeStream.i); } } } catch(const Ice::LocalException& ex) { setState(StateClosed, ex); return; } assert(_writeStream.b.empty()); _threadPool->unregister(this, SocketOperationWrite); // // If all the messages were sent and we are in the closing state, we schedule // the close timeout to wait for the peer to close the connection. // if(_state == StateClosing) { scheduleTimeout(SocketOperationWrite, closeTimeout()); } } AsyncStatus Ice::ConnectionI::sendMessage(OutgoingMessage& message) { assert(_state < StateClosed); message.stream->i = 0; // Reset the message stream iterator before starting sending the message. if(!_sendStreams.empty()) { _sendStreams.push_back(message); _sendStreams.back().adopt(0); return AsyncStatusQueued; } // // Attempt to send the message without blocking. If the send blocks, we register // the connection with the selector thread. // message.stream->i = message.stream->b.begin(); #ifndef ICE_OS_WINRT if(message.compress && message.stream->b.size() >= 100) // Only compress messages larger than 100 bytes. { // // Message compressed. Request compressed response, if any. // message.stream->b[9] = 2; // // Do compression. // BasicStream stream(_instance.get(), Ice::currentProtocolEncoding); doCompress(*message.stream, stream); stream.i = stream.b.begin(); if(message.outAsync) { trace("sending asynchronous request", *message.stream, _logger, _traceLevels); } else { traceSend(*message.stream, _logger, _traceLevels); } // // Send the message without blocking. // if(_observer) { _observer.startWrite(stream.i); } if(_transceiver->write(stream)) { if(_observer) { _observer.finishWrite(stream.i); } AsyncStatus status = AsyncStatusSent; if(message.sent(this, false)) { status = static_cast(status | AsyncStatusInvokeSentCallback); } if(_acmTimeout > 0) { _acmAbsoluteTimeout = IceUtil::Time::now(IceUtil::Time::Monotonic) + IceUtil::Time::seconds(_acmTimeout); } return status; } _sendStreams.push_back(message); _sendStreams.back().adopt(&stream); } else { #endif if(message.compress) { // // Message not compressed. Request compressed response, if any. // message.stream->b[9] = 1; } // // No compression, just fill in the message size. // Int sz = static_cast(message.stream->b.size()); const Byte* p = reinterpret_cast(&sz); #ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), message.stream->b.begin() + 10); #else copy(p, p + sizeof(Int), message.stream->b.begin() + 10); #endif message.stream->i = message.stream->b.begin(); if(message.outAsync) { trace("sending asynchronous request", *message.stream, _logger, _traceLevels); } else { traceSend(*message.stream, _logger, _traceLevels); } // // Send the message without blocking. // if(_observer) { _observer.startWrite(message.stream->i); } if(_transceiver->write(*message.stream)) { if(_observer) { _observer.finishWrite(message.stream->i); } AsyncStatus status = AsyncStatusSent; if(message.sent(this, false)) { status = static_cast(status | AsyncStatusInvokeSentCallback); } if(_acmTimeout > 0) { _acmAbsoluteTimeout = IceUtil::Time::now(IceUtil::Time::Monotonic) + IceUtil::Time::seconds(_acmTimeout); } return status; } _sendStreams.push_back(message); _sendStreams.back().adopt(0); // Adopt the stream. #ifndef ICE_OS_WINRT } #endif _writeStream.swap(*_sendStreams.back().stream); scheduleTimeout(SocketOperationWrite, _endpoint->timeout()); _threadPool->_register(this, SocketOperationWrite); return AsyncStatusQueued; } #ifndef ICE_OS_WINRT static string getBZ2Error(int bzError) { if(bzError == BZ_RUN_OK) { return ": BZ_RUN_OK"; } else if(bzError == BZ_FLUSH_OK) { return ": BZ_FLUSH_OK"; } else if(bzError == BZ_FINISH_OK) { return ": BZ_FINISH_OK"; } else if(bzError == BZ_STREAM_END) { return ": BZ_STREAM_END"; } else if(bzError == BZ_CONFIG_ERROR) { return ": BZ_CONFIG_ERROR"; } else if(bzError == BZ_SEQUENCE_ERROR) { return ": BZ_SEQUENCE_ERROR"; } else if(bzError == BZ_PARAM_ERROR) { return ": BZ_PARAM_ERROR"; } else if(bzError == BZ_MEM_ERROR) { return ": BZ_MEM_ERROR"; } else if(bzError == BZ_DATA_ERROR) { return ": BZ_DATA_ERROR"; } else if(bzError == BZ_DATA_ERROR_MAGIC) { return ": BZ_DATA_ERROR_MAGIC"; } else if(bzError == BZ_IO_ERROR) { return ": BZ_IO_ERROR"; } else if(bzError == BZ_UNEXPECTED_EOF) { return ": BZ_UNEXPECTED_EOF"; } else if(bzError == BZ_OUTBUFF_FULL) { return ": BZ_OUTBUFF_FULL"; } else { return ""; } } void Ice::ConnectionI::doCompress(BasicStream& uncompressed, BasicStream& compressed) { const Byte* p; // // Compress the message body, but not the header. // unsigned int uncompressedLen = static_cast(uncompressed.b.size() - headerSize); unsigned int compressedLen = static_cast(uncompressedLen * 1.01 + 600); compressed.b.resize(headerSize + sizeof(Int) + compressedLen); int bzError = BZ2_bzBuffToBuffCompress(reinterpret_cast(&compressed.b[0]) + headerSize + sizeof(Int), &compressedLen, reinterpret_cast(&uncompressed.b[0]) + headerSize, uncompressedLen, _compressionLevel, 0, 0); if(bzError != BZ_OK) { CompressionException ex(__FILE__, __LINE__); ex.reason = "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError); throw ex; } compressed.b.resize(headerSize + sizeof(Int) + compressedLen); // // Write the size of the compressed stream into the header of the // uncompressed stream. Since the header will be copied, this size // will also be in the header of the compressed stream. // Int compressedSize = static_cast(compressed.b.size()); p = reinterpret_cast(&compressedSize); #ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), uncompressed.b.begin() + 10); #else copy(p, p + sizeof(Int), uncompressed.b.begin() + 10); #endif // // Add the size of the uncompressed stream before the message body // of the compressed stream. // Int uncompressedSize = static_cast(uncompressed.b.size()); p = reinterpret_cast(&uncompressedSize); #ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), compressed.b.begin() + headerSize); #else copy(p, p + sizeof(Int), compressed.b.begin() + headerSize); #endif // // Copy the header from the uncompressed stream to the compressed one. // copy(uncompressed.b.begin(), uncompressed.b.begin() + headerSize, compressed.b.begin()); } void Ice::ConnectionI::doUncompress(BasicStream& compressed, BasicStream& uncompressed) { Int uncompressedSize; compressed.i = compressed.b.begin() + headerSize; compressed.read(uncompressedSize); if(uncompressedSize <= headerSize) { throw IllegalMessageSizeException(__FILE__, __LINE__); } uncompressed.resize(uncompressedSize); unsigned int uncompressedLen = uncompressedSize - headerSize; unsigned int compressedLen = static_cast(compressed.b.size() - headerSize - sizeof(Int)); int bzError = BZ2_bzBuffToBuffDecompress(reinterpret_cast(&uncompressed.b[0]) + headerSize, &uncompressedLen, reinterpret_cast(&compressed.b[0]) + headerSize + sizeof(Int), compressedLen, 0, 0); if(bzError != BZ_OK) { CompressionException ex(__FILE__, __LINE__); ex.reason = "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError); throw ex; } copy(compressed.b.begin(), compressed.b.begin() + headerSize, uncompressed.b.begin()); } #endif void Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& requestId, Byte& compress, ServantManagerPtr& servantManager, ObjectAdapterPtr& adapter, OutgoingAsyncPtr& outAsync) { assert(_state > StateNotValidated && _state < StateClosed); _readStream.swap(stream); _readStream.resize(headerSize); _readStream.i = _readStream.b.begin(); _readHeader = true; assert(stream.i == stream.b.end()); // // Connection is validated on first message. This is only used by // setState() to check wether or not we can print a connection // warning (a client might close the connection forcefully if the // connection isn't validated). // _validated = true; try { // // We don't need to check magic and version here. This has // already been done by the ThreadPool, which provides us // with the stream. // assert(stream.i == stream.b.end()); stream.i = stream.b.begin() + 8; Byte messageType; stream.read(messageType); stream.read(compress); #ifndef ICE_OS_WINRT if(compress == 2) { BasicStream ustream(_instance.get(), Ice::currentProtocolEncoding); doUncompress(stream, ustream); stream.b.swap(ustream.b); } #endif stream.i = stream.b.begin() + headerSize; switch(messageType) { case closeConnectionMsg: { traceRecv(stream, _logger, _traceLevels); if(_endpoint->datagram()) { if(_warn) { Warning out(_logger); out << "ignoring close connection message for datagram connection:\n" << _desc; } } else { setState(StateClosed, CloseConnectionException(__FILE__, __LINE__)); } break; } case requestMsg: { if(_state == StateClosing) { trace("received request during closing\n(ignored by server, client will retry)", stream, _logger, _traceLevels); } else { traceRecv(stream, _logger, _traceLevels); stream.read(requestId); invokeNum = 1; servantManager = _servantManager; adapter = _adapter; ++_dispatchCount; } break; } case requestBatchMsg: { if(_state == StateClosing) { trace("received batch request during closing\n(ignored by server, client will retry)", stream, _logger, _traceLevels); } else { traceRecv(stream, _logger, _traceLevels); stream.read(invokeNum); if(invokeNum < 0) { invokeNum = 0; throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); } servantManager = _servantManager; adapter = _adapter; _dispatchCount += invokeNum; } break; } case replyMsg: { traceRecv(stream, _logger, _traceLevels); stream.read(requestId); map::iterator p = _requests.end(); map::iterator q = _asyncRequests.end(); if(_requestsHint != _requests.end()) { if(_requestsHint->first == requestId) { p = _requestsHint; } } if(p == _requests.end()) { if(_asyncRequestsHint != _asyncRequests.end()) { if(_asyncRequestsHint->first == requestId) { q = _asyncRequestsHint; } } } if(p == _requests.end() && q == _asyncRequests.end()) { p = _requests.find(requestId); } if(p == _requests.end() && q == _asyncRequests.end()) { q = _asyncRequests.find(requestId); } if(p == _requests.end() && q == _asyncRequests.end()) { throw UnknownRequestIdException(__FILE__, __LINE__); } if(p != _requests.end()) { p->second->finished(stream); if(p == _requestsHint) { _requests.erase(p++); _requestsHint = p; } else { _requests.erase(p); } } else { assert(q != _asyncRequests.end()); outAsync = q->second; if(q == _asyncRequestsHint) { _asyncRequests.erase(q++); _asyncRequestsHint = q; } else { _asyncRequests.erase(q); } stream.swap(*outAsync->__getIs()); #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) // // If we just received the reply of a request which isn't acknowledge as // sent yet, we queue the reply instead of processing it right away. It // will be processed once the write callback is invoked for the message. // OutgoingMessage* message = _sendStreams.empty() ? 0 : &_sendStreams.front(); if(message && message->outAsync.get() == outAsync.get()) { swap(message->replyOutAsync, outAsync); } #endif } notifyAll(); // Notify threads blocked in close(false) break; } case validateConnectionMsg: { traceRecv(stream, _logger, _traceLevels); if(_warn) { Warning out(_logger); out << "ignoring unexpected validate connection message:\n" << _desc; } break; } default: { trace("received unknown message\n(invalid, closing connection)", stream, _logger, _traceLevels); throw UnknownMessageException(__FILE__, __LINE__); break; } } } catch(const LocalException& ex) { if(_endpoint->datagram()) { if(_warn) { Warning out(_logger); out << "datagram connection exception:\n" << ex << '\n' << _desc; } } else { setState(StateClosed, ex); } } } void Ice::ConnectionI::invokeAll(BasicStream& stream, Int invokeNum, Int requestId, Byte compress, const ServantManagerPtr& servantManager, const ObjectAdapterPtr& adapter) { // // Note: In contrast to other private or protected methods, this // operation must be called *without* the mutex locked. // try { while(invokeNum > 0) { // // Prepare the invocation. // bool response = !_endpoint->datagram() && requestId != 0; assert(!response || invokeNum == 1); Incoming in(_instance.get(), this, adapter, response, compress, requestId); // // Dispatch the invocation. // in.invoke(servantManager, &stream); --invokeNum; } stream.clear(); } catch(const LocalException& ex) { invokeException(ex, invokeNum); // Fatal invocation exception } } int Ice::ConnectionI::connectTimeout() { DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); if(defaultsAndOverrides->overrideConnectTimeout) { return defaultsAndOverrides->overrideConnectTimeoutValue; } else { return _endpoint->timeout(); } } int Ice::ConnectionI::closeTimeout() { DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); if(defaultsAndOverrides->overrideCloseTimeout) { return defaultsAndOverrides->overrideCloseTimeoutValue; } else { return _endpoint->timeout(); } } Ice::ConnectionInfoPtr Ice::ConnectionI::initConnectionInfo() const { if(_info) { return _info; } ConnectionInfoPtr info = _transceiver->getInfo(); info->connectionId = _endpoint->connectionId(); info->incoming = _connector == 0; info->adapterName = _adapter ? _adapter->getName() : string(); if(_state > StateNotInitialized) { _info = info; // Cache the connection information only if initialized. } return info; } ConnectionState ConnectionI::toConnectionState(State state) const { return connectionStateMap[static_cast(state)]; } Ice-3.5.1/cpp/src/Ice/ObjectAdapterFactory.cpp0000644000076400007640000001320312223561476017205 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(ObjectAdapterFactory* p) { return p; } void IceInternal::ObjectAdapterFactory::shutdown() { list adapters; { IceUtil::Monitor::Lock sync(*this); // // Ignore shutdown requests if the object adapter factory has // already been shut down. // if(!_instance) { return; } adapters = _adapters; _instance = 0; _communicator = 0; notifyAll(); } // // Deactivate outside the thread synchronization, to avoid // deadlocks. // for_each(adapters.begin(), adapters.end(), IceUtil::voidMemFun(&ObjectAdapter::deactivate)); } void IceInternal::ObjectAdapterFactory::waitForShutdown() { list adapters; { IceUtil::Monitor::Lock sync(*this); // // First we wait for the shutdown of the factory itself. // while(_instance) { wait(); } adapters = _adapters; } // // Now we wait for deactivation of each object adapter. // for_each(adapters.begin(), adapters.end(), IceUtil::voidMemFun(&ObjectAdapter::waitForDeactivate)); } bool IceInternal::ObjectAdapterFactory::isShutdown() const { IceUtil::Monitor::Lock sync(*this); return _instance == 0; } void IceInternal::ObjectAdapterFactory::destroy() { // // First wait for shutdown to finish. // waitForShutdown(); list adapters; { IceUtil::Monitor::Lock sync(*this); adapters = _adapters; } // // Now we destroy each object adapter. // for_each(adapters.begin(), adapters.end(), IceUtil::voidMemFun(&ObjectAdapter::destroy)); { IceUtil::Monitor::Lock sync(*this); _adapters.clear(); } } void IceInternal::ObjectAdapterFactory::updateObservers(void (ObjectAdapterI::*fn)()) { list adapters; { IceUtil::Monitor::Lock sync(*this); adapters = _adapters; } for_each(adapters.begin(), adapters.end(), IceUtil::voidMemFun(fn)); } ObjectAdapterPtr IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const RouterPrx& router) { IceUtil::Monitor::Lock sync(*this); if(!_instance) { throw ObjectAdapterDeactivatedException(__FILE__, __LINE__); } ObjectAdapterIPtr adapter; if(name.empty()) { string uuid = IceUtil::generateUUID(); adapter = new ObjectAdapterI(_instance, _communicator, this, uuid, true); adapter->initialize(0); } else { if(_adapterNamesInUse.find(name) != _adapterNamesInUse.end()) { throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name); } adapter = new ObjectAdapterI(_instance, _communicator, this, name, false); adapter->initialize(router); _adapterNamesInUse.insert(name); } _adapters.push_back(adapter); return adapter; } ObjectAdapterPtr IceInternal::ObjectAdapterFactory::findObjectAdapter(const ObjectPrx& proxy) { list adapters; { IceUtil::Monitor::Lock sync(*this); if(!_instance) { return 0; } adapters = _adapters; } for(list::iterator p = adapters.begin(); p != adapters.end(); ++p) { try { if((*p)->isLocal(proxy)) { return *p; } } catch(const ObjectAdapterDeactivatedException&) { // Ignore. } } return 0; } void IceInternal::ObjectAdapterFactory::removeObjectAdapter(const ObjectAdapterPtr& adapter) { IceUtil::Monitor::Lock sync(*this); if(!_instance) { return; } for(list::iterator p = _adapters.begin(); p != _adapters.end(); ++p) { if(*p == adapter) { _adapters.erase(p); break; } } _adapterNamesInUse.erase(adapter->getName()); } void IceInternal::ObjectAdapterFactory::flushAsyncBatchRequests(const CommunicatorBatchOutgoingAsyncPtr& outAsync) const { list adapters; { IceUtil::Monitor::Lock sync(*this); adapters = _adapters; } for(list::const_iterator p = adapters.begin(); p != adapters.end(); ++p) { (*p)->flushAsyncBatchRequests(outAsync); } } IceInternal::ObjectAdapterFactory::ObjectAdapterFactory(const InstancePtr& instance, const CommunicatorPtr& communicator) : _instance(instance), _communicator(communicator) { } IceInternal::ObjectAdapterFactory::~ObjectAdapterFactory() { assert(!_instance); assert(!_communicator); assert(_adapters.empty()); } Ice-3.5.1/cpp/src/Ice/EndpointI.cpp0000644000076400007640000002211312223561476015037 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace Ice::Instrumentation; using namespace IceInternal; namespace { IceUtil::Mutex* hashMutex = 0; class Init { public: Init() { hashMutex = new IceUtil::Mutex; } ~Init() { delete hashMutex; hashMutex = 0; } }; Init init; } Ice::LocalObject* IceInternal::upCast(EndpointI* p) { return p; } IceUtil::Shared* IceInternal::upCast(EndpointHostResolver* p) { return p; } vector IceInternal::EndpointI::connectors(const vector
          & /*addrs*/, const NetworkProxyPtr& /*proxy*/) const { // // This method must be extended by endpoints which use the EndpointHostResolver to create // connectors from IP addresses. // assert(false); return vector(); } const string& IceInternal::EndpointI::connectionId() const { return _connectionId; } Ice::Int IceInternal::EndpointI::internal_getHash() const { IceUtilInternal::MutexPtrLock lock(hashMutex); if(!_hashInitialized) { _hashValue = hashInit(); } return _hashValue; } IceInternal::EndpointI::EndpointI(const std::string& connectionId) : _connectionId(connectionId), _hashInitialized(false) { } IceInternal::EndpointI::EndpointI() : _hashInitialized(false) { } #ifndef ICE_OS_WINRT IceInternal::EndpointHostResolver::EndpointHostResolver(const InstancePtr& instance) : IceUtil::Thread("Ice.HostResolver"), _instance(instance), _protocol(instance->protocolSupport()), _preferIPv6(instance->preferIPv6()), _destroyed(false) { __setNoDelete(true); try { updateObserver(); bool hasPriority = _instance->initializationData().properties->getProperty("Ice.ThreadPriority") != ""; int priority = _instance->initializationData().properties->getPropertyAsInt("Ice.ThreadPriority"); if(hasPriority) { start(0, priority); } else { start(); } } catch(const IceUtil::Exception& ex) { { Ice::Error out(_instance->initializationData().logger); out << "cannot create thread for enpoint host resolver:\n" << ex; } throw; } __setNoDelete(false); } vector IceInternal::EndpointHostResolver::resolve(const string& host, int port, Ice::EndpointSelectionType selType, const EndpointIPtr& endpoint) { // // Try to get the addresses without DNS lookup. If this doesn't // work, we retry with DNS lookup (and observer). // NetworkProxyPtr networkProxy = _instance->networkProxy(); if(!networkProxy) { vector
          addrs = getAddresses(host, port, _protocol, selType, _preferIPv6, false); if(!addrs.empty()) { return endpoint->connectors(addrs, 0); } } ObserverHelperT<> observer; const CommunicatorObserverPtr& obsv = _instance->getObserver(); if(obsv) { observer.attach(obsv->getEndpointLookupObserver(endpoint)); } vector connectors; try { if(networkProxy) { networkProxy = networkProxy->resolveHost(); } connectors = endpoint->connectors(getAddresses(host, port, _protocol, selType, _preferIPv6, true), networkProxy); } catch(const Ice::LocalException& ex) { observer.failed(ex.ice_name()); throw; } return connectors; } void IceInternal::EndpointHostResolver::resolve(const string& host, int port, Ice::EndpointSelectionType selType, const EndpointIPtr& endpoint, const EndpointI_connectorsPtr& callback) { // // Try to get the addresses without DNS lookup. If this doesn't work, we queue a resolve // entry and the thread will take care of getting the endpoint addresses. // NetworkProxyPtr networkProxy = _instance->networkProxy(); if(!networkProxy) { try { vector
          addrs = getAddresses(host, port, _protocol, selType, _preferIPv6, false); if(!addrs.empty()) { callback->connectors(endpoint->connectors(addrs, 0)); return; } } catch(const Ice::LocalException& ex) { callback->exception(ex); return; } } Lock sync(*this); assert(!_destroyed); ResolveEntry entry; entry.host = host; entry.port = port; entry.selType = selType; entry.endpoint = endpoint; entry.callback = callback; const CommunicatorObserverPtr& obsv = _instance->getObserver(); if(obsv) { entry.observer = obsv->getEndpointLookupObserver(endpoint); if(entry.observer) { entry.observer->attach(); } } _queue.push_back(entry); notify(); } void IceInternal::EndpointHostResolver::destroy() { Lock sync(*this); assert(!_destroyed); _destroyed = true; notify(); } void IceInternal::EndpointHostResolver::run() { while(true) { ResolveEntry r; ThreadObserverPtr threadObserver; { Lock sync(*this); while(!_destroyed && _queue.empty()) { wait(); } if(_destroyed) { break; } r = _queue.front(); _queue.pop_front(); threadObserver = _observer.get(); } try { if(threadObserver) { threadObserver->stateChanged(ThreadStateIdle, ThreadStateInUseForOther); } NetworkProxyPtr networkProxy = _instance->networkProxy(); if(networkProxy) { networkProxy = networkProxy->resolveHost(); } r.callback->connectors(r.endpoint->connectors(getAddresses(r.host, r.port, _protocol, r.selType, _preferIPv6, true), networkProxy)); if(threadObserver) { threadObserver->stateChanged(ThreadStateInUseForOther, ThreadStateIdle); } if(r.observer) { r.observer->detach(); } } catch(const Ice::LocalException& ex) { if(r.observer) { r.observer->failed(ex.ice_name()); r.observer->detach(); } r.callback->exception(ex); } } for(deque::const_iterator p = _queue.begin(); p != _queue.end(); ++p) { Ice::CommunicatorDestroyedException ex(__FILE__, __LINE__); if(p->observer) { p->observer->failed(ex.ice_name()); p->observer->detach(); } p->callback->exception(ex); } _queue.clear(); if(_observer) { _observer.detach(); } } void IceInternal::EndpointHostResolver::updateObserver() { Lock sync(*this); const CommunicatorObserverPtr& obsv = _instance->getObserver(); if(obsv) { _observer.attach(obsv->getThreadObserver("Communicator", name(), ThreadStateIdle, _observer.get())); } } #else IceInternal::EndpointHostResolver::EndpointHostResolver(const InstancePtr& instance) : _instance(instance) { } vector IceInternal::EndpointHostResolver::resolve(const string& host, int port, Ice::EndpointSelectionType selType, const EndpointIPtr& endpoint) { vector
          addrs = getAddresses(host, port, _instance->protocolSupport(), selType, _instance->preferIPv6(), false); return endpoint->connectors(addrs, 0); } void IceInternal::EndpointHostResolver::resolve(const string&, int, Ice::EndpointSelectionType selType, const EndpointIPtr& endpoint, const EndpointI_connectorsPtr& callback) { // // No DNS lookup support with WinRT. // callback->connectors(endpoint->connectors(selType)); } void IceInternal::EndpointHostResolver::destroy() { } void IceInternal::EndpointHostResolver::run() { } void IceInternal::EndpointHostResolver::updateObserver() { } #endif Ice-3.5.1/cpp/src/Ice/ImplicitContextI.h0000644000076400007640000000234612223561476016051 0ustar mesmes// ********************************************************************** // // 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 ICE_IMPLICIT_CONTEXT_I_H #define ICE_IMPLICIT_CONTEXT_I_H #include namespace Ice { // // The base class for all ImplicitContext implementations // class ImplicitContextI : public ImplicitContext { public: static ImplicitContextI* create(const std::string&); #ifdef _WIN32 static void cleanupThread(); #endif // // Marshals the underlying context plus the given context // (entries in the given context overwrite entries in // the underlying context) // virtual void write(const Context&, ::IceInternal::BasicStream*) const = 0; // // Combines the underlying context plus the given context // (entries in the given context overwrite entries in // the underlying context) // virtual void combine(const Context&, Context&) const = 0; }; typedef IceInternal::Handle ImplicitContextIPtr; } #endif Ice-3.5.1/cpp/src/Ice/ConnectionFactory.cpp0000644000076400007640000014414612223561476016610 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include // For getThreadPool(). #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace Ice::Instrumentation; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(OutgoingConnectionFactory* p) { return p; } IceUtil::Shared* IceInternal::upCast(IncomingConnectionFactory* p) { return p; } namespace { struct RandomNumberGenerator : public std::unary_function { ptrdiff_t operator()(ptrdiff_t d) { return IceUtilInternal::random(static_cast(d)); } }; template void remove(multimap& m, K k, V v) { pair::iterator, typename multimap::iterator> pr = m.equal_range(k); assert(pr.first != pr.second); for(typename multimap::iterator q = pr.first; q != pr.second; ++q) { if(q->second.get() == v.get()) { m.erase(q); return; } } assert(false); // Nothing was removed which is an error. } template ::IceInternal::Handle find(const multimap >& m, K k, const ::IceUtilInternal::ConstMemFun >& predicate) { pair >::const_iterator, typename multimap >::const_iterator> pr = m.equal_range(k); for(typename multimap >::const_iterator q = pr.first; q != pr.second; ++q) { if(predicate(q->second)) { return q->second; } } return IceInternal::Handle(); } } bool IceInternal::OutgoingConnectionFactory::ConnectorInfo::operator==(const ConnectorInfo& other) const { return connector == other.connector; } void IceInternal::OutgoingConnectionFactory::destroy() { IceUtil::Monitor::Lock sync(*this); if(_destroyed) { return; } for_each(_connections.begin(), _connections.end(), bind2nd(Ice::secondVoidMemFun1 (&ConnectionI::destroy), ConnectionI::CommunicatorDestroyed)); _destroyed = true; _communicator = 0; notifyAll(); } void IceInternal::OutgoingConnectionFactory::updateConnectionObservers() { IceUtil::Monitor::Lock sync(*this); for_each(_connections.begin(), _connections.end(), Ice::secondVoidMemFun(&ConnectionI::updateObserver)); } void IceInternal::OutgoingConnectionFactory::waitUntilFinished() { multimap connections; { IceUtil::Monitor::Lock sync(*this); // // First we wait until the factory is destroyed. We also wait // until there are no pending connections anymore. Only then // we can be sure the _connections contains all connections. // while(!_destroyed || !_pending.empty() || _pendingConnectCount > 0) { wait(); } // // We want to wait until all connections are finished outside the // thread synchronization. // connections = _connections; } for_each(connections.begin(), connections.end(), Ice::secondVoidMemFun(&ConnectionI::waitUntilFinished)); { IceUtil::Monitor::Lock sync(*this); // Ensure all the connections are finished and reapable at this point. vector cons; _reaper->swapConnections(cons); assert(cons.size() == _connections.size()); cons.clear(); _connections.clear(); _connectionsByEndpoint.clear(); } } ConnectionIPtr IceInternal::OutgoingConnectionFactory::create(const vector& endpts, bool hasMore, Ice::EndpointSelectionType selType, bool& compress) { assert(!endpts.empty()); // // Apply the overrides. // vector endpoints = applyOverrides(endpts); // // Try to find a connection to one of the given endpoints. // Ice::ConnectionIPtr connection = findConnection(endpoints, compress); if(connection) { return connection; } IceUtil::UniquePtr exception; // // If we didn't find a connection with the endpoints, we create the connectors // for the endpoints. // vector connectors; for(vector::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { // // Create connectors for the endpoint. // try { vector cons = (*p)->connectors(selType); assert(!cons.empty()); for(vector::const_iterator r = cons.begin(); r != cons.end(); ++r) { assert(*r); connectors.push_back(ConnectorInfo(*r, *p)); } } catch(const Ice::LocalException& ex) { exception.reset(ex.ice_clone()); handleException(ex, hasMore || p != endpoints.end() - 1); } } if(connectors.empty()) { assert(exception.get()); exception->ice_throw(); } // // Try to get a connection to one of the connectors. A null result indicates that no // connection was found and that we should try to establish the connection (and that // the connectors were added to _pending to prevent other threads from establishing // the connection). // connection = getConnection(connectors, 0, compress); if(connection) { return connection; } // // Try to establish the connection to the connectors. // DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); const CommunicatorObserverPtr& obsv = _instance->getObserver(); vector::const_iterator q; for(q = connectors.begin(); q != connectors.end(); ++q) { ObserverPtr observer; if(obsv) { observer = obsv->getConnectionEstablishmentObserver(q->endpoint, q->connector->toString()); if(observer) { observer->attach(); } } try { connection = createConnection(q->connector->connect(), *q); connection->start(0); if(observer) { observer->detach(); } if(defaultsAndOverrides->overrideCompress) { compress = defaultsAndOverrides->overrideCompressValue; } else { compress = q->endpoint->compress(); } connection->activate(); break; } catch(const Ice::CommunicatorDestroyedException& ex) { if(observer) { observer->failed(ex.ice_name()); observer->detach(); } exception.reset(ex.ice_clone()); handleConnectionException(*exception.get(), hasMore || q != connectors.end() - 1); connection = 0; break; // No need to continue } catch(const Ice::LocalException& ex) { if(observer) { observer->failed(ex.ice_name()); observer->detach(); } exception.reset(ex.ice_clone()); handleConnectionException(*exception.get(), hasMore || q != connectors.end() - 1); connection = 0; } } // // Finish creating the connection (this removes the connectors from the _pending // list and notifies any waiting threads). // if(connection) { finishGetConnection(connectors, *q, connection, 0); } else { finishGetConnection(connectors, *exception.get(), 0); } if(!connection) { assert(exception.get()); exception->ice_throw(); } return connection; } void IceInternal::OutgoingConnectionFactory::create(const vector& endpts, bool hasMore, Ice::EndpointSelectionType selType, const CreateConnectionCallbackPtr& callback) { assert(!endpts.empty()); // // Apply the overrides. // vector endpoints = applyOverrides(endpts); // // Try to find a connection to one of the given endpoints. // try { bool compress; Ice::ConnectionIPtr connection = findConnection(endpoints, compress); if(connection) { callback->setConnection(connection, compress); return; } } catch(const Ice::LocalException& ex) { callback->setException(ex); return; } ConnectCallbackPtr cb = new ConnectCallback(this, endpoints, hasMore, callback, selType); cb->getConnectors(); } void IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& routerInfo) { IceUtil::Monitor::Lock sync(*this); if(_destroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(routerInfo); // // Search for connections to the router's client proxy endpoints, // and update the object adapter for such connections, so that // callbacks from the router can be received over such // connections. // ObjectAdapterPtr adapter = routerInfo->getAdapter(); vector endpoints = routerInfo->getClientEndpoints(); for(vector::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { EndpointIPtr endpoint = *p; // // Modify endpoints with overrides. // if(_instance->defaultsAndOverrides()->overrideTimeout) { endpoint = endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue); } // // The Connection object does not take the compression flag of // endpoints into account, but instead gets the information // about whether messages should be compressed or not from // other sources. In order to allow connection sharing for // endpoints that differ in the value of the compression flag // only, we always set the compression flag to false here in // this connection factory. // endpoint = endpoint->compress(false); for(multimap::const_iterator q = _connections.begin(); q != _connections.end(); ++q) { if(q->second->endpoint() == endpoint) { q->second->setAdapter(adapter); } } } } void IceInternal::OutgoingConnectionFactory::removeAdapter(const ObjectAdapterPtr& adapter) { IceUtil::Monitor::Lock sync(*this); if(_destroyed) { return; } for(multimap::const_iterator p = _connections.begin(); p != _connections.end(); ++p) { if(p->second->getAdapter() == adapter) { p->second->setAdapter(0); } } } void IceInternal::OutgoingConnectionFactory::flushAsyncBatchRequests(const CommunicatorBatchOutgoingAsyncPtr& outAsync) { list c; { IceUtil::Monitor::Lock sync(*this); for(multimap::const_iterator p = _connections.begin(); p != _connections.end(); ++p) { if(p->second->isActiveOrHolding()) { c.push_back(p->second); } } } for(list::const_iterator p = c.begin(); p != c.end(); ++p) { try { outAsync->flushConnection(*p); } catch(const LocalException&) { // Ignore. } } } IceInternal::OutgoingConnectionFactory::OutgoingConnectionFactory(const CommunicatorPtr& communicator, const InstancePtr& instance) : _communicator(communicator), _instance(instance), _reaper(new ConnectionReaper()), _destroyed(false), _pendingConnectCount(0) { } IceInternal::OutgoingConnectionFactory::~OutgoingConnectionFactory() { assert(_destroyed); assert(_connections.empty()); assert(_connectionsByEndpoint.empty()); assert(_pending.empty()); assert(_pendingConnectCount == 0); } vector IceInternal::OutgoingConnectionFactory::applyOverrides(const vector& endpts) { DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); vector endpoints = endpts; for(vector::iterator p = endpoints.begin(); p != endpoints.end(); ++p) { // // Modify endpoints with overrides. // if(defaultsAndOverrides->overrideTimeout) { *p = (*p)->timeout(defaultsAndOverrides->overrideTimeoutValue); } } return endpoints; } ConnectionIPtr IceInternal::OutgoingConnectionFactory::findConnection(const vector& endpoints, bool& compress) { IceUtil::Monitor::Lock sync(*this); if(_destroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); assert(!endpoints.empty()); for(vector::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { ConnectionIPtr connection = find(_connectionsByEndpoint, *p, Ice::constMemFun(&ConnectionI::isActiveOrHolding)); if(connection) { if(defaultsAndOverrides->overrideCompress) { compress = defaultsAndOverrides->overrideCompressValue; } else { compress = (*p)->compress(); } return connection; } } return 0; } ConnectionIPtr IceInternal::OutgoingConnectionFactory::findConnection(const vector& connectors, bool& compress) { // This must be called with the mutex locked. DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); for(vector::const_iterator p = connectors.begin(); p != connectors.end(); ++p) { if(_pending.find(p->connector) != _pending.end()) { continue; } ConnectionIPtr connection = find(_connections, p->connector, Ice::constMemFun(&ConnectionI::isActiveOrHolding)); if(connection) { if(defaultsAndOverrides->overrideCompress) { compress = defaultsAndOverrides->overrideCompressValue; } else { compress = p->endpoint->compress(); } return connection; } } return 0; } void IceInternal::OutgoingConnectionFactory::incPendingConnectCount() { // // Keep track of the number of pending connects. The outgoing connection factory // waitUntilFinished() method waits for all the pending connects to terminate before // to return. This ensures that the communicator client thread pool isn't destroyed // too soon and will still be available to execute the ice_exception() callbacks for // the asynchronous requests waiting on a connection to be established. // IceUtil::Monitor::Lock sync(*this); if(_destroyed) { throw Ice::CommunicatorDestroyedException(__FILE__, __LINE__); } ++_pendingConnectCount; } void IceInternal::OutgoingConnectionFactory::decPendingConnectCount() { IceUtil::Monitor::Lock sync(*this); --_pendingConnectCount; assert(_pendingConnectCount >= 0); if(_destroyed && _pendingConnectCount == 0) { notifyAll(); } } ConnectionIPtr IceInternal::OutgoingConnectionFactory::getConnection(const vector& connectors, const ConnectCallbackPtr& cb, bool& compress) { { IceUtil::Monitor::Lock sync(*this); if(_destroyed) { throw Ice::CommunicatorDestroyedException(__FILE__, __LINE__); } // // Reap closed connections // vector cons; _reaper->swapConnections(cons); for(vector::const_iterator p = cons.begin(); p != cons.end(); ++p) { remove(_connections, (*p)->connector(), *p); remove(_connectionsByEndpoint, (*p)->endpoint(), *p); remove(_connectionsByEndpoint, (*p)->endpoint()->compress(true), *p); } // // Try to get the connection. We may need to wait for other threads to // finish if one of them is currently establishing a connection to one // of our connectors. // while(true) { if(_destroyed) { throw Ice::CommunicatorDestroyedException(__FILE__, __LINE__); } // // Search for a matching connection. If we find one, we're done. // Ice::ConnectionIPtr connection = findConnection(connectors, compress); if(connection) { return connection; } // // Determine whether another thread/request is currently attempting to connect to // one of our endpoints; if so we wait until it's done. // if(addToPending(cb, connectors)) { // // If a callback is not specified we wait until another thread notifies us about a // change to the pending list. Otherwise, if a callback is provided we're done: // when the pending list changes the callback will be notified and will try to // get the connection again. // if(!cb) { wait(); } else { return 0; } } else { // // If no thread is currently establishing a connection to one of our connectors, // we get out of this loop and start the connection establishment to one of the // given connectors. // break; } } } // // At this point, we're responsible for establishing the connection to one of // the given connectors. If it's a non-blocking connect, calling nextConnector // will start the connection establishment. Otherwise, we return null to get // the caller to establish the connection. // if(cb) { cb->nextConnector(); } return 0; } ConnectionIPtr IceInternal::OutgoingConnectionFactory::createConnection(const TransceiverPtr& transceiver, const ConnectorInfo& ci) { IceUtil::Monitor::Lock sync(*this); assert(_pending.find(ci.connector) != _pending.end() && transceiver); // // Create and add the connection to the connection map. Adding the connection to the map // is necessary to support the interruption of the connection initialization and validation // in case the communicator is destroyed. // Ice::ConnectionIPtr connection; try { if(_destroyed) { throw Ice::CommunicatorDestroyedException(__FILE__, __LINE__); } connection = new ConnectionI(_communicator, _instance, _reaper, transceiver, ci.connector, ci.endpoint->compress(false), 0); } catch(const Ice::LocalException&) { try { transceiver->close(); } catch(const Ice::LocalException&) { // Ignore } throw; } _connections.insert(pair(ci.connector, connection)); _connectionsByEndpoint.insert(pair(connection->endpoint(), connection)); _connectionsByEndpoint.insert(pair(connection->endpoint()->compress(true), connection)); return connection; } void IceInternal::OutgoingConnectionFactory::finishGetConnection(const vector& connectors, const ConnectorInfo& ci, const ConnectionIPtr& connection, const ConnectCallbackPtr& cb) { set connectionCallbacks; if(cb) { connectionCallbacks.insert(cb); } set callbacks; { IceUtil::Monitor::Lock sync(*this); for(vector::const_iterator p = connectors.begin(); p != connectors.end(); ++p) { map >::iterator q = _pending.find(p->connector); if(q != _pending.end()) { for(set::const_iterator r = q->second.begin(); r != q->second.end(); ++r) { if((*r)->hasConnector(ci)) { connectionCallbacks.insert(*r); } else { callbacks.insert(*r); } } _pending.erase(q); } } for(set::iterator r = connectionCallbacks.begin(); r != connectionCallbacks.end(); ++r) { (*r)->removeFromPending(); callbacks.erase(*r); } for(set::iterator r = callbacks.begin(); r != callbacks.end(); ++r) { (*r)->removeFromPending(); } notifyAll(); } bool compress; DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); if(defaultsAndOverrides->overrideCompress) { compress = defaultsAndOverrides->overrideCompressValue; } else { compress = ci.endpoint->compress(); } for(set::const_iterator p = callbacks.begin(); p != callbacks.end(); ++p) { (*p)->getConnection(); } for(set::const_iterator p = connectionCallbacks.begin(); p != connectionCallbacks.end(); ++p) { (*p)->setConnection(connection, compress); } } void IceInternal::OutgoingConnectionFactory::finishGetConnection(const vector& connectors, const Ice::LocalException& ex, const ConnectCallbackPtr& cb) { set failedCallbacks; if(cb) { failedCallbacks.insert(cb); } set callbacks; { IceUtil::Monitor::Lock sync(*this); for(vector::const_iterator p = connectors.begin(); p != connectors.end(); ++p) { map >::iterator q = _pending.find(p->connector); if(q != _pending.end()) { for(set::const_iterator r = q->second.begin(); r != q->second.end(); ++r) { if((*r)->removeConnectors(connectors)) { failedCallbacks.insert(*r); } else { callbacks.insert(*r); } } _pending.erase(q); } } for(set::iterator r = callbacks.begin(); r != callbacks.end(); ++r) { assert(failedCallbacks.find(*r) == failedCallbacks.end()); (*r)->removeFromPending(); } notifyAll(); } for(set::const_iterator p = callbacks.begin(); p != callbacks.end(); ++p) { (*p)->getConnection(); } for(set::const_iterator p = failedCallbacks.begin(); p != failedCallbacks.end(); ++p) { (*p)->setException(ex); } } bool IceInternal::OutgoingConnectionFactory::addToPending(const ConnectCallbackPtr& cb, const vector& connectors) { // // Add the callback to each connector pending list. // bool found = false; for(vector::const_iterator p = connectors.begin(); p != connectors.end(); ++p) { map >::iterator q = _pending.find(p->connector); if(q != _pending.end()) { found = true; if(cb) { q->second.insert(cb); } } } if(found) { return true; } // // If there's no pending connection for the given connectors, we're // responsible for its establishment. We add empty pending lists, // other callbacks to the same connectors will be queued. // for(vector::const_iterator r = connectors.begin(); r != connectors.end(); ++r) { if(_pending.find(r->connector) == _pending.end()) { _pending.insert(pair >(r->connector, set())); } } return false; } void IceInternal::OutgoingConnectionFactory::removeFromPending(const ConnectCallbackPtr& cb, const vector& connectors) { for(vector::const_iterator p = connectors.begin(); p != connectors.end(); ++p) { map >::iterator q = _pending.find(p->connector); if(q != _pending.end()) { q->second.erase(cb); } } } void IceInternal::OutgoingConnectionFactory::handleException(const LocalException& ex, bool hasMore) { TraceLevelsPtr traceLevels = _instance->traceLevels(); if(traceLevels->retry >= 2) { Trace out(_instance->initializationData().logger, traceLevels->retryCat); out << "couldn't resolve endpoint host"; if(dynamic_cast(&ex)) { out << "\n"; } else { if(hasMore) { out << ", trying next endpoint\n"; } else { out << " and no more endpoints to try\n"; } } out << ex; } } void IceInternal::OutgoingConnectionFactory::handleConnectionException(const LocalException& ex, bool hasMore) { TraceLevelsPtr traceLevels = _instance->traceLevels(); if(traceLevels->retry >= 2) { Trace out(_instance->initializationData().logger, traceLevels->retryCat); out << "connection to endpoint failed"; if(dynamic_cast(&ex)) { out << "\n"; } else { if(hasMore) { out << ", trying next endpoint\n"; } else { out << " and no more endpoints to try\n"; } } out << ex; } } IceInternal::OutgoingConnectionFactory::ConnectCallback::ConnectCallback(const OutgoingConnectionFactoryPtr& factory, const vector& endpoints, bool hasMore, const CreateConnectionCallbackPtr& cb, Ice::EndpointSelectionType selType) : _factory(factory), _endpoints(endpoints), _hasMore(hasMore), _callback(cb), _selType(selType) { _endpointsIter = _endpoints.begin(); } // // Methods from ConnectionI.StartCallback // void IceInternal::OutgoingConnectionFactory::ConnectCallback::connectionStartCompleted(const ConnectionIPtr& connection) { if(_observer) { _observer->detach(); } connection->activate(); _factory->finishGetConnection(_connectors, *_iter, connection, this); } void IceInternal::OutgoingConnectionFactory::ConnectCallback::connectionStartFailed(const ConnectionIPtr& /*connection*/, const LocalException& ex) { assert(_iter != _connectors.end()); if(_observer) { _observer->failed(ex.ice_name()); _observer->detach(); } _factory->handleConnectionException(ex, _hasMore || _iter != _connectors.end() - 1); if(dynamic_cast(&ex)) // No need to continue. { _factory->finishGetConnection(_connectors, ex, this); } else if(++_iter != _connectors.end()) // Try the next connector. { nextConnector(); } else { _factory->finishGetConnection(_connectors, ex, this); } } // // Methods from EndpointI_connectors // void IceInternal::OutgoingConnectionFactory::ConnectCallback::connectors(const vector& connectors) { for(vector::const_iterator p = connectors.begin(); p != connectors.end(); ++p) { _connectors.push_back(ConnectorInfo(*p, *_endpointsIter)); } if(++_endpointsIter != _endpoints.end()) { nextEndpoint(); } else { assert(!_connectors.empty()); // // We now have all the connectors for the given endpoints. We can try to obtain the // connection. // _iter = _connectors.begin(); getConnection(); } } void IceInternal::OutgoingConnectionFactory::ConnectCallback::exception(const Ice::LocalException& ex) { _factory->handleException(ex, _hasMore || _endpointsIter != _endpoints.end() - 1); if(++_endpointsIter != _endpoints.end()) { nextEndpoint(); } else if(!_connectors.empty()) { // // We now have all the connectors for the given endpoints. We can try to obtain the // connection. // _iter = _connectors.begin(); getConnection(); } else { _callback->setException(ex); _factory->decPendingConnectCount(); // Must be called last. } } void IceInternal::OutgoingConnectionFactory::ConnectCallback::getConnectors() { try { // // Notify the factory that there's an async connect pending. This is necessary // to prevent the outgoing connection factory to be destroyed before all the // pending asynchronous connects are finished. // _factory->incPendingConnectCount(); } catch(const Ice::LocalException& ex) { _callback->setException(ex); return; } nextEndpoint(); } void IceInternal::OutgoingConnectionFactory::ConnectCallback::nextEndpoint() { try { assert(_endpointsIter != _endpoints.end()); (*_endpointsIter)->connectors_async(_selType, this); } catch(const Ice::LocalException& ex) { exception(ex); } } void IceInternal::OutgoingConnectionFactory::ConnectCallback::getConnection() { try { // // If all the connectors have been created, we ask the factory to get a // connection. // bool compress; Ice::ConnectionIPtr connection = _factory->getConnection(_connectors, this, compress); if(!connection) { // // A null return value from getConnection indicates that the connection // is being established and that everthing has been done to ensure that // the callback will be notified when the connection establishment is // done or that the callback already obtain the connection. // return; } _callback->setConnection(connection, compress); _factory->decPendingConnectCount(); // Must be called last. } catch(const Ice::LocalException& ex) { _callback->setException(ex); _factory->decPendingConnectCount(); // Must be called last. } } void IceInternal::OutgoingConnectionFactory::ConnectCallback::nextConnector() { Ice::ConnectionIPtr connection; try { const CommunicatorObserverPtr& obsv = _factory->_instance->getObserver(); if(obsv) { _observer = obsv->getConnectionEstablishmentObserver(_iter->endpoint, _iter->connector->toString()); if(_observer) { _observer->attach(); } } assert(_iter != _connectors.end()); connection = _factory->createConnection(_iter->connector->connect(), *_iter); connection->start(this); } catch(const Ice::LocalException& ex) { connectionStartFailed(connection, ex); } } void IceInternal::OutgoingConnectionFactory::ConnectCallback::setConnection(const Ice::ConnectionIPtr& connection, bool compress) { // // Callback from the factory: the connection to one of the callback // connectors has been established. // _callback->setConnection(connection, compress); _factory->decPendingConnectCount(); // Must be called last. } void IceInternal::OutgoingConnectionFactory::ConnectCallback::setException(const Ice::LocalException& ex) { // // Callback from the factory: connection establishment failed. // _callback->setException(ex); _factory->decPendingConnectCount(); // Must be called last. } bool IceInternal::OutgoingConnectionFactory::ConnectCallback::hasConnector(const ConnectorInfo& ci) { return find(_connectors.begin(), _connectors.end(), ci) != _connectors.end(); } bool IceInternal::OutgoingConnectionFactory::ConnectCallback::removeConnectors(const vector& connectors) { // // Callback from the factory: connecting to the given connectors // failed, we remove the connectors and return true if there's // no more connectors left to try. // for(vector::const_iterator p = connectors.begin(); p != connectors.end(); ++p) { _connectors.erase(remove(_connectors.begin(), _connectors.end(), *p), _connectors.end()); } return _connectors.empty(); } void IceInternal::OutgoingConnectionFactory::ConnectCallback::removeFromPending() { _factory->removeFromPending(this, _connectors); } bool IceInternal::OutgoingConnectionFactory::ConnectCallback::operator<(const ConnectCallback& rhs) const { return this < &rhs; } void IceInternal::IncomingConnectionFactory::activate() { IceUtil::Monitor::Lock sync(*this); setState(StateActive); } void IceInternal::IncomingConnectionFactory::hold() { IceUtil::Monitor::Lock sync(*this); setState(StateHolding); } void IceInternal::IncomingConnectionFactory::destroy() { IceUtil::Monitor::Lock sync(*this); setState(StateClosed); } void IceInternal::IncomingConnectionFactory::updateConnectionObservers() { IceUtil::Monitor::Lock sync(*this); for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&ConnectionI::updateObserver)); } void IceInternal::IncomingConnectionFactory::waitUntilHolding() const { set connections; { IceUtil::Monitor::Lock sync(*this); // // First we wait until the connection factory itself is in holding // state. // while(_state < StateHolding) { wait(); } // // We want to wait until all connections are in holding state // outside the thread synchronization. // connections = _connections; } // // Now we wait until each connection is in holding state. // for_each(connections.begin(), connections.end(), Ice::constVoidMemFun(&ConnectionI::waitUntilHolding)); } void IceInternal::IncomingConnectionFactory::waitUntilFinished() { set connections; { IceUtil::Monitor::Lock sync(*this); // // First we wait until the factory is destroyed. If we are using // an acceptor, we also wait for it to be closed. // while(_state != StateFinished) { wait(); } // // Clear the OA. See bug 1673 for the details of why this is necessary. // _adapter = 0; // We want to wait until all connections are finished outside the // thread synchronization. // connections = _connections; } for_each(connections.begin(), connections.end(), Ice::voidMemFun(&ConnectionI::waitUntilFinished)); { IceUtil::Monitor::Lock sync(*this); // Ensure all the connections are finished and reapable at this point. vector cons; _reaper->swapConnections(cons); assert(cons.size() == _connections.size()); cons.clear(); _connections.clear(); } } EndpointIPtr IceInternal::IncomingConnectionFactory::endpoint() const { // No mutex protection necessary, _endpoint is immutable. return _endpoint; } list IceInternal::IncomingConnectionFactory::connections() const { IceUtil::Monitor::Lock sync(*this); list result; // // Only copy connections which have not been destroyed. // remove_copy_if(_connections.begin(), _connections.end(), back_inserter(result), not1(Ice::constMemFun(&ConnectionI::isActiveOrHolding))); return result; } void IceInternal::IncomingConnectionFactory::flushAsyncBatchRequests(const CommunicatorBatchOutgoingAsyncPtr& outAsync) { list c = connections(); // connections() is synchronized, so no need to synchronize here. for(list::const_iterator p = c.begin(); p != c.end(); ++p) { try { outAsync->flushConnection(*p); } catch(const LocalException&) { // Ignore. } } } #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) bool IceInternal::IncomingConnectionFactory::startAsync(SocketOperation) { if(_state >= StateClosed) { return false; } try { _acceptor->startAccept(); } catch(const Ice::LocalException& ex) { { Error out(_instance->initializationData().logger); out << "can't accept connections:\n" << ex << '\n' << _acceptor->toString(); } abort(); } return true; } bool IceInternal::IncomingConnectionFactory::finishAsync(SocketOperation) { assert(_acceptor); try { _acceptor->finishAccept(); } catch(const LocalException& ex) { Error out(_instance->initializationData().logger); out << "couldn't accept connection:\n" << ex << '\n' << _acceptor->toString(); return false; } return _state < StateClosed; } #endif void IceInternal::IncomingConnectionFactory::message(ThreadPoolCurrent& current) { ConnectionIPtr connection; ThreadPoolMessage msg(current, *this); { IceUtil::Monitor::Lock sync(*this); ThreadPoolMessage::IOScope io(msg); if(!io) { return; } if(_state >= StateClosed) { return; } else if(_state == StateHolding) { IceUtil::ThreadControl::yield(); return; } // // Reap closed connections // vector cons; _reaper->swapConnections(cons); for(vector::const_iterator p = cons.begin(); p != cons.end(); ++p) { _connections.erase(*p); } // // Now accept a new connection. // TransceiverPtr transceiver; try { transceiver = _acceptor->accept(); } catch(const SocketException& ex) { if(noMoreFds(ex.error)) { { Error out(_instance->initializationData().logger); out << "fatal error: can't accept more connections:\n" << ex << '\n' << _acceptor->toString(); } abort(); } // Ignore socket exceptions. return; } catch(const LocalException& ex) { // Warn about other Ice local exceptions. if(_warn) { Warning out(_instance->initializationData().logger); out << "connection exception:\n" << ex << '\n' << _acceptor->toString(); } return; } assert(transceiver); try { connection = new ConnectionI(_adapter->getCommunicator(), _instance, _reaper, transceiver, 0, _endpoint, _adapter); } catch(const LocalException& ex) { try { transceiver->close(); } catch(const Ice::LocalException&) { // Ignore. } if(_warn) { Warning out(_instance->initializationData().logger); out << "connection exception:\n" << ex << '\n' << _acceptor->toString(); } return; } _connections.insert(connection); } assert(connection); connection->start(this); } void IceInternal::IncomingConnectionFactory::finished(ThreadPoolCurrent&) { IceUtil::Monitor::Lock sync(*this); assert(_state == StateClosed); setState(StateFinished); } string IceInternal::IncomingConnectionFactory::toString() const { IceUtil::Monitor::Lock sync(*this); if(_transceiver) { return _transceiver->toString(); } assert(_acceptor); return _acceptor->toString(); } NativeInfoPtr IceInternal::IncomingConnectionFactory::getNativeInfo() { if(_transceiver) { return _transceiver->getNativeInfo(); } assert(_acceptor); return _acceptor->getNativeInfo(); } void IceInternal::IncomingConnectionFactory::connectionStartCompleted(const Ice::ConnectionIPtr& connection) { IceUtil::Monitor::Lock sync(*this); // // Initialy, connections are in the holding state. If the factory is active // we activate the connection. // if(_state == StateActive) { connection->activate(); } } void IceInternal::IncomingConnectionFactory::connectionStartFailed(const Ice::ConnectionIPtr& /*connection*/, const Ice::LocalException& ex) { IceUtil::Monitor::Lock sync(*this); if(_state >= StateClosed) { return; } // // Do not warn about connection exceptions here. The connection is not yet validated. // } // // COMPILERFIX: The ConnectionFactory setup is broken out into a separate initialize // function because when it was part of the constructor C++Builder 2007 apps would // crash if an execption was thrown from any calls within the constructor. // IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const InstancePtr& instance, const EndpointIPtr& endpoint, const ObjectAdapterPtr& adapter) : _instance(instance), _reaper(new ConnectionReaper()), _endpoint(endpoint), _adapter(adapter), _warn(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Connections") > 0), _state(StateHolding) { } void IceInternal::IncomingConnectionFactory::initialize(const string& oaName) { if(_instance->defaultsAndOverrides()->overrideTimeout) { const_cast(_endpoint) = _endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue); } if(_instance->defaultsAndOverrides()->overrideCompress) { const_cast(_endpoint) = _endpoint->compress(_instance->defaultsAndOverrides()->overrideCompressValue); } try { const_cast(_transceiver) = _endpoint->transceiver(const_cast(_endpoint)); if(_transceiver) { ConnectionIPtr connection = new ConnectionI(_adapter->getCommunicator(), _instance, _reaper, _transceiver, 0, _endpoint, _adapter); connection->start(0); _connections.insert(connection); } else { const_cast(_acceptor) = _endpoint->acceptor(const_cast(_endpoint), oaName); assert(_acceptor); _acceptor->listen(); dynamic_cast(_adapter.get())->getThreadPool()->initialize(this); } } catch(const Ice::Exception&) { if(_transceiver) { try { _transceiver->close(); } catch(const Ice::LocalException&) { // Ignore } } if(_acceptor) { try { _acceptor->close(); } catch(const Ice::LocalException&) { // Ignore } } _state = StateFinished; _connections.clear(); throw; } } IceInternal::IncomingConnectionFactory::~IncomingConnectionFactory() { assert(_state == StateFinished); assert(_connections.empty()); } void IceInternal::IncomingConnectionFactory::setState(State state) { if(_state == state) // Don't switch twice. { return; } switch(state) { case StateActive: { if(_state != StateHolding) // Can only switch from holding to active. { return; } if(_acceptor) { if(_instance->traceLevels()->network >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); out << "accepting " << _endpoint->protocol() << " connections at " << _acceptor->toString(); } dynamic_cast(_adapter.get())->getThreadPool()->_register(this, SocketOperationRead); } for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&ConnectionI::activate)); break; } case StateHolding: { if(_state != StateActive) // Can only switch from active to holding. { return; } if(_acceptor) { if(_instance->traceLevels()->network >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); out << "holding " << _endpoint->protocol() << " connections at " << _acceptor->toString(); } dynamic_cast(_adapter.get())->getThreadPool()->unregister(this, SocketOperationRead); } for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&ConnectionI::hold)); break; } case StateClosed: { if(_acceptor) { dynamic_cast(_adapter.get())->getThreadPool()->finish(this); } else { state = StateFinished; } #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) // // With IOCP and WinRT, we close the acceptor now to cancel all the pending // asynchronous operations. It's important to wait for the pending asynchronous // operations to return before ConnectionI::finished(). Otherwise, if there was // a pending message waiting to be sent, the connection wouldn't know whether // or not the send failed or succeeded, potentially breaking at-most-once semantics. // if(_acceptor) { _acceptor->close(); } #endif for_each(_connections.begin(), _connections.end(), bind2nd(Ice::voidMemFun1(&ConnectionI::destroy), ConnectionI::ObjectAdapterDeactivated)); break; } case StateFinished: { assert(_state == StateClosed); #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) if(_acceptor) { _acceptor->close(); } #endif break; } } _state = state; notifyAll(); } Ice-3.5.1/cpp/src/Ice/Connector.cpp0000644000076400007640000000077212223561476015107 0ustar mesmes// ********************************************************************** // // 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 using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(Connector* p) { return p; } Ice-3.5.1/cpp/src/Ice/UdpConnector.h0000644000076400007640000000232512223561476015221 0ustar mesmes// ********************************************************************** // // 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 ICE_UDP_CONNECTOR_H #define ICE_UDP_CONNECTOR_H #include #include #include #include #include namespace IceInternal { class UdpConnector : public Connector { public: virtual TransceiverPtr connect(); virtual Ice::Short type() const; virtual std::string toString() const; virtual bool operator==(const Connector&) const; virtual bool operator!=(const Connector&) const; virtual bool operator<(const Connector&) const; private: UdpConnector(const InstancePtr&, const Address&, const std::string&, int, const std::string&); virtual ~UdpConnector(); friend class UdpEndpointI; const InstancePtr _instance; const Address _addr; const std::string _mcastInterface; const int _mcastTtl; const std::string _connectionId; }; } #endif Ice-3.5.1/cpp/src/Ice/Stream.cpp0000644000076400007640000000231312223561476014401 0ustar mesmes// ********************************************************************** // // 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 using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* Ice::upCast(InputStream* p) { return p; } IceUtil::Shared* Ice::upCast(OutputStream* p) { return p; } void Ice::UserExceptionReader::__writeImpl(::IceInternal::BasicStream*) const { assert(false); // Should never be called. } void Ice::UserExceptionReader::__readImpl(::IceInternal::BasicStream*) { assert(false); // Should never be called. } bool Ice::UserExceptionReader::__usesClasses() const { return usesClasses(); } void Ice::UserExceptionWriter::__writeImpl(::IceInternal::BasicStream*) const { assert(false); // Should never be called. } void Ice::UserExceptionWriter::__readImpl(::IceInternal::BasicStream*) { assert(false); // Should never be called. } bool Ice::UserExceptionWriter::__usesClasses() const { return usesClasses(); } Ice-3.5.1/cpp/src/Ice/ObjectFactoryManager.cpp0000644000076400007640000000646112223561476017207 0ustar mesmes // ********************************************************************** // // 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 #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(ObjectFactoryManager* p) { return p; } void IceInternal::ObjectFactoryManager::add(const ObjectFactoryPtr& factory, const string& id) { IceUtil::Mutex::Lock sync(*this); if((_factoryMapHint != _factoryMap.end() && _factoryMapHint->first == id) || _factoryMap.find(id) != _factoryMap.end()) { AlreadyRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "object factory"; ex.id = id; throw ex; } _factoryMapHint = _factoryMap.insert(_factoryMapHint, pair(id, factory)); } void IceInternal::ObjectFactoryManager::remove(const string& id) { ObjectFactoryPtr factory = 0; { IceUtil::Mutex::Lock sync(*this); FactoryMap::iterator p = _factoryMap.end(); if(_factoryMapHint != _factoryMap.end()) { if(_factoryMapHint->first == id) { p = _factoryMapHint; } } if(p == _factoryMap.end()) { p = _factoryMap.find(id); if(p == _factoryMap.end()) { NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "object factory"; ex.id = id; throw ex; } } assert(p != _factoryMap.end()); factory = p->second; if(p == _factoryMapHint) { _factoryMap.erase(p++); _factoryMapHint = p; } else { _factoryMap.erase(p); } } // // Destroy outside the lock // assert(factory != 0); factory->destroy(); } ObjectFactoryPtr IceInternal::ObjectFactoryManager::find(const string& id) const { IceUtil::Mutex::Lock sync(*this); FactoryMap& factoryMap = const_cast(_factoryMap); FactoryMap::iterator p = factoryMap.end(); if(_factoryMapHint != factoryMap.end()) { if(_factoryMapHint->first == id) { p = _factoryMapHint; } } if(p == factoryMap.end()) { p = factoryMap.find(id); } if(p != factoryMap.end()) { _factoryMapHint = p; return p->second; } else { return 0; } } IceInternal::ObjectFactoryManager::ObjectFactoryManager() : _factoryMapHint(_factoryMap.end()) { } void IceInternal::ObjectFactoryManager::destroy() { FactoryMap oldMap; { IceUtil::Mutex::Lock sync(*this); oldMap.swap(_factoryMap); _factoryMapHint = _factoryMap.end(); } // // Destroy all outside lock // for_each(oldMap.begin(), oldMap.end(), Ice::secondVoidMemFun(&ObjectFactory::destroy)); } Ice-3.5.1/cpp/src/Ice/ObserverHelper.cpp0000644000076400007640000000367212223561476016106 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace Ice; using namespace Ice::Instrumentation; namespace { Ice::Context emptyCtx; } IceInternal::InvocationObserver::InvocationObserver(IceProxy::Ice::Object* proxy, const string& op, const Context* ctx) { const CommunicatorObserverPtr& obsv = proxy->__reference()->getInstance()->getObserver(); if(!obsv) { return; } if(ctx) { attach(obsv->getInvocationObserver(proxy, op, *ctx)); } else { attach(obsv->getInvocationObserver(proxy, op, emptyCtx)); } } IceInternal::InvocationObserver::InvocationObserver(IceInternal::Instance* instance, const string& op) { const CommunicatorObserverPtr& obsv = instance->getObserver(); if(!obsv) { return; } attach(obsv->getInvocationObserver(0, op, emptyCtx)); } void IceInternal::InvocationObserver::attach(IceProxy::Ice::Object* proxy, const string& op, const Context* ctx) { const CommunicatorObserverPtr& obsv = proxy->__reference()->getInstance()->getObserver(); if(!obsv) { return; } if(ctx) { attach(obsv->getInvocationObserver(proxy, op, *ctx)); } else { attach(obsv->getInvocationObserver(proxy, op, emptyCtx)); } } void IceInternal::InvocationObserver::attach(IceInternal::Instance* instance, const string& op) { const CommunicatorObserverPtr& obsv = instance->getObserver(); if(!obsv) { return; } attach(obsv->getInvocationObserver(0, op, emptyCtx)); } Ice-3.5.1/cpp/src/Ice/ConnectionRequestHandler.cpp0000644000076400007640000000461212223561476020120 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include using namespace std; using namespace IceInternal; ConnectionRequestHandler::ConnectionRequestHandler(const ReferencePtr& reference, const Ice::ObjectPrx& proxy) : RequestHandler(reference) { _connection = _reference->getConnection(_compress); RouterInfoPtr ri = reference->getRouterInfo(); if(ri) { ri->addProxy(proxy); } } ConnectionRequestHandler::ConnectionRequestHandler(const ReferencePtr& reference, const Ice::ConnectionIPtr& connection, bool compress) : RequestHandler(reference), _connection(connection), _compress(compress) { } void ConnectionRequestHandler::prepareBatchRequest(BasicStream* out) { _connection->prepareBatchRequest(out); } void ConnectionRequestHandler::finishBatchRequest(BasicStream* out) { _connection->finishBatchRequest(out, _compress); } void ConnectionRequestHandler::abortBatchRequest() { _connection->abortBatchRequest(); } Ice::ConnectionI* ConnectionRequestHandler::sendRequest(Outgoing* out) { if(!_connection->sendRequest(out, _compress, _response) || _response) { return _connection.get(); // The request hasn't been sent or we're expecting a response. } else { return 0; // The request has been sent. } } AsyncStatus ConnectionRequestHandler::sendAsyncRequest(const OutgoingAsyncPtr& out) { return _connection->sendAsyncRequest(out, _compress, _response); } bool ConnectionRequestHandler::flushBatchRequests(BatchOutgoing* out) { return _connection->flushBatchRequests(out); } AsyncStatus ConnectionRequestHandler::flushAsyncBatchRequests(const BatchOutgoingAsyncPtr& out) { return _connection->flushAsyncBatchRequests(out); } Ice::ConnectionIPtr ConnectionRequestHandler::getConnection(bool /*wait*/) { return _connection; } Ice-3.5.1/cpp/src/Ice/PluginManagerI.h0000644000076400007640000000360212223561476015457 0ustar mesmes// ********************************************************************** // // 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 ICE_PLUGIN_MANAGER_I_H #define ICE_PLUGIN_MANAGER_I_H #include #include #include #include #include #include #include namespace IceInternal { ICE_API void loadPlugin(const ::Ice::CommunicatorPtr&, const std::string&, const std::string&, Ice::StringSeq&); } namespace Ice { class PluginManagerI : public PluginManager, public IceUtil::Mutex { public: virtual void initializePlugins(); virtual StringSeq getPlugins(); virtual PluginPtr getPlugin(const std::string&); virtual void addPlugin(const std::string&, const PluginPtr&); virtual void destroy(); private: PluginManagerI(const CommunicatorPtr&, const IceInternal::DynamicLibraryListPtr&); friend class IceInternal::Instance; friend void IceInternal::loadPlugin(const Ice::CommunicatorPtr&, const std::string&, const std::string&, Ice::StringSeq&); void loadPlugins(int&, char*[]); void loadPlugin(const std::string&, const std::string&, StringSeq&); PluginPtr findPlugin(const std::string&) const; CommunicatorPtr _communicator; IceInternal::DynamicLibraryListPtr _libraries; struct PluginInfo { std::string name; PluginPtr plugin; }; typedef std::vector PluginInfoList; PluginInfoList _plugins; bool _initialized; static const char * const _kindOfObject; }; typedef IceUtil::Handle PluginManagerIPtr; } #endif Ice-3.5.1/cpp/src/Ice/TcpConnector.cpp0000644000076400007640000000605012223561476015551 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; TransceiverPtr IceInternal::TcpConnector::connect() { if(_traceLevels->network >= 2) { Trace out(_logger, _traceLevels->networkCat); out << "trying to establish tcp connection to " << toString(); } try { TransceiverPtr transceiver = new TcpTransceiver(_instance, createSocket(false, _addr), _proxy, _addr); dynamic_cast(transceiver.get())->connect(); return transceiver; } catch(const Ice::LocalException& ex) { if(_traceLevels->network >= 2) { Trace out(_logger, _traceLevels->networkCat); out << "failed to establish tcp connection to " << toString() << "\n" << ex; } throw; } } Short IceInternal::TcpConnector::type() const { return TCPEndpointType; } string IceInternal::TcpConnector::toString() const { return addrToString(!_proxy ? _addr : _proxy->getAddress()); } bool IceInternal::TcpConnector::operator==(const Connector& r) const { const TcpConnector* p = dynamic_cast(&r); if(!p) { return false; } if(compareAddress(_addr, p->_addr) != 0) { return false; } if(_timeout != p->_timeout) { return false; } if(_connectionId != p->_connectionId) { return false; } return true; } bool IceInternal::TcpConnector::operator!=(const Connector& r) const { return !operator==(r); } bool IceInternal::TcpConnector::operator<(const Connector& r) const { const TcpConnector* p = dynamic_cast(&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; } return compareAddress(_addr, p->_addr) < 0; } IceInternal::TcpConnector::TcpConnector(const InstancePtr& instance, const Address& addr, const NetworkProxyPtr& proxy, Ice::Int timeout, const string& connectionId) : _instance(instance), _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger), _addr(addr), _proxy(proxy), _timeout(timeout), _connectionId(connectionId) { } IceInternal::TcpConnector::~TcpConnector() { } Ice-3.5.1/cpp/src/Ice/Makefile0000644000076400007640000001146712223561476014114 0ustar mesmes# ********************************************************************** # # 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,Ice,$(VERSION)) SONAME = $(call mksoname,Ice,$(SOVERSION)) LIBNAME = $(call mklibname,Ice) TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME)) OBJS = Acceptor.o \ Application.o \ Base64.o \ Buffer.o \ BasicStream.o \ BuiltinSequences.o \ CommunicatorI.o \ Communicator.o \ ConnectRequestHandler.o \ ConnectionFactory.o \ ConnectionI.o \ ConnectionMonitor.o \ Connection.o \ ConnectionRequestHandler.o \ Connector.o \ Current.o \ DefaultsAndOverrides.o \ Direct.o \ DispatchInterceptor.o \ DynamicLibrary.o \ Endpoint.o \ EndpointFactoryManager.o \ EndpointFactory.o \ EndpointI.o \ EndpointTypes.o \ EventHandler.o \ Exception.o \ FacetMap.o \ FactoryTable.o \ FactoryTableInit.o \ GC.o \ Identity.o \ ImplicitContextI.o \ ImplicitContext.o \ IncomingAsync.o \ Incoming.o \ Initialize.o \ Instance.o \ LocalException.o \ LocalObject.o \ LocatorInfo.o \ Locator.o \ LoggerI.o \ Logger.o \ LoggerUtil.o \ Metrics.o \ MetricsAdminI.o \ MetricsObserverI.o \ Network.o \ ObjectAdapterFactory.o \ ObjectAdapterI.o \ ObjectAdapter.o \ ObjectFactoryManager.o \ ObjectFactory.o \ Object.o \ Instrumentation.o \ ObserverHelper.o \ InstrumentationI.o \ OpaqueEndpointI.o \ OutgoingAsync.o \ Outgoing.o \ PluginManagerI.o \ Plugin.o \ Process.o \ PropertiesAdminI.o \ PropertiesI.o \ PropertiesAdmin.o \ Properties.o \ PropertyNames.o \ Protocol.o \ ProtocolPluginFacade.o \ ProxyFactory.o \ Proxy.o \ ReferenceFactory.o \ Reference.o \ RetryQueue.o \ RequestHandler.o \ RouterInfo.o \ Router.o \ Selector.o \ ServantLocator.o \ ServantManager.o \ Service.o \ SliceChecksumDict.o \ SliceChecksums.o \ SlicedData.o \ Stats.o \ StreamI.o \ Stream.o \ StringConverter.o \ TcpAcceptor.o \ TcpConnector.o \ TcpEndpointI.o \ TcpTransceiver.o \ ThreadPool.o \ TraceLevels.o \ TraceUtil.o \ Transceiver.o \ UdpConnector.o \ UdpEndpointI.o \ UdpTransceiver.o \ Version.o ifeq ($(findstring MINGW,$(shell uname)),) OBJS := $(OBJS) \ SysLoggerI.o endif SRCS = $(OBJS:.o=.cpp) \ DLLMain.cpp SLICE_SRCS = $(SDIR)/BuiltinSequences.ice \ $(SDIR)/CommunicatorF.ice \ $(SDIR)/Communicator.ice \ $(SDIR)/ConnectionF.ice \ $(SDIR)/Connection.ice \ $(SDIR)/Current.ice \ $(SDIR)/Endpoint.ice \ $(SDIR)/EndpointF.ice \ $(SDIR)/EndpointTypes.ice \ $(SDIR)/FacetMap.ice \ $(SDIR)/Identity.ice \ $(SDIR)/ImplicitContextF.ice \ $(SDIR)/ImplicitContext.ice \ $(SDIR)/LocalException.ice \ $(SDIR)/LocatorF.ice \ $(SDIR)/Locator.ice \ $(SDIR)/LoggerF.ice \ $(SDIR)/Logger.ice \ $(SDIR)/Metrics.ice \ $(SDIR)/ObjectAdapterF.ice \ $(SDIR)/ObjectAdapter.ice \ $(SDIR)/ObjectFactoryF.ice \ $(SDIR)/ObjectFactory.ice \ $(SDIR)/Instrumentation.ice \ $(SDIR)/InstrumentationF.ice \ $(SDIR)/PluginF.ice \ $(SDIR)/Plugin.ice \ $(SDIR)/ProcessF.ice \ $(SDIR)/Process.ice \ $(SDIR)/PropertiesF.ice \ $(SDIR)/PropertiesAdmin.ice \ $(SDIR)/Properties.ice \ $(SDIR)/RouterF.ice \ $(SDIR)/Router.ice \ $(SDIR)/ServantLocatorF.ice \ $(SDIR)/ServantLocator.ice \ $(SDIR)/SliceChecksumDict.ice \ $(SDIR)/StatsF.ice \ $(SDIR)/Stats.ice \ $(SDIR)/Version.ice \ HDIR = $(headerdir)/Ice SDIR = $(slicedir)/Ice include $(top_srcdir)/config/Make.rules CPPFLAGS := -I.. $(CPPFLAGS) -DICE_API_EXPORTS $(BZIP2_FLAGS) ifneq ($(COMPSUFFIX),) CPPFLAGS := $(CPPFLAGS) -DCOMPSUFFIX=\"$(COMPSUFFIX)\" endif SLICE2CPPFLAGS := --ice --include-dir Ice --dll-export ICE_API $(SLICE2CPPFLAGS) LINKWITH := -lIceUtil $(BZIP2_LIBS) $(ICONV_LIBS) $(ICE_OS_LIBS) 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 install:: all $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME)) include .depend Ice-3.5.1/cpp/src/Ice/InstrumentationI.h0000644000076400007640000002137312223561476016136 0ustar mesmes// ********************************************************************** // // 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 ICE_INSTRUMENTATION_I_H #define ICE_INSTRUMENTATION_I_H #include #include namespace IceInternal { template class ObserverWithDelegateT : public IceMX::ObserverT, virtual public O { public: typedef O ObserverType; typedef typename IceInternal::Handle ObserverPtrType; virtual void attach() { IceMX::ObserverT::attach(); if(_delegate) { _delegate->attach(); } } virtual void detach() { IceMX::ObserverT::detach(); if(_delegate) { _delegate->detach(); } } virtual void failed(const std::string& exceptionName) { IceMX::ObserverT::failed(exceptionName); if(_delegate) { _delegate->failed(exceptionName); } } ObserverPtrType getDelegate() const { return _delegate; } void setDelegate(ObserverPtrType delegate) { _delegate = delegate; } template ObserverPtrType getObserverWithDelegate(const std::string& mapName, const IceMX::MetricsHelperT& helper, const ObserverPtrType& del) { IceInternal::Handle obsv = IceMX::ObserverT::template getObserver(mapName, helper); if(obsv) { obsv->setDelegate(del); return obsv; } return del; } protected: ObserverPtrType _delegate; }; template class ObserverFactoryWithDelegateT : public IceMX::ObserverFactoryT { public: ObserverFactoryWithDelegateT(const IceInternal::MetricsAdminIPtr& metrics, const std::string& name) : IceMX::ObserverFactoryT(metrics, name) { } template ObserverPtrType getObserverWithDelegate(const IceMX::MetricsHelperT& helper, const ObserverPtrType& del) { IceInternal::Handle obsv = IceMX::ObserverFactoryT::getObserver(helper); if(obsv) { obsv->setDelegate(del); return obsv; } return del; } template ObserverPtrType getObserverWithDelegate(const IceMX::MetricsHelperT& helper, const ObserverPtrType& del, const ObserverPtrType& old) { IceInternal::Handle obsv = IceMX::ObserverFactoryT::getObserver(helper, old); if(obsv) { obsv->setDelegate(del); return obsv; } return del; } }; template void addEndpointAttributes(typename Helper::Attributes& attrs) { attrs.add("endpoint", &Helper::getEndpoint); attrs.add("endpointType", &Helper::getEndpointInfo, &Ice::EndpointInfo::type); attrs.add("endpointIsDatagram", &Helper::getEndpointInfo, &Ice::EndpointInfo::datagram); attrs.add("endpointIsSecure", &Helper::getEndpointInfo, &Ice::EndpointInfo::secure); attrs.add("endpointTimeout", &Helper::getEndpointInfo, &Ice::EndpointInfo::timeout); attrs.add("endpointCompress", &Helper::getEndpointInfo, &Ice::EndpointInfo::compress); attrs.add("endpointHost", &Helper::getEndpointInfo, &Ice::IPEndpointInfo::host); attrs.add("endpointPort", &Helper::getEndpointInfo, &Ice::IPEndpointInfo::port); } template void addConnectionAttributes(typename Helper::Attributes& attrs) { attrs.add("incoming", &Helper::getConnectionInfo, &Ice::ConnectionInfo::incoming); attrs.add("adapterName", &Helper::getConnectionInfo, &Ice::ConnectionInfo::adapterName); attrs.add("connectionId", &Helper::getConnectionInfo, &Ice::ConnectionInfo::connectionId); attrs.add("localHost", &Helper::getConnectionInfo, &Ice::IPConnectionInfo::localAddress); attrs.add("localPort", &Helper::getConnectionInfo, &Ice::IPConnectionInfo::localPort); attrs.add("remoteHost", &Helper::getConnectionInfo, &Ice::IPConnectionInfo::remoteAddress); attrs.add("remotePort", &Helper::getConnectionInfo, &Ice::IPConnectionInfo::remotePort); attrs.add("mcastHost", &Helper::getConnectionInfo, &Ice::UDPConnectionInfo::mcastAddress); attrs.add("mcastPort", &Helper::getConnectionInfo, &Ice::UDPConnectionInfo::mcastPort); addEndpointAttributes(attrs); } class ConnectionObserverI : public ObserverWithDelegateT { public: virtual void sentBytes(Ice::Int); virtual void receivedBytes(Ice::Int); }; class ThreadObserverI : public ObserverWithDelegateT { public: virtual void stateChanged(Ice::Instrumentation::ThreadState, Ice::Instrumentation::ThreadState); }; class DispatchObserverI : public ObserverWithDelegateT { public: virtual void userException(); virtual void reply(Ice::Int); }; class RemoteObserverI : public ObserverWithDelegateT { public: virtual void reply(Ice::Int); }; class InvocationObserverI : public ObserverWithDelegateT { public: virtual void retried(); virtual void userException(); virtual Ice::Instrumentation::RemoteObserverPtr getRemoteObserver(const Ice::ConnectionInfoPtr&, const Ice::EndpointPtr&, Ice::Int, Ice::Int); }; typedef ObserverWithDelegateT ObserverI; class ICE_API CommunicatorObserverI : public Ice::Instrumentation::CommunicatorObserver { public: CommunicatorObserverI(const IceInternal::MetricsAdminIPtr&, const Ice::Instrumentation::CommunicatorObserverPtr& = Ice::Instrumentation::CommunicatorObserverPtr()); virtual void setObserverUpdater(const Ice::Instrumentation::ObserverUpdaterPtr&); virtual Ice::Instrumentation::ObserverPtr getConnectionEstablishmentObserver(const Ice::EndpointPtr&, const std::string&); virtual Ice::Instrumentation::ObserverPtr getEndpointLookupObserver(const Ice::EndpointPtr&); virtual Ice::Instrumentation::ConnectionObserverPtr getConnectionObserver(const Ice::ConnectionInfoPtr&, const Ice::EndpointPtr&, Ice::Instrumentation::ConnectionState, const Ice::Instrumentation::ConnectionObserverPtr&); virtual Ice::Instrumentation::ThreadObserverPtr getThreadObserver(const std::string&, const std::string&, Ice::Instrumentation::ThreadState, const Ice::Instrumentation::ThreadObserverPtr&); virtual Ice::Instrumentation::InvocationObserverPtr getInvocationObserver(const Ice::ObjectPrx&, const std::string&, const Ice::Context&); virtual Ice::Instrumentation::DispatchObserverPtr getDispatchObserver(const Ice::Current&, Ice::Int); const IceInternal::MetricsAdminIPtr& getMetricsAdmin() const; void destroy(); private: IceInternal::MetricsAdminIPtr _metrics; Ice::LoggerPtr _logger; const Ice::Instrumentation::CommunicatorObserverPtr _delegate; ObserverFactoryWithDelegateT _connections; ObserverFactoryWithDelegateT _dispatch; ObserverFactoryWithDelegateT _invocations; ObserverFactoryWithDelegateT _threads; ObserverFactoryWithDelegateT _connects; ObserverFactoryWithDelegateT _endpointLookups; }; typedef IceUtil::Handle CommunicatorObserverIPtr; }; #endif Ice-3.5.1/cpp/src/Ice/ThreadPool.cpp0000644000076400007640000010513212223561476015212 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** // // The following is required for MinGW to bring in // some definitions. // #if defined(__MINGW32__) # define _WIN32_WINNT 0x0501 #endif #include #include #include #include #include #include #include #include #include #include #include #if defined(ICE_OS_WINRT) # include #endif using namespace std; using namespace Ice; using namespace Ice::Instrumentation; using namespace IceInternal; ICE_DECLSPEC_EXPORT IceUtil::Shared* IceInternal::upCast(ThreadPool* p) { return p; } ICE_DECLSPEC_EXPORT IceUtil::Shared* IceInternal::upCast(ThreadPoolWorkItem* p) { return p; } namespace { class ShutdownWorkItem : public ThreadPoolWorkItem { public: ShutdownWorkItem(const InstancePtr& instance) : _instance(instance) { } virtual void execute(ThreadPoolCurrent& current) { current.ioCompleted(); try { _instance->objectAdapterFactory()->shutdown(); } catch(const CommunicatorDestroyedException&) { } } private: const InstancePtr _instance; }; class FinishedWorkItem : public ThreadPoolWorkItem { public: FinishedWorkItem(const EventHandlerPtr& handler) : _handler(handler) { } virtual void execute(ThreadPoolCurrent& current) { _handler->finished(current); } private: const EventHandlerPtr _handler; }; class JoinThreadWorkItem : public ThreadPoolWorkItem { public: JoinThreadWorkItem(const IceUtil::ThreadPtr& thread) : _thread(thread) { } virtual void execute(ThreadPoolCurrent&) { // No call to ioCompleted, this shouldn't block (and we don't want to cause // a new thread to be started). _thread->getThreadControl().join(); } private: IceUtil::ThreadPtr _thread; }; // // Exception raised by the thread pool work queue when the thread pool // is destroyed. // class ThreadPoolDestroyedException { }; } IceInternal::DispatchWorkItem::DispatchWorkItem(const InstancePtr& instance) : _instance(instance) { } void IceInternal::DispatchWorkItem::execute(ThreadPoolCurrent& current) { Ice::DispatcherPtr dispatcher = _instance->initializationData().dispatcher; if(dispatcher) { try { dispatcher->dispatch(this, 0); } catch(const std::exception& ex) { if(_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) { Warning out(_instance->initializationData().logger); out << "dispatch exception:\n" << ex; } } catch(...) { if(_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) { Warning out(_instance->initializationData().logger); out << "dispatch exception:\nunknown c++ exception"; } } } else { current.ioCompleted(); // Promote a follower. run(); } } IceInternal::ThreadPoolWorkQueue::ThreadPoolWorkQueue(const InstancePtr& instance, Selector& selector) : _instance(instance), _selector(selector), _destroyed(false) #ifdef ICE_USE_IOCP , _info(SocketOperationRead) #endif { #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) SOCKET fds[2]; createPipe(fds); _fdIntrRead = fds[0]; _fdIntrWrite = fds[1]; _selector.initialize(this); _selector.update(this, SocketOperationNone, SocketOperationRead); #endif } IceInternal::ThreadPoolWorkQueue::~ThreadPoolWorkQueue() { assert(_destroyed); #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) try { closeSocket(_fdIntrRead); } catch(const LocalException& ex) { Error out(_instance->initializationData().logger); out << "exception in selector while calling closeSocket():\n" << ex; } try { closeSocket(_fdIntrWrite); } catch(const LocalException& ex) { Error out(_instance->initializationData().logger); out << "exception in selector while calling closeSocket():\n" << ex; } #endif } void IceInternal::ThreadPoolWorkQueue::destroy() { Lock sync(*this); assert(!_destroyed); _destroyed = true; postMessage(); } void IceInternal::ThreadPoolWorkQueue::queue(const ThreadPoolWorkItemPtr& item) { Lock sync(*this); if(_destroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } _workItems.push_back(item); #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) if(_workItems.size() == 1) { postMessage(); } #else postMessage(); #endif } #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) bool IceInternal::ThreadPoolWorkQueue::startAsync(SocketOperation) { assert(false); return false; } bool IceInternal::ThreadPoolWorkQueue::finishAsync(SocketOperation) { assert(false); return false; } #endif void IceInternal::ThreadPoolWorkQueue::message(ThreadPoolCurrent& current) { ThreadPoolWorkItemPtr workItem; { Lock sync(*this); if(!_workItems.empty()) { workItem = _workItems.front(); _workItems.pop_front(); #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) if(_workItems.empty()) { char c; while(true) { ssize_t ret; # ifdef _WIN32 ret = ::recv(_fdIntrRead, &c, 1, 0); # else ret = ::read(_fdIntrRead, &c, 1); # endif if(ret == SOCKET_ERROR) { if(interrupted()) { continue; } SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } break; } } #endif } else { assert(_destroyed); #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) postMessage(); #endif } } if(workItem) { workItem->execute(current); } else { current.ioCompleted(); throw ThreadPoolDestroyedException(); } } void IceInternal::ThreadPoolWorkQueue::finished(ThreadPoolCurrent&) { assert(false); } string IceInternal::ThreadPoolWorkQueue::toString() const { return "work queue"; } NativeInfoPtr IceInternal::ThreadPoolWorkQueue::getNativeInfo() { #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) return new NativeInfo(_fdIntrRead); #else return 0; #endif } void IceInternal::ThreadPoolWorkQueue::postMessage() { #if defined(ICE_USE_IOCP) if(!PostQueuedCompletionStatus(_selector.getIOCPHandle(), 0, reinterpret_cast(this), &_info)) { SocketException ex(__FILE__, __LINE__); ex.error = GetLastError(); throw ex; } #elif defined(ICE_OS_WINRT) _selector.completed(this, SocketOperationRead); #else char c = 0; while(true) { # ifdef _WIN32 if(::send(_fdIntrWrite, &c, 1, 0) == SOCKET_ERROR) # else if(::write(_fdIntrWrite, &c, 1) == SOCKET_ERROR) # endif { if(interrupted()) { continue; } SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } break; } #endif } IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& prefix, int timeout) : _instance(instance), _destroyed(false), _prefix(prefix), _selector(instance), _nextThreadId(0), _size(0), _sizeIO(0), _sizeMax(0), _sizeWarn(0), _serialize(_instance->initializationData().properties->getPropertyAsInt(_prefix + ".Serialize") > 0), _hasPriority(false), _priority(0), _serverIdleTime(timeout), _threadIdleTime(0), _stackSize(0), _inUse(0), #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) _inUseIO(0), _nextHandler(_handlers.end()), #endif _promote(true) { PropertiesPtr properties = _instance->initializationData().properties; #ifndef ICE_OS_WINRT # ifdef _WIN32 SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); int nProcessors = sysInfo.dwNumberOfProcessors; # else int nProcessors = static_cast(sysconf(_SC_NPROCESSORS_ONLN)); # endif #endif // // We use just one thread as the default. This is the fastest // possible setting, still allows one level of nesting, and // doesn't require to make the servants thread safe. // int size = properties->getPropertyAsIntWithDefault(_prefix + ".Size", 1); if(size < 1) { Warning out(_instance->initializationData().logger); out << _prefix << ".Size < 1; Size adjusted to 1"; size = 1; } int sizeMax = properties->getPropertyAsIntWithDefault(_prefix + ".SizeMax", size); #ifndef ICE_OS_WINRT if(sizeMax == -1) { sizeMax = nProcessors; } #endif if(sizeMax < size) { Warning out(_instance->initializationData().logger); out << _prefix << ".SizeMax < " << _prefix << ".Size; SizeMax adjusted to Size (" << size << ")"; sizeMax = size; } int sizeWarn = properties->getPropertyAsInt(_prefix + ".SizeWarn"); if(sizeWarn != 0 && sizeWarn < size) { Warning out(_instance->initializationData().logger); out << _prefix << ".SizeWarn < " << _prefix << ".Size; adjusted SizeWarn to Size (" << size << ")"; sizeWarn = size; } else if(sizeWarn > sizeMax) { Warning out(_instance->initializationData().logger); out << _prefix << ".SizeWarn > " << _prefix << ".SizeMax; adjusted SizeWarn to SizeMax (" << sizeMax << ")"; sizeWarn = sizeMax; } int threadIdleTime = properties->getPropertyAsIntWithDefault(_prefix + ".ThreadIdleTime", 60); if(threadIdleTime < 0) { Warning out(_instance->initializationData().logger); out << _prefix << ".ThreadIdleTime < 0; ThreadIdleTime adjusted to 0"; threadIdleTime = 0; } const_cast(_size) = size; const_cast(_sizeMax) = sizeMax; const_cast(_sizeWarn) = sizeWarn; #ifndef ICE_OS_WINRT const_cast(_sizeIO) = min(sizeMax, nProcessors); #else const_cast(_sizeIO) = sizeMax; #endif const_cast(_threadIdleTime) = threadIdleTime; #ifdef ICE_USE_IOCP _selector.setup(_sizeIO); #endif int stackSize = properties->getPropertyAsInt(_prefix + ".StackSize"); if(stackSize < 0) { Warning out(_instance->initializationData().logger); out << _prefix << ".StackSize < 0; Size adjusted to OS default"; stackSize = 0; } const_cast(_stackSize) = static_cast(stackSize); const_cast(_hasPriority) = properties->getProperty(_prefix + ".ThreadPriority") != ""; const_cast(_priority) = properties->getPropertyAsInt(_prefix + ".ThreadPriority"); if(!_hasPriority) { const_cast(_hasPriority) = properties->getProperty("Ice.ThreadPriority") != ""; const_cast(_priority) = properties->getPropertyAsInt("Ice.ThreadPriority"); } _workQueue = new ThreadPoolWorkQueue(_instance, _selector); if(_instance->traceLevels()->threadPool >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->threadPoolCat); out << "creating " << _prefix << ": Size = " << _size << ", SizeMax = " << _sizeMax << ", SizeWarn = " << _sizeWarn; } __setNoDelete(true); try { for(int i = 0 ; i < _size ; ++i) { EventHandlerThreadPtr thread = new EventHandlerThread(this, nextThreadId()); if(_hasPriority) { thread->start(_stackSize, _priority); } else { thread->start(_stackSize); } _threads.insert(thread); } } catch(const IceUtil::Exception& ex) { { Error out(_instance->initializationData().logger); out << "cannot create thread for `" << _prefix << "':\n" << ex; } destroy(); joinWithAllThreads(); __setNoDelete(false); throw; } catch(...) { __setNoDelete(false); throw; } __setNoDelete(false); } IceInternal::ThreadPool::~ThreadPool() { assert(_destroyed); } void IceInternal::ThreadPool::destroy() { Lock sync(*this); assert(!_destroyed); _destroyed = true; _workQueue->destroy(); } void IceInternal::ThreadPool::updateObservers() { Lock sync(*this); for(set::iterator p = _threads.begin(); p != _threads.end(); ++p) { (*p)->updateObserver(); } } void IceInternal::ThreadPool::initialize(const EventHandlerPtr& handler) { Lock sync(*this); assert(!_destroyed); _selector.initialize(handler.get()); } void IceInternal::ThreadPool::update(const EventHandlerPtr& handler, SocketOperation remove, SocketOperation add) { Lock sync(*this); assert(!_destroyed); _selector.update(handler.get(), remove, add); } void IceInternal::ThreadPool::finish(const EventHandlerPtr& handler) { Lock sync(*this); assert(!_destroyed); #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) _selector.finish(handler.get()); // This must be called before! _workQueue->queue(new FinishedWorkItem(handler)); // // Clear the current ready handlers. The handlers from this vector can't be // reference counted and a handler might get destroyed once it's finished. // _handlers.clear(); _nextHandler = _handlers.end(); #else // If there are no pending asynchronous operations, we can call finish on the handler now. if(!handler->_pending) { _workQueue->queue(new FinishedWorkItem(handler)); _selector.finish(handler.get()); } else { handler->_finish = true; } #endif } void IceInternal::ThreadPool::execute(const ThreadPoolWorkItemPtr& workItem) { _workQueue->queue(workItem); } void IceInternal::ThreadPool::joinWithAllThreads() { assert(_destroyed); // // _threads is immutable after destroy() has been called, // therefore no synchronization is needed. (Synchronization // wouldn't be possible here anyway, because otherwise the other // threads would never terminate.) // for(set::iterator p = _threads.begin(); p != _threads.end(); ++p) { (*p)->getThreadControl().join(); } #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) _selector.finish(_workQueue.get()); #endif _selector.destroy(); } string IceInternal::ThreadPool::prefix() const { return _prefix; } void IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) { #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) ThreadPoolCurrent current(_instance, this, thread); bool select = false; vector > handlers; while(true) { if(current._handler) { try { current._handler->message(current); } catch(ThreadPoolDestroyedException&) { return; } catch(const exception& ex) { Error out(_instance->initializationData().logger); out << "exception in `" << _prefix << "':\n" << ex << "\nevent handler: " << current._handler->toString(); } catch(...) { Error out(_instance->initializationData().logger); out << "exception in `" << _prefix << "':\nevent handler: " << current._handler->toString(); } } else if(select) { try { _selector.select(handlers, _serverIdleTime); } catch(SelectorTimeoutException&) { Lock sync(*this); if(!_destroyed && _inUse == 0) { _workQueue->queue(new ShutdownWorkItem(_instance)); // Select timed-out. } continue; } } { Lock sync(*this); if(!current._handler) { if(select) { _handlers.swap(handlers); _nextHandler = _handlers.begin(); _selector.finishSelect(); select = false; } else if(!current._leader && followerWait(current)) { return; // Wait timed-out. } } else if(_sizeMax > 1) { if(!current._ioCompleted) { // // The handler didn't call ioCompleted() so we take care of decreasing // the IO thread count now. // --_inUseIO; } else { // // If the handler called ioCompleted(), we re-enable the handler in // case it was disabled and we decrease the number of thread in use. // _selector.enable(current._handler.get(), current.operation); assert(_inUse > 0); --_inUse; } if(!current._leader && followerWait(current)) { return; // Wait timed-out. } } // // Get the next ready handler. // if(_nextHandler != _handlers.end()) { current._ioCompleted = false; current._handler = _nextHandler->first; current.operation = _nextHandler->second; ++_nextHandler; thread->setState(ThreadStateInUseForIO); } else { current._handler = 0; } if(!current._handler) { // // If there are no more ready handlers and there are still threads busy performing // IO, we give up leadership and promote another follower (which will perform the // select() only once all the IOs are completed). Otherwise, if there are no more // threads peforming IOs, it's time to do another select(). // if(_inUseIO > 0) { promoteFollower(current); } else { _selector.startSelect(); select = true; thread->setState(ThreadStateIdle); } } else if(_sizeMax > 1) { // // Increment the IO thread count and if there are still threads available // to perform IO and more handlers ready, we promote a follower. // ++_inUseIO; if(_nextHandler != _handlers.end() && _inUseIO < _sizeIO) { promoteFollower(current); } } } } #else ThreadPoolCurrent current(_instance, this, thread); while(true) { try { current._ioCompleted = false; current._handler = _selector.getNextHandler(current.operation, _threadIdleTime); } catch(const SelectorTimeoutException&) { if(_sizeMax > 1) { Lock sync(*this); if(_destroyed) { continue; } else if(_inUse < static_cast(_threads.size() - 1)) // If not the last idle thread, we can exit. { #ifndef ICE_OS_WINRT BOOL hasIO = false; GetThreadIOPendingFlag(GetCurrentThread(), &hasIO); if(hasIO) { continue; } #endif if(_instance->traceLevels()->threadPool >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->threadPoolCat); out << "shrinking " << _prefix << ": Size = " << (_threads.size() - 1); } _threads.erase(thread); _workQueue->queue(new JoinThreadWorkItem(thread)); return; } else if(_inUse > 0) { // // If this is the last idle thread but there are still other threads // busy dispatching, we go back waiting with _threadIdleTime. We only // wait with _serverIdleTime when there's only one thread left. // continue; } assert(_threads.size() == 1); } try { current._handler = _selector.getNextHandler(current.operation, _serverIdleTime); } catch(const SelectorTimeoutException&) { Lock sync(*this); if(!_destroyed) { _workQueue->queue(new ShutdownWorkItem(_instance)); } continue; } } { IceUtil::Monitor::Lock sync(*this); thread->setState(ThreadStateInUseForIO); } try { assert(current._handler); current._handler->message(current); } catch(ThreadPoolDestroyedException&) { return; } catch(const exception& ex) { Error out(_instance->initializationData().logger); out << "exception in `" << _prefix << "':\n" << ex << "\nevent handler: " << current._handler->toString(); } #ifdef ICE_OS_WINRT catch(Platform::Exception^ ex) { Error out(_instance->initializationData().logger); out << "exception in `" << _prefix << "':\n" << IceUtil::wstringToString(ex->Message->Data()) << "\nevent handler: " << current._handler->toString(); } #endif catch(...) { Error out(_instance->initializationData().logger); out << "exception in `" << _prefix << "':\nevent handler: " << current._handler->toString(); } { Lock sync(*this); if(_sizeMax > 1 && current._ioCompleted) { assert(_inUse > 0); --_inUse; } thread->setState(ThreadStateIdle); } } #endif } bool IceInternal::ThreadPool::ioCompleted(ThreadPoolCurrent& current) { IceUtil::Monitor::Lock sync(*this); current._ioCompleted = true; // Set the IO completed flag to specifiy that ioCompleted() has been called. current._thread->setState(ThreadStateInUseForUser); if(_sizeMax > 1) { #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) --_inUseIO; if(_serialize && !_destroyed) { _selector.disable(current._handler.get(), current.operation); } if(current._leader) { // // If this thread is still the leader, it's time to promote a new leader. // promoteFollower(current); } else if(_promote && (_nextHandler != _handlers.end() || _inUseIO == 0)) { notify(); } #endif assert(_inUse >= 0); ++_inUse; if(_inUse == _sizeWarn) { Warning out(_instance->initializationData().logger); out << "thread pool `" << _prefix << "' is running low on threads\n" << "Size=" << _size << ", " << "SizeMax=" << _sizeMax << ", " << "SizeWarn=" << _sizeWarn; } if(!_destroyed) { assert(_inUse <= static_cast(_threads.size())); if(_inUse < _sizeMax && _inUse == static_cast(_threads.size())) { if(_instance->traceLevels()->threadPool >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->threadPoolCat); out << "growing " << _prefix << ": Size=" << _threads.size() + 1; } try { EventHandlerThreadPtr thread = new EventHandlerThread(this, nextThreadId()); if(_hasPriority) { thread->start(_stackSize, _priority); } else { thread->start(_stackSize); } _threads.insert(thread); } catch(const IceUtil::Exception& ex) { Error out(_instance->initializationData().logger); out << "cannot create thread for `" << _prefix << "':\n" << ex; } } } } return _serialize; } #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) bool IceInternal::ThreadPool::startMessage(ThreadPoolCurrent& current) { assert(current._handler->_pending & current.operation); if(current._handler->_started & current.operation) { assert(!(current._handler->_ready & current.operation)); current._handler->_ready = static_cast(current._handler->_ready | current.operation); current._handler->_started = static_cast(current._handler->_started & ~current.operation); if(!current._handler->finishAsync(current.operation)) // Returns false if the handler is finished. { current._handler->_pending = static_cast(current._handler->_pending & ~current.operation); if(!current._handler->_pending && current._handler->_finish) { _workQueue->queue(new FinishedWorkItem(current._handler)); _selector.finish(current._handler.get()); } return false; } } else if(!(current._handler->_ready & current.operation) && (current._handler->_registered & current.operation)) { assert(!(current._handler->_started & current.operation)); if(!current._handler->startAsync(current.operation)) { current._handler->_pending = static_cast(current._handler->_pending & ~current.operation); if(!current._handler->_pending && current._handler->_finish) { _workQueue->queue(new FinishedWorkItem(current._handler)); _selector.finish(current._handler.get()); } return false; } else { current._handler->_started = static_cast(current._handler->_started | current.operation); return false; } } if(current._handler->_registered & current.operation) { assert(current._handler->_ready & current.operation); current._handler->_ready = static_cast(current._handler->_ready & ~current.operation); return true; } else { current._handler->_pending = static_cast(current._handler->_pending & ~current.operation); if(!current._handler->_pending && current._handler->_finish) { _workQueue->queue(new FinishedWorkItem(current._handler)); _selector.finish(current._handler.get()); } return false; } } void IceInternal::ThreadPool::finishMessage(ThreadPoolCurrent& current) { if(current._handler->_registered & current.operation) { assert(!(current._handler->_ready & current.operation)); if(!current._handler->startAsync(current.operation)) { current._handler->_pending = static_cast(current._handler->_pending & ~current.operation); } else { assert(current._handler->_pending & current.operation); current._handler->_started = static_cast(current._handler->_started | current.operation); } } else { current._handler->_pending = static_cast(current._handler->_pending & ~current.operation); } if(!current._handler->_pending && current._handler->_finish) { // There are no more pending async operations, it's time to call finish. _workQueue->queue(new FinishedWorkItem(current._handler)); _selector.finish(current._handler.get()); } } #else void IceInternal::ThreadPool::promoteFollower(ThreadPoolCurrent& current) { assert(!_promote && current._leader); _promote = true; if(_inUseIO < _sizeIO && (_nextHandler != _handlers.end() || _inUseIO == 0)) { notify(); } current._leader = false; } bool IceInternal::ThreadPool::followerWait(ThreadPoolCurrent& current) { assert(!current._leader); current._thread->setState(ThreadStateIdle); // // It's important to clear the handler before waiting to make sure that // resources for the handler are released now if it's finished. We also // clear the per-thread stream. // current._handler = 0; current.stream.clear(); current.stream.b.clear(); // // Wait to be promoted and for all the IO threads to be done. // while(!_promote || _inUseIO == _sizeIO || (_nextHandler == _handlers.end() && _inUseIO > 0)) { if(_threadIdleTime) { if(!timedWait(IceUtil::Time::seconds(_threadIdleTime))) { if(!_destroyed && (!_promote || _inUseIO == _sizeIO || (_nextHandler == _handlers.end() && _inUseIO > 0))) { if(_instance->traceLevels()->threadPool >= 1) { Trace out(_instance->initializationData().logger, _instance->traceLevels()->threadPoolCat); out << "shrinking " << _prefix << ": Size=" << (_threads.size() - 1); } assert(_threads.size() > 1); // Can only be called by a waiting follower thread. _threads.erase(current._thread); _workQueue->queue(new JoinThreadWorkItem(current._thread)); return true; } } } else { wait(); } } current._leader = true; // The current thread has become the leader. _promote = false; return false; } #endif string IceInternal::ThreadPool::nextThreadId() { ostringstream os; os << _prefix << "-" << _nextThreadId++; return os.str(); } IceInternal::ThreadPool::EventHandlerThread::EventHandlerThread(const ThreadPoolPtr& pool, const string& name) : IceUtil::Thread(name), _pool(pool), _state(Ice::Instrumentation::ThreadStateIdle) { updateObserver(); } void IceInternal::ThreadPool::EventHandlerThread::updateObserver() { // Must be called with the thread pool mutex locked const CommunicatorObserverPtr& obsv = _pool->_instance->getObserver(); if(obsv) { _observer.attach(obsv->getThreadObserver(_pool->_prefix, name(), _state, _observer.get())); } } void IceInternal::ThreadPool::EventHandlerThread::setState(Ice::Instrumentation::ThreadState s) { // Must be called with the thread pool mutex locked if(_observer) { if(_state != s) { _observer->stateChanged(_state, s); } } _state = s; } void IceInternal::ThreadPool::EventHandlerThread::run() { if(_pool->_instance->initializationData().threadHook) { try { _pool->_instance->initializationData().threadHook->start(); } catch(const exception& ex) { Error out(_pool->_instance->initializationData().logger); out << "thread hook start() method raised an unexpected exception in `" << _pool->_prefix << "':\n" << ex; } catch(...) { Error out(_pool->_instance->initializationData().logger); out << "thread hook start() method raised an unexpected exception in `" << _pool->_prefix << "'"; } } try { _pool->run(this); } catch(const exception& ex) { Error out(_pool->_instance->initializationData().logger); out << "exception in `" << _pool->_prefix << "':\n" << ex; } catch(...) { Error out(_pool->_instance->initializationData().logger); out << "unknown exception in `" << _pool->_prefix << "'"; } _observer.detach(); if(_pool->_instance->initializationData().threadHook) { try { _pool->_instance->initializationData().threadHook->stop(); } catch(const exception& ex) { Error out(_pool->_instance->initializationData().logger); out << "thread hook stop() method raised an unexpected exception in `" << _pool->_prefix << "':\n" << ex; } catch(...) { Error out(_pool->_instance->initializationData().logger); out << "thread hook stop() method raised an unexpected exception in `" << _pool->_prefix << "'"; } } _pool = 0; // Break cyclic dependency. } ThreadPoolCurrent::ThreadPoolCurrent(const InstancePtr& instance, const ThreadPoolPtr& threadPool, const ThreadPool::EventHandlerThreadPtr& thread) : operation(SocketOperationNone), stream(instance.get(), Ice::currentProtocolEncoding), _threadPool(threadPool.get()), _thread(thread), _ioCompleted(false) #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) , _leader(false) #endif { } Ice-3.5.1/cpp/src/Ice/RouterInfo.h0000644000076400007640000001012012223561476014702 0ustar mesmes// ********************************************************************** // // 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 ICE_ROUTER_INFO_H #define ICE_ROUTER_INFO_H #include #include #include #include #include #include #include #include #include #include namespace IceInternal { class RouterManager : public IceUtil::Shared, public IceUtil::Mutex { public: RouterManager(); void destroy(); // // Returns router info for a given router. Automatically creates // the router info if it doesn't exist yet. // RouterInfoPtr get(const Ice::RouterPrx&); RouterInfoPtr erase(const Ice::RouterPrx&); private: std::map _table; std::map::iterator _tableHint; }; class RouterInfo : public IceUtil::Shared, public IceUtil::Mutex { public: class GetClientEndpointsCallback : virtual public Ice::LocalObject { public: virtual void setEndpoints(const std::vector&) = 0; virtual void setException(const Ice::LocalException&) = 0; }; typedef IceUtil::Handle GetClientEndpointsCallbackPtr; class AddProxyCallback : virtual public IceUtil::Shared { public: virtual void addedProxy() = 0; virtual void setException(const Ice::LocalException&) = 0; }; typedef IceUtil::Handle AddProxyCallbackPtr; RouterInfo(const Ice::RouterPrx&); void destroy(); bool operator==(const RouterInfo&) const; bool operator!=(const RouterInfo&) const; bool operator<(const RouterInfo&) const; const Ice::RouterPrx& getRouter() const { // // No mutex lock necessary, _router is immutable. // return _router; } void getClientProxyResponse(const Ice::ObjectPrx&, const GetClientEndpointsCallbackPtr&); void getClientProxyException(const Ice::Exception&, const GetClientEndpointsCallbackPtr&); std::vector getClientEndpoints(); void getClientEndpoints(const GetClientEndpointsCallbackPtr&); std::vector getServerEndpoints(); class AddProxyCookie : public Ice::LocalObject { public: AddProxyCookie(const AddProxyCallbackPtr cb, const Ice::ObjectPrx& proxy) : _cb(cb), _proxy(proxy) { } AddProxyCallbackPtr cb() const { return _cb; } Ice::ObjectPrx proxy() const { return _proxy; } private: const AddProxyCallbackPtr _cb; const Ice::ObjectPrx _proxy; }; typedef IceUtil::Handle AddProxyCookiePtr; void addProxyResponse(const Ice::ObjectProxySeq&, const AddProxyCookiePtr&); void addProxyException(const Ice::Exception&, const AddProxyCookiePtr&); void addProxy(const Ice::ObjectPrx&); bool addProxy(const Ice::ObjectPrx&, const AddProxyCallbackPtr&); void setAdapter(const Ice::ObjectAdapterPtr&); Ice::ObjectAdapterPtr getAdapter() const; void clearCache(const ReferencePtr&); // // The following methods need to be public for access by AMI callbacks. // std::vector setClientEndpoints(const Ice::ObjectPrx&); std::vector setServerEndpoints(const Ice::ObjectPrx&); void addAndEvictProxies(const Ice::ObjectPrx&, const Ice::ObjectProxySeq&); private: const Ice::RouterPrx _router; std::vector _clientEndpoints; std::vector _serverEndpoints; Ice::ObjectAdapterPtr _adapter; std::set _identities; std::multiset _evictedIdentities; }; } #endif Ice-3.5.1/cpp/src/Ice/RetryQueue.h0000644000076400007640000000243112223561476014726 0ustar mesmes// ********************************************************************** // // 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 ICE_RETRY_QUEUE_H #define ICE_RETRY_QUEUE_H #include #include #include #include #include #include namespace IceInternal { class RetryTask : public IceUtil::TimerTask { public: RetryTask(const RetryQueuePtr&, const OutgoingAsyncPtr&); virtual void runTimerTask(); void destroy(); bool operator<(const RetryTask&) const; private: const RetryQueuePtr _queue; const OutgoingAsyncPtr _outAsync; }; typedef IceUtil::Handle RetryTaskPtr; class RetryQueue : public IceUtil::Shared, public IceUtil::Mutex { public: RetryQueue(const InstancePtr&); void add(const OutgoingAsyncPtr&, int); void destroy(); private: bool remove(const RetryTaskPtr&); friend class RetryTask; const InstancePtr _instance; std::set _requests; }; } #endif Ice-3.5.1/cpp/src/Ice/RouterInfo.cpp0000644000076400007640000002461312223561476015251 0ustar mesmes// ********************************************************************** // // 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 #include #include #include // For ice_connection()->timeout(). #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(RouterManager* p) { return p; } IceUtil::Shared* IceInternal::upCast(RouterInfo* p) { return p; } IceInternal::RouterManager::RouterManager() : _tableHint(_table.end()) { } void IceInternal::RouterManager::destroy() { IceUtil::Mutex::Lock sync(*this); for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun(&RouterInfo::destroy)); _table.clear(); _tableHint = _table.end(); } RouterInfoPtr IceInternal::RouterManager::get(const RouterPrx& rtr) { if(!rtr) { return 0; } RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed. IceUtil::Mutex::Lock sync(*this); map::iterator p = _table.end(); if(_tableHint != _table.end()) { if(_tableHint->first == router) { p = _tableHint; } } if(p == _table.end()) { p = _table.find(router); } if(p == _table.end()) { _tableHint = _table.insert(_tableHint, pair(router, new RouterInfo(router))); } else { _tableHint = p; } return _tableHint->second; } RouterInfoPtr IceInternal::RouterManager::erase(const RouterPrx& rtr) { RouterInfoPtr info; if(rtr) { RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed. IceUtil::Mutex::Lock sync(*this); map::iterator p = _table.end(); if(_tableHint != _table.end() && _tableHint->first == router) { p = _tableHint; _tableHint = _table.end(); } if(p == _table.end()) { p = _table.find(router); } if(p != _table.end()) { info = p->second; _table.erase(p); } } return info; } IceInternal::RouterInfo::RouterInfo(const RouterPrx& router) : _router(router) { assert(_router); } void IceInternal::RouterInfo::destroy() { IceUtil::Mutex::Lock sync(*this); _clientEndpoints.clear(); _serverEndpoints.clear(); _adapter = 0; _identities.clear(); } bool IceInternal::RouterInfo::operator==(const RouterInfo& rhs) const { return _router == rhs._router; } bool IceInternal::RouterInfo::operator!=(const RouterInfo& rhs) const { return _router != rhs._router; } bool IceInternal::RouterInfo::operator<(const RouterInfo& rhs) const { return _router < rhs._router; } vector IceInternal::RouterInfo::getClientEndpoints() { { IceUtil::Mutex::Lock sync(*this); if(!_clientEndpoints.empty()) { return _clientEndpoints; } } return setClientEndpoints(_router->getClientProxy()); } void IceInternal::RouterInfo::getClientProxyResponse(const Ice::ObjectPrx& proxy, const GetClientEndpointsCallbackPtr& callback) { callback->setEndpoints(setClientEndpoints(proxy)); } void IceInternal::RouterInfo::getClientProxyException(const Ice::Exception& ex, const GetClientEndpointsCallbackPtr& callback) { if(dynamic_cast(&ex)) { try { callback->setEndpoints(getClientEndpoints()); } catch(const Ice::LocalException& e) { callback->setException(e); } } else { callback->setException(dynamic_cast(ex)); } } void IceInternal::RouterInfo::getClientEndpoints(const GetClientEndpointsCallbackPtr& callback) { vector clientEndpoints; { IceUtil::Mutex::Lock sync(*this); clientEndpoints = _clientEndpoints; } if(!clientEndpoints.empty()) { callback->setEndpoints(clientEndpoints); return; } _router->begin_getClientProxy(newCallback_Router_getClientProxy(this, &RouterInfo::getClientProxyResponse, &RouterInfo::getClientProxyException), callback); } vector IceInternal::RouterInfo::getServerEndpoints() { { IceUtil::Mutex::Lock sync(*this); if(!_serverEndpoints.empty()) { return _serverEndpoints; } } return setServerEndpoints(_router->getServerProxy()); } void IceInternal::RouterInfo::addProxy(const ObjectPrx& proxy) { assert(proxy); // Must not be called for null proxies. { IceUtil::Mutex::Lock sync(*this); if(_identities.find(proxy->ice_getIdentity()) != _identities.end()) { // // Only add the proxy to the router if it's not already in our local map. // return; } } ObjectProxySeq proxies; proxies.push_back(proxy); addAndEvictProxies(proxy, _router->addProxies(proxies)); } void IceInternal::RouterInfo::addProxyResponse(const Ice::ObjectProxySeq& proxies, const AddProxyCookiePtr& cookie) { addAndEvictProxies(cookie->proxy(), proxies); cookie->cb()->addedProxy(); } void IceInternal::RouterInfo::addProxyException(const Ice::Exception& ex, const AddProxyCookiePtr& cookie) { if(dynamic_cast(&ex)) { try { addProxy(cookie->proxy()); cookie->cb()->addedProxy(); } catch(const Ice::LocalException& e) { cookie->cb()->setException(e); } } else { cookie->cb()->setException(dynamic_cast(ex)); } } bool IceInternal::RouterInfo::addProxy(const Ice::ObjectPrx& proxy, const AddProxyCallbackPtr& callback) { assert(proxy); { IceUtil::Mutex::Lock sync(*this); if(_identities.find(proxy->ice_getIdentity()) != _identities.end()) { // // Only add the proxy to the router if it's not already in our local map. // return true; } } Ice::ObjectProxySeq proxies; proxies.push_back(proxy); AddProxyCookiePtr cookie = new AddProxyCookie(callback, proxy); _router->begin_addProxies(proxies, newCallback_Router_addProxies(this, &RouterInfo::addProxyResponse, &RouterInfo::addProxyException), cookie); return false; } void IceInternal::RouterInfo::setAdapter(const ObjectAdapterPtr& adapter) { IceUtil::Mutex::Lock sync(*this); _adapter = adapter; } ObjectAdapterPtr IceInternal::RouterInfo::getAdapter() const { IceUtil::Mutex::Lock sync(*this); return _adapter; } void IceInternal::RouterInfo::clearCache(const ReferencePtr& ref) { IceUtil::Mutex::Lock sync(*this); _identities.erase(ref->getIdentity()); } vector IceInternal::RouterInfo::setClientEndpoints(const Ice::ObjectPrx& proxy) { IceUtil::Mutex::Lock sync(*this); if(_clientEndpoints.empty()) { if(!proxy) { // // If getClientProxy() return nil, use router endpoints. // _clientEndpoints = _router->__reference()->getEndpoints(); } else { Ice::ObjectPrx clientProxy = proxy->ice_router(0); // The client proxy cannot be routed. // // In order to avoid creating a new connection to the router, // we must use the same timeout as the already existing // connection. // try { clientProxy = clientProxy->ice_timeout(_router->ice_getConnection()->timeout()); } catch(const Ice::CollocationOptimizationException&) { // Ignore - collocated router } _clientEndpoints = clientProxy->__reference()->getEndpoints(); } } return _clientEndpoints; } vector IceInternal::RouterInfo::setServerEndpoints(const Ice::ObjectPrx& /*serverProxy*/) { IceUtil::Mutex::Lock sync(*this); if(_serverEndpoints.empty()) // Lazy initialization. { ObjectPrx serverProxy = _router->getServerProxy(); if(!serverProxy) { throw NoEndpointException(__FILE__, __LINE__); } serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed. _serverEndpoints = serverProxy->__reference()->getEndpoints(); } return _serverEndpoints; } void IceInternal::RouterInfo::addAndEvictProxies(const Ice::ObjectPrx& proxy, const Ice::ObjectProxySeq& evictedProxies) { IceUtil::Mutex::Lock sync(*this); // // Check if the proxy hasn't already been evicted by a concurrent addProxies call. // If it's the case, don't add it to our local map. // multiset::iterator p = _evictedIdentities.find(proxy->ice_getIdentity()); if(p != _evictedIdentities.end()) { _evictedIdentities.erase(p); } else { // // If we successfully added the proxy to the router, // we add it to our local map. // _identities.insert(proxy->ice_getIdentity()); } // // We also must remove whatever proxies the router evicted. // for(Ice::ObjectProxySeq::const_iterator q = evictedProxies.begin(); q != evictedProxies.end(); ++q) { if(_identities.erase((*q)->ice_getIdentity()) == 0) { // // It's possible for the proxy to not have been // added yet in the local map if two threads // concurrently call addProxies. // _evictedIdentities.insert((*q)->ice_getIdentity()); } } } Ice-3.5.1/cpp/src/Ice/SharedContext.h0000644000076400007640000000165512223561476015376 0ustar mesmes// ********************************************************************** // // 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 ICE_SHARED_CONTEXT_H #define ICE_SHARED_CONTEXT_H #include #include #include #include namespace Ice { typedef ::std::map< ::std::string, ::std::string> Context; } namespace IceInternal { class SharedContext : public IceUtil::Shared { public: SharedContext() { } SharedContext(const Ice::Context& val) : _val(val) { } inline const Ice::Context& getValue() { return _val; } private: Ice::Context _val; }; typedef IceUtil::Handle SharedContextPtr; } #endif Ice-3.5.1/cpp/src/Ice/Network.h0000644000076400007640000002255412223561476014255 0ustar mesmes// ********************************************************************** // // 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 ICE_NETWORK_H #define ICE_NETWORK_H #ifdef __hpux # define _XOPEN_SOURCE_EXTENDED #endif #include #include #include // For setTcpBufSize #include // For setTcpBufSize #include #include #ifdef ICE_OS_WINRT # include #elif defined(_WIN32) # include # include # if !defined(__MINGW32__) typedef int ssize_t; # endif #else # include # include # include # include # include # include # include # include #endif #if defined(__linux) && !defined(ICE_NO_EPOLL) # define ICE_USE_EPOLL 1 #elif (defined(__APPLE__) || defined(__FreeBSD__)) && !defined(ICE_NO_KQUEUE) # define ICE_USE_KQUEUE 1 #elif defined(_WIN32) # if defined(ICE_OS_WINRT) # elif !defined(ICE_NO_IOCP) # define ICE_USE_IOCP 1 # else # define ICE_USE_SELECT 1 # endif #else # define ICE_USE_POLL 1 #endif #if defined(_WIN32) || defined(__osf__) typedef int socklen_t; #endif #if !defined(_WIN32) # define SOCKET int # define INVALID_SOCKET -1 # define SOCKET_ERROR -1 #elif defined(ICE_OS_WINRT) typedef Platform::Object^ SOCKET; # define INVALID_SOCKET nullptr # define SOCKET_ERROR -1 #endif #ifndef SHUT_RD # define SHUT_RD 0 #endif #ifndef SHUT_WR # define SHUT_WR 1 #endif #ifndef SHUT_RDWR # define SHUT_RDWR 2 #endif #ifndef NETDB_INTERNAL # define NETDB_INTERNAL -1 #endif #ifndef NETDB_SUCCESS # define NETDB_SUCCESS 0 #endif #if defined(__MINGW32__) && !defined WSAID_CONNECTEX # define WSAID_CONNECTEX {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}} # define WSAID_ACCEPTEX {0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} # define SO_UPDATE_ACCEPT_CONTEXT 0x700B # define SO_UPDATE_CONNECT_CONTEXT 0x7010 typedef BOOL (PASCAL FAR * LPFN_CONNECTEX) (IN SOCKET s, IN const struct sockaddr FAR *name, IN int namelen, IN PVOID lpSendBuffer OPTIONAL, IN DWORD dwSendDataLength, OUT LPDWORD lpdwBytesSent, IN LPOVERLAPPED lpOverlapped); typedef BOOL (PASCAL FAR * LPFN_ACCEPTEX)(IN SOCKET sListenSocket, IN SOCKET sAcceptSocket, IN PVOID lpOutputBuffer, IN DWORD dwReceiveDataLength, IN DWORD dwLocalAddressLength, IN DWORD dwRemoteAddressLength, OUT LPDWORD lpdwBytesReceived, IN LPOVERLAPPED lpOverlapped); #endif namespace IceInternal { // // Use Address struct or union depending on the platform // #ifdef ICE_OS_WINRT struct ICE_API Address { Windows::Networking::HostName^ host; Platform::String^ port; }; #else union Address { sockaddr sa; sockaddr_in saIn; sockaddr_in6 saIn6; sockaddr_storage saStorage; }; #endif enum SocketOperation { SocketOperationNone = 0, SocketOperationRead = 1, SocketOperationWrite = 2, SocketOperationConnect = 2 }; // // AsyncInfo struct for Windows IOCP or WinRT holds the result of // asynchronous operations after it completed. // #if defined(ICE_USE_IOCP) struct ICE_API AsyncInfo : WSAOVERLAPPED { AsyncInfo(SocketOperation); SocketOperation status; WSABUF buf; DWORD flags; DWORD count; int error; }; #elif defined(ICE_OS_WINRT) struct ICE_API AsyncInfo { int count; int error; }; public delegate void SocketOperationCompletedHandler(int); #endif class ICE_API NativeInfo : virtual public IceUtil::Shared { public: NativeInfo(SOCKET socketFd = INVALID_SOCKET) : _fd(socketFd) { } SOCKET fd() { return _fd; } // // This is implemented by transceiver and acceptor implementations. // #if defined(ICE_USE_IOCP) virtual AsyncInfo* getAsyncInfo(SocketOperation) = 0; #elif defined(ICE_OS_WINRT) virtual void setCompletedHandler(SocketOperationCompletedHandler^) = 0; #endif protected: SOCKET _fd; }; typedef IceUtil::Handle NativeInfoPtr; class ICE_API Buffer; class ICE_API NetworkProxy : virtual public IceUtil::Shared { public: // // Write the connection request on the connection established // with the network proxy server. This is called right after // the connection establishment succeeds. // virtual void beginWriteConnectRequest(const Address&, Buffer&) = 0; virtual void endWriteConnectRequest(Buffer&) = 0; // // Once the connection request has been sent, this is called // to prepare and read the response from the proxy server. // virtual void beginReadConnectRequestResponse(Buffer&) = 0; virtual void endReadConnectRequestResponse(Buffer&) = 0; // // If the proxy host needs to be resolved, this should return // a new NetworkProxy containing the IP address of the proxy. // This is called from the endpoint host resolver thread, so // it's safe if this this method blocks. // virtual NetworkProxyPtr resolveHost() const = 0; // // Returns the IP address of the network proxy. This method // must not block. It's only called on a network proxy object // returned by resolveHost(). // virtual Address getAddress() const = 0; // // Returns the name of the proxy, used for tracing purposes. // virtual std::string getName() const = 0; }; #ifndef ICE_OS_WINRT class ICE_API SOCKSNetworkProxy : virtual public NetworkProxy { public: SOCKSNetworkProxy(const std::string&, int); SOCKSNetworkProxy(const Address&); virtual void beginWriteConnectRequest(const Address&, Buffer&); virtual void endWriteConnectRequest(Buffer&); virtual void beginReadConnectRequestResponse(Buffer&); virtual void endReadConnectRequestResponse(Buffer&); virtual NetworkProxyPtr resolveHost() const; virtual Address getAddress() const; virtual std::string getName() const; private: std::string _host; int _port; Address _address; }; typedef IceUtil::Handle SOCKSNetworkProxyPtr; #endif // ICE_OS_WINRT ICE_API bool noMoreFds(int); ICE_API std::string errorToStringDNS(int); ICE_API std::vector
          getAddresses(const std::string&, int, ProtocolSupport, Ice::EndpointSelectionType, bool, bool); ICE_API ProtocolSupport getProtocolSupport(const Address&); ICE_API Address getAddressForServer(const std::string&, int, ProtocolSupport, bool); ICE_API int compareAddress(const Address&, const Address&); ICE_API SOCKET createSocket(bool, const Address&); ICE_API SOCKET createServerSocket(bool, const Address&, ProtocolSupport); ICE_API void closeSocketNoThrow(SOCKET); ICE_API void closeSocket(SOCKET); ICE_API std::string addrToString(const Address&); ICE_API void fdToLocalAddress(SOCKET, Address&); ICE_API bool fdToRemoteAddress(SOCKET, Address&); ICE_API std::string fdToString(SOCKET, const NetworkProxyPtr&, const Address&, bool); ICE_API std::string fdToString(SOCKET); ICE_API void fdToAddressAndPort(SOCKET, std::string&, int&, std::string&, int&); ICE_API void addrToAddressAndPort(const Address&, std::string&, int&); ICE_API std::string addressesToString(const Address&, const Address&, bool); ICE_API bool isAddressValid(const Address&); ICE_API std::vector getHostsForEndpointExpand(const std::string&, ProtocolSupport, bool); ICE_API std::string inetAddrToString(const Address&); ICE_API int getPort(const Address&); ICE_API void setPort(Address&, int); ICE_API bool isMulticast(const Address&); ICE_API void setTcpBufSize(SOCKET, const Ice::PropertiesPtr&, const Ice::LoggerPtr&); ICE_API void setBlock(SOCKET, bool); ICE_API void setSendBufferSize(SOCKET, int); ICE_API int getSendBufferSize(SOCKET); ICE_API void setRecvBufferSize(SOCKET, int); ICE_API int getRecvBufferSize(SOCKET); ICE_API void setMcastGroup(SOCKET, const Address&, const std::string&); ICE_API void setMcastInterface(SOCKET, const std::string&, const Address&); ICE_API void setMcastTtl(SOCKET, int, const Address&); ICE_API void setReuseAddress(SOCKET, bool); ICE_API Address doBind(SOCKET, const Address&); #ifndef ICE_OS_WINRT ICE_API bool interrupted(); ICE_API bool acceptInterrupted(); ICE_API bool noBuffers(); ICE_API bool wouldBlock(); ICE_API bool notConnected(); ICE_API bool recvTruncated(); ICE_API bool connectFailed(); ICE_API bool connectionRefused(); ICE_API bool connectInProgress(); ICE_API bool connectionLost(); ICE_API void doListen(SOCKET, int); ICE_API bool doConnect(SOCKET, const Address&); ICE_API void doFinishConnect(SOCKET); ICE_API SOCKET doAccept(SOCKET); ICE_API void createPipe(SOCKET fds[2]); ICE_API int getSocketErrno(); #else ICE_API void checkConnectErrorCode(const char*, int, HRESULT, Windows::Networking::HostName^); ICE_API void checkErrorCode(const char*, int, HRESULT); #endif #if defined(ICE_USE_IOCP) ICE_API void doConnectAsync(SOCKET, const Address&, AsyncInfo&); ICE_API void doFinishConnectAsync(SOCKET, AsyncInfo&); #endif } #endif Ice-3.5.1/cpp/src/Ice/TransceiverF.h0000644000076400007640000000112612223561476015207 0ustar mesmes// ********************************************************************** // // 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 ICE_TRANSCEIVER_F_H #define ICE_TRANSCEIVER_F_H #include #include namespace IceInternal { class Transceiver; ICE_API IceUtil::Shared* upCast(Transceiver*); typedef Handle TransceiverPtr; } #endif Ice-3.5.1/cpp/src/Ice/IncomingAsync.cpp0000644000076400007640000001655312223561476015722 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(IncomingAsync* p) { return p; } IceUtil::Shared* Ice::upCast(AMD_Object_ice_invoke* p) { return p; } namespace { IceUtil::Mutex* globalMutex = 0; class Init { public: Init() { globalMutex = new IceUtil::Mutex; } ~Init() { delete globalMutex; globalMutex = 0; } }; Init init; } IceInternal::IncomingAsync::IncomingAsync(Incoming& in) : IncomingBase(in), _instanceCopy(_os.instance()), _connectionCopy(_connection), _retriable(in.isRetriable()), _active(true) { if(_retriable) { in.setActive(*this); } } void IceInternal::IncomingAsync::__deactivate(Incoming& in) { assert(_retriable); { IceUtilInternal::MutexPtrLock lock(globalMutex); if(!_active) { // // Since _deactivate can only be called on an active object, // this means the response has already been sent (see __validateXXX below) // throw ResponseSentException(__FILE__, __LINE__); } _active = false; } in.__adopt(*this); } void IceInternal::IncomingAsync::ice_exception(const ::std::exception& ex) { // // Only call __exception if this incoming is not retriable or if // all the interceptors return true and no response has been sent // yet. // if(_retriable) { try { for(deque::iterator p = _interceptorAsyncCallbackQueue.begin(); p != _interceptorAsyncCallbackQueue.end(); ++p) { if((*p)->exception(ex) == false) { return; } } } catch(...) { return; } IceUtilInternal::MutexPtrLock lock(globalMutex); if(!_active) { return; } _active = false; } if(_connection) { __exception(ex); } else { // // Response has already been sent. // if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) { __warning(ex.what()); } } } void IceInternal::IncomingAsync::ice_exception() { // // Only call __exception if this incoming is not retriable or if // all the interceptors return true and no response has been sent // yet. // if(_retriable) { try { for(deque::iterator p = _interceptorAsyncCallbackQueue.begin(); p != _interceptorAsyncCallbackQueue.end(); ++p) { if((*p)->exception() == false) { return; } } } catch(...) { return; } IceUtilInternal::MutexPtrLock lock(globalMutex); if(!_active) { return; } _active = false; } if(_connection) { __exception(); } else { // // Response has already been sent. // if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) { __warning("unknown exception"); } } } void IceInternal::IncomingAsync::__response() { try { if(_locator && !__servantLocatorFinished()) { return; } assert(_connection); if(_response) { _observer.reply(static_cast(_os.b.size() - headerSize - 4)); _connection->sendResponse(&_os, _compress); } else { _connection->sendNoResponse(); } _observer.detach(); _connection = 0; } catch(const LocalException& ex) { _connection->invokeException(ex, 1); // Fatal invocation exception } } void IceInternal::IncomingAsync::__exception(const std::exception& exc) { try { if(_locator && !__servantLocatorFinished()) { return; } __handleException(exc); } catch(const LocalException& ex) { _connection->invokeException(ex, 1); // Fatal invocation exception } } void IceInternal::IncomingAsync::__exception() { try { if(_locator && !__servantLocatorFinished()) { return; } __handleException(); } catch(const LocalException& ex) { _connection->invokeException(ex, 1); // Fatal invocation exception } } bool IceInternal::IncomingAsync::__validateResponse(bool ok) { // // Only returns true if this incoming is not retriable or if all // the interceptors return true and no response has been sent // yet. Upon getting a true return value, the caller should send // the response. // if(_retriable) { try { for(deque::iterator p = _interceptorAsyncCallbackQueue.begin(); p != _interceptorAsyncCallbackQueue.end(); ++p) { if((*p)->response(ok) == false) { return false; } } } catch(...) { return false; } IceUtilInternal::MutexPtrLock lock(globalMutex); if(!_active) { return false; } _active = false; } return true; } IceAsync::Ice::AMD_Object_ice_invoke::AMD_Object_ice_invoke(Incoming& in) : IncomingAsync(in) { } void IceAsync::Ice::AMD_Object_ice_invoke::ice_response(bool ok, const vector& outEncaps) { if(__validateResponse(ok)) { try { if(outEncaps.empty()) { __writeParamEncaps(0, 0, ok); } else { __writeParamEncaps(&outEncaps[0], static_cast< ::Ice::Int>(outEncaps.size()), ok); } } catch(const LocalException& ex) { __exception(ex); return; } __response(); } } void IceAsync::Ice::AMD_Object_ice_invoke::ice_response(bool ok, const pair& outEncaps) { if(__validateResponse(ok)) { try { __writeParamEncaps(outEncaps.first, static_cast(outEncaps.second - outEncaps.first), ok); } catch(const LocalException& ex) { __exception(ex); return; } __response(); } } Ice-3.5.1/cpp/src/Ice/Instance.cpp0000644000076400007640000012670212223561476014723 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef _WIN32 # include # include # include # include # include #endif #if defined(__linux) || defined(__sun) # include // for initgroups #endif #include #ifndef ICE_OS_WINRT # include #else # include // For IceSSL::EndpointType # include #endif using namespace std; using namespace Ice; using namespace IceInternal; namespace IceUtilInternal { extern bool ICE_DECLSPEC_IMPORT nullHandleAbort; extern bool ICE_DECLSPEC_IMPORT printStackTraces; }; namespace IceInternal { extern IceUtil::Handle theCollector; } namespace { IceUtil::Mutex* staticMutex = 0; bool oneOffDone = false; int instanceCount = 0; #ifndef _WIN32 struct sigaction oldAction; #endif bool printProcessIdDone = false; string identForOpenlog; class Init { public: Init() { staticMutex = new IceUtil::Mutex; } ~Init() { delete staticMutex; staticMutex = 0; } }; Init init; } namespace IceInternal { class ObserverUpdaterI : public Ice::Instrumentation::ObserverUpdater { public: ObserverUpdaterI(InstancePtr instance) : _instance(instance) { } void updateConnectionObservers() { _instance->updateConnectionObservers(); } void updateThreadObservers() { _instance->updateThreadObservers(); } private: InstancePtr _instance; }; } IceUtil::Shared* IceInternal::upCast(Instance* p) { return p; } bool IceInternal::Instance::destroyed() const { IceUtil::RecMutex::Lock sync(*this); return _state == StateDestroyed; } TraceLevelsPtr IceInternal::Instance::traceLevels() const { // No mutex lock, immutable. assert(_traceLevels); return _traceLevels; } DefaultsAndOverridesPtr IceInternal::Instance::defaultsAndOverrides() const { // No mutex lock, immutable. assert(_defaultsAndOverrides); return _defaultsAndOverrides; } RouterManagerPtr IceInternal::Instance::routerManager() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_routerManager); return _routerManager; } LocatorManagerPtr IceInternal::Instance::locatorManager() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_locatorManager); return _locatorManager; } ReferenceFactoryPtr IceInternal::Instance::referenceFactory() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_referenceFactory); return _referenceFactory; } ProxyFactoryPtr IceInternal::Instance::proxyFactory() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_proxyFactory); return _proxyFactory; } OutgoingConnectionFactoryPtr IceInternal::Instance::outgoingConnectionFactory() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_outgoingConnectionFactory); return _outgoingConnectionFactory; } ConnectionMonitorPtr IceInternal::Instance::connectionMonitor() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_connectionMonitor); return _connectionMonitor; } ObjectFactoryManagerPtr IceInternal::Instance::servantFactoryManager() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_servantFactoryManager); return _servantFactoryManager; } ObjectAdapterFactoryPtr IceInternal::Instance::objectAdapterFactory() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_objectAdapterFactory); return _objectAdapterFactory; } ProtocolSupport IceInternal::Instance::protocolSupport() const { return _protocolSupport; } bool IceInternal::Instance::preferIPv6() const { return _preferIPv6; } NetworkProxyPtr IceInternal::Instance::networkProxy() const { return _networkProxy; } ThreadPoolPtr IceInternal::Instance::clientThreadPool() { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_clientThreadPool); return _clientThreadPool; } ThreadPoolPtr IceInternal::Instance::serverThreadPool(bool create) { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } if(!_serverThreadPool && create) // Lazy initialization. { int timeout = _initData.properties->getPropertyAsInt("Ice.ServerIdleTime"); _serverThreadPool = new ThreadPool(this, "Ice.ThreadPool.Server", timeout); } return _serverThreadPool; } EndpointHostResolverPtr IceInternal::Instance::endpointHostResolver() { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_endpointHostResolver); return _endpointHostResolver; } RetryQueuePtr IceInternal::Instance::retryQueue() { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_retryQueue); return _retryQueue; } IceUtil::TimerPtr IceInternal::Instance::timer() { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_timer); return _timer; } EndpointFactoryManagerPtr IceInternal::Instance::endpointFactoryManager() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_endpointFactoryManager); return _endpointFactoryManager; } DynamicLibraryListPtr IceInternal::Instance::dynamicLibraryList() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_dynamicLibraryList); return _dynamicLibraryList; } PluginManagerPtr IceInternal::Instance::pluginManager() const { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } assert(_pluginManager); return _pluginManager; } int IceInternal::Instance::clientACM() const { // No mutex lock, immutable. return _clientACM; } int IceInternal::Instance::serverACM() const { // No mutex lock, immutable. return _serverACM; } Identity IceInternal::Instance::stringToIdentity(const string& s) const { // // This method only accepts printable ascii. Since printable ascii is a subset // of all narrow string encodings, it is not necessary to convert the string // from the native string encoding. Any characters other than printable-ASCII // will cause an IllegalArgumentException. Note that it can contain Unicode // encoded in the escaped form which is the reason why we call fromUTF8 after // unespcaping the printable ASCII string. // Identity ident; // // Find unescaped separator. // string::size_type slash = string::npos, pos = 0; while((pos = s.find('/', pos)) != string::npos) { if(pos == 0 || s[pos - 1] != '\\') { if(slash == string::npos) { slash = pos; } else { // // Extra unescaped slash found. // IdentityParseException ex(__FILE__, __LINE__); ex.str = "unescaped backslash in identity `" + s + "'"; throw ex; } } pos++; } if(slash == string::npos) { try { ident.name = IceUtilInternal::unescapeString(s, 0, s.size()); } catch(const IceUtil::IllegalArgumentException& e) { IdentityParseException ex(__FILE__, __LINE__); ex.str = "invalid identity name `" + s + "': " + e.reason(); throw ex; } } else { try { ident.category = IceUtilInternal::unescapeString(s, 0, slash); } catch(const IceUtil::IllegalArgumentException& e) { IdentityParseException ex(__FILE__, __LINE__); ex.str = "invalid category in identity `" + s + "': " + e.reason(); throw ex; } if(slash + 1 < s.size()) { try { ident.name = IceUtilInternal::unescapeString(s, slash + 1, s.size()); } catch(const IceUtil::IllegalArgumentException& e) { IdentityParseException ex(__FILE__, __LINE__); ex.str = "invalid name in identity `" + s + "': " + e.reason(); throw ex; } } } ident.name = Ice::UTF8ToNative(_initData.stringConverter, ident.name); ident.category = Ice::UTF8ToNative(_initData.stringConverter, ident.category); return ident; } string IceInternal::Instance::identityToString(const Identity& ident) const { // // This method returns the stringified identity. The returned string only // contains printable ascii. It can contain UTF8 in the escaped form. // string name = Ice::nativeToUTF8(_initData.stringConverter, ident.name); string category = Ice::nativeToUTF8(_initData.stringConverter, ident.category); if(category.empty()) { return IceUtilInternal::escapeString(name, "/"); } else { return IceUtilInternal::escapeString(category, "/") + '/' + IceUtilInternal::escapeString(name, "/"); } } Ice::ObjectPrx IceInternal::Instance::getAdmin() { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } const string adminOA = "Ice.Admin"; if(_adminAdapter != 0) { return _adminAdapter->createProxy(_adminIdentity); } else if(_initData.properties->getProperty(adminOA + ".Endpoints") == "") { return 0; } else { string serverId = _initData.properties->getProperty("Ice.Admin.ServerId"); string instanceName = _initData.properties->getProperty("Ice.Admin.InstanceName"); Ice::LocatorPrx defaultLocator = _referenceFactory->getDefaultLocator(); if((defaultLocator != 0 && serverId != "") || instanceName != "") { if(_adminIdentity.name == "") { _adminIdentity.name = "admin"; if(instanceName == "") { instanceName = IceUtil::generateUUID(); } _adminIdentity.category = instanceName; // // Afterwards, _adminIdentity is read-only // } // // Create OA // _adminAdapter = _objectAdapterFactory->createObjectAdapter(adminOA, 0); // // Add all facets to OA // FacetMap filteredFacets; for(FacetMap::iterator p = _adminFacets.begin(); p != _adminFacets.end(); ++p) { if(_adminFacetFilter.empty() || _adminFacetFilter.find(p->first) != _adminFacetFilter.end()) { _adminAdapter->addFacet(p->second, _adminIdentity, p->first); } else { filteredFacets[p->first] = p->second; } } _adminFacets.swap(filteredFacets); ObjectAdapterPtr adapter = _adminAdapter; sync.release(); // // Activate OA // try { adapter->activate(); } catch(...) { // // We cleanup _adminAdapter, however this error is not recoverable // (can't call again getAdmin() after fixing the problem) // since all the facets (servants) in the adapter are lost // adapter->destroy(); sync.acquire(); _adminAdapter = 0; throw; } Ice::ObjectPrx admin = adapter->createProxy(_adminIdentity); if(defaultLocator != 0 && serverId != "") { ProcessPrx process = ProcessPrx::uncheckedCast(admin->ice_facet("Process")); try { // // Note that as soon as the process proxy is registered, the communicator might be // shutdown by a remote client and admin facets might start receiving calls. // defaultLocator->getRegistry()->setServerProcessProxy(serverId, process); } catch(const ServerNotFoundException&) { if(_traceLevels->location >= 1) { Trace out(_initData.logger, _traceLevels->locationCat); out << "couldn't register server `" + serverId + "' with the locator registry:\n"; out << "the server is not known to the locator registry"; } throw InitializationException(__FILE__, __LINE__, "Locator knows nothing about server '" + serverId + "'"); } catch(const LocalException& ex) { if(_traceLevels->location >= 1) { Trace out(_initData.logger, _traceLevels->locationCat); out << "couldn't register server `" + serverId + "' with the locator registry:\n" << ex; } throw; } } if(_traceLevels->location >= 1) { Trace out(_initData.logger, _traceLevels->locationCat); out << "registered server `" + serverId + "' with the locator registry"; } return admin; } else { return 0; } } } void IceInternal::Instance::addAdminFacet(const Ice::ObjectPtr& servant, const string& facet) { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } if(_adminAdapter == 0 || (!_adminFacetFilter.empty() && _adminFacetFilter.find(facet) == _adminFacetFilter.end())) { if(_adminFacets.insert(FacetMap::value_type(facet, servant)).second == false) { throw AlreadyRegisteredException(__FILE__, __LINE__, "facet", facet); } } else { _adminAdapter->addFacet(servant, _adminIdentity, facet); } } Ice::ObjectPtr IceInternal::Instance::removeAdminFacet(const string& facet) { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } ObjectPtr result; if(_adminAdapter == 0 || (!_adminFacetFilter.empty() && _adminFacetFilter.find(facet) == _adminFacetFilter.end())) { FacetMap::iterator p = _adminFacets.find(facet); if(p == _adminFacets.end()) { throw NotRegisteredException(__FILE__, __LINE__, "facet", facet); } else { result = p->second; _adminFacets.erase(p); } } else { result = _adminAdapter->removeFacet(_adminIdentity, facet); } return result; } Ice::ObjectPtr IceInternal::Instance::findAdminFacet(const string& facet) { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } ObjectPtr result; if(_adminAdapter == 0 || (!_adminFacetFilter.empty() && _adminFacetFilter.find(facet) == _adminFacetFilter.end())) { FacetMap::iterator p = _adminFacets.find(facet); if(p != _adminFacets.end()) { result = p->second; } } else { result = _adminAdapter->findFacet(_adminIdentity, facet); } return result; } void IceInternal::Instance::setDefaultLocator(const Ice::LocatorPrx& defaultLocator) { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } _referenceFactory = _referenceFactory->setDefaultLocator(defaultLocator); } void IceInternal::Instance::setDefaultRouter(const Ice::RouterPrx& defaultRouter) { IceUtil::RecMutex::Lock sync(*this); if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } _referenceFactory = _referenceFactory->setDefaultRouter(defaultRouter); } void IceInternal::Instance::setStringConverter(const Ice::StringConverterPtr& stringConverter) { // // No locking, as it can only be called during plug-in loading // _initData.stringConverter = stringConverter; } void IceInternal::Instance::setWstringConverter(const Ice::WstringConverterPtr& wstringConverter) { // // No locking, as it can only be called during plug-in loading // _initData.wstringConverter = wstringConverter; } void IceInternal::Instance::setLogger(const Ice::LoggerPtr& logger) { // // No locking, as it can only be called during plug-in loading // _initData.logger = logger; } void IceInternal::Instance::setThreadHook(const Ice::ThreadNotificationPtr& threadHook) { // // No locking, as it can only be called during plug-in loading // _initData.threadHook = threadHook; } IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const InitializationData& initData) : _state(StateActive), _initData(initData), _messageSizeMax(0), _clientACM(0), _serverACM(0), _implicitContext(0) { try { __setNoDelete(true); { IceUtilInternal::MutexPtrLock sync(staticMutex); instanceCount++; if(!_initData.properties) { _initData.properties = createProperties(); } if(!oneOffDone) { // // StdOut and StdErr redirection // string stdOutFilename = _initData.properties->getProperty("Ice.StdOut"); string stdErrFilename = _initData.properties->getProperty("Ice.StdErr"); if(stdOutFilename != "") { #ifdef _LARGEFILE64_SOURCE FILE* file = freopen64(stdOutFilename.c_str(), "a", stdout); #else #ifdef _WIN32 FILE* file = _wfreopen(IceUtil::stringToWstring(nativeToUTF8(_initData.stringConverter, stdOutFilename)).c_str(), L"a", stdout); #else FILE* file = freopen(stdOutFilename.c_str(), "a", stdout); #endif #endif if(file == 0) { FileException ex(__FILE__, __LINE__); ex.path = stdOutFilename; ex.error = getSystemErrno(); throw ex; } } if(stdErrFilename != "") { #ifdef _LARGEFILE64_SOURCE FILE* file = freopen64(stdErrFilename.c_str(), "a", stderr); #else #ifdef _WIN32 FILE* file = _wfreopen(IceUtil::stringToWstring(nativeToUTF8(_initData.stringConverter, stdErrFilename)).c_str(), L"a", stderr); #else FILE* file = freopen(stdErrFilename.c_str(), "a", stderr); #endif #endif if(file == 0) { FileException ex(__FILE__, __LINE__); ex.path = stdErrFilename; ex.error = getSystemErrno(); throw ex; } } if(_initData.properties->getPropertyAsInt("Ice.NullHandleAbort") > 0) { IceUtilInternal::nullHandleAbort = true; } #ifdef NDEBUG if(_initData.properties->getPropertyAsIntWithDefault("Ice.PrintStackTraces", 0) > 0) #else if(_initData.properties->getPropertyAsIntWithDefault("Ice.PrintStackTraces", 1) > 0) #endif { IceUtilInternal::printStackTraces = true; } #ifndef _WIN32 string newUser = _initData.properties->getProperty("Ice.ChangeUser"); if(!newUser.empty()) { errno = 0; struct passwd* pw = getpwnam(newUser.c_str()); if(!pw) { if(errno) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } else { InitializationException ex(__FILE__, __LINE__, "Unknown user account `" + newUser + "'"); throw ex; } } if(setgid(pw->pw_gid) == -1) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } if(initgroups(pw->pw_name, pw->pw_gid) == -1) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } if(setuid(pw->pw_uid) == -1) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } } #endif oneOffDone = true; } if(instanceCount == 1) { #if defined(_WIN32) && !defined(ICE_OS_WINRT) WORD version = MAKEWORD(1, 1); WSADATA data; if(WSAStartup(version, &data) != 0) { SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } #endif #ifndef _WIN32 struct sigaction action; action.sa_handler = SIG_IGN; sigemptyset(&action.sa_mask); action.sa_flags = 0; sigaction(SIGPIPE, &action, &oldAction); if(_initData.properties->getPropertyAsInt("Ice.UseSyslog") > 0) { identForOpenlog = _initData.properties->getProperty("Ice.ProgramName"); if(identForOpenlog.empty()) { identForOpenlog = ""; } openlog(identForOpenlog.c_str(), LOG_PID, LOG_USER); } #endif } } if(!_initData.logger) { string logfile = _initData.properties->getProperty("Ice.LogFile"); #ifndef _WIN32 if(_initData.properties->getPropertyAsInt("Ice.UseSyslog") > 0) { if(!logfile.empty()) { throw InitializationException(__FILE__, __LINE__, "Both syslog and file logger cannot be enabled."); } _initData.logger = new SysLoggerI(_initData.properties->getProperty("Ice.ProgramName"), _initData.properties->getPropertyWithDefault("Ice.SyslogFacility", "LOG_USER")); } else #endif if(!logfile.empty()) { _initData.logger = new LoggerI(_initData.properties->getProperty("Ice.ProgramName"), nativeToUTF8(_initData.stringConverter, logfile)); } else { _initData.logger = getProcessLogger(); } } const_cast(_traceLevels) = new TraceLevels(_initData.properties); const_cast(_defaultsAndOverrides) = new DefaultsAndOverrides(_initData.properties); { static const int defaultMessageSizeMax = 1024; Int num = _initData.properties->getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax); if(num < 1) { const_cast(_messageSizeMax) = defaultMessageSizeMax * 1024; // Ignore non-sensical values. } else if(static_cast(num) > (size_t)(0x7fffffff / 1024)) { const_cast(_messageSizeMax) = static_cast(0x7fffffff); } else { // Property is in kilobytes, _messageSizeMax in bytes. const_cast(_messageSizeMax) = static_cast(num) * 1024; } } // // Client ACM enabled by default. Server ACM disabled by default. // const_cast(_clientACM) = _initData.properties->getPropertyAsIntWithDefault("Ice.ACM.Client", 60); const_cast(_serverACM) = _initData.properties->getPropertyAsInt("Ice.ACM.Server"); #ifndef ICE_OS_WINRT const_cast(_implicitContext) = ImplicitContextI::create(_initData.properties->getProperty("Ice.ImplicitContext")); #endif _routerManager = new RouterManager; _locatorManager = new LocatorManager(_initData.properties); _referenceFactory = new ReferenceFactory(this, communicator); _proxyFactory = new ProxyFactory(this); string proxyHost = _initData.properties->getProperty("Ice.SOCKSProxyHost"); int defaultIPv6 = 1; // IPv6 enabled by default. if(!proxyHost.empty()) { #ifdef ICE_OS_WINRT throw InitializationException(__FILE__, __LINE__, "SOCKS proxy not supported in WinRT"); #else int proxyPort = _initData.properties->getPropertyAsIntWithDefault("Ice.SOCKSProxyPort", 1080); _networkProxy = new SOCKSNetworkProxy(proxyHost, proxyPort); defaultIPv6 = 0; // IPv6 is not supported with SOCKS #endif } bool ipv4 = _initData.properties->getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0; bool ipv6 = _initData.properties->getPropertyAsIntWithDefault("Ice.IPv6", defaultIPv6) > 0; if(!ipv4 && !ipv6) { throw InitializationException(__FILE__, __LINE__, "Both IPV4 and IPv6 support cannot be disabled."); } else if(ipv4 && ipv6) { _protocolSupport = EnableBoth; } else if(ipv4) { _protocolSupport = EnableIPv4; } else { _protocolSupport = EnableIPv6; } _preferIPv6 = _initData.properties->getPropertyAsInt("Ice.PreferIPv6Address") > 0; #ifndef ICE_OS_WINRT if(ipv6 && SOCKSNetworkProxyPtr::dynamicCast(_networkProxy)) { throw InitializationException(__FILE__, __LINE__, "IPv6 is not supported with SOCKS4 proxies"); } #endif _endpointFactoryManager = new EndpointFactoryManager(this); #ifndef ICE_OS_WINRT EndpointFactoryPtr tcpEndpointFactory = new TcpEndpointFactory(this); _endpointFactoryManager->add(tcpEndpointFactory); #else EndpointFactoryPtr tcpStreamEndpointFactory = new StreamEndpointFactory(this, TCPEndpointType); _endpointFactoryManager->add(tcpStreamEndpointFactory); EndpointFactoryPtr sslStreamEndpointFactory = new StreamEndpointFactory(this, IceSSL::EndpointType); _endpointFactoryManager->add(sslStreamEndpointFactory); #endif EndpointFactoryPtr udpEndpointFactory = new UdpEndpointFactory(this); _endpointFactoryManager->add(udpEndpointFactory); _dynamicLibraryList = new DynamicLibraryList; _pluginManager = new PluginManagerI(communicator, _dynamicLibraryList); _outgoingConnectionFactory = new OutgoingConnectionFactory(communicator, this); _servantFactoryManager = new ObjectFactoryManager(); _objectAdapterFactory = new ObjectAdapterFactory(this, communicator); _retryQueue = new RetryQueue(this); if(_initData.wstringConverter == 0) { _initData.wstringConverter = new UnicodeWstringConverter(); } // // Add Process and Properties facets // StringSeq facetSeq = _initData.properties->getPropertyAsList("Ice.Admin.Facets"); if(!facetSeq.empty()) { _adminFacetFilter.insert(facetSeq.begin(), facetSeq.end()); } _adminFacets.insert(FacetMap::value_type("Process", new ProcessI(communicator))); PropertiesAdminIPtr props = new PropertiesAdminI("Properties", _initData.properties, _initData.logger); _adminFacets.insert(FacetMap::value_type("Properties",props)); _metricsAdmin = new MetricsAdminI(_initData.properties, _initData.logger); _adminFacets.insert(FacetMap::value_type("Metrics", _metricsAdmin)); // // Setup the communicator observer only if the user didn't already set an // Ice observer resolver and if the admininistrative endpoints are set. // if((_adminFacetFilter.empty() || _adminFacetFilter.find("Metrics") != _adminFacetFilter.end()) && _initData.properties->getProperty("Ice.Admin.Endpoints") != "") { _observer = new CommunicatorObserverI(_metricsAdmin, _initData.observer); // // Make sure the admin plugin receives property updates. // props->addUpdateCallback(_metricsAdmin); } else { _observer = _initData.observer; } __setNoDelete(false); } catch(...) { { IceUtilInternal::MutexPtrLock sync(staticMutex); --instanceCount; } destroy(); __setNoDelete(false); throw; } } IceInternal::Instance::~Instance() { assert(_state == StateDestroyed); assert(!_referenceFactory); assert(!_proxyFactory); assert(!_outgoingConnectionFactory); assert(!_connectionMonitor); assert(!_servantFactoryManager); assert(!_objectAdapterFactory); assert(!_clientThreadPool); assert(!_serverThreadPool); assert(!_endpointHostResolver); assert(!_retryQueue); assert(!_timer); assert(!_routerManager); assert(!_locatorManager); assert(!_endpointFactoryManager); assert(!_dynamicLibraryList); assert(!_pluginManager); IceUtilInternal::MutexPtrLock sync(staticMutex); if(--instanceCount == 0) { #if defined(_WIN32) && !defined(ICE_OS_WINRT) WSACleanup(); #endif #ifndef _WIN32 sigaction(SIGPIPE, &oldAction, 0); if(!identForOpenlog.empty()) { closelog(); identForOpenlog.clear(); } #endif } } void IceInternal::Instance::finishSetup(int& argc, char* argv[]) { // // Load plug-ins. // assert(!_serverThreadPool); PluginManagerI* pluginManagerImpl = dynamic_cast(_pluginManager.get()); assert(pluginManagerImpl); pluginManagerImpl->loadPlugins(argc, argv); // // Set observer updater // if(_observer) { theCollector->updateObserver(_observer); _observer->setObserverUpdater(new ObserverUpdaterI(this)); } // // Create threads. // try { bool hasPriority = _initData.properties->getProperty("Ice.ThreadPriority") != ""; int priority = _initData.properties->getPropertyAsInt("Ice.ThreadPriority"); if(hasPriority) { _timer = new IceUtil::Timer(priority); } else { _timer = new IceUtil::Timer; } } catch(const IceUtil::Exception& ex) { Error out(_initData.logger); out << "cannot create thread for timer:\n" << ex; throw; } try { _endpointHostResolver = new EndpointHostResolver(this); } catch(const IceUtil::Exception& ex) { Error out(_initData.logger); out << "cannot create thread for endpoint host resolver:\n" << ex; throw; } _clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0); // // Get default router and locator proxies. Don't move this // initialization before the plug-in initialization!!! The proxies // might depend on endpoint factories to be installed by plug-ins. // RouterPrx router = RouterPrx::uncheckedCast(_proxyFactory->propertyToProxy("Ice.Default.Router")); if(router) { _referenceFactory = _referenceFactory->setDefaultRouter(router); } LocatorPrx locator = LocatorPrx::uncheckedCast(_proxyFactory->propertyToProxy("Ice.Default.Locator")); if(locator) { _referenceFactory = _referenceFactory->setDefaultLocator(locator); } // // Show process id if requested (but only once). // bool printProcessId = false; if(!printProcessIdDone && _initData.properties->getPropertyAsInt("Ice.PrintProcessId") > 0) { // // Safe double-check locking (no dependent variable!) // IceUtilInternal::MutexPtrLock sync(staticMutex); printProcessId = !printProcessIdDone; // // We anticipate: we want to print it once, and we don't care when. // printProcessIdDone = true; } if(printProcessId) { #ifdef _MSC_VER cout << GetCurrentProcessId() << endl; #else cout << getpid() << endl; #endif } // // Create the connection monitor and ensure the interval for // monitoring connections is appropriate for client & server // ACM. // _connectionMonitor = new ConnectionMonitor(this, _initData.properties->getPropertyAsInt("Ice.MonitorConnections")); _connectionMonitor->checkIntervalForACM(_clientACM); _connectionMonitor->checkIntervalForACM(_serverACM); // // Server thread pool initialization is lazy in serverThreadPool(). // // // An application can set Ice.InitPlugins=0 if it wants to postpone // initialization until after it has interacted directly with the // plug-ins. // if(_initData.properties->getPropertyAsIntWithDefault("Ice.InitPlugins", 1) > 0) { pluginManagerImpl->initializePlugins(); } // // This must be done last as this call creates the Ice.Admin object adapter // and eventually register a process proxy with the Ice locator (allowing // remote clients to invoke on Ice.Admin facets as soon as it's registered). // if(_initData.properties->getPropertyAsIntWithDefault("Ice.Admin.DelayCreation", 0) <= 0) { getAdmin(); } } bool IceInternal::Instance::destroy() { { IceUtil::RecMutex::Lock sync(*this); // // If the _state is not StateActive then the instance is // either being destroyed, or has already been destroyed. // if(_state != StateActive) { return false; } // // We cannot set state to StateDestroyed otherwise instance // methods called during the destroy process (such as // outgoingConnectionFactory() from // ObjectAdapterI::deactivate() will cause an exception. // _state = StateDestroyInProgress; } if(_objectAdapterFactory) { _objectAdapterFactory->shutdown(); } if(_outgoingConnectionFactory) { _outgoingConnectionFactory->destroy(); } if(_objectAdapterFactory) { _objectAdapterFactory->destroy(); } if(_outgoingConnectionFactory) { _outgoingConnectionFactory->waitUntilFinished(); } if(_retryQueue) { _retryQueue->destroy(); } if(_observer && theCollector) { theCollector->clearObserver(_observer); } if(_metricsAdmin) { _metricsAdmin->destroy(); _metricsAdmin = 0; // Break cyclic reference counts. Don't clear _observer, it's immutable. if(_observer) { CommunicatorObserverIPtr::dynamicCast(_observer)->destroy(); } } ThreadPoolPtr serverThreadPool; ThreadPoolPtr clientThreadPool; EndpointHostResolverPtr endpointHostResolver; { IceUtil::RecMutex::Lock sync(*this); _objectAdapterFactory = 0; _outgoingConnectionFactory = 0; _retryQueue = 0; if(_connectionMonitor) { _connectionMonitor->destroy(); _connectionMonitor = 0; } if(_serverThreadPool) { _serverThreadPool->destroy(); std::swap(_serverThreadPool, serverThreadPool); } if(_clientThreadPool) { _clientThreadPool->destroy(); std::swap(_clientThreadPool, clientThreadPool); } if(_endpointHostResolver) { _endpointHostResolver->destroy(); std::swap(endpointHostResolver, _endpointHostResolver); } if(_timer) { _timer->destroy(); _timer = 0; } if(_servantFactoryManager) { _servantFactoryManager->destroy(); _servantFactoryManager = 0; } //_referenceFactory->destroy(); // No destroy function defined. _referenceFactory = 0; // _proxyFactory->destroy(); // No destroy function defined. _proxyFactory = 0; if(_routerManager) { _routerManager->destroy(); _routerManager = 0; } if(_locatorManager) { _locatorManager->destroy(); _locatorManager = 0; } if(_endpointFactoryManager) { _endpointFactoryManager->destroy(); _endpointFactoryManager = 0; } if(_pluginManager) { _pluginManager->destroy(); _pluginManager = 0; } // No destroy function defined. // _dynamicLibraryList->destroy(); _dynamicLibraryList = 0; _adminAdapter = 0; _adminFacets.clear(); _state = StateDestroyed; } // // Join with the thread pool threads outside the synchronization. // if(clientThreadPool) { clientThreadPool->joinWithAllThreads(); } if(serverThreadPool) { serverThreadPool->joinWithAllThreads(); } #ifndef ICE_OS_WINRT if(endpointHostResolver) { endpointHostResolver->getThreadControl().join(); } #endif if(_initData.properties->getPropertyAsInt("Ice.Warn.UnusedProperties") > 0) { set unusedProperties = static_cast(_initData.properties.get())->getUnusedProperties(); if(unusedProperties.size() != 0) { Warning out(_initData.logger); out << "The following properties were set but never read:"; for(set::const_iterator p = unusedProperties.begin(); p != unusedProperties.end(); ++p) { out << "\n " << *p; } } } return true; } void IceInternal::Instance::updateConnectionObservers() { try { assert(_outgoingConnectionFactory); _outgoingConnectionFactory->updateConnectionObservers(); assert(_objectAdapterFactory); _objectAdapterFactory->updateObservers(&ObjectAdapterI::updateConnectionObservers); } catch(const Ice::CommunicatorDestroyedException&) { } } void IceInternal::Instance::updateThreadObservers() { try { if(_clientThreadPool) { _clientThreadPool->updateObservers(); } if(_serverThreadPool) { _serverThreadPool->updateObservers(); } assert(_objectAdapterFactory); _objectAdapterFactory->updateObservers(&ObjectAdapterI::updateThreadObservers); if(_endpointHostResolver) { _endpointHostResolver->updateObserver(); } assert(theCollector); theCollector->updateObserver(_observer); } catch(const Ice::CommunicatorDestroyedException&) { } } IceInternal::ProcessI::ProcessI(const CommunicatorPtr& communicator) : _communicator(communicator) { } void IceInternal::ProcessI::shutdown(const Current&) { _communicator->shutdown(); } void IceInternal::ProcessI::writeMessage(const string& message, Int fd, const Current&) { switch(fd) { case 1: { cout << message << endl; break; } case 2: { cerr << message << endl; break; } } } Ice-3.5.1/cpp/src/Ice/LoggerI.h0000644000076400007640000000200212223561476014136 0ustar mesmes// ********************************************************************** // // 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 ICE_LOGGER_I_H #define ICE_LOGGER_I_H #include #include namespace Ice { class LoggerI : public Logger { public: LoggerI(const std::string&, const std::string&); ~LoggerI(); virtual void print(const std::string&); virtual void trace(const std::string&, const std::string&); virtual void warning(const std::string&); virtual void error(const std::string&); virtual LoggerPtr cloneWithPrefix(const std::string&); private: void write(const std::string&, bool); std::string _prefix; IceUtilInternal::ofstream _out; std::string _file; }; typedef IceUtil::Handle LoggerIPtr; } #endif Ice-3.5.1/cpp/src/Ice/UdpEndpointI.h0000644000076400007640000000546712223561476015172 0ustar mesmes// ********************************************************************** // // 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 ICE_UDP_ENDPOINT_I_H #define ICE_UDP_ENDPOINT_I_H #include #include #include #include namespace IceInternal { class UdpEndpointI : public EndpointI { public: UdpEndpointI(const InstancePtr&, const std::string&, Ice::Int, const std::string&, Ice::Int, bool, const std::string&, bool); UdpEndpointI(const InstancePtr&, const std::string&, bool); UdpEndpointI(BasicStream*); virtual void streamWrite(BasicStream*) const; virtual std::string toString() const; virtual Ice::EndpointInfoPtr getInfo() const; virtual Ice::Short type() const; virtual std::string protocol() const; virtual Ice::Int timeout() const; virtual EndpointIPtr timeout(Ice::Int) const; virtual EndpointIPtr connectionId(const ::std::string&) const; virtual bool compress() const; virtual EndpointIPtr compress(bool) const; virtual bool datagram() const; virtual bool secure() const; virtual TransceiverPtr transceiver(EndpointIPtr&) const; virtual std::vector connectors(Ice::EndpointSelectionType) const; virtual void connectors_async(Ice::EndpointSelectionType, const EndpointI_connectorsPtr&) const; virtual AcceptorPtr acceptor(EndpointIPtr&, const std::string&) const; virtual std::vector expand() const; virtual bool equivalent(const EndpointIPtr&) const; virtual std::vector connectors(const std::vector
          &, const NetworkProxyPtr&) const; virtual bool operator==(const Ice::LocalObject&) const; virtual bool operator<(const Ice::LocalObject&) const; #ifdef __SUNPRO_CC using EndpointI::connectionId; #endif private: virtual ::Ice::Int hashInit() const; // // All members are const, because endpoints are immutable. // const InstancePtr _instance; const std::string _host; const Ice::Int _port; const std::string _mcastInterface; const Ice::Int _mcastTtl; const bool _connect; const bool _compress; }; class UdpEndpointFactory : public EndpointFactory { public: virtual ~UdpEndpointFactory(); virtual Ice::Short type() const; virtual std::string protocol() const; virtual EndpointIPtr create(const std::string&, bool) const; virtual EndpointIPtr read(BasicStream*) const; virtual void destroy(); private: UdpEndpointFactory(const InstancePtr&); friend class Instance; InstancePtr _instance; }; } #endif Ice-3.5.1/cpp/src/Ice/UdpTransceiver.h0000644000076400007640000000623212223561476015555 0ustar mesmes// ********************************************************************** // // 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 ICE_UDP_TRANSCEIVER_H #define ICE_UDP_TRANSCEIVER_H #include #include #include #include #include #include #include #include #ifdef ICE_OS_WINRT # include #endif namespace IceInternal { class UdpEndpoint; class UdpTransceiver : public Transceiver, public NativeInfo { enum State { StateNeedConnect, StateConnectPending, StateConnected, StateNotConnected }; public: virtual NativeInfoPtr getNativeInfo(); #if defined(ICE_USE_IOCP) virtual AsyncInfo* getAsyncInfo(SocketOperation); #elif defined(ICE_OS_WINRT) virtual void setCompletedHandler(SocketOperationCompletedHandler^); #endif virtual SocketOperation initialize(Buffer&, Buffer&); virtual void close(); virtual bool write(Buffer&); virtual bool read(Buffer&); #if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) virtual bool startWrite(Buffer&); virtual void finishWrite(Buffer&); virtual void startRead(Buffer&); virtual void finishRead(Buffer&); #endif virtual std::string type() const; virtual std::string toString() const; virtual Ice::ConnectionInfoPtr getInfo() const; virtual void checkSendSize(const Buffer&, size_t); int effectivePort() const; private: UdpTransceiver(const InstancePtr&, const Address&, const std::string&, int); UdpTransceiver(const InstancePtr&, const std::string&, int, const std::string&, bool); virtual ~UdpTransceiver(); void setBufSize(const InstancePtr&); #ifdef ICE_OS_WINRT bool checkIfErrorOrCompleted(SocketOperation, Windows::Foundation::IAsyncInfo^); void appendMessage(Windows::Networking::Sockets::DatagramSocketMessageReceivedEventArgs^); Windows::Networking::Sockets::DatagramSocketMessageReceivedEventArgs^ readMessage(); #endif friend class UdpEndpointI; friend class UdpConnector; const TraceLevelsPtr _traceLevels; const Ice::LoggerPtr _logger; const Ice::StatsPtr _stats; const bool _incoming; const Address _addr; Address _mcastAddr; Address _peerAddr; State _state; int _rcvSize; int _sndSize; static const int _udpOverhead; static const int _maxPacketSize; #if defined(ICE_USE_IOCP) AsyncInfo _read; AsyncInfo _write; Address _readAddr; socklen_t _readAddrLen; #elif defined(ICE_OS_WINRT) AsyncInfo _write; Windows::Storage::Streams::DataWriter^ _writer; SocketOperationCompletedHandler^ _completedHandler; Windows::Foundation::AsyncOperationCompletedHandler^ _writeOperationCompletedHandler; IceUtil::Mutex _mutex; bool _readPending; std::deque _received; #endif }; } #endif Ice-3.5.1/cpp/src/ca/0000755000076400007640000000000012223561477012327 5ustar mesmesIce-3.5.1/cpp/src/ca/README0000644000076400007640000000035512223561477013212 0ustar mesmesThe Python script in this directory is a wrapper around OpenSSL's tools to simplify the process of setting up a private certificate authority and generating certificates. See the IceSSL chapter of the Ice manual for usage instructions. Ice-3.5.1/cpp/src/ca/ImportKey.java0000644000076400007640000001020712223561476015114 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** // // Java's keytool program does not provide any way to import a private // key, so this simple utility imports a private key and certificate // chain from a PKCS12 file into a Java keystore. // import java.security.Key; import java.security.KeyStore; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; public class ImportKey { static private char[] readPassword(String f) { try { java.io.InputStream s = new java.io.FileInputStream(f); int n = s.available(); byte[] raw = new byte[n]; s.read(raw); s.close(); return (new String(raw)).toCharArray(); } catch(Exception ex) { ex.printStackTrace(); System.exit(1); } return null; } public static void main(String[] args) { if(args.length < 5) { // // Arguments: // // pkcs12-file A file in PKCS12 format that contains the // private key and certificate chain. // // alias The key's friendly name in pkcs12-file and the // alias for the key in the new keystore. // // cert-file The CA certificate file in DER format. // // keystore-file The name of the keystore file to update // or create. // // store-password The file containing the password to use // for the keystore. // // key-password The file containing the password to use // for the key. // // kstore-password The file containing the password to use // to store the key. If this isn't provided the // key-password is used. This is used to import an // unprotected private key. // System.err.println("Usage: ImportKey pkcs12-file alias cert-file " + "keystore-file store-password key-password [kstore-password]"); System.exit(1); } final String pkcs12File = args[0]; final String alias = args[1]; final String certFile = args[2]; final String keystoreFile = args[3]; final char[] storePassword = readPassword(args[4]); final char[] keyPassword = readPassword(args[5]); char[] kstorePassword = readPassword(args[5]); if(args.length > 6) { kstorePassword = readPassword(args[6]); } else { kstorePassword = keyPassword; } try { KeyStore src = KeyStore.getInstance("PKCS12"); src.load(new java.io.FileInputStream(pkcs12File), keyPassword); KeyStore dest = KeyStore.getInstance("JKS"); java.io.File f = new java.io.File(keystoreFile); if(f.exists()) { dest.load(new java.io.FileInputStream(f), storePassword); } else { dest.load(null, null); } Certificate[] chain = src.getCertificateChain(alias); Key key = src.getKey(alias, keyPassword); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate) cf.generateCertificate(new java.io.FileInputStream(certFile)); dest.setKeyEntry(alias, key, kstorePassword, chain); dest.setCertificateEntry("cacert", cert); dest.store(new java.io.FileOutputStream(keystoreFile), storePassword); } catch(Exception ex) { ex.printStackTrace(); System.exit(1); } System.exit(0); } } Ice-3.5.1/cpp/src/ca/iceca.bat0000755000076400007640000000071312223561476014066 0ustar mesmes@echo off REM ********************************************************************** REM REM Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. REM REM This copy of Ice is licensed to you under the terms described in the REM ICE_LICENSE file included in this distribution. REM REM ********************************************************************** REM .bat wrapper for iceca python script. Assumes python is in your PATH. @python "%~dp0iceca" %* Ice-3.5.1/cpp/src/ca/iceca0000755000076400007640000005463412223561476013334 0ustar mesmes#!/usr/bin/env python # ********************************************************************** # # 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. # # ********************************************************************** import os import sys import getopt import tempfile import getpass import shutil import socket home = os.getenv("ICE_CA_HOME") if home is None: # The substring on sys.platform is required because some cygwin # versions return variations like "cygwin_nt-4.01". if sys.platform == "win32" or sys.platform[:6] == "cygwin": home = os.path.dirname(sys.argv[0]) home = os.path.join(home, "..", "config") else: home = os.getenv('HOME') if home is None: print("Environment variable HOME is not set.") sys.exit(1) home = os.path.join(home, ".iceca") home = os.path.normpath(home) os.putenv("ICE_CA_HOME", home) opensslCmd = "openssl" if sys.platform == "win32" or sys.platform[:6] == "cygwin": # Add the directory containing this script to the PATH, this is # also where the openssl.exe is located. if os.path.exists(os.path.join(os.path.dirname(sys.argv[0]), "openssl.exe")): os.environ["PATH"] = os.path.dirname(sys.argv[0]) + os.pathsep + os.getenv("PATH", "") # Setup RANDFILE to avoid errors on Vista about openssl not being # able to write 'Random State' os.environ["RANDFILE"] = os.path.join(os.getenv("ICE_CA_HOME"), "randfile") caroot = os.path.join(home, "ca") cadb = os.path.join(caroot, "db") def usage(): print("usage: " + sys.argv[0] + " [--verbose --keep] import sign request init") sys.exit(1) if len(sys.argv) == 1: usage() # Work out the position of the script. script = 1 while script < len(sys.argv) and sys.argv[script].startswith("--"): script = script + 1 if script > len(sys.argv): usage() # # Parse the global options. # try: opts, args = getopt.getopt(sys.argv[1:script], "", [ "verbose", "keep"]) except getopt.GetoptError: usage() verbose = False keep = False for o, a in opts: if o == "--verbose": verbose = True if o == "--keep": keep = True if sys.argv[script] == "import": def usage(): print("usage: " + sys.argv[script] + " [--overwrite] [--key-pass password] [--store-pass password] [--java alias cert key keystore ] [--cs cert key out-file]") sys.exit(1) try: opts, args = getopt.getopt(sys.argv[script+1:], "", [ "overwrite", "key-pass=", "store-pass=", "java", "cs"]) except getopt.GetoptError: usage() java = False cs = False keyPass = None storePass = None overwrite = False for o, a in opts: if o == "--overwrite": overwrite = True if o == "--key-pass": keyPass = a if o == "--store-pass": storePass = a if o == "--java": java = True if o == "--cs": cs = True if not java and not cs: print(sys.argv[script] + ": one of --java or --cs must be provided") usage() if java: # # For an RPM install we use /usr/share/Ice-. A # non-RPM install uses ${prefix}/lib (that is the location of the # script ../lib). For development purposes we also check ".". # checkLocations = [".", os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..", "lib")), os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..", "..", "lib")), "/usr/share/Ice-3.5.1"] for bindir in checkLocations: bindir = os.path.normpath(bindir) if os.path.exists(os.path.join(bindir, "ImportKey.class")): break else: print("Error: cannot locate ImportKey.class any of the following locations:\n%s" % str(checkLocations)) sys.exit(1) if len(args) != 4: usage() alias = args[0] cert = args[1] key = args[2] store = args[3] if keyPass is None: keyPass = getpass.getpass("Enter private key passphrase:") while storePass is None or len(storePass) == 0: storePass = getpass.getpass("Enter keystore password:") # # We use secure temporary files to transfer the password to openssl # and the ImportKey java tool. Its necessary to create 2 files for the # key password because openssl craps out if you use the same password # file twice. # keypassfile1 = None keypassfile2 = None if len(keyPass) > 0: temp, keypassfile1 = tempfile.mkstemp("keypass1") os.write(temp, keyPass.encode("utf-8")) os.close(temp) temp, keypassfile2 = tempfile.mkstemp("keypass2") os.write(temp, keyPass.encode("utf-8")) os.close(temp) else: # Java can't deal with unencrypted keystores, so we use a # temporary one. temp, keypassfile1 = tempfile.mkstemp("keypass1") os.write(temp, "password".encode("utf-8")) os.close(temp) # We create a file with an empty password to store the results # in the keystore. temp, keypassfile2 = tempfile.mkstemp("keypass2") os.close(temp) temp, storepassfile = tempfile.mkstemp("storepass3") os.write(temp, storePass.encode("utf-8")) os.close(temp) temp, pkcs12cert = tempfile.mkstemp(".p12", "pkcs12") os.close(temp) if len(keyPass) > 0: cmd = opensslCmd + " pkcs12 -in " + cert + " -inkey " + key + " -export -out " + pkcs12cert + " -name " + \ alias + " -passin file:" + keypassfile1 + " -passout file:" + keypassfile2 + ' -certfile "' + \ os.path.join(home, "ca_cert.pem") + '"' else: cmd = opensslCmd + " pkcs12 -in " + cert + " -inkey " + key + " -export -out " + pkcs12cert + " -name " + \ alias + " -passout file:" + keypassfile1 + ' -certfile "' + os.path.join(home, "ca_cert.pem") + '"' sys.stdout.write("converting to pkcs12 format... ") sys.stdout.flush() if verbose: print(cmd) status = os.system(cmd) if status != 0: print("openssl command failed") if not keep: os.remove(keypassfile1) if not keep: os.remove(keypassfile2) if not keep: os.remove(storepassfile) sys.exit(1) print("ok") # Use java to import the cert into the keystore. cmd = "java -classpath \"" + bindir + "\" ImportKey " + pkcs12cert + " " + alias + " " \ + os.path.join(home, "ca_cert.pem") + " " + store + " " + storepassfile + " " + keypassfile1 if len(keyPass) == 0: cmd = cmd + " " + keypassfile2 #print(cmd) sys.stdout.write("importing into the keystore...") sys.stdout.flush() if verbose: print(cmd) status = os.system(cmd) if status != 0: print("java command failed") else: print("ok") # Cleanup. if not keep: os.remove(pkcs12cert) if not keep: os.remove(keypassfile1) if not keep: os.remove(keypassfile2) if not keep: os.remove(storepassfile) if cs: if len(args) != 3: usage() if storePass is not None: print('Usage: %s: "--store-pass" is only supported with --java' % sys.argv[script]) sys.exit(1) cert = args[0] key = args[1] pkcs12cert = args[2] if not overwrite and os.path.exists(pkcs12cert): print(pkcs12cert + ": file exists") sys.exit(1) if keyPass is None: keyPass = getpass.getpass("Enter private key passphrase:") # # We use secure temporary files to transfer the password to # openssl Its necessary to create 2 files for the key password # because openssl craps out if you use the same password file # twice. # keypassfile1 = None keypassfile2 = None if len(keyPass) > 0: temp, keypassfile1 = tempfile.mkstemp("keypass1") os.write(temp, keyPass.encode("utf-8")) os.close(temp) temp, keypassfile2 = tempfile.mkstemp("keypass2") os.write(temp, keyPass.encode("utf-8")) os.close(temp) cmd = opensslCmd + " pkcs12 -in " + cert + " -inkey " + key + " -export -out " + pkcs12cert + \ " -passin file:" + keypassfile1 + " -passout file:" + keypassfile2 else: cmd = opensslCmd + " pkcs12 -in " + cert + " -inkey " + key + " -export -out " + pkcs12cert + \ " -passout pass:" sys.stdout.write("converting to pkcs12 format...") sys.stdout.flush() if verbose: print(cmd) status = os.system(cmd) if keypassfile1 != None: if not keep: os.remove(keypassfile1) if keypassfile2 != None: if not keep: os.remove(keypassfile2) if status != 0: print("openssl command failed") sys.exit(1) print("ok") sys.exit(0) if sys.argv[script] == "init": def usage(): print("usage: " + sys.argv[script] + " [--no-password] [--overwrite]") sys.exit(1) try: opts, args = getopt.getopt(sys.argv[script+1:], "", [ "no-password", "overwrite"]) except getopt.GetoptError: usage() if args: usage() print("This script will initialize your organization's Certificate Authority (CA).") print('The CA database will be created in "%s"' % caroot) nopassphrase = False for o, a in opts: if o == "--no-password": nopassphrase = True if o == "--overwrite": # If the CA exists then destroy it. if os.path.exists(caroot): print("Warning: running this command will destroy your existing CA setup!") sys.stdout.write("Do you want to continue? (y/n)") sys.stdout.flush() choice = sys.stdin.readline().strip() if choice != 'y' and choice != 'Y': sys.exit(1) shutil.rmtree(caroot) # # Check that the caroot isn't already populated. # if os.path.exists(os.path.join(cadb, "ca_key.pem")): print(cadb + ": CA has already been initialized.") print("Use the --overwrite option to re-initialize the database.") sys.exit(1) try: os.makedirs(cadb) except OSError: pass # # Initialize the CA serial and index. # serial = open(os.path.join(cadb, "serial"), "w" ) serial.write("01\n") serial.close() index = open(os.path.join(cadb, "index.txt"), "w") index.close() # Construct the DN for the CA certificate. DNelements = { \ 'C':['countryName', "Country name", "", 'match'], \ 'ST':['stateOrProvinceName', "State or province name", "", 'match'], \ 'L':['localityName', "Locality", "", 'match'], \ 'O':['organizationName', "Organization name", "GridCA-" + socket.gethostname(), 'match'], \ 'OU':['organizationalUnitName', "Organizational unit name", "", 'optional'], \ 'CN':['commonName', "Common name", "Grid CA", 'supplied'] \ } while True: print("The subject name for your CA will be ") first = True for k,v in DNelements.items(): if len(v[2]) > 0: if not first: sys.stdout.write(", ") sys.stdout.write(k + "=" + v[2]) first = False print("") sys.stdout.write("Do you want to keep this as the CA subject name? (y/n) [y]") sys.stdout.flush() input = sys.stdin.readline().strip() if input == 'n': for v in DNelements.values(): sys.stdout.write(v[1] + ":") sys.stdout.flush() v[2] = sys.stdin.readline().strip() else: break while True: sys.stdout.write("Enter the email address of the CA: ") sys.stdout.flush() DNelements['emailAddress'] = ['emailAddress', '', sys.stdin.readline().strip(), 'optional'] if DNelements['emailAddress'][2] and len(DNelements['emailAddress'][2]) > 0: break # # Static configuration file data. This avoids locating template files # and such. # config = {\ "ca.cnf":"\ # **********************************************************************\n\ #\n\ # Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.\n\ #\n\ # This copy of Ice is licensed to you under the terms described in the\n\ # ICE_LICENSE file included in this distribution.\n\ #\n\ # **********************************************************************\n\ \n\ # Configuration file for the CA. This file is generated by iceca init.\n\ # DO NOT EDIT!\n\ \n\ ###############################################################################\n\ ### Self Signed Root Certificate\n\ ###############################################################################\n\ \n\ [ ca ]\n\ default_ca = ice\n\ \n\ [ ice ]\n\ default_days = 1825 # How long certs are valid.\n\ default_md = md5 # The Message Digest type.\n\ preserve = no # Keep passed DN ordering?\n\ \n\ [ req ]\n\ default_bits = 2048\n\ default_keyfile = $ENV::ICE_CA_HOME/ca/db/ca_key.pem\n\ default_md = md5\n\ prompt = no\n\ distinguished_name = dn\n\ x509_extensions = extensions\n\ \n\ [ extensions ]\n\ basicConstraints = CA:true\n\ \n\ # PKIX recommendation.\n\ subjectKeyIdentifier = hash\n\ authorityKeyIdentifier = keyid:always,issuer:always\n\ \n\ [dn]\n\ ",\ "sign.cnf":"\ # **********************************************************************\n\ #\n\ # Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.\n\ #\n\ # This copy of Ice is licensed to you under the terms described in the\n\ # ICE_LICENSE file included in this distribution.\n\ #\n\ # **********************************************************************\n\ \n\ # Configuration file to sign a certificate. This file is generated by iceca init.\n\ # DO NOT EDIT!!\n\ \n\ [ ca ]\n\ default_ca = ice\n\ \n\ [ ice ]\n\ dir = $ENV::ICE_CA_HOME/ca/db # Where everything is kept.\n\ private_key = $dir/ca_key.pem # The CA Private Key.\n\ certificate = $dir/ca_cert.pem # The CA Certificate.\n\ database = $dir/index.txt # Database index file.\n\ new_certs_dir = $dir # Default loc for new certs.\n\ serial = $dir/serial # The current serial number.\n\ certs = $dir # Where issued certs are kept.\n\ RANDFILE = $dir/.rand # Private random number file.\n\ default_days = 1825 # How long certs are valid.\n\ default_md = md5 # The Message Digest type.\n\ preserve = yes # Keep passed DN ordering?\n\ \n\ policy = ca_policy\n\ x509_extensions = certificate_extensions\n\ \n\ [ certificate_extensions ]\n\ basicConstraints = CA:false\n\ \n\ # PKIX recommendation.\n\ subjectKeyIdentifier = hash\n\ authorityKeyIdentifier = keyid:always,issuer:always\n\ \n\ # ca_policy is generated by the initca script.\n\ ",\ "req.cnf":"\ # **********************************************************************\n\ #\n\ # Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.\n\ #\n\ # This copy of Ice is licensed to you under the terms described in the\n\ # ICE_LICENSE file included in this distribution.\n\ #\n\ # **********************************************************************\n\ \n\ # Configuration file to request a node, registry or service\n\ # certificate. This file is generated by iceca init.\n\ # DO NOT EDIT!\n\ \n\ [ req ]\n\ default_bits = 1024\n\ default_md = md5\n\ prompt = no\n\ distinguished_name = dn\n\ x509_extensions = extensions\n\ \n\ [ extensions ]\n\ basicConstraints = CA:false\n\ \n\ # PKIX recommendation.\n\ subjectKeyIdentifier = hash\n\ authorityKeyIdentifier = keyid:always,issuer:always\n\ keyUsage = nonRepudiation, digitalSignature, keyEncipherment\n\ \n\ # The dn section is added by the initca script.\n\ \n\ [dn]\n\ "\ } # # It is necessary to generate configuration files because the # openssl configuration files do not permit empty values. # sys.stdout.write("Generating configuration files... ") sys.stdout.write("ca.cnf") sys.stdout.flush() temp, cacnfname = tempfile.mkstemp(".cnf", "ca") os.write(temp, config["ca.cnf"].encode("utf-8")) for k,v in DNelements.items(): if len(v[2]) > 0: os.write(temp, (v[0] + "=" + v[2] + "\n").encode("utf-8")) os.close(temp) file = 'sign.cnf' sys.stdout.write(" " + file) sys.stdout.flush() cnf = open(os.path.join(caroot, file), "w") cnf.write(config[file]) cnf.write("[ ca_policy ]\n"); for k,v in DNelements.items(): if len(v[2]) > 0: cnf.write(v[0] + "=" + v[3] + "\n") cnf.close() # Don't want these RDNs in req.cnf del DNelements['emailAddress'] del DNelements['CN'] file = "req.cnf" sys.stdout.write(file) sys.stdout.flush() cnf = open(os.path.join(home, file), "w") cnf.write(config[file]) for k,v in DNelements.items(): if len(v[2]) > 0: cnf.write(v[0] + "=" + v[2] + "\n") cnf.close() print("ok") cmd = opensslCmd + ' req -config "' + cacnfname + '" -x509 -days 1825 -newkey rsa:2048 -out "' + \ os.path.join(cadb, "ca_cert.pem") + '" -outform PEM' if nopassphrase: cmd += " -nodes" #print(cmd) if verbose: print(cmd) status = os.system(cmd) if not keep: os.remove(cacnfname) if status != 0: print("openssl command failed") sys.exit(1) # Copy in the new ca certificate and private key. shutil.copy(os.path.join(cadb, "ca_cert.pem"), os.path.join(home)) print("") print("The CA is initialized.") print("") print("You need to distribute the following files to all machines that can") print("request certificates:") print("") print(os.path.join(home, "req.cnf")) print(os.path.join(home, "ca_cert.pem")) print("") print("These files should be placed in the user's home directory in") print("~/.iceca. On Windows, place these files in /config.") sys.exit(0) if sys.argv[script] == "request": def usage(): print("usage: " + sys.argv[script] + " [--overwrite] [--no-password] file common-name [email]") sys.exit(1) try: opts, args = getopt.getopt(sys.argv[script+1:], "", [ "overwrite", "no-password" ]) except getopt.GetoptError: usage() nopassphrase = False overwrite = False for o, a in opts: if o == "--overwrite": overwrite = True elif o == "--no-password": nopassphrase = True if len(args) < 2 or len(args) > 3: usage() keyfile = args[0] + "_key.pem" reqfile = args[0] + "_req.pem" if not overwrite: if os.path.exists(keyfile): print(keyfile + ": exists") sys.exit(1) if os.path.exists(reqfile): print(reqfile + ": exists") sys.exit(1) commonName = args[1] if len(args) == 3: email = args[2] else: email = None # # Create a temporary configuration file. # template = open(os.path.join(home, "req.cnf"), "r") if not template: print("cannot open " + os.path.join(home, "req.cnf")) sys.exit(1) data = template.read() template.close() temp, tempname = tempfile.mkstemp(".cnf", "req") os.write(temp, data.encode("utf-8")) os.write(temp, ("commonName=" + commonName + "\n").encode("utf-8")) if email: os.write(temp, ("emailAddress=" + email + "\n").encode("utf-8")) os.close(temp) cmd = opensslCmd + ' req -config "' + tempname + '" -new -keyout "' + keyfile + '" -out "' + reqfile + '"' if nopassphrase: cmd += " -nodes" if verbose: print(cmd) status = os.system(cmd) if not keep: os.remove(tempname) if status != 0: print("openssl command failed") sys.exit(1) print("") print("Created key: " + keyfile) print("Created certificate request: " + reqfile) print("") print("The certificate request must be signed by the CA. Send the certificate") print("request file to the CA at the following email address:") cmd = opensslCmd + ' x509 -in "' + os.path.join(home, "ca_cert.pem") + '" -email -noout' if verbose: print(cmd) os.system(cmd) sys.exit(0) if sys.argv[script] == "sign": def usage(): print("usage: " + sys.argv[script] + " --in --out [--ip --dns ]") sys.exit(1) try: opts, args = getopt.getopt(sys.argv[script+1:], "", [ "in=", "out=", "ip=", "dns=" ]) except getopt.GetoptError: usage() if args: usage() infile = None outfile = None subjectAltName = "" for o, a in opts: if o == "--in": infile = a elif o == "--out": outfile = a elif o == "--ip": if len(subjectAltName) > 0: subjectAltName += "," subjectAltName += "IP:" + a elif o == "--dns": if len(subjectAltName) > 0: subjectAltName += "," subjectAltName += "DNS:" + a if infile == None or outfile == None: usage() # # Create a temporary configuration file. # template = open(os.path.join(caroot, "sign.cnf"), "r") if not template: print("cannot open " + os.path.join(caroot, "sign.cnf")) sys.exit(1) data = template.read() template.close() temp, tempname = tempfile.mkstemp(".cnf", "sign") os.write(temp, data.encode("utf-8")) if len(subjectAltName) > 0: os.write(temp, ("\n[certificate_extensions]\nsubjectAltName=" + subjectAltName + "\n").encode("utf-8")) os.close(temp) cmd = opensslCmd + ' ca -config "' + tempname + '" -in "' + infile + '" -out "' + outfile + '"' if verbose: print(cmd) status = os.system(cmd) if not keep: os.remove(tempname) if status != 0: print("openssl command failed") sys.exit(1) sys.exit(0) usage() Ice-3.5.1/cpp/src/ca/Makefile0000644000076400007640000000240012223561476013762 0ustar mesmes# ********************************************************************** # # 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 = ../.. CA_FILES = iceca CLASS_FILES = ImportKey.class TARGETS = $(bindir)/iceca \ $(top_srcdir)/lib/ImportKey.class include $(top_srcdir)/config/Make.rules $(bindir)/iceca: iceca cp iceca $@ $(top_srcdir)/lib/ImportKey.class: ImportKey.class cp ImportKey.class $@ install:: @for subdir in $(DESTDIR)$(prefix)/bin $(DESTDIR)$(prefix)/lib; \ do \ if test ! -d $$subdir ; \ then \ echo "Creating $$subdir..." ; \ mkdir -p $$subdir ; \ chmod a+rx $$subdir ; \ fi ; \ done @for i in $(CA_FILES) ; \ do \ echo "Installing $$i" ; \ $(INSTALL_PROGRAM) $$i $(DESTDIR)$(prefix)/bin ;\ chmod a+x $(DESTDIR)$(prefix)/bin/$$i ;\ done $(call installdata,$(top_srcdir)/../man/man1/iceca.1,$(DESTDIR)$(install_mandir)) @for i in $(CLASS_FILES) ; \ do \ echo "Installing $$i" ; \ $(INSTALL_PROGRAM) $$i $(DESTDIR)$(prefix)/lib ;\ chmod a+x $(DESTDIR)$(prefix)/lib/$$i ;\ done Ice-3.5.1/cpp/src/ca/ImportKey.class0000644000076400007640000000573112223561476015306 0ustar mesmes. &TU V WX WY WZ[ \ ]^ _ `a `bc de %fg hi hjkl V m n ho hpq rs rtu hvw hxy "V hz{|()VCodeLineNumberTableLocalVariableTablethis LImportKey; readPassword(Ljava/lang/String;)[CsLjava/io/InputStream;nIraw[BexLjava/lang/Exception;fLjava/lang/String;main([Ljava/lang/String;)VsrcLjava/security/KeyStore;destLjava/io/File;chain![Ljava/security/cert/Certificate;keyLjava/security/Key;cf'Ljava/security/cert/CertificateFactory;cert$Ljava/security/cert/X509Certificate;args[Ljava/lang/String; pkcs12FilealiascertFile keystoreFile storePassword[C keyPasswordkstorePassword SourceFileImportKey.java '(java/io/FileInputStream '}~  (java/lang/String ' java/lang/Exception ( hUsage: ImportKey pkcs12-file alias cert-file keystore-file store-password key-password [kstore-password] } ./PKCS12 JKS java/io/File ' X.509 "java/security/cert/X509Certificate cacert java/io/FileOutputStream  ImportKeyjava/lang/Object(Ljava/lang/String;)Vjava/io/InputStream available()Iread([B)Iclose([B)V toCharArray()[CprintStackTracejava/lang/Systemexit(I)VerrLjava/io/PrintStream;java/io/PrintStreamprintlnjava/security/KeyStore getInstance,(Ljava/lang/String;)Ljava/security/KeyStore;load(Ljava/io/InputStream;[C)Vexists()Z(Ljava/io/File;)VgetCertificateChain5(Ljava/lang/String;)[Ljava/security/cert/Certificate;getKey)(Ljava/lang/String;[C)Ljava/security/Key;%java/security/cert/CertificateFactory;(Ljava/lang/String;)Ljava/security/cert/CertificateFactory;generateCertificate7(Ljava/io/InputStream;)Ljava/security/cert/Certificate; setKeyEntryK(Ljava/lang/String;Ljava/security/Key;[C[Ljava/security/cert/Certificate;)VsetCertificateEntry5(Ljava/lang/String;Ljava/security/cert/Certificate;)Vstore(Ljava/io/OutputStream;[C)V!%&'()/**+ ,- ./)3Y*L+=N+-W+Y- L+  '( **   "($)&-'1)+4 012345)67389 :;)G*  *2L*2M*2N*2:*2:*2:*2:**2:::Y+: Y:   Y   ,: ,: :  Y-: ,    ! "Y#$:   R *!/JLOPQR#S+T3U;VBXN\RaYbhdoezfhlnoqruvx~z|}+Y<=o}>= zr8? H@A >BC 7DE %FG 67HIJ9K9L9#M9+NO3PO;QORSIce-3.5.1/cpp/src/Glacier2Lib/0000755000076400007640000000000012223561476014022 5ustar mesmesIce-3.5.1/cpp/src/Glacier2Lib/SessionHelper.cpp0000644000076400007640000005554412223561476017326 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include // required by max using namespace std; namespace { class ConnectStrategy : public IceUtil::Shared { public: virtual Glacier2::SessionPrx connect(const Glacier2::RouterPrx& router) = 0; }; typedef IceUtil::Handle< ConnectStrategy> ConnectStrategyPtr; class Disconnected : public Ice::DispatcherCall { public: Disconnected(const Glacier2::SessionHelperPtr& session, const Glacier2::SessionCallbackPtr& callback) : _session(session), _callback(callback) { } virtual void run() { _callback->disconnected(_session); } private: const Glacier2::SessionHelperPtr _session; const Glacier2::SessionCallbackPtr _callback; }; class SessionRefreshThread : public IceUtil::Thread { public: SessionRefreshThread(const Glacier2::SessionHelperPtr&, const Glacier2::RouterPrx&, Ice::Long); virtual void run(); void done(); void success(); void failure(const Ice::Exception&); private: const Glacier2::SessionHelperPtr _session; const Glacier2::RouterPrx _router; Ice::Long _period; bool _done; IceUtil::Monitor _monitor; }; typedef IceUtil::Handle SessionRefreshThreadPtr; class SessionHelperI : public Glacier2::SessionHelper { public: SessionHelperI(const Glacier2::SessionCallbackPtr&, const Ice::InitializationData&); void destroy(); Ice::CommunicatorPtr communicator() const; std::string categoryForClient() const; Ice::ObjectPrx addWithUUID(const Ice::ObjectPtr&); Glacier2::SessionPrx session() const; bool isConnected() const; Ice::ObjectAdapterPtr objectAdapter(); friend class DestroyInternal; friend class ConnectThread; friend class DispatchCallThread; friend class Glacier2::SessionFactoryHelper; private: void destroy(const IceUtil::ThreadPtr&); Ice::ObjectAdapterPtr internalObjectAdapter(); void connected(const Glacier2::RouterPrx&, const Glacier2::SessionPrx&); void destroyInternal(const Ice::DispatcherCallPtr&); void connectFailed(); void connect(const std::map&); void connect(const std::string&, const std::string&, const std::map&); void connectImpl(const ConnectStrategyPtr&); void dispatchCallback(const Ice::DispatcherCallPtr&, const Ice::ConnectionPtr&); void dispatchCallbackAndWait(const Ice::DispatcherCallPtr&, const Ice::ConnectionPtr&); IceUtil::Mutex _mutex; Ice::CommunicatorPtr _communicator; Ice::ObjectAdapterPtr _adapter; Glacier2::RouterPrx _router; Glacier2::SessionPrx _session; SessionRefreshThreadPtr _refreshThread; std::string _category; bool _connected; bool _destroy; const Ice::InitializationData _initData; const Glacier2::SessionCallbackPtr _callback; }; typedef IceUtil::Handle SessionHelperIPtr; SessionRefreshThread::SessionRefreshThread(const Glacier2::SessionHelperPtr& session, const Glacier2::RouterPrx& router, Ice::Long period) : _session(session), _router(router), _period(period), _done(false) { } void SessionRefreshThread::run() { Glacier2::Callback_Router_refreshSessionPtr cb = Glacier2::newCallback_Router_refreshSession(this, &SessionRefreshThread::failure); IceUtil::Monitor::Lock lock(_monitor); while(true) { try { _router->begin_refreshSession(cb); } catch(const Ice::CommunicatorDestroyedException&) { // // AMI requests can raise CommunicatorDestroyedException directly. // break; } if(!_done) { _monitor.timedWait(IceUtil::Time::seconds(_period)); } if(_done) { break; } } } void SessionRefreshThread::done() { IceUtil::Monitor::Lock lock(_monitor); if(!_done) { _done = true; _monitor.notify(); } } void SessionRefreshThread::failure(const Ice::Exception&) { done(); _session->destroy(); } class DestroyInternal : public IceUtil::Thread { public: DestroyInternal(const SessionHelperIPtr& session, const Glacier2::SessionCallbackPtr& callback) : _session(session), _disconnected(new Disconnected(session, callback)) { } virtual void run() { _session->destroyInternal(_disconnected); } private: const SessionHelperIPtr _session; const Ice::DispatcherCallPtr _disconnected; }; } SessionHelperI::SessionHelperI(const Glacier2::SessionCallbackPtr& callback, const Ice::InitializationData& initData) : _connected(false), _destroy(false), _initData(initData), _callback(callback) { } void SessionHelperI::destroy() { IceUtil::Mutex::Lock sync(_mutex); destroy(new DestroyInternal(this, _callback)); } void SessionHelperI::destroy(const IceUtil::ThreadPtr& destroyInternal) { if(_destroy) { return; } _destroy = true; if(!_connected) { // // In this case a connecting session is being // destroyed. The communicator and session will be // destroyed when the connection establishment has // completed. // return; } _session = 0; _connected = false; // // Run the destroyInternal in a thread. This is because it // destroyInternal makes remote invocations. // destroyInternal->start().detach(); } Ice::CommunicatorPtr SessionHelperI::communicator() const { IceUtil::Mutex::Lock sync(_mutex); return _communicator; } string SessionHelperI::categoryForClient() const { IceUtil::Mutex::Lock sync(_mutex); if(!_router) { throw Glacier2::SessionNotExistException(); } return _category; } Ice::ObjectPrx SessionHelperI::addWithUUID(const Ice::ObjectPtr& servant) { IceUtil::Mutex::Lock sync(_mutex); if(!_router) { throw Glacier2::SessionNotExistException(); } Ice::Identity id; id.name = IceUtil::generateUUID(); id.category = _category; return internalObjectAdapter()->add(servant, id); } Glacier2::SessionPrx SessionHelperI::session() const { IceUtil::Mutex::Lock sync(_mutex); if(!_session) { throw new Glacier2::SessionNotExistException(); } return _session; } bool SessionHelperI::isConnected() const { IceUtil::Mutex::Lock sync(_mutex); return _connected; } Ice::ObjectAdapterPtr SessionHelperI::objectAdapter() { IceUtil::Mutex::Lock sync(_mutex); return internalObjectAdapter(); } bool Glacier2::SessionHelper::operator==(const Glacier2::SessionHelper& other) const { return this == &other; } bool Glacier2::SessionHelper::operator!=(const Glacier2::SessionHelper& other) const { return this != &other; } Ice::ObjectAdapterPtr SessionHelperI::internalObjectAdapter() { if(!_router) { throw Glacier2::SessionNotExistException(); } if(!_adapter) { _adapter = _communicator->createObjectAdapterWithRouter("", _router); _adapter->activate(); } return _adapter; } namespace { class ConnectStrategySecureConnection : public ConnectStrategy { public: ConnectStrategySecureConnection(const map& context) : _context(context) { } virtual Glacier2::SessionPrx connect(const Glacier2::RouterPrx& router) { return router->createSessionFromSecureConnection(_context); } private: const map _context; }; class ConnectStrategyUserPassword : public ConnectStrategy { public: ConnectStrategyUserPassword(const string& user, const string& password, const map& context) : _user(user), _password(password), _context(context) { } virtual Glacier2::SessionPrx connect(const Glacier2::RouterPrx& router) { return router->createSession(_user, _password, _context); } private: const string _user; const string _password; const map _context; }; } void SessionHelperI::connect(const map& context) { IceUtil::Mutex::Lock sync(_mutex); connectImpl(new ConnectStrategySecureConnection(context)); } void SessionHelperI::connect(const string& user, const string& password, const map& context) { IceUtil::Mutex::Lock sync(_mutex); connectImpl(new ConnectStrategyUserPassword(user, password, context)); } void SessionHelperI::destroyInternal(const Ice::DispatcherCallPtr& disconnected) { assert(_destroy); Ice::CommunicatorPtr communicator; Glacier2::RouterPrx router; SessionRefreshThreadPtr refreshThread; { IceUtil::Mutex::Lock sync(_mutex); router = _router; _router = 0; _connected = false; refreshThread = _refreshThread; _refreshThread = 0; communicator = _communicator; } if(router) { try { router->destroySession(); } catch(const Ice::ConnectionLostException&) { // // Expected if another thread invoked on an object from the session concurrently. // } catch(const Glacier2::SessionNotExistException&) { // // This can also occur. // } catch(const std::exception& ex) { // // Not expected. // if(communicator) { Ice::Warning warn(communicator->getLogger()); warn << "SessionHelper: unexpected exception when destroying the session:\n" << ex; } } } if(refreshThread) { refreshThread->done(); refreshThread->getThreadControl().join(); refreshThread = 0; } if(communicator) { try { communicator->destroy(); } catch(...) { } communicator = 0; } dispatchCallback(disconnected, 0); } void SessionHelperI::connectFailed() { Ice::CommunicatorPtr communicator; { IceUtil::Mutex::Lock sync(_mutex); communicator = _communicator; } if(communicator) { try { communicator->destroy(); } catch(...) { } } } namespace { class ConnectFailed : public Ice::DispatcherCall { public: ConnectFailed(const Glacier2::SessionCallbackPtr& callback, const Glacier2::SessionHelperPtr& session, const Ice::Exception& ex) : _callback(callback), _session(session) { _ex.reset(ex.ice_clone()); } virtual void run() { const Ice::Exception* ex(_ex.get()); _callback->connectFailed(_session, *ex); } private: const Glacier2::SessionCallbackPtr _callback; const Glacier2::SessionHelperPtr _session; IceUtil::UniquePtr _ex; }; class CreatedCommunicator : public Ice::DispatcherCall { public: CreatedCommunicator(const Glacier2::SessionCallbackPtr& callback, const Glacier2::SessionHelperPtr& session) : _callback(callback), _session(session) { } virtual void run() { _callback->createdCommunicator(_session); } private: const Glacier2::SessionCallbackPtr _callback; const Glacier2::SessionHelperPtr _session; }; class ConnectThread : public IceUtil::Thread { public: ConnectThread(const Glacier2::SessionCallbackPtr& callback, const SessionHelperIPtr& session, const ConnectStrategyPtr& factory, const Ice::CommunicatorPtr& communicator) : _callback(callback), _session(session), _factory(factory), _communicator(communicator) { } virtual void run() { try { _session->dispatchCallbackAndWait(new CreatedCommunicator(_callback, _session), 0); Glacier2::RouterPrx routerPrx = Glacier2::RouterPrx::uncheckedCast(_communicator->getDefaultRouter()); Glacier2::SessionPrx session = _factory->connect(routerPrx); _session->connected(routerPrx, session); } catch(const Ice::Exception& ex) { try { _session->connectFailed(); } catch(...) { } _session->dispatchCallback(new ConnectFailed(_callback, _session, ex), 0); } } private: const Glacier2::SessionCallbackPtr _callback; const SessionHelperIPtr _session; const ConnectStrategyPtr _factory; const Ice::CommunicatorPtr _communicator; }; class DispatchCallThread : public IceUtil::Thread { public: DispatchCallThread(const SessionHelperIPtr& session, const Ice::DispatcherCallPtr& call, const Ice::ConnectionPtr& conn) : _session(session), _call(call), _conn(conn) { } virtual void run() { _session->dispatchCallback(_call, _conn); } private: const SessionHelperIPtr _session; const Ice::DispatcherCallPtr _call; const Ice::ConnectionPtr _conn; }; } void SessionHelperI::connectImpl(const ConnectStrategyPtr& factory) { assert(!_destroy); try { _communicator = Ice::initialize(_initData); } catch(const Ice::LocalException& ex) { _destroy = true; IceUtil::ThreadPtr thread = new DispatchCallThread(this, new ConnectFailed(_callback, this, ex), 0); thread->start().detach(); return; } IceUtil::ThreadPtr connectThread = new ConnectThread(_callback, this, factory, _communicator); connectThread->start().detach(); } namespace { class Connected : public Ice::DispatcherCall { public: Connected(const Glacier2::SessionCallbackPtr& callback, const Glacier2::SessionHelperPtr& session) : _callback(callback), _session(session) { } virtual void run() { try { _callback->connected(_session); } catch(const Glacier2::SessionNotExistException&) { _session->destroy(); } } private: const Glacier2::SessionCallbackPtr _callback; const Glacier2::SessionHelperPtr _session; }; } void SessionHelperI::connected(const Glacier2::RouterPrx& router, const Glacier2::SessionPrx& session) { // // Remote invocation should be done without acquire a mutex lock. // assert(router); Ice::ConnectionPtr conn = router->ice_getCachedConnection(); string category = router->getCategoryForClient(); Ice::Long timeout = router->getSessionTimeout(); { IceUtil::Mutex::Lock sync(_mutex); _router = router; if(_destroy) { // // Run the destroyInternal in a thread. This is because it // destroyInternal makes remote invocations. // IceUtil::ThreadPtr thread = new DestroyInternal(this, _callback); thread->start().detach(); return; } // // Cache the category. // _category = category; // // Assign the session after _destroy is checked. // _session = session; _connected = true; assert(!_refreshThread); if(timeout > 0) { _refreshThread = new SessionRefreshThread(this, _router, (timeout)/2); _refreshThread->start(); } } dispatchCallback(new Connected(_callback, this), conn); } void SessionHelperI::dispatchCallback(const Ice::DispatcherCallPtr& call, const Ice::ConnectionPtr& conn) { if(_initData.dispatcher) { _initData.dispatcher->dispatch(call, conn); } else { call->run(); } } namespace { class DispatcherCallWait : public Ice::DispatcherCall { public: DispatcherCallWait(IceUtilInternal::CountDownLatch& cdl, const Ice::DispatcherCallPtr& call) : _cdl(cdl), _call(call) { } virtual void run() { _call->run(); _cdl.countDown(); } private: IceUtilInternal::CountDownLatch& _cdl; const Ice::DispatcherCallPtr _call; }; } void SessionHelperI::dispatchCallbackAndWait(const Ice::DispatcherCallPtr& call, const Ice::ConnectionPtr& conn) { if(_initData.dispatcher) { IceUtilInternal::CountDownLatch cdl(1); Ice::DispatcherCallPtr callWait = new DispatcherCallWait(cdl, call); _initData.dispatcher->dispatch(callWait, conn); cdl.await(); } else { call->run(); } } Glacier2::SessionFactoryHelper::SessionFactoryHelper(const SessionCallbackPtr& callback) : _routerHost("localhost"), _secure(true), _port(0), _timeout(10000), _callback(callback) { _identity.name = "router"; _identity.category = "Glacier2"; _initData.properties = Ice::createProperties(); setDefaultProperties(); } Glacier2::SessionFactoryHelper::SessionFactoryHelper(const Ice::InitializationData& initData, const SessionCallbackPtr& callback) : _routerHost("localhost"), _secure(true), _port(0), _timeout(10000), _initData(initData), _callback(callback) { _identity.name = "router"; _identity.category = "Glacier2"; if(!initData.properties) { _initData.properties = Ice::createProperties(); } setDefaultProperties(); } Glacier2::SessionFactoryHelper::SessionFactoryHelper(const Ice::PropertiesPtr& properties, const SessionCallbackPtr& callback) : _routerHost("localhost"), _secure(true), _port(0), _timeout(10000), _callback(callback) { if(!properties) { throw Ice::InitializationException( __FILE__, __LINE__, "Attempt to create a SessionFactoryHelper with a null Properties argument"); } _identity.name = "router"; _identity.category = "Glacier2"; _initData.properties = properties; setDefaultProperties(); } void Glacier2::SessionFactoryHelper::setRouterIdentity(const Ice::Identity& identity) { IceUtil::Mutex::Lock sync(_mutex); _identity = identity; } Ice::Identity Glacier2::SessionFactoryHelper::getRouterIdentity() const { IceUtil::Mutex::Lock sync(_mutex); return _identity; } void Glacier2::SessionFactoryHelper::setRouterHost(const string& hostname) { IceUtil::Mutex::Lock sync(_mutex); _routerHost = hostname; } string Glacier2::SessionFactoryHelper::getRouterHost() const { IceUtil::Mutex::Lock sync(_mutex); return _routerHost; } void Glacier2::SessionFactoryHelper::setSecure(bool secure) { IceUtil::Mutex::Lock sync(_mutex); _secure = secure; } bool Glacier2::SessionFactoryHelper::getSecure() const { IceUtil::Mutex::Lock sync(_mutex); return _secure; } void Glacier2::SessionFactoryHelper::setTimeout(int timeout) { IceUtil::Mutex::Lock sync(_mutex); _timeout = timeout; } int Glacier2::SessionFactoryHelper::getTimeout() const { IceUtil::Mutex::Lock sync(_mutex); return _timeout; } void Glacier2::SessionFactoryHelper::setPort(int port) { IceUtil::Mutex::Lock sync(_mutex); _port = port; } int Glacier2::SessionFactoryHelper::getPort() const { IceUtil::Mutex::Lock sync(_mutex); return _port; } Ice::InitializationData Glacier2::SessionFactoryHelper::getInitializationData() const { IceUtil::Mutex::Lock sync(_mutex); return _initData; } void Glacier2::SessionFactoryHelper::setConnectContext(map context) { IceUtil::Mutex::Lock sync(_mutex); _context = context; } Glacier2::SessionHelperPtr Glacier2::SessionFactoryHelper::connect() { IceUtil::Mutex::Lock sync(_mutex); SessionHelperIPtr session = new SessionHelperI(_callback, createInitData()); session->connect(_context); return session; } Glacier2::SessionHelperPtr Glacier2::SessionFactoryHelper::connect(const string& user, const string& password) { IceUtil::Mutex::Lock sync(_mutex); SessionHelperIPtr session = new SessionHelperI(_callback, createInitData()); session->connect(user, password, _context); return session; } Ice::InitializationData Glacier2::SessionFactoryHelper::createInitData() { // // Clone the initialization data and properties. // Ice::InitializationData initData = _initData; initData.properties = initData.properties->clone(); if(initData.properties->getProperty("Ice.Default.Router").size() == 0) { ostringstream os; os << "\""; // // TODO replace with identityToString, we cannot use the Communicator::identityToString // current implementation because we need to do that before the communicator has been // initialized. // if(!_identity.category.empty()) { os << _identity.category << "/"; } os << _identity.name; os << "\""; os << ":"; if(_secure) { os << "ssl -p "; } else { os << "tcp -p "; } if(_port != 0) { os << _port; } else { if(_secure) { os << GLACIER2_SSL_PORT; } else { os << GLACIER2_TCP_PORT; } } os << " -h "; os << _routerHost; if(_timeout > 0) { os << " -t "; os << _timeout; } initData.properties->setProperty("Ice.Default.Router", os.str()); #ifndef ICE_OS_WINRT // // If using a secure connection setup the IceSSL plug-in, if IceSSL // plug-in has already been setup we don't want to override the // configuration so it can be loaded from a custom location. // if(_secure && initData.properties->getProperty("Ice.Plugin.IceSSL").empty()) { initData.properties->setProperty("Ice.Plugin.IceSSL","IceSSL:createIceSSL"); } #endif } return initData; } void Glacier2::SessionFactoryHelper::setDefaultProperties() { assert(_initData.properties); _initData.properties->setProperty("Ice.ACM.Client", "0"); _initData.properties->setProperty("Ice.RetryIntervals", "-1"); } Ice-3.5.1/cpp/src/Glacier2Lib/.depend0000644000076400007640000005012212223561476015262 0ustar mesmesPermissionsVerifier$(OBJEXT): PermissionsVerifier.cpp $(includedir)/Glacier2/PermissionsVerifier.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/FactoryTableInit.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SlicedData.h $(includedir)/IceUtil/DisableWarnings.h Router$(OBJEXT): Router.cpp $(includedir)/Glacier2/Router.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/Router.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/Glacier2/PermissionsVerifier.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SlicedData.h $(includedir)/IceUtil/DisableWarnings.h SSLInfo$(OBJEXT): SSLInfo.cpp $(includedir)/Glacier2/SSLInfo.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)/IceUtil/Optional.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.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)/IceUtil/DisableWarnings.h Session$(OBJEXT): Session.cpp $(includedir)/Glacier2/Session.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/FactoryTableInit.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SlicedData.h $(includedir)/IceUtil/DisableWarnings.h Application$(OBJEXT): Application.cpp $(includedir)/Glacier2/Application.h $(includedir)/Ice/Application.h $(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/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 $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/Glacier2/Router.h $(includedir)/Glacier2/PermissionsVerifier.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/ArgVector.h Metrics$(OBJEXT): Metrics.cpp $(includedir)/Glacier2/Metrics.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/FactoryTableInit.h $(includedir)/Ice/Metrics.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/DisableWarnings.h SessionHelper$(OBJEXT): SessionHelper.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/Glacier2/SessionHelper.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/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/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/Properties.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/PropertiesAdmin.h $(includedir)/Ice/Communicator.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 $(includedir)/Ice/Ice.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.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 $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/Glacier2/Router.h $(includedir)/Glacier2/PermissionsVerifier.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h $(HDIR)/Metrics.h Metrics.cpp: $(slicedir)/Glacier2/Metrics.ice $(slicedir)/Ice/Metrics.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/PermissionsVerifierF.h PermissionsVerifierF.cpp: $(slicedir)/Glacier2/PermissionsVerifierF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/PermissionsVerifier.h PermissionsVerifier.cpp: $(slicedir)/Glacier2/PermissionsVerifier.ice $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Router.h Router.cpp: $(slicedir)/Glacier2/Router.ice $(slicedir)/Ice/Router.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Glacier2/Session.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/Glacier2/PermissionsVerifier.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/RouterF.h RouterF.cpp: $(slicedir)/Glacier2/RouterF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Session.h Session.cpp: $(slicedir)/Glacier2/Session.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Glacier2/SSLInfo.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/SSLInfo.h SSLInfo.cpp: $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) Ice-3.5.1/cpp/src/Glacier2Lib/Application.cpp0000644000076400007640000002627612223561476017006 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace Ice; Ice::ObjectAdapterPtr Glacier2::Application::_adapter; Glacier2::RouterPrx Glacier2::Application::_router; Glacier2::SessionPrx Glacier2::Application::_session; bool Glacier2::Application::_createdSession = false; string Glacier2::Application::_category; namespace { class SessionPingThreadI : virtual public IceUtil::Thread { public: SessionPingThreadI(Glacier2::Application* app, const Glacier2::RouterPrx& router, IceUtil::Int64 period) : _app(app), _router(router), _period(period), _done(false) { assert(_period); } void exception(const Ice::Exception&) { // // Here the session has been destroyed. The thread terminates, // and we notify the application that the session has been // destroyed. // done(); _app->sessionDestroyed(); } void run() { IceUtil::Monitor::Lock lock(_monitor); Glacier2::Callback_Router_refreshSessionPtr callback = Glacier2::newCallback_Router_refreshSession(this, &SessionPingThreadI::exception); while(true) { try { _router->begin_refreshSession(callback); } catch(const Ice::CommunicatorDestroyedException&) { // // AMI requests can raise CommunicatorDestroyedException directly. // break; } if(!_done) { _monitor.timedWait(IceUtil::Time::milliSeconds(_period)); } if(_done) { break; } } } void done() { IceUtil::Monitor::Lock lock(_monitor); if(!_done) { _done = true; _monitor.notify(); } } private: Glacier2::Application* _app; Glacier2::RouterPrx _router; IceUtil::Int64 _period; bool _done; IceUtil::Monitor _monitor; }; typedef IceUtil::Handle SessionPingThreadIPtr; } string Glacier2::RestartSessionException::ice_name() const { return "RestartSessionException"; } Glacier2::RestartSessionException* Glacier2::RestartSessionException::ice_clone() const { return new RestartSessionException(*this); } void Glacier2::RestartSessionException::ice_throw() const { throw *this; } Ice::ObjectAdapterPtr Glacier2::Application::objectAdapter() { if(!_router) { SessionNotExistException ex; throw ex; } IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); if(!_adapter) { _adapter = communicator()->createObjectAdapterWithRouter("", _router); _adapter->activate(); } return _adapter; } Ice::ObjectPrx Glacier2::Application::addWithUUID(const Ice::ObjectPtr& servant) { return objectAdapter()->add(servant, createCallbackIdentity(IceUtil::generateUUID())); } Ice::Identity Glacier2::Application::createCallbackIdentity(const string& name) { Ice::Identity id; id.name = name; id.category = categoryForClient(); return id; } std::string Glacier2::Application::categoryForClient() { if(!_router) { SessionNotExistException ex; throw ex; } return _category; } int Glacier2::Application::doMain(int argc, char* argv[], const Ice::InitializationData& initData) { // Set the default properties for all Glacier2 applications. initData.properties->setProperty("Ice.ACM.Client", "0"); initData.properties->setProperty("Ice.RetryIntervals", "-1"); bool restart; int ret = 0; do { // // A copy of the initialization data and the string seq // needs to be passed to doMainInternal, as these can be // changed by the application. // Ice::InitializationData id(initData); id.properties = id.properties->clone(); Ice::StringSeq args = Ice::argsToStringSeq(argc, argv); restart = doMain(args, id, ret); } while(restart); return ret; } bool Glacier2::Application::doMain(Ice::StringSeq& args, const Ice::InitializationData& initData, int& status) { // // Reset internal state variables from Ice.Application. The // remainder are reset at the end of this method. // IceInternal::Application::_callbackInProgress = false; IceInternal::Application::_destroyed = false; IceInternal::Application::_interrupted = false; bool restart = false; status = 0; SessionPingThreadIPtr ping; try { IceInternal::Application::_communicator = Ice::initialize(args, initData); _router = Glacier2::RouterPrx::uncheckedCast(communicator()->getDefaultRouter()); if(!_router) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": no glacier2 router configured"; status = 1; } else { // // The default is to destroy when a signal is received. // if(IceInternal::Application::_signalPolicy == Ice::HandleSignals) { destroyOnInterrupt(); } // If createSession throws, we're done. try { _session = createSession(); _createdSession = true; } catch(const Ice::LocalException& ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": " << ex; status = 1; } if(_createdSession) { IceUtil::Int64 timeout = _router->getSessionTimeout(); if(timeout > 0) { ping = new SessionPingThreadI(this, _router, (timeout * 1000) / 2); ping->start(); } _category = _router->getCategoryForClient(); IceUtilInternal::ArgVector a(args); status = runWithSession(a.argc, a.argv); } } } // We want to restart on those exceptions which indicate a // break down in communications, but not those exceptions that // indicate a programming logic error (ie: marshal, protocol // failure, etc). catch(const RestartSessionException&) { restart = true; } catch(const Ice::ConnectionRefusedException& ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": " << ex; restart = true; } catch(const Ice::ConnectionLostException& ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": " << ex; restart = true; } catch(const Ice::UnknownLocalException& ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": " << ex; restart = true; } catch(const Ice::RequestFailedException& ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": " << ex; restart = true; } catch(const Ice::TimeoutException& ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": " << ex; restart = true; } catch(const Ice::LocalException& ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": " << ex; status = 1; } catch(const std::exception& ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": std::exception " << ex; status = 1; } catch(const std::string& ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": c++ exception " << ex; status = 1; } catch(const char* ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": char* exception " << ex; status = 1; } catch(...) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": unknown exception"; status = 1; } // // Don't want any new interrupt and at this point (post-run), // it would not make sense to release a held signal to run // shutdown or destroy. // if(IceInternal::Application::_signalPolicy == HandleSignals) { ignoreInterrupt(); } { IceUtil::Mutex::Lock lock(*IceInternal::Application::mutex); while(IceInternal::Application::_callbackInProgress) { IceInternal::Application::_condVar->wait(lock); } if(IceInternal::Application::_destroyed) { IceInternal::Application::_communicator = 0; } else { IceInternal::Application::_destroyed = true; // // And _communicator != 0, meaning will be destroyed // next, _destroyed = true also ensures that any // remaining callback won't do anything // } IceInternal::Application::_application = 0; } if(ping) { ping->done(); while(true) { ping->getThreadControl().join(); break; } ping = 0; } if(_createdSession && _router) { try { _router->destroySession(); } catch(const Ice::ConnectionLostException&) { // Expected if another thread invoked on an object from the session concurrently. } catch(const Glacier2::SessionNotExistException&) { // This can also occur. } catch(const exception& ex) { // Not expected. Error out(getProcessLogger()); out << "unexpected exception when destroying the session:\n" << ex; } _router = 0; } if(IceInternal::Application::_communicator) { try { IceInternal::Application::_communicator->destroy(); } catch(const Ice::LocalException& ex) { Error out(getProcessLogger()); out << IceInternal::Application::_appName << ": " << ex; status = 1; } catch(const exception& ex) { Error out(getProcessLogger()); out << "unknown exception:\n" << ex; status = 1; } IceInternal::Application::_communicator = 0; } // // Reset internal state. We cannot reset the Application state // here, since _destroyed must remain true until we re-run // this method. // _adapter = 0; _router = 0; _session = 0; _createdSession = false; _category.clear(); return restart; } Ice-3.5.1/cpp/src/Glacier2Lib/Makefile0000644000076400007640000000330512223561476015463 0ustar mesmes# ********************************************************************** # # 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,Glacier2,$(VERSION)) SONAME = $(call mksoname,Glacier2,$(SOVERSION)) LIBNAME = $(call mklibname,Glacier2) TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME)) OBJS = PermissionsVerifier.o \ Router.o \ SSLInfo.o \ Session.o \ Application.o \ Metrics.o \ SessionHelper.o SRCS = $(OBJS:.o=.cpp) SLICE_SRCS = $(SDIR)/Metrics.ice \ $(SDIR)/PermissionsVerifierF.ice \ $(SDIR)/PermissionsVerifier.ice \ $(SDIR)/Router.ice \ $(SDIR)/RouterF.ice \ $(SDIR)/Session.ice \ $(SDIR)/SSLInfo.ice HDIR = $(headerdir)/Glacier2 SDIR = $(slicedir)/Glacier2 include $(top_srcdir)/config/Make.rules CPPFLAGS := -I.. $(CPPFLAGS) $(OPENSSL_FLAGS) -DGLACIER2_API_EXPORTS SLICE2CPPFLAGS := --ice --include-dir Glacier2 --dll-export GLACIER2_API $(SLICE2CPPFLAGS) LINKWITH := $(BZIP2_RPATH_LINK) -lIce -lIceUtil $(libdir)/$(LIBFILENAME): $(OBJS) $(HDIR)/PermissionsVerifierF.h $(HDIR)/RouterF.h 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) $@ install:: all $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME)) include .depend Ice-3.5.1/cpp/src/FreezeScript/0000755000076400007640000000000012223561477014351 5ustar mesmesIce-3.5.1/cpp/src/FreezeScript/Transformer.cpp0000644000076400007640000023211012223561476017355 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; namespace FreezeScript { class DeleteRecordException {}; class Descriptor; typedef IceUtil::Handle DescriptorPtr; class InitDescriptor; typedef IceUtil::Handle InitDescriptorPtr; class TransformDescriptor; typedef IceUtil::Handle TransformDescriptorPtr; class TransformDataFactory; typedef IceUtil::Handle TransformDataFactoryPtr; typedef map TransformMap; typedef map RenameMap; // // TransformInfoI // struct TransformInfoI : public TransformInfo { virtual DataFactoryPtr getDataFactory(); virtual ErrorReporterPtr getErrorReporter(); virtual bool doDefaultTransform(const Slice::TypePtr&); virtual bool doBaseTransform(const Slice::ClassDefPtr&); virtual Slice::TypePtr getRenamedType(const Slice::TypePtr&); virtual void executeCustomTransform(const DataPtr&, const DataPtr&); virtual string facetName(); virtual bool purgeObjects(); virtual ObjectDataMap& getObjectDataMap(); Ice::CommunicatorPtr communicator; FreezeScript::ObjectFactoryPtr objectFactory; Slice::UnitPtr oldUnit; Slice::UnitPtr newUnit; Db* oldDb; Db* newDb; DbTxn* newDbTxn; // // Connection to the new environment; not null only if we want to write into the catalog // Freeze::ConnectionPtr connection; string newDbName; string facet; bool purge; ErrorReporterPtr errorReporter; TransformDataFactoryPtr factory; SymbolTablePtr symbolTable; Slice::TypePtr oldKeyType; Slice::TypePtr oldValueType; Slice::TypePtr newKeyType; Slice::TypePtr newValueType; TransformMap transformMap; RenameMap renameMap; ObjectDataMap objectDataMap; }; typedef IceUtil::Handle TransformInfoIPtr; // // TransformDataFactory // class TransformDataFactory : public DataFactory { public: TransformDataFactory(const Ice::CommunicatorPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&); void addInitDescriptor(const InitDescriptorPtr&); void disableInitializers(); void enableInitializers(); protected: virtual void initialize(const DataPtr&); private: typedef map InitMap; InitMap _initMap; bool _enabled; }; // // Descriptor // class Descriptor : public IceUtil::SimpleShared { public: virtual ~Descriptor(); virtual DescriptorPtr parent() const; virtual void addChild(const DescriptorPtr&) = 0; virtual void validate() = 0; virtual void execute(const SymbolTablePtr&) = 0; protected: Descriptor(const DescriptorPtr&, int, const TransformInfoIPtr&); NodePtr parse(const string&) const; Slice::TypePtr findType(const Slice::UnitPtr&, const string&); DescriptorPtr _parent; int _line; TransformInfoIPtr _info; }; // // SetDescriptor // class SetDescriptor : public Descriptor { public: SetDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&); private: EntityNodePtr _target; NodePtr _value; string _valueStr; string _type; NodePtr _length; string _lengthStr; bool _convert; }; // // DefineDescriptor // class DefineDescriptor : public Descriptor { public: DefineDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&); private: string _name; NodePtr _value; string _valueStr; Slice::TypePtr _type; bool _convert; }; // // AddDescriptor // class AddDescriptor : public Descriptor { public: AddDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&); private: EntityNodePtr _target; NodePtr _key; string _keyStr; NodePtr _index; string _indexStr; NodePtr _value; string _valueStr; string _type; bool _convert; }; // // RemoveDescriptor // class RemoveDescriptor : public Descriptor { public: RemoveDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&); private: EntityNodePtr _target; NodePtr _key; string _keyStr; NodePtr _index; string _indexStr; }; // // DeleteDescriptor // class DeleteDescriptor : public Descriptor { public: DeleteDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&); }; // // FailDescriptor // class FailDescriptor : public Descriptor { public: FailDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&); private: NodePtr _test; string _testStr; string _message; }; // // EchoDescriptor // class EchoDescriptor : public Descriptor { public: EchoDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&); private: string _message; NodePtr _value; string _valueStr; }; // // ExecutableContainerDescriptor // class ExecutableContainerDescriptor : public Descriptor { public: ExecutableContainerDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&, const string&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&); protected: vector _children; private: string _name; }; // // IfDescriptor // class IfDescriptor : public ExecutableContainerDescriptor { public: IfDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void execute(const SymbolTablePtr&); private: NodePtr _test; string _testStr; }; // // IterateDescriptor // class IterateDescriptor : public ExecutableContainerDescriptor { public: IterateDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void execute(const SymbolTablePtr&); private: EntityNodePtr _target; string _key; string _value; string _element; string _index; }; // // TransformDescriptor // class TransformDescriptor : public ExecutableContainerDescriptor { public: TransformDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); Slice::TypePtr type() const; string typeName() const; Slice::TypePtr renameType() const; string renameTypeName() const; bool doDefaultTransform() const; bool doBaseTransform() const; private: bool _default; bool _base; Slice::TypePtr _newType; Slice::TypePtr _renameType; }; typedef IceUtil::Handle TransformDescriptorPtr; // // InitDescriptor // class InitDescriptor : public ExecutableContainerDescriptor { public: InitDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); void initialize(const DataPtr&); string typeName() const; private: Slice::TypePtr _type; }; // // RecordDescriptor // class RecordDescriptor : public ExecutableContainerDescriptor { public: RecordDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void execute(const SymbolTablePtr&); private: void transformRecord(const Ice::ByteSeq&, const Ice::ByteSeq&, Ice::ByteSeq&, Ice::ByteSeq&); Slice::UnitPtr _old; Slice::UnitPtr _new; }; typedef IceUtil::Handle RecordDescriptorPtr; // // DatabaseDescriptor // class DatabaseDescriptor : public ExecutableContainerDescriptor { public: DatabaseDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void execute(const SymbolTablePtr&); string name() const; private: string _name; string _oldKeyName; string _oldValueName; string _newKeyName; string _newValueName; RecordDescriptorPtr _record; }; typedef IceUtil::Handle DatabaseDescriptorPtr; // // TransformDBDescriptor // class TransformDBDescriptor : public Descriptor { public: TransformDBDescriptor(int, const TransformInfoIPtr&, const IceXML::Attributes&); ~TransformDBDescriptor(); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&); private: map _databases; vector _children; }; typedef IceUtil::Handle TransformDBDescriptorPtr; // // SymbolTableI // class SymbolTableI : public SymbolTable { public: SymbolTableI(const TransformInfoIPtr&, const SymbolTablePtr& = SymbolTablePtr()); virtual void add(const string&, const DataPtr&); virtual DataPtr getValue(const EntityNodePtr&) const; virtual DataPtr getConstantValue(const string&) const; virtual SymbolTablePtr createChild(); virtual Slice::TypePtr lookupType(const string&); virtual DataPtr invokeFunction(const string&, const DataPtr&, const DataList&); private: DataPtr findValue(const string&) const; class EntityVisitor : public EntityNodeVisitor { public: EntityVisitor(SymbolTableI*); virtual void visitIdentifier(const string&); virtual void visitElement(const NodePtr&); DataPtr getCurrent() const; private: SymbolTableI* _table; DataPtr _current; bool _error; }; friend class EntityVisitor; TransformInfoIPtr _info; SymbolTablePtr _parent; typedef map DataMap; DataMap _dataMap; DataMap _constantCache; }; typedef IceUtil::Handle SymbolTableIPtr; // // ObjectVisitor // class ObjectVisitor : public DataVisitor { public: ObjectVisitor(ObjectDataMap&); virtual void visitStruct(const StructDataPtr&); virtual void visitSequence(const SequenceDataPtr&); virtual void visitDictionary(const DictionaryDataPtr&); virtual void visitObject(const ObjectRefPtr&); private: ObjectDataMap& _map; }; // // DescriptorHandler // class DescriptorHandler : public IceXML::Handler { public: DescriptorHandler(const TransformInfoIPtr&); virtual void startElement(const string&, const IceXML::Attributes&, int, int); virtual void endElement(const string&, int, int); virtual void characters(const string&, int, int); virtual void error(const string&, int, int); TransformDBDescriptorPtr descriptor() const; private: TransformInfoIPtr _info; DescriptorPtr _current; TransformDBDescriptorPtr _descriptor; }; void assignOrTransform(const DataPtr&, const DataPtr&, bool, const TransformInfoPtr&); } // End of namespace FreezeScript // // TransformDataFactory // FreezeScript::TransformDataFactory::TransformDataFactory(const Ice::CommunicatorPtr& communicator, const Slice::UnitPtr& unit, const ErrorReporterPtr& errorReporter) : DataFactory(communicator, unit, errorReporter), _enabled(true) { } void FreezeScript::TransformDataFactory::addInitDescriptor(const InitDescriptorPtr& init) { string typeName = init->typeName(); assert(_initMap.find(typeName) == _initMap.end()); _initMap.insert(InitMap::value_type(typeName, init)); } void FreezeScript::TransformDataFactory::initialize(const DataPtr& data) { if(_enabled) { string typeName = typeToString(data->getType()); InitMap::iterator p = _initMap.find(typeName); if(p != _initMap.end()) { p->second->initialize(data); } } } void FreezeScript::TransformDataFactory::disableInitializers() { _enabled = false; } void FreezeScript::TransformDataFactory::enableInitializers() { _enabled = true; } // // Descriptor // FreezeScript::Descriptor::Descriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info) : _parent(parent), _line(line), _info(info) { } FreezeScript::Descriptor::~Descriptor() { } FreezeScript::DescriptorPtr FreezeScript::Descriptor::parent() const { return _parent; } FreezeScript::NodePtr FreezeScript::Descriptor::parse(const string& expr) const { return parseExpression(expr, _info->factory, _info->errorReporter); } Slice::TypePtr FreezeScript::Descriptor::findType(const Slice::UnitPtr& u, const string& type) { Slice::TypeList l; l = u->lookupType(type, false); if(l.empty()) { _info->errorReporter->error("unknown type `" + type + "'"); } return l.front(); } // // SetDescriptor // FreezeScript::SetDescriptor::SetDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : Descriptor(parent, line, info) { DescriptorErrorContext ctx(_info->errorReporter, "set", _line); IceXML::Attributes::const_iterator p; string target; p = attributes.find("target"); if(p == attributes.end()) { _info->errorReporter->error("required attribute `target' is missing"); } target = p->second; p = attributes.find("value"); if(p != attributes.end()) { _valueStr = p->second; } p = attributes.find("type"); if(p != attributes.end()) { _type = p->second; } p = attributes.find("length"); if(p != attributes.end()) { _lengthStr = p->second; } p = attributes.find("convert"); if(p != attributes.end()) { _convert = p->second == "true"; } if(!_valueStr.empty() && !_type.empty()) { _info->errorReporter->error("attributes `value' and 'type' are mutually exclusive"); } if(_valueStr.empty() && _type.empty() && _lengthStr.empty()) { _info->errorReporter->error("requires a value for attributes `value', 'type' or 'length'"); } NodePtr node = parse(target); _target = EntityNodePtr::dynamicCast(node); if(!_target) { _info->errorReporter->error("`target' attribute is not an entity: `" + target + "'"); } if(!_valueStr.empty()) { _value = parse(_valueStr); } if(!_lengthStr.empty()) { _length = parse(_lengthStr); } } void FreezeScript::SetDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_info->errorReporter, "set", _line); _info->errorReporter->error("child elements are not supported"); } void FreezeScript::SetDescriptor::validate() { } void FreezeScript::SetDescriptor::execute(const SymbolTablePtr& sym) { DescriptorErrorContext ctx(_info->errorReporter, "set", _line); DataPtr data = sym->getValue(_target); if(data->readOnly()) { ostringstream ostr; ostr << _target; _info->errorReporter->error("target `" + ostr.str() + "' cannot be modified"); } DataPtr value; if(_value) { try { value = _value->evaluate(sym); } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); } } Destroyer valueDestroyer; if(!_type.empty()) { assert(!value); Slice::TypePtr type = sym->lookupType(_type); if(!type) { _info->errorReporter->error("type `" + _type + "' not found"); } value = _info->factory->createObject(type, false); valueDestroyer.set(value); } DataPtr length; if(_length) { SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); if(!seq) { ostringstream ostr; ostr << _target; _info->errorReporter->error("target `" + ostr.str() + "' is not a sequence"); } try { length = _length->evaluate(sym); } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of length `" + _lengthStr + "' failed:\n" + ex.reason()); } DataList& elements = seq->getElements(); Ice::Long l = length->integerValue(); if(l < 0 || l > INT_MAX) { _info->errorReporter->error("sequence length " + length->toString() + " is out of range"); } DataList::size_type len = static_cast(l); if(len < elements.size()) { for(DataList::size_type i = len; i < elements.size(); ++i) { elements[i]->destroy(); } elements.resize(len); } else if(len > elements.size()) { Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(seq->getType()); assert(seqType); Slice::TypePtr elemType = seqType->type(); for(DataList::size_type i = elements.size(); i < len; ++i) { DataPtr v = _info->factory->create(elemType, false); if(value) { assignOrTransform(v, value, _convert, _info); } elements.push_back(v); } } } else { assignOrTransform(data, value, _convert, _info); } } // // DefineDescriptor // FreezeScript::DefineDescriptor::DefineDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : Descriptor(parent, line, info) { DescriptorErrorContext ctx(_info->errorReporter, "define", _line); IceXML::Attributes::const_iterator p; p = attributes.find("name"); if(p == attributes.end()) { _info->errorReporter->error("required attribute `name' is missing"); } _name = p->second; p = attributes.find("type"); if(p == attributes.end()) { _info->errorReporter->error("required attribute `type' is missing"); } if(p->second.find("::New") != string::npos) { Slice::TypeList l = _info->newUnit->lookupType(p->second.substr(5), false); if(l.empty()) { _info->errorReporter->error("type `" + p->second + "' not found"); } _type = l.front(); } else if(p->second.find("::Old") != string::npos) { Slice::TypeList l = _info->oldUnit->lookupType(p->second.substr(5), false); if(l.empty()) { _info->errorReporter->error("type `" + p->second + "' not found"); } _type = l.front(); } else { Slice::TypeList l = _info->newUnit->lookupType(p->second, false); if(l.empty()) { _info->errorReporter->error("type `" + p->second + "' not found"); } _type = l.front(); } p = attributes.find("value"); if(p != attributes.end()) { _valueStr = p->second; } p = attributes.find("convert"); if(p != attributes.end()) { _convert = p->second == "true"; } if(!_valueStr.empty()) { _value = parse(_valueStr); } } void FreezeScript::DefineDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_info->errorReporter, "define", _line); _info->errorReporter->error("child elements are not supported"); } void FreezeScript::DefineDescriptor::validate() { } void FreezeScript::DefineDescriptor::execute(const SymbolTablePtr& sym) { DescriptorErrorContext ctx(_info->errorReporter, "define", _line); DataPtr data = _info->factory->create(_type, false); DataPtr value; if(_value) { try { value = _value->evaluate(sym); } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); } } if(value) { assignOrTransform(data, value, _convert, _info); } sym->add(_name, data); } // // AddDescriptor // FreezeScript::AddDescriptor::AddDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : Descriptor(parent, line, info) { DescriptorErrorContext ctx(_info->errorReporter, "add", _line); IceXML::Attributes::const_iterator p; string target; p = attributes.find("target"); if(p == attributes.end()) { _info->errorReporter->error("required attribute `target' is missing"); } target = p->second; p = attributes.find("key"); if(p != attributes.end()) { _keyStr = p->second; } p = attributes.find("index"); if(p != attributes.end()) { _indexStr = p->second; } p = attributes.find("value"); if(p != attributes.end()) { _valueStr = p->second; } p = attributes.find("type"); if(p != attributes.end()) { _type = p->second; } p = attributes.find("convert"); if(p != attributes.end()) { _convert = p->second == "true"; } if(!_keyStr.empty() && !_indexStr.empty()) { _info->errorReporter->error("attributes `key' and `index' are mutually exclusive"); } if(_keyStr.empty() && _indexStr.empty()) { _info->errorReporter->error("one of attributes `key' or `index' is required"); } if(!_valueStr.empty() && !_type.empty()) { _info->errorReporter->error("attributes `value' and `type' are mutually exclusive"); } NodePtr node = parse(target); _target = EntityNodePtr::dynamicCast(node); if(!_target) { _info->errorReporter->error("`target' attribute is not an entity: `" + target + "'"); } if(!_keyStr.empty()) { _key = parse(_keyStr); } if(!_indexStr.empty()) { _index = parse(_indexStr); } if(!_valueStr.empty()) { _value = parse(_valueStr); } } void FreezeScript::AddDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_info->errorReporter, "add", _line); _info->errorReporter->error("child elements are not supported"); } void FreezeScript::AddDescriptor::validate() { } void FreezeScript::AddDescriptor::execute(const SymbolTablePtr& sym) { DescriptorErrorContext ctx(_info->errorReporter, "add", _line); DataPtr data = sym->getValue(_target); if(data->readOnly()) { ostringstream ostr; ostr << _target; _info->errorReporter->error("target `" + ostr.str() + "' cannot be modified"); } if(_key) { DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); if(!dict) { ostringstream ostr; ostr << _target; _info->errorReporter->error("target `" + ostr.str() + "' is not a dictionary"); } Slice::DictionaryPtr type = Slice::DictionaryPtr::dynamicCast(dict->getType()); assert(type); DataPtr key; Destroyer keyDestroyer; try { DataPtr v = _key->evaluate(sym); key = _info->factory->create(type->keyType(), false); keyDestroyer.set(key); assignOrTransform(key, v, _convert, _info); } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of key `" + _keyStr + "' failed:\n" + ex.reason()); } if(dict->getElement(key)) { ostringstream ostr; printData(key, ostr); _info->errorReporter->error("key " + ostr.str() + " already exists in dictionary"); } DataPtr elem = _info->factory->create(type->valueType(), false); Destroyer elemDestroyer(elem); DataPtr value; if(_value) { try { value = _value->evaluate(sym); } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); } } Destroyer valueDestroyer; if(!_type.empty()) { assert(!value); Slice::TypePtr type = sym->lookupType(_type); if(!type) { _info->errorReporter->error("type `" + _type + "' not found"); } value = _info->factory->createObject(type, false); valueDestroyer.set(value); } if(value) { assignOrTransform(elem, value, _convert, _info); } DataMap& map = dict->getElements(); map.insert(DataMap::value_type(key, elem)); keyDestroyer.release(); elemDestroyer.release(); } else { assert(_index); SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); if(!seq) { ostringstream ostr; ostr << _target; _info->errorReporter->error("target `" + ostr.str() + "' is not a sequence"); } Slice::SequencePtr type = Slice::SequencePtr::dynamicCast(seq->getType()); assert(type); DataPtr index; Destroyer indexDestroyer; try { index = _index->evaluate(sym); indexDestroyer.set(index); } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of index `" + _indexStr + "' failed:\n" + ex.reason()); } DataList& elements = seq->getElements(); Ice::Long l = index->integerValue(); DataList::size_type i = static_cast(l); if(l < 0 || l > INT_MAX || i > elements.size()) { _info->errorReporter->error("sequence index " + index->toString() + " is out of range"); } DataPtr elem = _info->factory->create(type->type(), false); Destroyer elemDestroyer(elem); DataPtr value; if(_value) { try { value = _value->evaluate(sym); } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); } } Destroyer valueDestroyer; if(!_type.empty()) { assert(!value); Slice::TypePtr type = sym->lookupType(_type); if(!type) { _info->errorReporter->error("type `" + _type + "' not found"); } value = _info->factory->createObject(type, false); valueDestroyer.set(value); } if(value) { assignOrTransform(elem, value, _convert, _info); } elements.insert(elements.begin() + i, elem); indexDestroyer.release(); elemDestroyer.release(); } } // // RemoveDescriptor // FreezeScript::RemoveDescriptor::RemoveDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : Descriptor(parent, line, info) { DescriptorErrorContext ctx(_info->errorReporter, "remove", _line); IceXML::Attributes::const_iterator p; string target; p = attributes.find("target"); if(p == attributes.end()) { _info->errorReporter->error("required attribute `target' is missing"); } target = p->second; p = attributes.find("key"); if(p != attributes.end()) { _keyStr = p->second; } p = attributes.find("index"); if(p != attributes.end()) { _indexStr = p->second; } NodePtr node = parse(target); _target = EntityNodePtr::dynamicCast(node); if(!_target) { _info->errorReporter->error("`target' attribute is not an entity: `" + target + "'"); } if(!_keyStr.empty() && !_indexStr.empty()) { _info->errorReporter->error("attributes `key' and `index' are mutually exclusive"); } if(_keyStr.empty() && _indexStr.empty()) { _info->errorReporter->error("one of attributes `key' or `index' is required"); } if(!_keyStr.empty()) { _key = parse(_keyStr); } if(!_indexStr.empty()) { _index = parse(_indexStr); } } void FreezeScript::RemoveDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_info->errorReporter, "remove", _line); _info->errorReporter->error("child elements are not supported"); } void FreezeScript::RemoveDescriptor::validate() { } void FreezeScript::RemoveDescriptor::execute(const SymbolTablePtr& sym) { DescriptorErrorContext ctx(_info->errorReporter, "remove", _line); DataPtr data = sym->getValue(_target); if(data->readOnly()) { ostringstream ostr; ostr << _target; _info->errorReporter->error("target `" + ostr.str() + "' cannot be modified"); } if(_key) { DataPtr key; try { key = _key->evaluate(sym); } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of key `" + _keyStr + "' failed:\n" + ex.reason()); } DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); if(!dict) { ostringstream ostr; ostr << _target; _info->errorReporter->error("target `" + ostr.str() + "' is not a dictionary"); } DataMap& map = dict->getElements(); DataMap::iterator p = map.find(key); if(p != map.end()) { p->first->destroy(); p->second->destroy(); map.erase(p); } } else { assert(_index); DataPtr index; try { index = _index->evaluate(sym); } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of index `" + _indexStr + "' failed:\n" + ex.reason()); } SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); if(!seq) { ostringstream ostr; ostr << _target; _info->errorReporter->error("target `" + ostr.str() + "' is not a sequence"); } DataList& elements = seq->getElements(); Ice::Long l = index->integerValue(); DataList::size_type i = static_cast(l); if(l < 0 || l > INT_MAX || i >= elements.size()) { _info->errorReporter->error("sequence index " + index->toString() + " is out of range"); } elements[i]->destroy(); elements.erase(elements.begin() + i); } } // // DeleteDescriptor // FreezeScript::DeleteDescriptor::DeleteDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes&) : Descriptor(parent, line, info) { } void FreezeScript::DeleteDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_info->errorReporter, "delete", _line); _info->errorReporter->error("child elements are not supported"); } void FreezeScript::DeleteDescriptor::validate() { } void FreezeScript::DeleteDescriptor::execute(const SymbolTablePtr&) { throw DeleteRecordException(); } // // FailDescriptor // FreezeScript::FailDescriptor::FailDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : Descriptor(parent, line, info) { IceXML::Attributes::const_iterator p; p = attributes.find("test"); if(p != attributes.end()) { _testStr = p->second; } p = attributes.find("message"); if(p != attributes.end()) { _message = p->second; } if(!_testStr.empty()) { _test = parse(_testStr); } if(_message.empty()) { ostringstream ostr; ostr << " executed at line " << line << endl; _message = ostr.str(); } } void FreezeScript::FailDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_info->errorReporter, "fail", _line); _info->errorReporter->error("child elements are not supported"); } void FreezeScript::FailDescriptor::validate() { } void FreezeScript::FailDescriptor::execute(const SymbolTablePtr& sym) { DescriptorErrorContext ctx(_info->errorReporter, "fail", _line); if(_test) { try { DataPtr b = _test->evaluate(sym); BooleanDataPtr bd = BooleanDataPtr::dynamicCast(b); if(!bd) { _info->errorReporter->error("expression `" + _testStr + "' does not evaluate to a boolean"); } if(!bd->booleanValue()) { return; } } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of expression `" + _testStr + "' failed:\n" + ex.reason()); } } throw FailureException(__FILE__, __LINE__, _message); } // // EchoDescriptor // FreezeScript::EchoDescriptor::EchoDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : Descriptor(parent, line, info) { IceXML::Attributes::const_iterator p; p = attributes.find("message"); if(p != attributes.end()) { _message = p->second; } p = attributes.find("value"); if(p != attributes.end()) { _valueStr = p->second; } if(!_valueStr.empty()) { _value = parse(_valueStr); } } void FreezeScript::EchoDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_info->errorReporter, "echo", _line); _info->errorReporter->error("child elements are not supported"); } void FreezeScript::EchoDescriptor::validate() { } void FreezeScript::EchoDescriptor::execute(const SymbolTablePtr& sym) { DescriptorErrorContext ctx(_info->errorReporter, "echo", _line); ostream& out = _info->errorReporter->stream(); if(!_message.empty()) { out << _message; } if(_value) { DataPtr v; try { v = _value->evaluate(sym); } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); } printData(v, out); } out << endl; } // // ExecutableContainerDescriptor // FreezeScript::ExecutableContainerDescriptor::ExecutableContainerDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes&, const string& name) : Descriptor(parent, line, info), _name(name) { } void FreezeScript::ExecutableContainerDescriptor::addChild(const DescriptorPtr& child) { _children.push_back(child); } void FreezeScript::ExecutableContainerDescriptor::validate() { for(vector::iterator p = _children.begin(); p != _children.end(); ++p) { (*p)->validate(); } } void FreezeScript::ExecutableContainerDescriptor::execute(const SymbolTablePtr& sym) { for(vector::iterator p = _children.begin(); p != _children.end(); ++p) { (*p)->execute(sym); } } // // IfDescriptor // FreezeScript::IfDescriptor::IfDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : ExecutableContainerDescriptor(parent, line, info, attributes, "if") { DescriptorErrorContext ctx(_info->errorReporter, "if", _line); IceXML::Attributes::const_iterator p = attributes.find("test"); if(p == attributes.end()) { _info->errorReporter->error("required attribute `test' is missing"); } _testStr = p->second; _test = parse(_testStr); } void FreezeScript::IfDescriptor::execute(const SymbolTablePtr& sym) { DescriptorErrorContext ctx(_info->errorReporter, "if", _line); try { DataPtr b = _test->evaluate(sym); BooleanDataPtr bd = BooleanDataPtr::dynamicCast(b); if(!bd) { _info->errorReporter->error("expression `" + _testStr + "' does not evaluate to a boolean"); } if(bd->booleanValue()) { ExecutableContainerDescriptor::execute(sym); } } catch(const EvaluateException& ex) { _info->errorReporter->error("evaluation of conditional expression `" + _testStr + "' failed:\n" + ex.reason()); } } // // IterateDescriptor // FreezeScript::IterateDescriptor::IterateDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : ExecutableContainerDescriptor(parent, line, info, attributes, "iterate") { DescriptorErrorContext ctx(_info->errorReporter, "iterate", _line); IceXML::Attributes::const_iterator p; string target; p = attributes.find("target"); if(p == attributes.end()) { _info->errorReporter->error("required attribute `target' is missing"); } target = p->second; p = attributes.find("key"); if(p != attributes.end()) { _key = p->second; } p = attributes.find("value"); if(p != attributes.end()) { _value = p->second; } p = attributes.find("element"); if(p != attributes.end()) { _element = p->second; } p = attributes.find("index"); if(p != attributes.end()) { _index = p->second; } NodePtr node = parse(target); _target = EntityNodePtr::dynamicCast(node); if(!_target) { _info->errorReporter->error("`target' attribute is not an entity: `" + target + "'"); } } void FreezeScript::IterateDescriptor::execute(const SymbolTablePtr& sym) { DescriptorErrorContext ctx(_info->errorReporter, "iterate", _line); DataPtr data = sym->getValue(_target); DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); if(!dict && !seq) { ostringstream ostr; ostr << _target; _info->errorReporter->error("target `" + ostr.str() + "' is not a dictionary or sequence"); } if(dict) { if(!_element.empty()) { _info->errorReporter->error("attribute `element' specified for dictionary target"); } if(!_index.empty()) { _info->errorReporter->error("attribute `index' specified for dictionary target"); } string key = _key; if(key.empty()) { key = "key"; } string value = _value; if(value.empty()) { value = "value"; } DataMap& map = dict->getElements(); for(DataMap::iterator p = map.begin(); p != map.end(); ++p) { SymbolTablePtr elemSym = sym->createChild(); elemSym->add(key, p->first); elemSym->add(value, p->second); ExecutableContainerDescriptor::execute(elemSym); } } else { if(!_key.empty()) { _info->errorReporter->error("attribute `key' specified for sequence target"); } if(!_value.empty()) { _info->errorReporter->error("attribute `value' specified for sequence target"); } string element = _element; if(element.empty()) { element = "elem"; } string index = _index; if(index.empty()) { index = "i"; } // // NOTE: Don't use iterator to traverse vector because child descriptors might remove elements. // DataList& l = seq->getElements(); DataList::size_type i = 0; while(i < l.size()) { SymbolTablePtr elemSym = sym->createChild(); elemSym->add(element, l[i]); elemSym->add(index, _info->factory->createInteger(i, true)); ExecutableContainerDescriptor::execute(elemSym); ++i; } } } // // TransformDescriptor // FreezeScript::TransformDescriptor::TransformDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : ExecutableContainerDescriptor(parent, line, info, attributes, "transform"), _default(true), _base(true) { DescriptorErrorContext ctx(_info->errorReporter, "transform", _line); IceXML::Attributes::const_iterator p; string type, rename; p = attributes.find("type"); if(p == attributes.end()) { _info->errorReporter->error("required attribute `type' is missing"); } type = p->second; p = attributes.find("default"); if(p != attributes.end()) { if(p->second == "false") { _default = false; } } p = attributes.find("base"); if(p != attributes.end()) { if(p->second == "false") { _base = false; } } p = attributes.find("rename"); if(p != attributes.end()) { rename = p->second; } Slice::TypeList l; l = _info->newUnit->lookupType(type, false); if(l.empty()) { _info->errorReporter->error("unable to find type `" + type + "' in new Slice definitions"); } else { _newType = l.front(); } if(!rename.empty()) { l = _info->oldUnit->lookupType(rename, false); if(l.empty()) { _info->errorReporter->error("unable to find type `" + rename + "' in old Slice definitions"); } _renameType = l.front(); } } Slice::TypePtr FreezeScript::TransformDescriptor::type() const { return _newType; } string FreezeScript::TransformDescriptor::typeName() const { return typeToString(_newType); } Slice::TypePtr FreezeScript::TransformDescriptor::renameType() const { return _renameType; } string FreezeScript::TransformDescriptor::renameTypeName() const { string result; if(_renameType) { result = typeToString(_renameType); } return result; } bool FreezeScript::TransformDescriptor::doDefaultTransform() const { return _default; } bool FreezeScript::TransformDescriptor::doBaseTransform() const { return _base; } // // InitDescriptor // FreezeScript::InitDescriptor::InitDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : ExecutableContainerDescriptor(parent, line, info, attributes, "init") { DescriptorErrorContext ctx(_info->errorReporter, "init", _line); IceXML::Attributes::const_iterator p = attributes.find("type"); string type; if(p == attributes.end()) { _info->errorReporter->error("required attribute `type' is missing"); } type = p->second; Slice::TypeList l = _info->newUnit->lookupType(type, false); if(l.empty()) { _info->errorReporter->error("unable to find type `" + type + "' in new Slice definitions"); } else { _type = l.front(); } } void FreezeScript::InitDescriptor::initialize(const DataPtr& data) { SymbolTablePtr sym = new SymbolTableI(_info, _info->symbolTable); sym->add("value", data); execute(sym); } string FreezeScript::InitDescriptor::typeName() const { return typeToString(_type); } // // RecordDescriptor // FreezeScript::RecordDescriptor::RecordDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : ExecutableContainerDescriptor(parent, line, info, attributes, "record") { } void FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& /*sym*/) { // // Temporarily add an object factory. // _info->objectFactory->activate(_info->factory, _info->oldUnit); // // Iterate over the database. // Dbc* dbc = 0; _info->oldDb->cursor(0, &dbc, 0); try { Dbt dbKey, dbValue; while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0) { Ice::ByteSeq inKeyBytes; inKeyBytes.resize(dbKey.get_size()); memcpy(&inKeyBytes[0], dbKey.get_data(), dbKey.get_size()); Ice::ByteSeq inValueBytes; inValueBytes.resize(dbValue.get_size()); memcpy(&inValueBytes[0], dbValue.get_data(), dbValue.get_size()); try { Ice::ByteSeq outKeyBytes, outValueBytes; transformRecord(inKeyBytes, inValueBytes, outKeyBytes, outValueBytes); Dbt dbNewKey(&outKeyBytes[0], static_cast(outKeyBytes.size())), dbNewValue(&outValueBytes[0], static_cast(outValueBytes.size())); if(_info->newDb->put(_info->newDbTxn, &dbNewKey, &dbNewValue, DB_NOOVERWRITE) == DB_KEYEXIST) { _info->errorReporter->error("duplicate key encountered"); } } catch(const DeleteRecordException&) { // The record is deleted simply by not adding it to the new database. } catch(const ClassNotFoundException& ex) { if(!_info->purge) { _info->errorReporter->error("class " + ex.id + " not found in new Slice definitions"); } else { // The record is deleted simply by not adding it to the new database. _info->errorReporter->warning("purging database record due to missing class type " + ex.id); } } } } catch(...) { if(dbc) { dbc->close(); } _info->objectFactory->deactivate(); throw; } if(dbc) { dbc->close(); } _info->objectFactory->deactivate(); } void FreezeScript::RecordDescriptor::transformRecord(const Ice::ByteSeq& inKeyBytes, const Ice::ByteSeq& inValueBytes, Ice::ByteSeq& outKeyBytes, Ice::ByteSeq& outValueBytes) { Ice::InputStreamPtr inKey = Ice::wrapInputStream(_info->communicator, inKeyBytes); Ice::InputStreamPtr inValue = Ice::wrapInputStream(_info->communicator, inValueBytes); inValue->startEncapsulation(); Ice::OutputStreamPtr outKey = Ice::createOutputStream(_info->communicator); Ice::OutputStreamPtr outValue = Ice::createOutputStream(_info->communicator); outValue->startEncapsulation(); // // Create data representations of the old key and value types. // _info->factory->disableInitializers(); DataPtr oldKeyData = _info->factory->create(_info->oldKeyType, true); Destroyer oldKeyDataDestroyer(oldKeyData); DataPtr oldValueData = _info->factory->create(_info->oldValueType, true); Destroyer oldValueDataDestroyer(oldValueData); // // Unmarshal the old key and value. // oldKeyData->unmarshal(inKey); oldValueData->unmarshal(inValue); _info->objectDataMap.clear(); if(_info->oldValueType->usesClasses()) { inValue->readPendingObjects(); ObjectVisitor visitor(_info->objectDataMap); oldValueData->visit(visitor); } _info->factory->enableInitializers(); // // Create data representations of the new key and value types. // DataPtr newKeyData = _info->factory->create(_info->newKeyType, false); Destroyer newKeyDataDestroyer(newKeyData); DataPtr newValueData = _info->factory->create(_info->newValueType, false); Destroyer newValueDataDestroyer(newValueData); DataPtr facetData = _info->factory->createString(_info->facet, true); Destroyer facetDataDestroyer(facetData); // // Copy the data from the old key and value to the new key and value, if possible. // TransformVisitor keyVisitor(oldKeyData, _info); newKeyData->visit(keyVisitor); TransformVisitor valueVisitor(oldValueData, _info); newValueData->visit(valueVisitor); if(!_children.empty()) { // // Execute the child descriptors. // // TODO: Revisit identifiers. // SymbolTablePtr st = new SymbolTableI(_info, _info->symbolTable); st->add("oldkey", oldKeyData); st->add("newkey", newKeyData); st->add("oldvalue", oldValueData); st->add("newvalue", newValueData); st->add("facet", facetData); ExecutableContainerDescriptor::execute(st); } newKeyData->marshal(outKey); newValueData->marshal(outValue); outKey->finished(outKeyBytes); if(_info->newValueType->usesClasses()) { outValue->writePendingObjects(); } outValue->endEncapsulation(); outValue->finished(outValueBytes); } // // DatabaseDescriptor // FreezeScript::DatabaseDescriptor::DatabaseDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, const IceXML::Attributes& attributes) : ExecutableContainerDescriptor(parent, line, info, attributes, "database") { DescriptorErrorContext ctx(_info->errorReporter, "database", _line); IceXML::Attributes::const_iterator p; p = attributes.find("name"); if(p != attributes.end()) { _name = p->second; } p = attributes.find("key"); if(p == attributes.end()) { _info->errorReporter->error("required attribute `key' is missing"); } string keyTypes = p->second; p = attributes.find("value"); if(p == attributes.end()) { _info->errorReporter->error("required attribute `value' is missing"); } string valueTypes = p->second; string::size_type pos; pos = keyTypes.find(','); if(pos == 0 || pos == keyTypes.size()) { _info->errorReporter->error("invalid key type specification `" + keyTypes +"'"); } if(pos == string::npos) { _oldKeyName = keyTypes; _newKeyName = keyTypes; } else { _oldKeyName = keyTypes.substr(0, pos); _newKeyName = keyTypes.substr(pos + 1); } pos = valueTypes.find(','); if(pos == 0 || pos == valueTypes.size()) { _info->errorReporter->error("invalid value type specification `" + valueTypes +"'"); } if(pos == string::npos) { _oldValueName = valueTypes; _newValueName = valueTypes; } else { _oldValueName = valueTypes.substr(0, pos); _newValueName = valueTypes.substr(pos + 1); } } void FreezeScript::DatabaseDescriptor::addChild(const DescriptorPtr& child) { DescriptorErrorContext ctx(_info->errorReporter, "database", _line); RecordDescriptorPtr rec = RecordDescriptorPtr::dynamicCast(child); if(rec) { if(_record) { _info->errorReporter->error("only one element can be specified"); } _record = rec; } ExecutableContainerDescriptor::addChild(child); } void FreezeScript::DatabaseDescriptor::execute(const SymbolTablePtr& st) { DescriptorErrorContext ctx(_info->errorReporter, "database", _line); // // Look up the Slice definitions for the key and value types. // _info->oldKeyType = findType(_info->oldUnit, _oldKeyName); _info->newKeyType = findType(_info->newUnit, _newKeyName); _info->oldValueType = findType(_info->oldUnit, _oldValueName); _info->newValueType = findType(_info->newUnit, _newValueName); if(_info->connection != 0) { Freeze::Catalog catalog(_info->connection, Freeze::catalogName()); Freeze::CatalogData catalogData; catalogData.evictor = false; catalogData.key = _info->newKeyType->typeId(); catalogData.value = _info->newValueType->typeId(); catalog.put(Freeze::Catalog::value_type(_info->newDbName, catalogData)); } // // TODO: it looks like _info is not destroyed before the new dbEnv is closed. // _info->connection = 0; ExecutableContainerDescriptor::execute(st); } string FreezeScript::DatabaseDescriptor::name() const { return _name; } // // TransformDBDescriptor // FreezeScript::TransformDBDescriptor::TransformDBDescriptor(int line, const TransformInfoIPtr& info, const IceXML::Attributes&) : Descriptor(0, line, info) { } FreezeScript::TransformDBDescriptor::~TransformDBDescriptor() { } void FreezeScript::TransformDBDescriptor::addChild(const DescriptorPtr& child) { DescriptorErrorContext ctx(_info->errorReporter, "transformdb", _line); DatabaseDescriptorPtr db = DatabaseDescriptorPtr::dynamicCast(child); TransformDescriptorPtr transform = TransformDescriptorPtr::dynamicCast(child); InitDescriptorPtr init = InitDescriptorPtr::dynamicCast(child); if(db) { string name = db->name(); map::iterator p = _databases.find(name); if(p != _databases.end()) { if(name.empty()) { _info->errorReporter->error("duplicate element"); } else { _info->errorReporter->error(string("duplicate element for ") + name); } } else { _databases[name] = db; _children.push_back(db); } } else if(transform) { string name = transform->typeName(); TransformMap::iterator p = _info->transformMap.find(name); if(p != _info->transformMap.end()) { _info->errorReporter->error("transform `" + name + "' specified more than once"); } _info->transformMap.insert(TransformMap::value_type(name, transform)); string renameTypeName = transform->renameTypeName(); if(!renameTypeName.empty()) { RenameMap::iterator q = _info->renameMap.find(renameTypeName); if(q != _info->renameMap.end()) { _info->errorReporter->error("multiple transform descriptors specify the rename value `" + renameTypeName + "'"); } _info->renameMap.insert(RenameMap::value_type(renameTypeName, transform->type())); } _children.push_back(transform); } else if(init) { _info->factory->addInitDescriptor(init); _children.push_back(init); } else { _info->errorReporter->error("invalid child element"); } } void FreezeScript::TransformDBDescriptor::validate() { DescriptorErrorContext ctx(_info->errorReporter, "transformdb", _line); if(_databases.empty()) { _info->errorReporter->error("no element defined"); } for(vector::iterator p = _children.begin(); p != _children.end(); ++p) { (*p)->validate(); } } void FreezeScript::TransformDBDescriptor::execute(const SymbolTablePtr& sym) { map::iterator p = _databases.find(_info->newDbName); if(p == _databases.end()) { p = _databases.find(""); } if(p == _databases.end()) { _info->errorReporter->error("no element found for `" + _info->newDbName + "'"); } p->second->execute(sym); } // // SymbolTableI // FreezeScript::SymbolTableI::SymbolTableI(const TransformInfoIPtr& info, const SymbolTablePtr& parent) : _info(info), _parent(parent) { } void FreezeScript::SymbolTableI::add(const string& name, const DataPtr& data) { DataMap::const_iterator p = _dataMap.find(name); if(p != _dataMap.end()) { _info->errorReporter->error("`" + name + "' is already defined"); } _dataMap.insert(DataMap::value_type(name, data)); } FreezeScript::DataPtr FreezeScript::SymbolTableI::getValue(const EntityNodePtr& entity) const { EntityVisitor visitor(const_cast(this)); entity->visit(visitor); DataPtr result = visitor.getCurrent(); if(!result) { ostringstream ostr; ostr << "invalid entity `" << entity << "'"; _info->errorReporter->error(ostr.str()); } return result; } FreezeScript::DataPtr FreezeScript::SymbolTableI::getConstantValue(const string& name) const { string::size_type pos; Slice::UnitPtr unit; string key; DataMap::const_iterator p = _constantCache.find(name); if(p != _constantCache.end()) { return p->second; } if(_parent) { return _parent->getConstantValue(name); } // // Name must start with "::Old" or "::New" to indicate the Slice unit. // pos = name.find("::Old"); if(pos == 0) { if(name.length() > 5) { key = name.substr(5); unit = _info->oldUnit; } } else { pos = name.find("::New"); if(pos == 0) { if(name.length() > 5) { key = name.substr(5); unit = _info->newUnit; } } } if(key.empty()) { _info->errorReporter->error("invalid constant name `" + name + "'"); } Slice::ContainedList l = unit->findContents(key); if(l.empty()) { _info->errorReporter->error("unknown constant `" + name + "'"); } Slice::EnumeratorPtr e = Slice::EnumeratorPtr::dynamicCast(l.front()); Slice::ConstPtr c = Slice::ConstPtr::dynamicCast(l.front()); if(!e && !c) { _info->errorReporter->error("`" + name + "' does not refer to a Slice constant or enumerator"); } DataPtr result; if(c) { Slice::TypePtr type = c->type(); string value = c->value(); Slice::BuiltinPtr b = Slice::BuiltinPtr::dynamicCast(type); if(b) { switch(b->kind()) { case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: { Ice::Long n; if(!IceUtilInternal::stringToInt64(value, n)) { assert(false); } result = _info->factory->createInteger(n, true); break; } case Slice::Builtin::KindBool: { result = _info->factory->createBoolean(value == "true", true); break; } case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: { double v = strtod(value.c_str(), 0); result = _info->factory->createDouble(v, true); break; } case Slice::Builtin::KindString: { result = _info->factory->createString(value, true); break; } case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: assert(false); } } else { Slice::EnumPtr en = Slice::EnumPtr::dynamicCast(type); assert(en); Slice::EnumeratorList el = en->getEnumerators(); for(Slice::EnumeratorList::iterator q = el.begin(); q != el.end(); ++q) { if((*q)->name() == value) { e = *q; break; } } assert(e); } } if(!result) { assert(e); result = _info->factory->create(e->type(), true); EnumDataPtr ed = EnumDataPtr::dynamicCast(result); assert(ed); ed->setValueAsString(e->name()); } // // Cache the value. // const_cast(_constantCache).insert(DataMap::value_type(name, result)); return result; } FreezeScript::SymbolTablePtr FreezeScript::SymbolTableI::createChild() { return new SymbolTableI(_info, this); } Slice::TypePtr FreezeScript::SymbolTableI::lookupType(const string& name) { Slice::TypeList l = _info->newUnit->lookupType(name, false); Slice::TypePtr result; if(!l.empty()) { result = l.front(); } return result; } FreezeScript::DataPtr FreezeScript::SymbolTableI::invokeFunction(const string& name, const DataPtr& target, const DataList& args) { if(target) { DictionaryDataPtr targetDict = DictionaryDataPtr::dynamicCast(target); if(targetDict && name == "containsKey") { if(args.size() != 1) { _info->errorReporter->error("containsKey() requires one argument"); } Slice::DictionaryPtr dictType = Slice::DictionaryPtr::dynamicCast(targetDict->getType()); assert(dictType); DataPtr key = _info->factory->create(dictType->keyType(), false); assignOrTransform(key, args[0], false, _info); DataPtr value = targetDict->getElement(key); return _info->factory->createBoolean(value ? true : false, false); } DataPtr result; if(invokeMemberFunction(name, target, args, result, _info->factory, _info->errorReporter)) { return result; } _info->errorReporter->error("unknown function `" + name + "' invoked on type " + typeToString(target->getType())); } else { // // Global function. // DataPtr result; if(invokeGlobalFunction(_info->communicator, name, args, result, _info->factory, _info->errorReporter)) { return result; } else { _info->errorReporter->error("unknown global function `" + name + "'"); } } return 0; } FreezeScript::DataPtr FreezeScript::SymbolTableI::findValue(const string& name) const { DataMap::const_iterator p = _dataMap.find(name); if(p != _dataMap.end()) { return p->second; } if(_parent) { SymbolTableIPtr parentI = SymbolTableIPtr::dynamicCast(_parent); assert(parentI); return parentI->findValue(name); } return 0; } FreezeScript::SymbolTableI::EntityVisitor::EntityVisitor(SymbolTableI* table) : _table(table), _error(false) { } void FreezeScript::SymbolTableI::EntityVisitor::visitIdentifier(const string& name) { if(!_error) { if(!_current) { _current = _table->findValue(name); } else { _current = _current->getMember(name); } if(!_current) { _error = true; } } } void FreezeScript::SymbolTableI::EntityVisitor::visitElement(const NodePtr& value) { if(!_error) { assert(_current); DataPtr val = value->evaluate(_table); _current = _current->getElement(val); if(!_current) { _error = true; } } } FreezeScript::DataPtr FreezeScript::SymbolTableI::EntityVisitor::getCurrent() const { return _current; } // // ObjectVisitor // FreezeScript::ObjectVisitor::ObjectVisitor(ObjectDataMap& objectDataMap) : _map(objectDataMap) { } void FreezeScript::ObjectVisitor::visitStruct(const StructDataPtr& data) { Slice::TypePtr type = data->getType(); if(type->usesClasses()) { DataMemberMap& members = data->getMembers(); for(DataMemberMap::iterator p = members.begin(); p != members.end(); ++p) { p->second->visit(*this); } } } void FreezeScript::ObjectVisitor::visitSequence(const SequenceDataPtr& data) { Slice::TypePtr type = data->getType(); if(type->usesClasses()) { DataList& elements = data->getElements(); for(DataList::iterator p = elements.begin(); p != elements.end(); ++p) { (*p)->visit(*this); } } } void FreezeScript::ObjectVisitor::visitDictionary(const DictionaryDataPtr& data) { Slice::TypePtr type = data->getType(); if(type->usesClasses()) { DataMap& elements = data->getElements(); for(DataMap::iterator p = elements.begin(); p != elements.end(); ++p) { // // NOTE: There's no need to visit the key. // p->second->visit(*this); } } } void FreezeScript::ObjectVisitor::visitObject(const ObjectRefPtr& data) { ObjectDataPtr value = data->getValue(); if(value) { ObjectDataMap::iterator p = _map.find(value.get()); if(p == _map.end()) { #if (defined(_MSC_VER) && (_MSC_VER >= 1600)) _map.insert(ObjectDataMap::value_type(value.get(), static_cast(nullptr))); #else _map.insert(ObjectDataMap::value_type(value.get(), 0)); #endif DataMemberMap& members = value->getMembers(); for(DataMemberMap::iterator q = members.begin(); q != members.end(); ++q) { q->second->visit(*this); } } } } // // TransformInfoI // FreezeScript::DataFactoryPtr FreezeScript::TransformInfoI::getDataFactory() { return factory; } FreezeScript::ErrorReporterPtr FreezeScript::TransformInfoI::getErrorReporter() { return errorReporter; } bool FreezeScript::TransformInfoI::doDefaultTransform(const Slice::TypePtr& type) { TransformMap::const_iterator p = transformMap.find(typeToString(type)); if(p != transformMap.end()) { return p->second->doDefaultTransform(); } return true; } bool FreezeScript::TransformInfoI::doBaseTransform(const Slice::ClassDefPtr& type) { TransformMap::const_iterator p = transformMap.find(type->scoped()); if(p != transformMap.end()) { return p->second->doBaseTransform(); } return true; } Slice::TypePtr FreezeScript::TransformInfoI::getRenamedType(const Slice::TypePtr& old) { RenameMap::iterator p = renameMap.find(typeToString(old)); if(p != renameMap.end()) { return p->second; } return 0; } void FreezeScript::TransformInfoI::executeCustomTransform(const DataPtr& dest, const DataPtr& src) { // // Execute the type's transform (if any). Non-nil objects need special consideration, // for two reasons: // // 1. The dest and src arguments are ObjectRef instances whose getType() // function returns the formal type, which may not match the actual type // if inheritance is being used. Therefore, we need to look for the // transform of the actual type of the object. // // 2. It's not sufficient to execute only the transform for the actual type; // the transform descriptors for base types must also be executed (if not // explicitly precluded). // // The algorithm goes like this: // // 1. If a transform exists for the actual type, execute it. // 2. If the transform doesn't exist, or if it does exist and does not preclude // the execution of the base transform, then obtain the base type. If the // type has no user-defined base class, use Object. // 3. If a base type was found and a transform exists for the base type, execute it. // 4. Repeat step 2. // ObjectRefPtr obj = ObjectRefPtr::dynamicCast(dest); if(obj && obj->getValue()) { ObjectDataPtr data = obj->getValue(); Slice::TypePtr cls = data->getType(); // Actual type: may be Builtin (Object) or ClassDecl bool transformBase = true; while(cls) { string type = typeToString(cls); TransformMap::const_iterator p = transformMap.find(type); if(p != transformMap.end()) { SymbolTablePtr sym = new SymbolTableI(this, symbolTable); sym->add("new", dest); sym->add("old", src); p->second->execute(sym); transformBase = p->second->doBaseTransform(); } Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(cls); cls = 0; if(transformBase && decl) { Slice::ClassDefPtr def = decl->definition(); assert(def); Slice::ClassList bases = def->bases(); if(!bases.empty() && !bases.front()->isInterface()) { cls = bases.front()->declaration(); } else { cls = newUnit->builtin(Slice::Builtin::KindObject); } } } } else { string type = typeToString(dest->getType()); TransformMap::const_iterator p = transformMap.find(type); if(p != transformMap.end()) { SymbolTablePtr sym = new SymbolTableI(this, symbolTable); sym->add("new", dest); sym->add("old", src); p->second->execute(sym); } } } string FreezeScript::TransformInfoI::facetName() { return facet; } bool FreezeScript::TransformInfoI::purgeObjects() { return purge; } FreezeScript::ObjectDataMap& FreezeScript::TransformInfoI::getObjectDataMap() { return objectDataMap; } // // DescriptorHandler // FreezeScript::DescriptorHandler::DescriptorHandler(const TransformInfoIPtr& info) : _info(info) { } void FreezeScript::DescriptorHandler::startElement(const string& name, const IceXML::Attributes& attributes, int line, int /*column*/) { DescriptorPtr d; if(name == "transformdb") { if(_current) { _info->errorReporter->descriptorError(" must be the top-level element", line); } _descriptor = new TransformDBDescriptor(line, _info, attributes); d = _descriptor; } else if(name == "database") { if(!_current) { _info->errorReporter->descriptorError(" must be a child of ", line); } d = new DatabaseDescriptor(_current, line, _info, attributes); } else if(name == "record") { if(!_current) { _info->errorReporter->descriptorError(" must be a child of ", line); } d = new RecordDescriptor(_current, line, _info, attributes); } else if(name == "transform") { if(!_current) { _info->errorReporter->descriptorError(" must be a child of ", line); } d = new TransformDescriptor(_current, line, _info, attributes); } else if(name == "init") { if(!_current) { _info->errorReporter->descriptorError(" must be a child of ", line); } d = new InitDescriptor(_current, line, _info, attributes); } else if(name == "set") { if(!_current) { _info->errorReporter->descriptorError(" cannot be a top-level element", line); } d = new SetDescriptor(_current, line, _info, attributes); } else if(name == "define") { if(!_current) { _info->errorReporter->descriptorError(" cannot be a top-level element", line); } d = new DefineDescriptor(_current, line, _info, attributes); } else if(name == "add") { if(!_current) { _info->errorReporter->descriptorError(" cannot be a top-level element", line); } d = new AddDescriptor(_current, line, _info, attributes); } else if(name == "remove") { if(!_current) { _info->errorReporter->descriptorError(" cannot be a top-level element", line); } d = new RemoveDescriptor(_current, line, _info, attributes); } else if(name == "delete") { if(!_current) { _info->errorReporter->descriptorError(" cannot be a top-level element", line); } d = new DeleteDescriptor(_current, line, _info, attributes); } else if(name == "fail") { if(!_current) { _info->errorReporter->descriptorError(" cannot be a top-level element", line); } d = new FailDescriptor(_current, line, _info, attributes); } else if(name == "echo") { if(!_current) { _info->errorReporter->descriptorError(" cannot be a top-level element", line); } d = new EchoDescriptor(_current, line, _info, attributes); } else if(name == "if") { if(!_current) { _info->errorReporter->descriptorError(" cannot be a top-level element", line); } d = new IfDescriptor(_current, line, _info, attributes); } else if(name == "iterate") { if(!_current) { _info->errorReporter->descriptorError(" cannot be a top-level element", line); } d = new IterateDescriptor(_current, line, _info, attributes); } else { _info->errorReporter->descriptorError("unknown descriptor `" + name + "'", line); } if(_current) { _current->addChild(d); } _current = d; } void FreezeScript::DescriptorHandler::endElement(const string&, int, int) { assert(_current); _current = _current->parent(); } void FreezeScript::DescriptorHandler::characters(const string&, int, int) { } void FreezeScript::DescriptorHandler::error(const string& msg, int line, int) { _info->errorReporter->descriptorError(msg, line); } FreezeScript::TransformDBDescriptorPtr FreezeScript::DescriptorHandler::descriptor() const { return _descriptor; } // // assignOrTransform // void FreezeScript::assignOrTransform(const DataPtr& dest, const DataPtr& src, bool convert, const TransformInfoPtr& info) { Slice::TypePtr destType = dest->getType(); Slice::TypePtr srcType = src->getType(); Slice::BuiltinPtr b1 = Slice::BuiltinPtr::dynamicCast(destType); Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(srcType); if(!b1 && !b2 && dest->getType()->unit().get() != src->getType()->unit().get()) { TransformVisitor v(src, info); dest->visit(v); } else { AssignVisitor v(src, info->getDataFactory(), info->getErrorReporter(), convert); dest->visit(v); } } void FreezeScript::transformDatabase(const Ice::CommunicatorPtr& communicator, const FreezeScript::ObjectFactoryPtr& objectFactory, const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit, Db* oldDb, Db* newDb, DbTxn* newDbTxn, const Freeze::ConnectionPtr& connection, const string& newDbName, const string& facetName, bool purgeObjects, ostream& errors, bool suppress, istream& is) { TransformInfoIPtr info = new TransformInfoI; info->communicator = communicator; info->objectFactory = objectFactory; info->oldUnit = oldUnit; info->newUnit = newUnit; info->oldDb = oldDb; info->newDb = newDb; info->newDbTxn = newDbTxn; info->connection = connection; info->newDbName = newDbName; info->facet = facetName; info->purge = purgeObjects; info->errorReporter = new ErrorReporter(errors, suppress); info->factory = new TransformDataFactory(communicator, newUnit, info->errorReporter); info->symbolTable = new SymbolTableI(info); try { DescriptorHandler dh(info); IceXML::Parser::parse(is, dh); TransformDBDescriptorPtr descriptor = dh.descriptor(); descriptor->validate(); descriptor->execute(info->symbolTable); } catch(const IceXML::ParserException& ex) { info->errorReporter->error(ex.reason()); } } Ice-3.5.1/cpp/src/FreezeScript/Scanner.cpp0000644000076400007640000016452112223561476016456 0ustar mesmes#include #line 2 "lex.yy.c" #line 4 "lex.yy.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer freeze_script__create_buffer #define yy_delete_buffer freeze_script__delete_buffer #define yy_flex_debug freeze_script__flex_debug #define yy_init_buffer freeze_script__init_buffer #define yy_flush_buffer freeze_script__flush_buffer #define yy_load_buffer_state freeze_script__load_buffer_state #define yy_switch_to_buffer freeze_script__switch_to_buffer #define yyin freeze_script_in #define yyleng freeze_script_leng #define yylex freeze_script_lex #define yylineno freeze_script_lineno #define yyout freeze_script_out #define yyrestart freeze_script_restart #define yytext freeze_script_text #define yywrap freeze_script_wrap #define yyalloc freeze_script_alloc #define yyrealloc freeze_script_realloc #define yyfree freeze_script_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE freeze_script_restart(freeze_script_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int freeze_script_leng; extern FILE *freeze_script_in, *freeze_script_out; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up freeze_script_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up freeze_script_text again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via freeze_script_restart()), so that the user can continue scanning by * just pointing freeze_script_in at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when freeze_script_text is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int freeze_script_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow freeze_script_wrap()'s to do buffer switches * instead of setting up a fresh freeze_script_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void freeze_script_restart (FILE *input_file ); void freeze_script__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE freeze_script__create_buffer (FILE *file,int size ); void freeze_script__delete_buffer (YY_BUFFER_STATE b ); void freeze_script__flush_buffer (YY_BUFFER_STATE b ); void freeze_script_push_buffer_state (YY_BUFFER_STATE new_buffer ); void freeze_script_pop_buffer_state (void ); static void freeze_script_ensure_buffer_stack (void ); static void freeze_script__load_buffer_state (void ); static void freeze_script__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER freeze_script__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE freeze_script__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE freeze_script__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE freeze_script__scan_bytes (yyconst char *bytes,int len ); void *freeze_script_alloc (yy_size_t ); void *freeze_script_realloc (void *,yy_size_t ); void freeze_script_free (void * ); #define yy_new_buffer freeze_script__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ freeze_script_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ freeze_script__create_buffer(freeze_script_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ freeze_script_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ freeze_script__create_buffer(freeze_script_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define freeze_script_wrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *freeze_script_in = (FILE *) 0, *freeze_script_out = (FILE *) 0; typedef int yy_state_type; extern int freeze_script_lineno; int freeze_script_lineno = 1; extern char *freeze_script_text; #define yytext_ptr freeze_script_text static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up freeze_script_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ freeze_script_leng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 26 #define YY_END_OF_BUFFER 27 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[51] = { 0, 0, 0, 27, 25, 8, 8, 25, 4, 19, 5, 20, 21, 17, 15, 16, 25, 18, 6, 6, 25, 9, 25, 10, 3, 22, 23, 14, 0, 6, 6, 7, 2, 1, 7, 6, 0, 0, 24, 11, 13, 12, 3, 0, 7, 0, 7, 6, 0, 7, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 1, 1, 6, 1, 7, 8, 9, 10, 11, 1, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 18, 1, 19, 20, 21, 1, 1, 22, 22, 22, 22, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 1, 27, 1, 25, 1, 22, 22, 22, 22, 28, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 29, 25, 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[30] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 3, 3, 3, 1, 1, 1, 1, 4, 4, 4, 5, 1, 1, 4, 5 } ; static yyconst flex_int16_t yy_base[55] = { 0, 0, 0, 72, 104, 104, 104, 51, 104, 104, 104, 104, 104, 104, 17, 22, 25, 33, 35, 30, 44, 29, 24, 16, 0, 104, 104, 104, 38, 0, 0, 50, 104, 104, 0, 2, 45, 0, 104, 104, 104, 104, 0, 49, 104, 53, 60, 0, 64, 70, 104, 92, 96, 97, 100 } ; static yyconst flex_int16_t yy_def[55] = { 0, 50, 1, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 18, 50, 50, 50, 50, 51, 50, 50, 50, 50, 18, 19, 50, 50, 50, 31, 18, 52, 53, 50, 50, 50, 50, 51, 54, 50, 50, 50, 53, 50, 50, 0, 50, 50, 50, 50 } ; static yyconst flex_int16_t yy_nxt[134] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 24, 24, 24, 25, 26, 24, 24, 28, 50, 29, 30, 30, 28, 41, 29, 30, 30, 31, 31, 31, 32, 40, 30, 30, 33, 34, 39, 35, 35, 30, 31, 31, 31, 45, 45, 36, 50, 48, 48, 38, 36, 37, 31, 31, 31, 46, 46, 46, 27, 50, 43, 44, 46, 46, 46, 43, 49, 49, 49, 50, 50, 44, 49, 49, 49, 50, 50, 50, 50, 50, 50, 44, 42, 42, 42, 46, 46, 47, 47, 49, 49, 3, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50 } ; static yyconst flex_int16_t yy_chk[134] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, 35, 14, 14, 14, 15, 23, 15, 15, 15, 16, 16, 16, 17, 22, 19, 19, 17, 18, 21, 18, 18, 18, 28, 28, 28, 36, 36, 18, 19, 43, 43, 20, 18, 18, 31, 31, 31, 45, 45, 45, 7, 3, 31, 31, 46, 46, 46, 31, 48, 48, 48, 0, 0, 46, 49, 49, 49, 0, 0, 0, 0, 0, 0, 49, 51, 51, 51, 52, 52, 53, 53, 54, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int freeze_script__flex_debug; int freeze_script__flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *freeze_script_text; #line 1 "Scanner.l" #line 2 "Scanner.l" // ********************************************************************** // // 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 // Before Grammar.h, so that YYSTYPE is defined #include #include #include #include #include #if defined(_MSC_VER) && defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // # pragma warning( 4 : 4267 ) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // # pragma warning( 4 : 4244 ) #endif #ifdef _MSC_VER # ifdef freeze_script_wrap # undef freeze_script_wrap # define freeze_script_wrap() 1 # endif # define YY_NO_UNISTD_H #endif #ifdef __SUNPRO_CC # ifdef freeze_script_wrap # undef freeze_script_wrap # define freeze_script_wrap() 1 # endif # ifdef ICE_64 # pragma error_messages(off,truncwarn) # endif #endif using namespace std; using namespace FreezeScript; namespace FreezeScript { typedef map KeywordMap; static KeywordMap keywordMap; void initScanner(); int checkKeyword(const string&); StringTokPtr parseString(char); } #define YY_USER_INIT initScanner(); #define YY_INPUT(buf, result, max_size) { result = getInput(buf, max_size); } #line 585 "lex.yy.c" #define INITIAL 0 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int freeze_script_lex_destroy (void ); int freeze_script_get_debug (void ); void freeze_script_set_debug (int debug_flag ); YY_EXTRA_TYPE freeze_script_get_extra (void ); void freeze_script_set_extra (YY_EXTRA_TYPE user_defined ); FILE *freeze_script_get_in (void ); void freeze_script_set_in (FILE * in_str ); FILE *freeze_script_get_out (void ); void freeze_script_set_out (FILE * out_str ); int freeze_script_get_leng (void ); char *freeze_script_get_text (void ); int freeze_script_get_lineno (void ); void freeze_script_set_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int freeze_script_wrap (void ); #else extern int freeze_script_wrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( freeze_script_text, freeze_script_leng, 1, freeze_script_out )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( freeze_script_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( freeze_script_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, freeze_script_in))==0 && ferror(freeze_script_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(freeze_script_in); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int freeze_script_lex (void); #define YY_DECL int freeze_script_lex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after freeze_script_text and freeze_script_leng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 83 "Scanner.l" #line 770 "lex.yy.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! freeze_script_in ) freeze_script_in = stdin; if ( ! freeze_script_out ) freeze_script_out = stdout; if ( ! YY_CURRENT_BUFFER ) { freeze_script_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = freeze_script__create_buffer(freeze_script_in,YY_BUF_SIZE ); } freeze_script__load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of freeze_script_text. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 51 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_current_state != 50 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 85 "Scanner.l" { // C++-style comment int c; do { c = yyinput(); if(c == '\n') { parseLine++; } } while(c != '\n' && c != EOF); } YY_BREAK case 2: YY_RULE_SETUP #line 99 "Scanner.l" { // C-style comment while(true) { int c = yyinput(); if(c == '\n') { parseLine++; } else if(c == '*') { int next = yyinput(); if(next == '/') { break; } else { unput(next); } } else if(c == EOF) { parseErrorReporter->expressionSyntaxError("EOF in comment"); break; } } } YY_BREAK case 3: YY_RULE_SETUP #line 128 "Scanner.l" { StringTokPtr ident = new StringTok; ident->v = freeze_script_text; *yylvalp = ident; return checkKeyword(ident->v); } YY_BREAK case 4: YY_RULE_SETUP #line 135 "Scanner.l" { StringTokPtr str = parseString('"'); *yylvalp = str; return TOK_STRING_LITERAL; } YY_BREAK case 5: YY_RULE_SETUP #line 141 "Scanner.l" { StringTokPtr str = parseString('\''); *yylvalp = str; return TOK_STRING_LITERAL; } YY_BREAK case 6: YY_RULE_SETUP #line 147 "Scanner.l" { IntegerTokPtr itp = new IntegerTok; *yylvalp = itp; if(!IceUtilInternal::stringToInt64(string(freeze_script_text), itp->v)) { assert(itp->v != 0); string msg = "integer constant `"; msg += freeze_script_text; msg += "' out of range"; parseErrorReporter->expressionSyntaxError(msg); } return TOK_INTEGER_LITERAL; } YY_BREAK case 7: YY_RULE_SETUP #line 161 "Scanner.l" { errno = 0; FloatingTokPtr ftp = new FloatingTok; *yylvalp = ftp; string literal(freeze_script_text); char lastChar = literal[literal.size() - 1]; if(lastChar == 'f' || lastChar == 'F') { literal = literal.substr(0, literal.size() - 1); // Clobber trailing 'f' or 'F' suffix } ftp->v = strtod(literal.c_str(), 0); if((ftp->v == HUGE_VAL || ftp->v == -HUGE_VAL) && errno == ERANGE) { string msg = "floating-point constant `"; msg += freeze_script_text; msg += "' too large (overflow)"; parseErrorReporter->expressionSyntaxError(msg); } else if(ftp->v == 0 && errno == ERANGE) { string msg = "floating-point constant `"; msg += freeze_script_text; msg += "' too small (underflow)"; parseErrorReporter->expressionSyntaxError(msg); } return TOK_FLOATING_POINT_LITERAL; } YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP #line 189 "Scanner.l" { // Igore white-space if(freeze_script_text[0] == '\n') { parseLine++; } } YY_BREAK case 9: YY_RULE_SETUP #line 198 "Scanner.l" return TOK_LESS_THAN; YY_BREAK case 10: YY_RULE_SETUP #line 199 "Scanner.l" return TOK_GREATER_THAN; YY_BREAK case 11: YY_RULE_SETUP #line 200 "Scanner.l" return TOK_LESS_EQUAL; YY_BREAK case 12: YY_RULE_SETUP #line 201 "Scanner.l" return TOK_GREATER_EQUAL; YY_BREAK case 13: YY_RULE_SETUP #line 202 "Scanner.l" return TOK_EQUAL; YY_BREAK case 14: YY_RULE_SETUP #line 203 "Scanner.l" return TOK_NEQ; YY_BREAK case 15: YY_RULE_SETUP #line 204 "Scanner.l" return TOK_ADD; YY_BREAK case 16: YY_RULE_SETUP #line 205 "Scanner.l" return TOK_SUB; YY_BREAK case 17: YY_RULE_SETUP #line 206 "Scanner.l" return TOK_MUL; YY_BREAK case 18: YY_RULE_SETUP #line 207 "Scanner.l" return TOK_DIV; YY_BREAK case 19: YY_RULE_SETUP #line 208 "Scanner.l" return TOK_MOD; YY_BREAK case 20: YY_RULE_SETUP #line 209 "Scanner.l" return TOK_LPAREN; YY_BREAK case 21: YY_RULE_SETUP #line 210 "Scanner.l" return TOK_RPAREN; YY_BREAK case 22: YY_RULE_SETUP #line 211 "Scanner.l" return TOK_LBRACKET; YY_BREAK case 23: YY_RULE_SETUP #line 212 "Scanner.l" return TOK_RBRACKET; YY_BREAK case 24: YY_RULE_SETUP #line 213 "Scanner.l" return TOK_SCOPE_DELIMITER; YY_BREAK case 25: YY_RULE_SETUP #line 215 "Scanner.l" { return freeze_script_text[0]; } YY_BREAK case 26: YY_RULE_SETUP #line 219 "Scanner.l" ECHO; YY_BREAK #line 1079 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed freeze_script_in at a new source and called * freeze_script_lex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = freeze_script_in; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( freeze_script_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * freeze_script_text, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of freeze_script_lex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ freeze_script_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; freeze_script_restart(freeze_script_in ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) freeze_script_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 51 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 51 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 50); return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up freeze_script_text */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ freeze_script_restart(freeze_script_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( freeze_script_wrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve freeze_script_text */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void freeze_script_restart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ freeze_script_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = freeze_script__create_buffer(freeze_script_in,YY_BUF_SIZE ); } freeze_script__init_buffer(YY_CURRENT_BUFFER,input_file ); freeze_script__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void freeze_script__switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * freeze_script_pop_buffer_state(); * freeze_script_push_buffer_state(new_buffer); */ freeze_script_ensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; freeze_script__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (freeze_script_wrap()) processing, but the only time this flag * is looked at is after freeze_script_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void freeze_script__load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; freeze_script_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE freeze_script__create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) freeze_script_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in freeze_script__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) freeze_script_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in freeze_script__create_buffer()" ); b->yy_is_our_buffer = 1; freeze_script__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with freeze_script__create_buffer() * */ void freeze_script__delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) freeze_script_free((void *) b->yy_ch_buf ); freeze_script_free((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a freeze_script_restart() or at EOF. */ static void freeze_script__init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; freeze_script__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then freeze_script__init_buffer was _probably_ * called from freeze_script_restart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void freeze_script__flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) freeze_script__load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void freeze_script_push_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; freeze_script_ensure_buffer_stack(); /* This block is copied from freeze_script__switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from freeze_script__switch_to_buffer. */ freeze_script__load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void freeze_script_pop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; freeze_script__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { freeze_script__load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void freeze_script_ensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)freeze_script_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in freeze_script_ensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)freeze_script_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in freeze_script_ensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE freeze_script__scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) freeze_script_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in freeze_script__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; freeze_script__switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to freeze_script_lex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * freeze_script__scan_bytes() instead. */ YY_BUFFER_STATE freeze_script__scan_string (yyconst char * yystr ) { return freeze_script__scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to freeze_script_lex() will * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE freeze_script__scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) freeze_script_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in freeze_script__scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = freeze_script__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in freeze_script__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up freeze_script_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ freeze_script_text[freeze_script_leng] = (yy_hold_char); \ (yy_c_buf_p) = freeze_script_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ freeze_script_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int freeze_script_get_lineno (void) { return freeze_script_lineno; } /** Get the input stream. * */ FILE *freeze_script_get_in (void) { return freeze_script_in; } /** Get the output stream. * */ FILE *freeze_script_get_out (void) { return freeze_script_out; } /** Get the length of the current token. * */ int freeze_script_get_leng (void) { return freeze_script_leng; } /** Get the current token. * */ char *freeze_script_get_text (void) { return freeze_script_text; } /** Set the current line number. * @param line_number * */ void freeze_script_set_lineno (int line_number ) { freeze_script_lineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see freeze_script__switch_to_buffer */ void freeze_script_set_in (FILE * in_str ) { freeze_script_in = in_str ; } void freeze_script_set_out (FILE * out_str ) { freeze_script_out = out_str ; } int freeze_script_get_debug (void) { return freeze_script__flex_debug; } void freeze_script_set_debug (int bdebug ) { freeze_script__flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from freeze_script_lex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT freeze_script_in = stdin; freeze_script_out = stdout; #else freeze_script_in = (FILE *) 0; freeze_script_out = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * freeze_script_lex_init() */ return 0; } /* freeze_script_lex_destroy is for both reentrant and non-reentrant scanners. */ int freeze_script_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ freeze_script__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; freeze_script_pop_buffer_state(); } /* Destroy the stack itself. */ freeze_script_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * freeze_script_lex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *freeze_script_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *freeze_script_realloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void freeze_script_free (void * ptr ) { free( (char *) ptr ); /* see freeze_script_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 219 "Scanner.l" namespace FreezeScript { void initScanner() { keywordMap["true"] = TOK_TRUE; keywordMap["false"] = TOK_FALSE; keywordMap["and"] = TOK_AND; keywordMap["or"] = TOK_OR; keywordMap["not"] = TOK_NOT; keywordMap["nil"] = TOK_NIL; } int checkKeyword(const string& id) { KeywordMap::const_iterator pos = keywordMap.find(id); if(pos != keywordMap.end()) { return pos->second; } return TOK_IDENTIFIER; } StringTokPtr parseString(char start) { StringTokPtr str = new StringTok; while(true) { char c = static_cast(yyinput()); if(c == start) { break; } else if(c == EOF) { parseErrorReporter->expressionSyntaxError("EOF in string"); break; } else if(c == '\n') { parseErrorReporter->expressionSyntaxError("newline in string"); } else if(c == '\\') { char next = static_cast(yyinput()); switch(next) { case '\\': case '"': case '\'': { str->v += next; break; } case 'n': { str->v += '\n'; break; } case 'r': { str->v += '\r'; break; } case 't': { str->v += '\t'; break; } case 'v': { str->v += '\v'; break; } case 'f': { str->v += '\f'; break; } case 'a': { str->v += '\a'; break; } case 'b': { str->v += '\b'; break; } case '?': { str->v += '\?'; break; } case '0': case '1': case '2': case '3': { static string octalDigits = "01234567"; unsigned short us = next - '0'; if(octalDigits.find_first_of(next = static_cast(yyinput())) != string::npos) { us = us * 8 + next - '0'; if(octalDigits.find_first_of(next = static_cast(yyinput())) != string::npos) { us = us * 8 + next - '0'; } else { unput(next); } } else { unput(next); } str->v += static_cast(us); break; } case 'x': { IceUtil::Int64 ull = 0; while(isxdigit(static_cast(next = static_cast(yyinput())))) { ull *= 16; if(isdigit(static_cast(next))) { ull += next - '0'; } else if(islower(static_cast(next))) { ull += next - 'a' + 10; } else { ull += next - 'A' + 10; } } unput(next); str->v += static_cast(ull); break; } // TODO: add universal character names default: { str->v += c; unput(next); } } } else { str->v += c; } } return str; } } // End of namespace FreezeScript Ice-3.5.1/cpp/src/FreezeScript/Error.h0000644000076400007640000000326012223561476015613 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_ERROR_H #define FREEZE_SCRIPT_ERROR_H #include namespace FreezeScript { class ErrorReporter : public IceUtil::SimpleShared { public: ErrorReporter(std::ostream&, bool); std::ostream& stream() const; void warning(const std::string&); void error(const std::string&); void typeMismatchError(const Slice::TypePtr&, const Slice::TypePtr&, bool); void conversionError(const std::string&, const Slice::TypePtr&, bool); void rangeError(const std::string&, const Slice::TypePtr&, bool); void expressionSyntaxError(const std::string&); void descriptorError(const std::string&, int); void setDescriptor(const std::string&, int); void getDescriptor(std::string&, int&); void clearDescriptor(); void setExpression(const std::string&); void clearExpression(); private: std::ostream& _out; bool _suppress; std::map _warningHistory; std::string _descName; int _descLine; std::string _expression; }; typedef IceUtil::Handle ErrorReporterPtr; class DescriptorErrorContext { public: DescriptorErrorContext(const ErrorReporterPtr&, const std::string&, int); ~DescriptorErrorContext(); private: ErrorReporterPtr _errorReporter; std::string _name; int _line; }; } // End of namespace FreezeScript #endif Ice-3.5.1/cpp/src/FreezeScript/Transformer.h0000644000076400007640000000171412223561476017026 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_TRANSFORMER_H #define FREEZE_SCRIPT_TRANSFORMER_H #include #include #include #include class Db; class DbTxn; namespace FreezeScript { void transformDatabase(const Ice::CommunicatorPtr&, const FreezeScript::ObjectFactoryPtr& objectFactory, const Slice::UnitPtr&, const Slice::UnitPtr&, Db*, Db*, DbTxn*, const Freeze::ConnectionPtr&, const std::string&, const std::string&, bool, std::ostream&, bool, std::istream&); } // End of namespace FreezeScript #endif Ice-3.5.1/cpp/src/FreezeScript/Print.h0000644000076400007640000000104712223561476015617 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_PRINT_H #define FREEZE_SCRIPT_PRINT_H #include namespace FreezeScript { void printData(const DataPtr&, std::ostream&); } // End of namespace FreezeScript #endif Ice-3.5.1/cpp/src/FreezeScript/.depend0000644000076400007640000014750612223561476015625 0ustar mesmesGrammar$(OBJEXT): ../FreezeScript/Grammar.cpp ../FreezeScript/GrammarUtil.h ../FreezeScript/Parser.h ../FreezeScript/Data.h $(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 $(includedir)/Slice/Parser.h ../FreezeScript/Error.h Scanner$(OBJEXT): Scanner.cpp $(includedir)/IceUtil/ScannerConfig.h $(includedir)/IceUtil/Config.h ../FreezeScript/GrammarUtil.h ../FreezeScript/Parser.h ../FreezeScript/Data.h $(includedir)/Ice/Ice.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 $(includedir)/Slice/Parser.h ../FreezeScript/Error.h ../FreezeScript/Grammar.h $(includedir)/IceUtil/InputUtil.h AssignVisitor$(OBJEXT): AssignVisitor.cpp ../FreezeScript/AssignVisitor.h ../FreezeScript/Data.h $(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 $(includedir)/Slice/Parser.h ../FreezeScript/Error.h ../FreezeScript/Util.h $(includedir)/Freeze/CatalogData.h Data$(OBJEXT): Data.cpp $(includedir)/IceUtil/DisableWarnings.h ../FreezeScript/Data.h $(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 $(includedir)/Slice/Parser.h ../FreezeScript/Error.h ../FreezeScript/Util.h $(includedir)/Freeze/CatalogData.h ../FreezeScript/Exception.h $(includedir)/IceUtil/InputUtil.h Error$(OBJEXT): Error.cpp ../FreezeScript/Error.h $(includedir)/Slice/Parser.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h ../FreezeScript/Exception.h ../FreezeScript/Util.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/Freeze/CatalogData.h Functions$(OBJEXT): Functions.cpp ../FreezeScript/Functions.h ../FreezeScript/Data.h $(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 $(includedir)/Slice/Parser.h ../FreezeScript/Error.h ../FreezeScript/Util.h $(includedir)/Freeze/CatalogData.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/StringUtil.h Exception$(OBJEXT): Exception.cpp ../FreezeScript/Exception.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Config.h Parser$(OBJEXT): Parser.cpp ../FreezeScript/Parser.h ../FreezeScript/Data.h $(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 $(includedir)/Slice/Parser.h ../FreezeScript/Error.h ../FreezeScript/GrammarUtil.h $(includedir)/IceUtil/MutexPtrLock.h Print$(OBJEXT): Print.cpp ../FreezeScript/Print.h ../FreezeScript/Data.h $(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 $(includedir)/Slice/Parser.h ../FreezeScript/Error.h ../FreezeScript/Util.h $(includedir)/Freeze/CatalogData.h $(includedir)/IceUtil/OutputUtil.h Util$(OBJEXT): Util.cpp ../FreezeScript/Util.h $(includedir)/Slice/Parser.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/Freeze/CatalogData.h ../FreezeScript/Exception.h $(includedir)/Freeze/Catalog.h $(includedir)/Freeze/Map.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.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 $(includedir)/Freeze/DB.h $(includedir)/Freeze/Exception.h $(includedir)/Freeze/Connection.h $(includedir)/Freeze/Transaction.h $(includedir)/Freeze/Initialize.h $(includedir)/Freeze/EvictorF.h $(includedir)/Freeze/ConnectionF.h $(includedir)/Freeze/Index.h $(includedir)/Slice/Preprocessor.h TransformAnalyzer$(OBJEXT): TransformAnalyzer.cpp ../FreezeScript/TransformAnalyzer.h $(includedir)/Slice/Parser.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/OutputUtil.h ../FreezeScript/Util.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/Freeze/CatalogData.h TransformVisitor$(OBJEXT): TransformVisitor.cpp ../FreezeScript/TransformVisitor.h ../FreezeScript/Data.h $(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 $(includedir)/Slice/Parser.h ../FreezeScript/Error.h ../FreezeScript/Util.h $(includedir)/Freeze/CatalogData.h $(includedir)/IceUtil/InputUtil.h Transformer$(OBJEXT): Transformer.cpp ../FreezeScript/Transformer.h $(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 $(includedir)/Slice/Parser.h $(includedir)/Freeze/Connection.h $(includedir)/Freeze/Transaction.h ../FreezeScript/Data.h ../FreezeScript/Error.h ../FreezeScript/Parser.h ../FreezeScript/TransformVisitor.h ../FreezeScript/AssignVisitor.h ../FreezeScript/Print.h ../FreezeScript/Functions.h ../FreezeScript/Exception.h ../FreezeScript/Util.h $(includedir)/Freeze/CatalogData.h $(includedir)/Freeze/Catalog.h $(includedir)/Freeze/Map.h $(includedir)/Freeze/DB.h $(includedir)/Freeze/Exception.h $(includedir)/Freeze/Initialize.h $(includedir)/Freeze/EvictorF.h $(includedir)/Freeze/ConnectionF.h $(includedir)/Freeze/Index.h $(includedir)/IceXML/Parser.h $(includedir)/IceUtil/InputUtil.h transformdb$(OBJEXT): transformdb.cpp ../FreezeScript/Transformer.h $(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 $(includedir)/Slice/Parser.h $(includedir)/Freeze/Connection.h $(includedir)/Freeze/Transaction.h ../FreezeScript/Data.h ../FreezeScript/Error.h ../FreezeScript/TransformAnalyzer.h $(includedir)/IceUtil/OutputUtil.h ../FreezeScript/Exception.h ../FreezeScript/Util.h $(includedir)/Freeze/CatalogData.h $(includedir)/Freeze/Initialize.h $(includedir)/Freeze/EvictorF.h $(includedir)/Freeze/ConnectionF.h $(includedir)/Freeze/Index.h $(includedir)/Freeze/DB.h $(includedir)/Freeze/Catalog.h $(includedir)/Freeze/Map.h $(includedir)/Freeze/Exception.h $(includedir)/IceUtil/Options.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/FileUtil.h DumpDescriptors$(OBJEXT): DumpDescriptors.cpp ../FreezeScript/DumpDescriptors.h ../FreezeScript/Parser.h ../FreezeScript/Data.h $(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 $(includedir)/Slice/Parser.h ../FreezeScript/Error.h $(includedir)/IceXML/Parser.h ../FreezeScript/AssignVisitor.h ../FreezeScript/Print.h ../FreezeScript/Functions.h ../FreezeScript/Exception.h ../FreezeScript/Util.h $(includedir)/Freeze/CatalogData.h $(includedir)/IceUtil/InputUtil.h DumpDB$(OBJEXT): DumpDB.cpp ../FreezeScript/DumpDescriptors.h ../FreezeScript/Parser.h ../FreezeScript/Data.h $(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 $(includedir)/Slice/Parser.h ../FreezeScript/Error.h $(includedir)/IceXML/Parser.h ../FreezeScript/Util.h $(includedir)/Freeze/CatalogData.h ../FreezeScript/Exception.h $(includedir)/Freeze/Initialize.h $(includedir)/Freeze/EvictorF.h $(includedir)/Freeze/ConnectionF.h $(includedir)/Freeze/Index.h $(includedir)/Freeze/DB.h $(includedir)/Freeze/Transaction.h $(includedir)/Freeze/Connection.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceUtil/Options.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/FileUtil.h Ice-3.5.1/cpp/src/FreezeScript/Scanner.l0000644000076400007640000002241712223561476016124 0ustar mesmes%{ // ********************************************************************** // // 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 // Before Grammar.h, so that YYSTYPE is defined #include #include #include #include #include #if defined(_MSC_VER) && defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // # pragma warning( 4 : 4267 ) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // # pragma warning( 4 : 4244 ) #endif #ifdef _MSC_VER # ifdef freeze_script_wrap # undef freeze_script_wrap # define freeze_script_wrap() 1 # endif # define YY_NO_UNISTD_H #endif #ifdef __SUNPRO_CC # ifdef freeze_script_wrap # undef freeze_script_wrap # define freeze_script_wrap() 1 # endif # ifdef ICE_64 # pragma error_messages(off,truncwarn) # endif #endif using namespace std; using namespace FreezeScript; namespace FreezeScript { typedef map KeywordMap; static KeywordMap keywordMap; void initScanner(); int checkKeyword(const string&); StringTokPtr parseString(char); } #define YY_USER_INIT initScanner(); #define YY_INPUT(buf, result, max_size) { result = getInput(buf, max_size); } %} %option noyywrap %option never-interactive %option prefix="freeze_script_" %option outfile="lex.yy.c" identifier [[:alpha:]_][[:alnum:]_]* integer_constant (\+|-)?((0[0-7]+)|(0x[[:xdigit:]]+)|([[:digit:]]+)) fractional_constant (\+|-)?(([[:digit:]]*\.[[:digit:]]+)|([[:digit:]]+\.)) exponent_part (e|E)(\+|-)?[[:digit:]]+ floating_literal (({fractional_constant}{exponent_part}?)|((\+|-)?[[:digit:]]+{exponent_part}))[fF]? %% "//" { // C++-style comment int c; do { c = yyinput(); if(c == '\n') { parseLine++; } } while(c != '\n' && c != EOF); } "/*" { // C-style comment while(true) { int c = yyinput(); if(c == '\n') { parseLine++; } else if(c == '*') { int next = yyinput(); if(next == '/') { break; } else { unput(next); } } else if(c == EOF) { parseErrorReporter->expressionSyntaxError("EOF in comment"); break; } } } {identifier} { StringTokPtr ident = new StringTok; ident->v = yytext; *yylvalp = ident; return checkKeyword(ident->v); } \" { StringTokPtr str = parseString('"'); *yylvalp = str; return TOK_STRING_LITERAL; } \' { StringTokPtr str = parseString('\''); *yylvalp = str; return TOK_STRING_LITERAL; } {integer_constant} { IntegerTokPtr itp = new IntegerTok; *yylvalp = itp; if(!IceUtilInternal::stringToInt64(string(yytext), itp->v)) { assert(itp->v != 0); string msg = "integer constant `"; msg += yytext; msg += "' out of range"; parseErrorReporter->expressionSyntaxError(msg); } return TOK_INTEGER_LITERAL; } {floating_literal} { errno = 0; FloatingTokPtr ftp = new FloatingTok; *yylvalp = ftp; string literal(yytext); char lastChar = literal[literal.size() - 1]; if(lastChar == 'f' || lastChar == 'F') { literal = literal.substr(0, literal.size() - 1); // Clobber trailing 'f' or 'F' suffix } ftp->v = strtod(literal.c_str(), 0); if((ftp->v == HUGE_VAL || ftp->v == -HUGE_VAL) && errno == ERANGE) { string msg = "floating-point constant `"; msg += yytext; msg += "' too large (overflow)"; parseErrorReporter->expressionSyntaxError(msg); } else if(ftp->v == 0 && errno == ERANGE) { string msg = "floating-point constant `"; msg += yytext; msg += "' too small (underflow)"; parseErrorReporter->expressionSyntaxError(msg); } return TOK_FLOATING_POINT_LITERAL; } [[:space:]] { // Igore white-space if(yytext[0] == '\n') { parseLine++; } } "<" return TOK_LESS_THAN; ">" return TOK_GREATER_THAN; "<=" return TOK_LESS_EQUAL; ">=" return TOK_GREATER_EQUAL; "==" return TOK_EQUAL; "!=" return TOK_NEQ; "+" return TOK_ADD; "-" return TOK_SUB; "*" return TOK_MUL; "/" return TOK_DIV; "%" return TOK_MOD; "(" return TOK_LPAREN; ")" return TOK_RPAREN; "[" return TOK_LBRACKET; "]" return TOK_RBRACKET; "::" return TOK_SCOPE_DELIMITER; . { return yytext[0]; } %% namespace FreezeScript { void initScanner() { keywordMap["true"] = TOK_TRUE; keywordMap["false"] = TOK_FALSE; keywordMap["and"] = TOK_AND; keywordMap["or"] = TOK_OR; keywordMap["not"] = TOK_NOT; keywordMap["nil"] = TOK_NIL; } int checkKeyword(const string& id) { KeywordMap::const_iterator pos = keywordMap.find(id); if(pos != keywordMap.end()) { return pos->second; } return TOK_IDENTIFIER; } StringTokPtr parseString(char start) { StringTokPtr str = new StringTok; while(true) { char c = static_cast(yyinput()); if(c == start) { break; } else if(c == EOF) { parseErrorReporter->expressionSyntaxError("EOF in string"); break; } else if(c == '\n') { parseErrorReporter->expressionSyntaxError("newline in string"); } else if(c == '\\') { char next = static_cast(yyinput()); switch(next) { case '\\': case '"': case '\'': { str->v += next; break; } case 'n': { str->v += '\n'; break; } case 'r': { str->v += '\r'; break; } case 't': { str->v += '\t'; break; } case 'v': { str->v += '\v'; break; } case 'f': { str->v += '\f'; break; } case 'a': { str->v += '\a'; break; } case 'b': { str->v += '\b'; break; } case '?': { str->v += '\?'; break; } case '0': case '1': case '2': case '3': { static string octalDigits = "01234567"; unsigned short us = next - '0'; if(octalDigits.find_first_of(next = static_cast(yyinput())) != string::npos) { us = us * 8 + next - '0'; if(octalDigits.find_first_of(next = static_cast(yyinput())) != string::npos) { us = us * 8 + next - '0'; } else { unput(next); } } else { unput(next); } str->v += static_cast(us); break; } case 'x': { IceUtil::Int64 ull = 0; while(isxdigit(static_cast(next = static_cast(yyinput())))) { ull *= 16; if(isdigit(static_cast(next))) { ull += next - '0'; } else if(islower(static_cast(next))) { ull += next - 'a' + 10; } else { ull += next - 'A' + 10; } } unput(next); str->v += static_cast(ull); break; } // TODO: add universal character names default: { str->v += c; unput(next); } } } else { str->v += c; } } return str; } } // End of namespace FreezeScript Ice-3.5.1/cpp/src/FreezeScript/Util.cpp0000644000076400007640000001570112223561476015775 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include using namespace std; using namespace Slice; string FreezeScript::typeToString(const TypePtr& type) { BuiltinPtr b = BuiltinPtr::dynamicCast(type); ContainedPtr c = ContainedPtr::dynamicCast(type); if(b) { return b->kindAsString(); } else if(c) { return c->scoped(); } else { ProxyPtr p = ProxyPtr::dynamicCast(type); assert(p); return p->_class()->scoped() + "*"; } } bool FreezeScript::ignoreType(const string& type) { // // Suppress descriptors for the following pre-defined types. Must be kept in ascending alphabetical order. // static const string ignoreTypeList[] = { "::Freeze::ObjectRecord", "::Freeze::Statistics", "::Ice::Identity" }; return binary_search(&ignoreTypeList[0], &ignoreTypeList[sizeof(ignoreTypeList) / sizeof(*ignoreTypeList)], type); } void FreezeScript::createEvictorSliceTypes(const Slice::UnitPtr& u) { Slice::TypeList l; Slice::ContainedList c; // // Create the Ice module if necessary. // c = u->lookupContained("Ice", false); Slice::ModulePtr ice; if(c.empty()) { ice = u->createModule("Ice"); } else { ice = Slice::ModulePtr::dynamicCast(c.front()); if(!ice) { throw FailureException(__FILE__, __LINE__, "the symbol `::Ice' is defined in Slice but is not a module"); } } // // Create the Slice definition for Ice::Identity if it doesn't exist. // string scoped = "::Ice::Identity"; l = u->lookupTypeNoBuiltin(scoped, false); Slice::StructPtr identity; if(l.empty()) { identity = ice->createStruct("Identity", false); Slice::TypePtr str = u->builtin(Slice::Builtin::KindString); identity->createDataMember("name", str, false, 0, 0, "", ""); identity->createDataMember("category", str, false, 0, 0, "", ""); } else { identity = Slice::StructPtr::dynamicCast(l.front()); if(!identity) { throw FailureException(__FILE__, __LINE__, "the symbol `::Ice::Identity' is defined in Slice but is not a struct"); } } // // Create the Freeze module if necessary. // c = u->lookupContained("Freeze", false); Slice::ModulePtr freeze; if(c.empty()) { freeze = u->createModule("Freeze"); } else { freeze = Slice::ModulePtr::dynamicCast(c.front()); if(!freeze) { throw FailureException(__FILE__, __LINE__, "the symbol `::Freeze' is defined in Slice but is not a module"); } } // // Create the Slice definition for Freeze::Statistics if it doesn't exist. // scoped = "::Freeze::Statistics"; l = u->lookupTypeNoBuiltin(scoped, false); Slice::StructPtr stats; if(l.empty()) { stats = freeze->createStruct("Statistics", false); Slice::TypePtr tl = u->builtin(Slice::Builtin::KindLong); stats->createDataMember("creationTime", tl, false, 0, 0, "", ""); stats->createDataMember("lastSaveTime", tl, false, 0, 0, "", ""); stats->createDataMember("avgSaveTime", tl, false, 0, 0, "", ""); } else { stats = Slice::StructPtr::dynamicCast(l.front()); if(!stats) { throw FailureException(__FILE__, __LINE__, "the symbol `::Freeze::Statistics' is defined in " "Slice but is not a struct"); } } // // Create the Slice definition for Freeze::ObjectRecord if it doesn't exist. // scoped = "::Freeze::ObjectRecord"; l = u->lookupTypeNoBuiltin(scoped, false); if(l.empty()) { Slice::StructPtr rec = freeze->createStruct("ObjectRecord", false); Slice::TypePtr obj = u->builtin(Slice::Builtin::KindObject); rec->createDataMember("servant", obj, false, 0, 0, "", ""); rec->createDataMember("stats", stats, false, 0, 0, "", ""); } else { if(!Slice::StructPtr::dynamicCast(l.front())) { throw FailureException(__FILE__, __LINE__, "the symbol `::Freeze::ObjectRecord' is defined in " "Slice but is not a struct"); } } } bool FreezeScript::parseSlice(const string& n, const Slice::UnitPtr& u, const vector& files, const vector& cppArgs, bool debug, const std::string& extraArgs) { // // Parse the Slice files. // for(vector::const_iterator p = files.begin(); p != files.end(); ++p) { PreprocessorPtr icecpp = Preprocessor::create(n, *p, cppArgs); FILE* cppHandle = icecpp->preprocess(false, extraArgs); if(cppHandle == 0) { return false; } int status = u->parse(*p, cppHandle, debug); if(!icecpp->close()) { return false; } if(status != EXIT_SUCCESS) { return false; } } u->mergeModules(); return true; } FreezeScript::CatalogDataMap FreezeScript::readCatalog(const Ice::CommunicatorPtr& communicator, const string& dbEnvName) { CatalogDataMap result; DbEnv dbEnv(0); try { #ifdef _WIN32 // // Berkeley DB may use a different C++ runtime. // dbEnv.set_alloc(::malloc, ::realloc, ::free); #endif // // Open the database environment. // { u_int32_t flags = DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_MPOOL; dbEnv.open(dbEnvName.c_str(), flags, 0); } Freeze::ConnectionPtr connection = Freeze::createConnection(communicator, dbEnvName, dbEnv); Freeze::Catalog catalog(connection, Freeze::catalogName()); for(Freeze::Catalog::const_iterator p = catalog.begin(); p != catalog.end(); ++p) { result.insert(make_pair(p->first, p->second)); } } catch(const DbException& ex) { dbEnv.close(0); throw FailureException(__FILE__, __LINE__, string("database error: ") + ex.what()); } catch(const IceUtil::FileLockException&) { dbEnv.close(0); throw FailureException(__FILE__, __LINE__, "environment `" + dbEnvName + "' is locked"); } catch(...) { dbEnv.close(0); throw; } dbEnv.close(0); return result; } Ice-3.5.1/cpp/src/FreezeScript/AssignVisitor.h0000644000076400007640000000351012223561476017324 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_ASSIGN_VISITOR_H #define FREEZE_SCRIPT_ASSIGN_VISITOR_H #include namespace FreezeScript { class AssignVisitor : public DataVisitor { public: AssignVisitor(const DataPtr&, const DataFactoryPtr&, const ErrorReporterPtr&, bool, const std::string& = std::string()); virtual void visitBoolean(const BooleanDataPtr&); virtual void visitInteger(const IntegerDataPtr&); virtual void visitDouble(const DoubleDataPtr&); virtual void visitString(const StringDataPtr&); virtual void visitProxy(const ProxyDataPtr&); virtual void visitStruct(const StructDataPtr&); virtual void visitSequence(const SequenceDataPtr&); virtual void visitEnum(const EnumDataPtr&); virtual void visitDictionary(const DictionaryDataPtr&); virtual void visitObject(const ObjectRefPtr&); private: bool isCompatible(const Slice::TypePtr&, const Slice::TypePtr&); bool checkClasses(const Slice::ClassDeclPtr&, const Slice::ClassDeclPtr&); void typeMismatchError(const Slice::TypePtr&, const Slice::TypePtr&); void conversionError(const Slice::TypePtr&, const Slice::TypePtr&, const std::string&); void rangeError(const std::string&, const Slice::TypePtr&); void error(const std::string&); DataPtr _src; DataFactoryPtr _factory; ErrorReporterPtr _errorReporter; bool _convert; std::string _context; // Provides additional detail for use in warning messages. }; } // End of namespace FreezeScript #endif Ice-3.5.1/cpp/src/FreezeScript/Parser.h0000644000076400007640000001164412223561476015763 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_PARSER_H #define FREEZE_SCRIPT_PARSER_H #include namespace FreezeScript { class SymbolTable; typedef IceUtil::Handle SymbolTablePtr; class Node; typedef IceUtil::Handle NodePtr; typedef std::vector NodeList; class EntityNode; typedef IceUtil::Handle EntityNodePtr; // // parseExpression parses the given expression and returns the root node of the parse tree. // NodePtr parseExpression(const std::string&, const DataFactoryPtr&, const ErrorReporterPtr&); // // EvaluateException is raised by Node::evaluate(). // class EvaluateException : public IceUtil::Exception { public: EvaluateException(const char*, int, const std::string&); virtual ~EvaluateException() throw(); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual EvaluateException* ice_clone() const; virtual void ice_throw() const; std::string reason() const; private: std::string _reason; static const char* _name; }; // // SymbolTable is an interface for the lookup operations required by node evaluation. // class SymbolTable : public IceUtil::SimpleShared { public: virtual ~SymbolTable(); virtual void add(const std::string&, const DataPtr&) = 0; virtual DataPtr getValue(const EntityNodePtr&) const = 0; virtual DataPtr getConstantValue(const std::string&) const = 0; virtual SymbolTablePtr createChild() = 0; virtual Slice::TypePtr lookupType(const std::string&) = 0; virtual DataPtr invokeFunction(const std::string&, const DataPtr&, const DataList&) = 0; }; class Node : public IceUtil::SimpleShared { public: virtual ~Node(); virtual DataPtr evaluate(const SymbolTablePtr&) = 0; virtual void print(std::ostream&) const = 0; }; enum BinaryOperator { BinOpOr, BinOpAnd, BinOpMul, BinOpDiv, BinOpMod, BinOpAdd, BinOpSub, BinOpLess, BinOpGreater, BinOpLessEq, BinOpGrEq, BinOpEq, BinOpNotEq }; class BinaryNode : public Node { public: BinaryNode(BinaryOperator, const DataFactoryPtr&, const NodePtr&, const NodePtr&); virtual DataPtr evaluate(const SymbolTablePtr&); virtual void print(std::ostream&) const; private: static std::string opToString(BinaryOperator); BinaryOperator _op; DataFactoryPtr _factory; NodePtr _left; NodePtr _right; }; enum UnaryOperator { UnaryOpNeg, UnaryOpNot }; class UnaryNode : public Node { public: UnaryNode(UnaryOperator, const DataFactoryPtr&, const NodePtr&); virtual DataPtr evaluate(const SymbolTablePtr&); virtual void print(std::ostream&) const; private: static std::string opToString(UnaryOperator); UnaryOperator _op; DataFactoryPtr _factory; NodePtr _right; }; class DataNode : public Node { public: DataNode(const DataPtr&); virtual DataPtr evaluate(const SymbolTablePtr&); virtual void print(std::ostream&) const; private: DataPtr _data; }; class EntityNodeVisitor { public: virtual ~EntityNodeVisitor(); virtual void visitIdentifier(const std::string&) = 0; virtual void visitElement(const NodePtr&) = 0; }; class EntityNode : public Node { public: virtual DataPtr evaluate(const SymbolTablePtr&); virtual void print(std::ostream&) const; virtual void visit(EntityNodeVisitor&) const = 0; void append(const EntityNodePtr&); protected: EntityNodePtr _next; }; class IdentNode : public EntityNode { public: IdentNode(const std::string&); virtual void visit(EntityNodeVisitor&) const; std::string getValue() const; private: std::string _value; }; typedef IceUtil::Handle IdentNodePtr; class ElementNode : public EntityNode { public: ElementNode(const NodePtr&); virtual void visit(EntityNodeVisitor&) const; NodePtr getValue() const; private: NodePtr _value; }; typedef IceUtil::Handle ElementNodePtr; class FunctionNode : public Node { public: FunctionNode(const std::string&, const NodeList&); virtual DataPtr evaluate(const SymbolTablePtr&); virtual void print(std::ostream&) const; void setTarget(const EntityNodePtr&); private: std::string _name; NodeList _args; EntityNodePtr _target; }; typedef IceUtil::Handle FunctionNodePtr; class ConstantNode : public Node { public: ConstantNode(const std::string&); virtual DataPtr evaluate(const SymbolTablePtr&); virtual void print(std::ostream&) const; private: std::string _value; }; } // End of namespace FreezeScript std::ostream& operator<<(std::ostream&, const FreezeScript::EntityNodePtr&); #endif Ice-3.5.1/cpp/src/FreezeScript/DumpDB.cpp0000644000076400007640000006732512223561476016204 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace IceUtil; using namespace IceUtilInternal; #ifdef _WIN32 # define FREEZE_SCRIPT_DB_MODE 0 #else # define FREEZE_SCRIPT_DB_MODE (S_IRUSR | S_IWUSR) #endif namespace FreezeScript { // // SliceVisitor generates default descriptors. // class SliceVisitor : public Slice::ParserVisitor { public: SliceVisitor(IceUtilInternal::XMLOutput&, const Slice::TypePtr&, const Slice::TypePtr&, const string&); virtual bool visitClassDefStart(const Slice::ClassDefPtr&); virtual bool visitStructStart(const Slice::StructPtr&); virtual void visitSequence(const Slice::SequencePtr&); virtual void visitDictionary(const Slice::DictionaryPtr&); virtual void visitEnum(const Slice::EnumPtr&); private: IceUtilInternal::XMLOutput& _out; }; class DescriptorHandler : public IceXML::Handler { public: DescriptorHandler(const DataFactoryPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&, const FreezeScript::ObjectFactoryPtr&); virtual void startElement(const std::string&, const IceXML::Attributes&, int, int); virtual void endElement(const std::string&, int, int); virtual void characters(const std::string&, int, int); virtual void error(const std::string&, int, int); DumpDBDescriptorPtr descriptor() const; private: DataFactoryPtr _factory; Slice::UnitPtr _unit; ErrorReporterPtr _errorReporter; DescriptorPtr _current; DumpDBDescriptorPtr _descriptor; FreezeScript::ObjectFactoryPtr _objectFactory; }; } static void usage(const string& n) { cerr << "Usage:\n"; cerr << "\n"; cerr << n << " [options] dbenv db\n"; cerr << n << " -c dbenv [db]\n"; cerr << "\n"; cerr << "Options:\n" "-h, --help Show this message.\n" "-v, --version Display the Ice version.\n" "-DNAME Define NAME as 1.\n" "-DNAME=DEF Define NAME as DEF.\n" "-UNAME Remove any definition for NAME.\n" "-IDIR Put DIR in the include file search path.\n" "-d, --debug Print debug messages.\n" "--ice Permit `Ice' prefix (for building Ice source code only).\n" "--underscore Permit underscores in Slice identifiers.\n" "-o FILE Output sample descriptors into the file FILE.\n" "-f FILE Execute the descriptors in the file FILE.\n" "--load SLICE Load Slice definitions from the file SLICE.\n" "-e Indicates the database is an Evictor database.\n" "--key TYPE Specifies the Slice type of the database key.\n" "--value TYPE Specifies the Slice type of the database value.\n" "--select EXPR Dump a record only if EXPR is true.\n" "-c, --catalog Display information about the databases in an\n" " environment, or about a particular database.\n" ; } static void printCatalogData(const string& dbName, const Freeze::CatalogData& data) { cout << dbName << ": "; if(data.evictor) { cout << "Evictor database" << endl; } else { cout << "Map database" << endl; cout << " key type = " << data.key << endl; cout << " value type = " << data.value << endl; } } static int run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator) { vector cppArgs; bool debug; bool ice = true; // Needs to be true in order to create default definitions. bool underscore; string outputFile; string inputFile; vector slice; bool evictor; string keyTypeName; string valueTypeName; string selectExpr; string dbEnvName, dbName; const string appName = originalArgs[0]; IceUtilInternal::Options opts; opts.addOpt("h", "help"); opts.addOpt("v", "version"); opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("I", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("d", "debug"); opts.addOpt("", "ice"); opts.addOpt("", "underscore"); opts.addOpt("o", "", IceUtilInternal::Options::NeedArg); opts.addOpt("f", "", IceUtilInternal::Options::NeedArg); opts.addOpt("", "load", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("e"); opts.addOpt("", "key", IceUtilInternal::Options::NeedArg); opts.addOpt("", "value", IceUtilInternal::Options::NeedArg); opts.addOpt("", "select", IceUtilInternal::Options::NeedArg); opts.addOpt("c", "catalog"); vector args; try { args = opts.parse(originalArgs); } catch(const IceUtilInternal::BadOptException& e) { cerr << appName << ": " << e.reason << endl; usage(appName); return EXIT_FAILURE; } // // Freeze creates a lock file by default to prevent multiple processes from opening // the same database environment simultaneously. In the case of a read-only program // such as dumpdb, however, we still want to be able to open the environment despite // the lock. This assumes of course that the other process has opened the environment // with DbPrivate=0. If DbPrivate=0 is also set for dumpdb, we disable the lock. // if(!args.empty()) { // // If an argument is present, we assume it is the name of the database environment. // Ice::PropertiesPtr props = communicator->getProperties(); string prefix = "Freeze.DbEnv." + args[0]; if(props->getPropertyAsIntWithDefault(prefix + ".DbPrivate", 1) == 0) { props->setProperty(prefix + ".LockFile", "0"); } } if(opts.isSet("h")) { usage(appName); return EXIT_SUCCESS; } if(opts.isSet("version")) { cout << ICE_STRING_VERSION << endl; return EXIT_SUCCESS; } if(opts.isSet("c")) { if(args.empty()) { cerr << appName << ": no database environment specified." << endl; usage(appName); return EXIT_FAILURE; } else if(args.size() > 2) { usage(appName); return EXIT_FAILURE; } try { FreezeScript::CatalogDataMap catalog = FreezeScript::readCatalog(communicator, args[0]); if(args.size() == 1) { if(catalog.empty()) { cout << "Catalog is empty." << endl; } else { cout << "Catalog contents:" << endl; for(FreezeScript::CatalogDataMap::const_iterator p = catalog.begin(); p != catalog.end(); ++p) { cout << endl; printCatalogData(p->first, p->second); } } } else { FreezeScript::CatalogDataMap::const_iterator p = catalog.find(args[1]); if(p == catalog.end()) { cerr << appName << ": database `" << args[1] << "' not found in environment `" << args[0] << "'." << endl; return EXIT_FAILURE; } else { printCatalogData(p->first, p->second); } } return EXIT_SUCCESS; } catch(const FreezeScript::FailureException& ex) { cerr << appName << ": " << ex.reason() << endl; return EXIT_FAILURE; } } if(opts.isSet("D")) { vector optargs = opts.argVec("D"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { cppArgs.push_back("-D" + *i); } } if(opts.isSet("U")) { vector optargs = opts.argVec("U"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { cppArgs.push_back("-U" + *i); } } if(opts.isSet("I")) { vector optargs = opts.argVec("I"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { cppArgs.push_back("-I" + *i); } } debug = opts.isSet("debug"); // No need to set --ice option here -- it is always true. underscore = opts.isSet("underscore"); if(opts.isSet("o")) { outputFile = opts.optArg("o"); } if(opts.isSet("f")) { inputFile = opts.optArg("f"); } if(opts.isSet("load")) { vector optArgs = opts.argVec("load"); for(vector::const_iterator i = optArgs.begin(); i != optArgs.end(); ++i) { slice.push_back(*i); } } evictor = opts.isSet("e"); if(opts.isSet("key")) { keyTypeName = opts.optArg("key"); } if(opts.isSet("value")) { valueTypeName = opts.optArg("value"); } if(opts.isSet("select")) { selectExpr = opts.optArg("select"); } if(outputFile.empty() && args.size() != 2) { usage(appName); return EXIT_FAILURE; } if(!args.empty()) { dbEnvName = args[0]; } if(args.size() == 2) { dbName = args[1]; } else { usage(appName); return EXIT_FAILURE; } if(!inputFile.empty() && !selectExpr.empty()) { cerr << appName << ": an input file cannot be specified with --select" << endl; return EXIT_FAILURE; } Slice::UnitPtr unit = Slice::Unit::createUnit(true, true, ice, underscore); FreezeScript::Destroyer unitD(unit); if(!FreezeScript::parseSlice(appName, unit, slice, cppArgs, debug, "-D___DUMPDB__")) { return EXIT_FAILURE; } FreezeScript::createEvictorSliceTypes(unit); // // If no input file was provided, then we need to generate default descriptors. // string descriptors; if(inputFile.empty()) { const string evictorKeyTypeName = "::Ice::Identity"; const string oldEvictorValueTypeName = "::Freeze::ObjectRecord"; const string newEvictorValueTypeName = "Object"; if((!keyTypeName.empty() && valueTypeName.empty()) || (keyTypeName.empty() && !valueTypeName.empty() && !evictor)) { cerr << appName << ": a key type and a value type must be specified" << endl; usage(appName); return EXIT_FAILURE; } else if(valueTypeName.empty()) { try { FreezeScript::CatalogDataMap catalog = FreezeScript::readCatalog(communicator, dbEnvName); FreezeScript::CatalogDataMap::iterator p = catalog.find(dbName); if(p == catalog.end()) { cerr << appName << ": database `" << dbName << "' not found in catalog." << endl; cerr << "Current catalog databases:" << endl; for(p = catalog.begin(); p != catalog.end(); ++p) { cerr << " " << p->first << endl; } return EXIT_FAILURE; } else { if(p->second.evictor) { evictor = true; } keyTypeName = p->second.key; valueTypeName = p->second.value; if(evictor && valueTypeName.empty()) { valueTypeName = oldEvictorValueTypeName; } } } catch(const FreezeScript::FailureException& ex) { cerr << appName << ": " << ex.reason() << endl; return EXIT_FAILURE; } } if(evictor) { if(keyTypeName.empty()) { keyTypeName = evictorKeyTypeName; } if(valueTypeName.empty()) { valueTypeName = newEvictorValueTypeName; } } Slice::TypePtr keyType, valueType; Slice::TypeList l; l = unit->lookupType(keyTypeName, false); if(l.empty()) { cerr << appName << ": unknown key type `" << keyTypeName << "'" << endl; return EXIT_FAILURE; } keyType = l.front(); l = unit->lookupType(valueTypeName, false); if(l.empty()) { cerr << appName << ": unknown value type `" << valueTypeName << "'" << endl; return EXIT_FAILURE; } valueType = l.front(); ostringstream os; IceUtilInternal::XMLOutput out(os); out << se("dumpdb"); FreezeScript::SliceVisitor visitor(out, keyType, valueType, selectExpr); unit->visit(&visitor, false); out << ee; descriptors = os.str(); if(!outputFile.empty()) { // // No nativeToUTF8 conversion necessary here, no string converter is installed // by wmain() on Windows and args are assumbed to be UTF8 on Unix platforms. // IceUtilInternal::ofstream of(outputFile); if(!of.good()) { cerr << appName << ": unable to open file `" << outputFile << "'" << endl; return EXIT_FAILURE; } of << descriptors << endl; of.close(); return EXIT_SUCCESS; } } else { // // No nativeToUTF8 conversion necessary here, no string converter is installed // by wmain() on Windows and args are assumbed to be UTF8 on Unix platforms. // IceUtilInternal::ifstream in(inputFile); char buff[1024]; while(true) { in.read(buff, 1024); descriptors.append(buff, static_cast(in.gcount())); if(in.gcount() < 1024) { break; } } in.close(); } FreezeScript::ObjectFactoryPtr objectFactory = new FreezeScript::ObjectFactory; communicator->addObjectFactory(objectFactory, ""); DbEnv dbEnv(0); DbTxn* txn = 0; Freeze::ConnectionPtr connection; int status = EXIT_SUCCESS; try { #ifdef _WIN32 // // Berkeley DB may use a different C++ runtime. // dbEnv.set_alloc(::malloc, ::realloc, ::free); #endif // // Open the database environment and start a transaction. // { u_int32_t flags = DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_MPOOL; dbEnv.open(dbEnvName.c_str(), flags, FREEZE_SCRIPT_DB_MODE); } // // We're creating a connection just to make sure the database environment // isn't locked. // connection = Freeze::createConnection(communicator, dbEnvName, dbEnv); dbEnv.txn_begin(0, &txn, 0); FreezeScript::ErrorReporterPtr errorReporter = new FreezeScript::ErrorReporter(cerr, false); try { FreezeScript::DataFactoryPtr factory = new FreezeScript::DataFactory(communicator, unit, errorReporter); FreezeScript::DescriptorHandler dh(factory, unit, errorReporter, objectFactory); istringstream istr(descriptors); IceXML::Parser::parse(istr, dh); FreezeScript::DumpDBDescriptorPtr descriptor = dh.descriptor(); descriptor->validate(); if(evictor) { // // The evictor database file contains multiple databases. We must first // determine the names of those databases, ignoring any whose names // begin with "$index:". Each database represents a separate facet, with // the facet name used as the database name. The database named "$default" // represents the main object. // vector dbNames; { Db db(&dbEnv, 0); db.open(txn, dbName.c_str(), 0, DB_UNKNOWN, DB_RDONLY, 0); Dbt dbKey, dbValue; dbKey.set_flags(DB_DBT_MALLOC); dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); Dbc* dbc = 0; db.cursor(txn, &dbc, 0); while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0) { string s(static_cast(dbKey.get_data()), dbKey.get_size()); if(s.find("$index:") != 0) { dbNames.push_back(s); } free(dbKey.get_data()); } dbc->close(); db.close(0); } // // Dump each database. // for(vector::iterator p = dbNames.begin(); p != dbNames.end(); ++p) { string name = *p; string facet = (name == "$default" ? string("") : name); Db db(&dbEnv, 0); db.open(txn, dbName.c_str(), name.c_str(), DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); descriptor->dump(communicator, &db, txn, facet); db.close(0); } } else { // // Dump a map database. // Db db(&dbEnv, 0); db.open(txn, dbName.c_str(), 0, DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); descriptor->dump(communicator, &db, txn, ""); db.close(0); } } catch(const IceXML::ParserException& ex) { errorReporter->error(ex.reason()); } } catch(const DbException& ex) { cerr << appName << ": database error: " << ex.what() << endl; status = EXIT_FAILURE; } catch(...) { try { if(txn) { txn->abort(); } dbEnv.close(0); } catch(const DbException& ex) { cerr << appName << ": database error: " << ex.what() << endl; } if(connection) { connection->close(); connection = 0; } throw; } try { if(txn) { txn->abort(); } if(connection) { connection->close(); } dbEnv.close(0); } catch(const DbException& ex) { cerr << appName << ": database error: " << ex.what() << endl; status = EXIT_FAILURE; } return status; } #ifdef _WIN32 int wmain(int argc, wchar_t* argv[]) #else int main(int argc, char* argv[]) #endif { Ice::StringSeq args = Ice::argsToStringSeq(argc, argv); assert(args.size() > 0); const string appName = args[0]; Ice::CommunicatorPtr communicator; int status = EXIT_SUCCESS; try { communicator = Ice::initialize(args); status = run(args, communicator); } catch(const FreezeScript::FailureException& ex) { string reason = ex.reason(); cerr << appName << ": " << reason; if(reason[reason.size() - 1] != '\n') { cerr << endl; } return EXIT_FAILURE; } catch(const std::exception& ex) { cerr << appName << ": " << ex.what() << endl; status = EXIT_FAILURE; } catch(...) { cerr << appName << ": unknown error" << endl; return EXIT_FAILURE; } if(communicator) { communicator->destroy(); } return status; } // // SliceVisitor // FreezeScript::SliceVisitor::SliceVisitor(IceUtilInternal::XMLOutput& out, const Slice::TypePtr& keyType, const Slice::TypePtr& valueType, const string& selectExpr) : _out(out) { out << se("database") << attr("key", typeToString(keyType)) << attr("value", typeToString(valueType)); out << se("record"); if(!selectExpr.empty()) { out << se("if") << attr("test", selectExpr); out << se("echo") << attr("message", "Key: ") << attr("value", "key") << ee; out << se("echo") << attr("message", "Value: ") << attr("value", "value") << ee; out << ee; } else { out << se("echo") << attr("message", "Key: ") << attr("value", "key") << ee; out << se("echo") << attr("message", "Value: ") << attr("value", "value") << ee; } out << ee; out << ee; } bool FreezeScript::SliceVisitor::visitClassDefStart(const Slice::ClassDefPtr& v) { if(v->isInterface() || v->isLocal()) { return false; } string scoped = v->scoped(); if(ignoreType(scoped)) { return false; } _out.newline(); _out.newline(); _out << ""; _out << se("dump") << attr("type", scoped) << ee; return false; } bool FreezeScript::SliceVisitor::visitStructStart(const Slice::StructPtr& v) { if(v->isLocal()) { return false; } string scoped = v->scoped(); if(ignoreType(scoped)) { return false; } _out.newline(); _out.newline(); _out << ""; _out << se("dump") << attr("type", scoped) << ee; return false; } void FreezeScript::SliceVisitor::visitSequence(const Slice::SequencePtr& v) { if(v->isLocal()) { return; } string scoped = v->scoped(); if(ignoreType(scoped)) { return; } _out.newline(); _out.newline(); _out << ""; _out << se("dump") << attr("type", scoped) << ee; } void FreezeScript::SliceVisitor::visitDictionary(const Slice::DictionaryPtr& v) { if(v->isLocal()) { return; } string scoped = v->scoped(); if(ignoreType(scoped)) { return; } _out.newline(); _out.newline(); _out << ""; _out << se("dump") << attr("type", scoped) << ee; } void FreezeScript::SliceVisitor::visitEnum(const Slice::EnumPtr& v) { if(v->isLocal()) { return; } string scoped = v->scoped(); if(ignoreType(scoped)) { return; } _out.newline(); _out.newline(); _out << ""; _out << se("dump") << attr("type", scoped) << ee; } // // DescriptorHandler // FreezeScript::DescriptorHandler::DescriptorHandler(const DataFactoryPtr& factory, const Slice::UnitPtr& unit, const ErrorReporterPtr& errorReporter, const FreezeScript::ObjectFactoryPtr& objectFactory) : _factory(factory), _unit(unit), _errorReporter(errorReporter), _objectFactory(objectFactory) { } void FreezeScript::DescriptorHandler::startElement(const string& name, const IceXML::Attributes& attributes, int line, int /*column*/) { DescriptorPtr d; if(name == "dumpdb") { if(_current) { _errorReporter->descriptorError(" must be the top-level element", line); } _descriptor = new DumpDBDescriptor(line, _factory, _errorReporter, attributes, _unit); d = _descriptor; } else if(name == "database") { if(!_current) { _errorReporter->descriptorError(" must be a child of ", line); } d = new DatabaseDescriptor(_current, line, _factory, _errorReporter, attributes, _unit); } else if(name == "record") { if(!_current) { _errorReporter->descriptorError(" must be a child of ", line); } d = new RecordDescriptor(_current, line, _factory, _errorReporter, attributes, _unit, _objectFactory); } else if(name == "dump") { if(!_current) { _errorReporter->descriptorError(" must be a child of ", line); } d = new DumpDescriptor(_current, line, _factory, _errorReporter, attributes, _unit); } else if(name == "set") { if(!_current) { _errorReporter->descriptorError(" cannot be a top-level element", line); } d = new SetDescriptor(_current, line, _factory, _errorReporter, attributes); } else if(name == "define") { if(!_current) { _errorReporter->descriptorError(" cannot be a top-level element", line); } d = new DefineDescriptor(_current, line, _factory, _errorReporter, attributes, _unit); } else if(name == "add") { if(!_current) { _errorReporter->descriptorError(" cannot be a top-level element", line); } d = new AddDescriptor(_current, line, _factory, _errorReporter, attributes); } else if(name == "remove") { if(!_current) { _errorReporter->descriptorError(" cannot be a top-level element", line); } d = new RemoveDescriptor(_current, line, _factory, _errorReporter, attributes); } else if(name == "fail") { if(!_current) { _errorReporter->descriptorError(" cannot be a top-level element", line); } d = new FailDescriptor(_current, line, _factory, _errorReporter, attributes); } else if(name == "echo") { if(!_current) { _errorReporter->descriptorError(" cannot be a top-level element", line); } d = new EchoDescriptor(_current, line, _factory, _errorReporter, attributes, cout); } else if(name == "if") { if(!_current) { _errorReporter->descriptorError(" cannot be a top-level element", line); } d = new IfDescriptor(_current, line, _factory, _errorReporter, attributes); } else if(name == "iterate") { if(!_current) { _errorReporter->descriptorError(" cannot be a top-level element", line); } d = new IterateDescriptor(_current, line, _factory, _errorReporter, attributes); } else { _errorReporter->descriptorError("unknown descriptor `" + name + "'", line); } if(_current) { _current->addChild(d); } _current = d; } void FreezeScript::DescriptorHandler::endElement(const std::string&, int, int) { assert(_current); _current = _current->parent(); } void FreezeScript::DescriptorHandler::characters(const std::string&, int, int) { } void FreezeScript::DescriptorHandler::error(const std::string& msg, int line, int) { _errorReporter->descriptorError(msg, line); } FreezeScript::DumpDBDescriptorPtr FreezeScript::DescriptorHandler::descriptor() const { return _descriptor; } Ice-3.5.1/cpp/src/FreezeScript/Grammar.y0000644000076400007640000001625412223561476016140 0ustar mesmes%{ // ********************************************************************** // // 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 #ifdef _MSC_VER // I get these warnings from some bison versions: // warning C4102: 'yyoverflowlab' : unreferenced label # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) #endif using namespace std; using namespace FreezeScript; void freeze_script_error(const char* s) { // yacc and recent versions of Bison use "syntax error" instead // of "parse error". if(strcmp(s, "parse error") == 0) { parseErrorReporter->expressionSyntaxError("syntax error"); } else { parseErrorReporter->expressionSyntaxError(s); } } %} %pure_parser %token TOK_AND %token TOK_OR %token TOK_NOT %token TOK_ADD %token TOK_SUB %token TOK_MUL %token TOK_DIV %token TOK_MOD %token TOK_LPAREN %token TOK_RPAREN %token TOK_LBRACKET %token TOK_RBRACKET %token TOK_LESS_THAN %token TOK_GREATER_THAN %token TOK_LESS_EQUAL %token TOK_GREATER_EQUAL %token TOK_EQUAL %token TOK_NEQ %token TOK_TRUE %token TOK_FALSE %token TOK_NIL %token TOK_SCOPE_DELIMITER %token TOK_IDENTIFIER %token TOK_STRING_LITERAL %token TOK_INTEGER_LITERAL %token TOK_FLOATING_POINT_LITERAL %left TOK_OR %left TOK_AND %nonassoc TOK_LESS_THAN TOK_GREATER_THAN TOK_LESS_EQUAL TOK_GREATER_EQUAL TOK_EQUAL TOK_NEQ %left TOK_ADD TOK_SUB %left TOK_MUL TOK_DIV TOK_MOD %right UNARY_OP %% // ---------------------------------------------------------------------- start // ---------------------------------------------------------------------- : expr { parseResult = $1; } ; // ---------------------------------------------------------------------- expr // ---------------------------------------------------------------------- : binary { $$ = $1; } ; // ---------------------------------------------------------------------- binary // ---------------------------------------------------------------------- : binary TOK_LESS_THAN binary { $$ = new BinaryNode(BinOpLess, parseDataFactory, $1, $3); } | binary TOK_GREATER_THAN binary { $$ = new BinaryNode(BinOpGreater, parseDataFactory, $1, $3); } | binary TOK_LESS_EQUAL binary { $$ = new BinaryNode(BinOpLessEq, parseDataFactory, $1, $3); } | binary TOK_GREATER_EQUAL binary { $$ = new BinaryNode(BinOpGrEq, parseDataFactory, $1, $3); } | binary TOK_EQUAL binary { $$ = new BinaryNode(BinOpEq, parseDataFactory, $1, $3); } | binary TOK_NEQ binary { $$ = new BinaryNode(BinOpNotEq, parseDataFactory, $1, $3); } | binary TOK_OR binary { $$ = new BinaryNode(BinOpOr, parseDataFactory, $1, $3); } | binary TOK_AND binary { $$ = new BinaryNode(BinOpAnd, parseDataFactory, $1, $3); } | binary TOK_MUL binary { $$ = new BinaryNode(BinOpMul, parseDataFactory, $1, $3); } | binary TOK_DIV binary { $$ = new BinaryNode(BinOpDiv, parseDataFactory, $1, $3); } | binary TOK_MOD binary { $$ = new BinaryNode(BinOpMod, parseDataFactory, $1, $3); } | binary TOK_ADD binary { $$ = new BinaryNode(BinOpAdd, parseDataFactory, $1, $3); } | binary TOK_SUB binary { $$ = new BinaryNode(BinOpSub, parseDataFactory, $1, $3); } | unary { $$ = $1; } ; // ---------------------------------------------------------------------- unary // ---------------------------------------------------------------------- : TOK_LPAREN expr TOK_RPAREN { $$ = $2; } | TOK_SUB unary %prec UNARY_OP { $$ = new UnaryNode(UnaryOpNeg, parseDataFactory, $2); } | TOK_NOT unary %prec UNARY_OP { $$ = new UnaryNode(UnaryOpNot, parseDataFactory, $2); } | TOK_INTEGER_LITERAL { IntegerTokPtr intVal = IntegerTokPtr::dynamicCast($1); assert(intVal); $$ = new DataNode(parseDataFactory->createInteger(intVal->v, true)); } | TOK_FLOATING_POINT_LITERAL { FloatingTokPtr floatVal = FloatingTokPtr::dynamicCast($1); assert(floatVal); $$ = new DataNode(parseDataFactory->createDouble(floatVal->v, true)); } | TOK_STRING_LITERAL { StringTokPtr stringVal = StringTokPtr::dynamicCast($1); assert(stringVal); $$ = new DataNode(parseDataFactory->createString(stringVal->v, true)); } | TOK_TRUE { $$ = new DataNode(parseDataFactory->createBoolean(true, true)); } | TOK_FALSE { $$ = new DataNode(parseDataFactory->createBoolean(false, true)); } | TOK_NIL { $$ = new DataNode(parseDataFactory->createNil(true)); } | entity { $$ = $1; } | entity '.' function { EntityNodePtr entity = EntityNodePtr::dynamicCast($1); assert(entity); FunctionNodePtr func = FunctionNodePtr::dynamicCast($3); assert(func); func->setTarget(entity); $$ = $3; } | function { $$ = $1; } | constant { StringTokPtr stringVal = StringTokPtr::dynamicCast($1); assert(stringVal); $$ = new ConstantNode(stringVal->v); } ; // ---------------------------------------------------------------------- entity // ---------------------------------------------------------------------- : entity TOK_LBRACKET expr TOK_RBRACKET { EntityNodePtr entity = EntityNodePtr::dynamicCast($1); assert(entity); entity->append(new ElementNode($3)); $$ = $1; } | entity '.' TOK_IDENTIFIER { StringTokPtr stringVal = StringTokPtr::dynamicCast($3); assert(stringVal); EntityNodePtr entity = EntityNodePtr::dynamicCast($1); assert(entity); entity->append(new IdentNode(stringVal->v)); $$ = $1; } | TOK_IDENTIFIER { StringTokPtr stringVal = StringTokPtr::dynamicCast($1); assert(stringVal); $$ = new IdentNode(stringVal->v); } ; // ---------------------------------------------------------------------- function // ---------------------------------------------------------------------- : TOK_IDENTIFIER TOK_LPAREN arg_list TOK_RPAREN { StringTokPtr func = StringTokPtr::dynamicCast($1); assert(func); NodeListTokPtr args = NodeListTokPtr::dynamicCast($3); assert(args); $$ = new FunctionNode(func->v, args->v); } ; // ---------------------------------------------------------------------- arg_list // ---------------------------------------------------------------------- : arg_list ',' expr { NodeListTokPtr l = NodeListTokPtr::dynamicCast($1); assert(l); l->v.push_back($3); $$ = $1; } | expr { NodeListTokPtr result = new NodeListTok; result->v.push_back($1); $$ = result; } | { $$ = new NodeListTok; } ; // ---------------------------------------------------------------------- constant // ---------------------------------------------------------------------- : constant TOK_SCOPE_DELIMITER TOK_IDENTIFIER { StringTokPtr stringVal = StringTokPtr::dynamicCast($1); assert(stringVal); StringTokPtr idVal = StringTokPtr::dynamicCast($3); assert(idVal); stringVal->v.append("::" + idVal->v); $$ = $1; } | TOK_SCOPE_DELIMITER TOK_IDENTIFIER { StringTokPtr idVal = StringTokPtr::dynamicCast($2); assert(idVal); StringTokPtr stringVal = new StringTok; stringVal->v.append("::" + idVal->v); $$ = stringVal; } ; %% Ice-3.5.1/cpp/src/FreezeScript/Exception.cpp0000644000076400007640000000253112223561476017013 0ustar mesmes// ********************************************************************** // // 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 using namespace std; // // FailureException // FreezeScript::FailureException::FailureException(const char* file, int line, const string& reason) : IceUtil::Exception(file, line), _reason(reason) { } FreezeScript::FailureException::~FailureException() throw() { } const char* FreezeScript::FailureException::_name = "FreezeScript::FailureException"; string FreezeScript::FailureException::ice_name() const { return _name; } void FreezeScript::FailureException::ice_print(ostream& out) const { ::IceUtil::Exception::ice_print(out); out << ":\nerror occurred during transformation"; // TODO if(!_reason.empty()) { out << ":\n" << _reason; } } FreezeScript::FailureException* FreezeScript::FailureException::ice_clone() const { return new FailureException(ice_file(), ice_line(), _reason); } void FreezeScript::FailureException::ice_throw() const { throw *this; } string FreezeScript::FailureException::reason() const { return _reason; } Ice-3.5.1/cpp/src/FreezeScript/DumpDescriptors.h0000644000076400007640000001667712223561476017671 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_DUMP_DESCRIPTORS_H #define FREEZE_SCRIPT_DUMP_DESCRIPTORS_H #include #include class Db; class DbTxn; namespace FreezeScript { class Descriptor; typedef IceUtil::Handle DescriptorPtr; struct ExecuteInfo; class Descriptor : virtual public IceUtil::SimpleShared { public: virtual ~Descriptor(); virtual DescriptorPtr parent() const; virtual void addChild(const DescriptorPtr&) = 0; virtual void validate() = 0; virtual void execute(const SymbolTablePtr&, ExecuteInfo*) = 0; protected: Descriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&); NodePtr parse(const std::string&) const; Slice::TypePtr findType(const Slice::UnitPtr&, const std::string&); DescriptorPtr _parent; int _line; DataFactoryPtr _factory; ErrorReporterPtr _errorReporter; }; class SetDescriptor : public Descriptor { public: SetDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: EntityNodePtr _target; NodePtr _value; std::string _valueStr; NodePtr _length; std::string _lengthStr; bool _convert; }; class DefineDescriptor : public Descriptor { public: DefineDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&, const Slice::UnitPtr&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: std::string _name; Slice::TypePtr _type; NodePtr _value; std::string _valueStr; bool _convert; }; class AddDescriptor : public Descriptor { public: AddDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: EntityNodePtr _target; NodePtr _key; std::string _keyStr; NodePtr _index; std::string _indexStr; NodePtr _value; std::string _valueStr; bool _convert; }; class RemoveDescriptor : public Descriptor { public: RemoveDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: EntityNodePtr _target; NodePtr _key; std::string _keyStr; NodePtr _index; std::string _indexStr; }; class FailDescriptor : public Descriptor { public: FailDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: NodePtr _test; std::string _testStr; std::string _message; }; class EchoDescriptor : public Descriptor { public: EchoDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&, std::ostream&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: std::ostream& _os; std::string _message; NodePtr _value; std::string _valueStr; }; class ExecutableContainerDescriptor : virtual public Descriptor { public: ExecutableContainerDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&, const std::string&); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); protected: std::vector _children; private: std::string _name; }; class IfDescriptor : public ExecutableContainerDescriptor { public: IfDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: NodePtr _test; std::string _testStr; }; class IterateDescriptor : public ExecutableContainerDescriptor { public: IterateDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: EntityNodePtr _target; std::string _key; std::string _value; std::string _element; std::string _index; }; class DumpDescriptor : public ExecutableContainerDescriptor { public: DumpDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&, const Slice::UnitPtr&); Slice::TypePtr type() const; std::string typeName() const; bool base() const; bool contents() const; private: Slice::TypePtr _type; bool _base; bool _contents; }; typedef IceUtil::Handle DumpDescriptorPtr; class RecordDescriptor : public ExecutableContainerDescriptor { public: RecordDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&, const Slice::UnitPtr&, const FreezeScript::ObjectFactoryPtr&); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: Slice::UnitPtr _unit; FreezeScript::ObjectFactoryPtr _objectFactory; }; typedef IceUtil::Handle RecordDescriptorPtr; class DatabaseDescriptor : public ExecutableContainerDescriptor { public: DatabaseDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&, const Slice::UnitPtr&); virtual void addChild(const DescriptorPtr&); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: Slice::UnitPtr _unit; Slice::TypePtr _key; Slice::TypePtr _value; RecordDescriptorPtr _record; }; typedef IceUtil::Handle DatabaseDescriptorPtr; class DumpDBDescriptor : public Descriptor { public: DumpDBDescriptor(int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&, const Slice::UnitPtr&); ~DumpDBDescriptor(); virtual void addChild(const DescriptorPtr&); virtual void validate(); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); void dump(const Ice::CommunicatorPtr&, Db*, DbTxn*, const std::string&); private: Slice::UnitPtr _unit; DatabaseDescriptorPtr _database; std::vector _children; ExecuteInfo* _info; }; typedef IceUtil::Handle DumpDBDescriptorPtr; } // End of namespace FreezeScript #endif Ice-3.5.1/cpp/src/FreezeScript/TransformAnalyzer.cpp0000644000076400007640000007124012223561476020541 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace Slice; using namespace IceUtil; using namespace IceUtilInternal; namespace FreezeScript { // // AnalyzeTransformVisitor visits the old definitions and compares them with // the new definitions. // class AnalyzeTransformVisitor : public ParserVisitor { public: AnalyzeTransformVisitor(XMLOutput&, const UnitPtr&, bool, vector&, vector&); void addDatabase(const string&, const TypePtr&, const TypePtr&, const TypePtr&, const TypePtr&); virtual bool visitClassDefStart(const ClassDefPtr&); virtual bool visitStructStart(const StructPtr&); virtual void visitSequence(const SequencePtr&); virtual void visitDictionary(const DictionaryPtr&); virtual void visitEnum(const EnumPtr&); private: void compareMembers(const DataMemberList&, const DataMemberList&); void compareTypes(const string&, const TypePtr&, const TypePtr&); void typeChange(const string&, const TypePtr&, const TypePtr&); bool checkClasses(const ClassDeclPtr&, const ClassDeclPtr&); XMLOutput& _out; UnitPtr _newUnit; bool _ignoreTypeChanges; vector& _missingTypes; vector& _errors; }; // // InitVisitor visits the new definitions to find any that are not present // in the old definitions, and generates init elements for them. // class AnalyzeInitVisitor : public ParserVisitor { public: AnalyzeInitVisitor(XMLOutput&, const UnitPtr&); virtual bool visitClassDefStart(const ClassDefPtr&); virtual bool visitStructStart(const StructPtr&); virtual void visitSequence(const SequencePtr&); virtual void visitDictionary(const DictionaryPtr&); virtual void visitEnum(const EnumPtr&); private: void typeChange(const TypePtr&, const string&, const string&); XMLOutput& _out; UnitPtr _oldUnit; }; } //////////////////////////////////// // AnalyzeTransformVisitor //////////////////////////////////// FreezeScript::AnalyzeTransformVisitor::AnalyzeTransformVisitor(XMLOutput& out, const UnitPtr& newUnit, bool ignoreTypeChanges, vector& missingTypes, vector& errors) : _out(out), _newUnit(newUnit), _ignoreTypeChanges(ignoreTypeChanges), _missingTypes(missingTypes), _errors(errors) { } void FreezeScript::AnalyzeTransformVisitor::addDatabase(const string& name, const TypePtr& oldKey, const TypePtr& newKey, const TypePtr& oldValue, const TypePtr& newValue) { _out << "\n"; _out << se("database"); if(!name.empty()) { _out << attr("name", name); } string oldKeyName = oldKey ? typeToString(oldKey) : string("UNKNOWN"); string newKeyName = newKey ? typeToString(newKey) : string("UNKNOWN"); if(oldKeyName == newKeyName) { _out << attr("key", oldKeyName); } else { _out << attr("key", oldKeyName + "," + newKeyName); } string oldValueName = oldValue ? typeToString(oldValue) : string("UNKNOWN"); string newValueName = newValue ? typeToString(newValue) : string("UNKNOWN"); if(oldValueName == newValueName) { _out << attr("value", oldValueName); } else { _out << attr("value", oldValueName + "," + newValueName); } _out << se("record"); if(oldKey && newKey) { compareTypes("database key", oldKey, newKey); } if(oldValue && newValue) { compareTypes("database value", oldValue, newValue); } _out << ee; _out << ee; } bool FreezeScript::AnalyzeTransformVisitor::visitClassDefStart(const ClassDefPtr& v) { if(v->isInterface() || v->isLocal()) { return false; } string scoped = v->scoped(); if(ignoreType(scoped)) { return false; } TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false); if(l.empty()) { _missingTypes.push_back(scoped); return false; } ClassDeclPtr decl = ClassDeclPtr::dynamicCast(l.front()); if(!decl || decl->isInterface()) { if(!_ignoreTypeChanges) { typeChange(scoped, v->declaration(), l.front()); } return false; } ClassDefPtr newClass = decl->definition(); if(!newClass) { _missingTypes.push_back(scoped); return false; } _out.newline(); _out.newline(); _out << ""; _out << se("transform") << attr("type", scoped); DataMemberList oldMembers = v->dataMembers(); DataMemberList newMembers = newClass->dataMembers(); compareMembers(oldMembers, newMembers); _out << ee; return false; } bool FreezeScript::AnalyzeTransformVisitor::visitStructStart(const StructPtr& v) { if(v->isLocal()) { return false; } string scoped = v->scoped(); if(ignoreType(scoped)) { return false; } TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false); if(l.empty()) { _missingTypes.push_back(scoped); return false; } StructPtr newStruct = StructPtr::dynamicCast(l.front()); if(!newStruct) { if(!_ignoreTypeChanges) { typeChange(scoped, v, l.front()); } return false; } _out.newline(); _out.newline(); _out << ""; _out << se("transform") << attr("type", scoped); DataMemberList oldMembers = v->dataMembers(); DataMemberList newMembers = newStruct->dataMembers(); compareMembers(oldMembers, newMembers); _out << ee; return false; } void FreezeScript::AnalyzeTransformVisitor::visitSequence(const SequencePtr& v) { if(v->isLocal()) { return; } string scoped = v->scoped(); if(ignoreType(scoped)) { return; } TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false); if(l.empty()) { _missingTypes.push_back(scoped); return; } SequencePtr newSeq = SequencePtr::dynamicCast(l.front()); if(!newSeq) { if(!_ignoreTypeChanges) { typeChange(scoped, v, l.front()); } return; } _out.newline(); _out.newline(); _out << ""; _out << se("transform") << attr("type", scoped); compareTypes(scoped + " sequence type", v->type(), newSeq->type()); _out << ee; } void FreezeScript::AnalyzeTransformVisitor::visitDictionary(const DictionaryPtr& v) { if(v->isLocal()) { return; } string scoped = v->scoped(); if(ignoreType(scoped)) { return; } TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false); if(l.empty()) { _missingTypes.push_back(scoped); return; } DictionaryPtr newDict = DictionaryPtr::dynamicCast(l.front()); if(!newDict) { if(!_ignoreTypeChanges) { typeChange(scoped, v, l.front()); } return; } _out.newline(); _out.newline(); _out << ""; _out << se("transform") << attr("type", scoped); compareTypes(scoped + " key type", v->keyType(), newDict->keyType()); compareTypes(scoped + " value type", v->valueType(), newDict->valueType()); _out << ee; } void FreezeScript::AnalyzeTransformVisitor::visitEnum(const EnumPtr& v) { if(v->isLocal()) { return; } string scoped = v->scoped(); if(ignoreType(scoped)) { return; } TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false); if(l.empty()) { _missingTypes.push_back(scoped); return; } EnumPtr newEnum = EnumPtr::dynamicCast(l.front()); if(!newEnum) { if(!_ignoreTypeChanges) { typeChange(scoped, v, l.front()); } return; } map m; { Slice::EnumeratorList enumerators = newEnum->getEnumerators(); int i = 0; for(Slice::EnumeratorList::iterator p = enumerators.begin(); p != enumerators.end(); ++p, ++i) { m.insert(map::value_type((*p)->name(), i)); } } _out.newline(); _out.newline(); _out << ""; _out << se("transform") << attr("type", scoped); Slice::EnumeratorList enumerators = v->getEnumerators(); int i = 0; for(Slice::EnumeratorList::iterator p = enumerators.begin(); p != enumerators.end(); ++p, ++i) { map::const_iterator q = m.find((*p)->name()); if(q == m.end()) { _out.newline(); _out << ""; } else if(q->second != i) { _out.newline(); _out << ""; } } _out << ee; } void FreezeScript::AnalyzeTransformVisitor::compareMembers(const DataMemberList& oldMembers, const DataMemberList& newMembers) { map oldMap, newMap; for(DataMemberList::const_iterator p = oldMembers.begin(); p != oldMembers.end(); ++p) { oldMap.insert(pair((*p)->name(), *p)); } for(DataMemberList::const_iterator p = newMembers.begin(); p != newMembers.end(); ++p) { newMap.insert(pair((*p)->name(), *p)); } for(DataMemberList::const_iterator p = oldMembers.begin(); p != oldMembers.end(); ++p) { string name = (*p)->name(); map::iterator q = newMap.find(name); if(q == newMap.end()) { _out.newline(); _out << ""; } else { TypePtr oldType = (*p)->type(); TypePtr newType = q->second->type(); compareTypes(name, oldType, newType); // // Remove this entry from the map to indicate that we've // already seen it. // newMap.erase(q); } } // // Iterate over the remaining entries in newMap. These represent // members that were added in the new definition. // for(map::iterator q = newMap.begin(); q != newMap.end(); ++q) { _out.newline(); _out << ""; } } void FreezeScript::AnalyzeTransformVisitor::compareTypes(const string& desc, const TypePtr& oldType, const TypePtr& newType) { assert(!oldType->isLocal()); if(newType->isLocal()) { ostringstream ostr; ostr << desc << " has changed to a local type"; _errors.push_back(ostr.str()); return; } BuiltinPtr b = BuiltinPtr::dynamicCast(oldType); if(b) { BuiltinPtr newb = BuiltinPtr::dynamicCast(newType); switch(b->kind()) { case Builtin::KindByte: { if(newb) { switch(newb->kind()) { case Builtin::KindByte: case Builtin::KindShort: case Builtin::KindInt: case Builtin::KindLong: case Builtin::KindString: { return; } case Builtin::KindBool: case Builtin::KindFloat: case Builtin::KindDouble: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { break; } } } break; } case Builtin::KindBool: { if(newb && (newb->kind() == Builtin::KindBool || newb->kind() == Builtin::KindString)) { return; } break; } case Builtin::KindShort: { if(newb) { switch(newb->kind()) { case Builtin::KindByte: case Builtin::KindShort: case Builtin::KindInt: case Builtin::KindLong: case Builtin::KindString: { return; } case Builtin::KindBool: case Builtin::KindFloat: case Builtin::KindDouble: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { break; } } } break; } case Builtin::KindInt: { if(newb) { switch(newb->kind()) { case Builtin::KindByte: case Builtin::KindShort: case Builtin::KindInt: case Builtin::KindLong: case Builtin::KindString: { return; } case Builtin::KindBool: case Builtin::KindFloat: case Builtin::KindDouble: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { break; } } } break; } case Builtin::KindLong: { if(newb) { switch(newb->kind()) { case Builtin::KindByte: case Builtin::KindShort: case Builtin::KindInt: case Builtin::KindLong: case Builtin::KindString: { return; } case Builtin::KindBool: case Builtin::KindFloat: case Builtin::KindDouble: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { break; } } } break; } case Builtin::KindFloat: { if(newb) { switch(newb->kind()) { case Builtin::KindFloat: case Builtin::KindDouble: case Builtin::KindString: { return; } case Builtin::KindByte: case Builtin::KindShort: case Builtin::KindInt: case Builtin::KindLong: case Builtin::KindBool: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { break; } } } break; } case Builtin::KindDouble: { if(newb) { switch(newb->kind()) { case Builtin::KindFloat: case Builtin::KindDouble: case Builtin::KindString: { return; } case Builtin::KindByte: case Builtin::KindShort: case Builtin::KindInt: case Builtin::KindLong: case Builtin::KindBool: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { break; } } } break; } case Builtin::KindString: { if(newb) { switch(newb->kind()) { case Builtin::KindByte: case Builtin::KindBool: case Builtin::KindShort: case Builtin::KindInt: case Builtin::KindLong: case Builtin::KindFloat: case Builtin::KindDouble: case Builtin::KindString: case Builtin::KindObjectProxy: { return; } case Builtin::KindObject: case Builtin::KindLocalObject: { break; } } break; } if(EnumPtr::dynamicCast(newType)) { return; } if(ProxyPtr::dynamicCast(newType)) { return; } break; } case Builtin::KindObject: { // // Allow change from Object to class. Validation has to // be done during transformation, when the actual type of // an instance can be compared for compatibility with the // new type. // ClassDeclPtr cl = ClassDeclPtr::dynamicCast(newType); if(cl || (newb && newb->kind() == Builtin::KindObject)) { return; } break; } case Builtin::KindObjectProxy: { ProxyPtr p = ProxyPtr::dynamicCast(newType); if(p || (newb && newb->kind() == Builtin::KindObjectProxy) || (newb && newb->kind() == Builtin::KindString)) { return; } break; } case Builtin::KindLocalObject: { assert(false); break; } } typeChange(desc, oldType, newType); return; } ClassDeclPtr cl = ClassDeclPtr::dynamicCast(oldType); if(cl) { if(!cl->definition()) { _errors.push_back("class " + cl->scoped() + " declared but not defined"); return; } // // Allow target type of Object. // BuiltinPtr newb = BuiltinPtr::dynamicCast(newType); if(newb && newb->kind() == Builtin::KindObject) { return; } ClassDeclPtr newcl = ClassDeclPtr::dynamicCast(newType); if(newcl) { if(!newcl->definition()) { _errors.push_back("class " + newcl->scoped() + " declared but not defined"); return; } if(checkClasses(cl, newcl)) { return; } } typeChange(desc, oldType, newType); return; } StructPtr s = StructPtr::dynamicCast(oldType); if(s) { StructPtr news = StructPtr::dynamicCast(newType); if(news && s->scoped() == news->scoped()) { return; } typeChange(desc, oldType, newType); return; } ProxyPtr proxy = ProxyPtr::dynamicCast(oldType); if(proxy) { // // Allow target type of Object* and string. // BuiltinPtr newb = BuiltinPtr::dynamicCast(newType); if(newb && (newb->kind() == Builtin::KindObjectProxy || newb->kind() == Builtin::KindString)) { return; } ProxyPtr newProxy = ProxyPtr::dynamicCast(newType); if(newProxy && checkClasses(proxy->_class(), newProxy->_class())) { return; } typeChange(desc, oldType, newType); return; } DictionaryPtr dict = DictionaryPtr::dynamicCast(oldType); if(dict) { DictionaryPtr newDict = DictionaryPtr::dynamicCast(newType); if(newDict && dict->scoped() == newDict->scoped()) { return; } typeChange(desc, oldType, newType); return; } SequencePtr seq = SequencePtr::dynamicCast(oldType); if(seq) { SequencePtr newSeq = SequencePtr::dynamicCast(newType); if(newSeq && seq->scoped() == newSeq->scoped()) { return; } typeChange(desc, oldType, newType); return; } EnumPtr en = EnumPtr::dynamicCast(oldType); if(en) { EnumPtr newen = EnumPtr::dynamicCast(newType); BuiltinPtr newb = BuiltinPtr::dynamicCast(newType); if((newen && en->scoped() == newen->scoped()) || (newb && newb->kind() == Builtin::KindString)) { return; } typeChange(desc, oldType, newType); return; } assert(false); } void FreezeScript::AnalyzeTransformVisitor::typeChange(const string& desc, const TypePtr& t1, const TypePtr& t2) { BuiltinPtr b1 = BuiltinPtr::dynamicCast(t1); BuiltinPtr b2 = BuiltinPtr::dynamicCast(t2); ContainedPtr c1 = ContainedPtr::dynamicCast(t1); ContainedPtr c2 = ContainedPtr::dynamicCast(t2); ProxyPtr p1 = ProxyPtr::dynamicCast(t1); ProxyPtr p2 = ProxyPtr::dynamicCast(t2); if(_ignoreTypeChanges) { _out.newline(); _out << ""; } else { ostringstream ostr; ostr << "unsupported type change in " << desc << " from "; if(b1) { ostr << b1->kindAsString(); } else if(p1) { ostr << p1->_class()->scoped() << '*'; } else { assert(c1); ostr << c1->kindOf() << ' ' << c1->scoped(); } ostr << " to "; if(b2) { ostr << b2->kindAsString(); } else if(p2) { ostr << p2->_class()->scoped() << '*'; } else { assert(c2); ostr << c2->kindOf() << ' ' << c2->scoped(); } _errors.push_back(ostr.str()); } } bool FreezeScript::AnalyzeTransformVisitor::checkClasses(const ClassDeclPtr& from, const ClassDeclPtr& to) { string fromScoped = from->scoped(); string toScoped = to->scoped(); if(fromScoped == toScoped) { return true; } // // The types don't match, so check them for compatibility. Specifically, // look up the old type id in the new Slice and see if it has the target // type as a base class. // TypeList l = to->unit()->lookupTypeNoBuiltin(from->scoped(), false); if(!l.empty()) { ClassDeclPtr decl = ClassDeclPtr::dynamicCast(l.front()); if(decl) { ClassDefPtr def = decl->definition(); if(def) { ClassList bases = def->allBases(); for(ClassList::iterator p = bases.begin(); p != bases.end(); ++p) { if((*p)->scoped() == toScoped) { return true; } } } } } return false; } //////////////////////////////////// // InitVisitor //////////////////////////////////// FreezeScript::AnalyzeInitVisitor::AnalyzeInitVisitor(XMLOutput& out, const UnitPtr& oldUnit) : _out(out), _oldUnit(oldUnit) { } bool FreezeScript::AnalyzeInitVisitor::visitClassDefStart(const ClassDefPtr& v) { if(v->isInterface() || v->isLocal()) { return false; } string scoped = v->scoped(); TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false); if(!l.empty()) { ClassDeclPtr decl = ClassDeclPtr::dynamicCast(l.front()); if(!decl || decl->isInterface()) { typeChange(l.front(), scoped, "class"); } else { return false; } } _out.newline(); _out.newline(); _out << ""; _out << se("init") << attr("type", scoped); _out << ee; return false; } bool FreezeScript::AnalyzeInitVisitor::visitStructStart(const StructPtr& v) { if(v->isLocal()) { return false; } string scoped = v->scoped(); TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false); if(!l.empty()) { StructPtr s = StructPtr::dynamicCast(l.front()); if(!s) { typeChange(l.front(), scoped, "struct"); } else { return false; } } _out.newline(); _out.newline(); _out << ""; _out << se("init") << attr("type", scoped); _out << ee; return false; } void FreezeScript::AnalyzeInitVisitor::visitSequence(const SequencePtr& v) { if(v->isLocal()) { return; } string scoped = v->scoped(); TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false); if(!l.empty()) { SequencePtr s = SequencePtr::dynamicCast(l.front()); if(!s) { typeChange(l.front(), scoped, "sequence"); } else { return; } } _out.newline(); _out.newline(); _out << ""; _out << se("init") << attr("type", scoped); _out << ee; } void FreezeScript::AnalyzeInitVisitor::visitDictionary(const DictionaryPtr& v) { if(v->isLocal()) { return; } string scoped = v->scoped(); TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false); if(!l.empty()) { DictionaryPtr d = DictionaryPtr::dynamicCast(l.front()); if(!d) { typeChange(l.front(), scoped, "dictionary"); } else { return; } } _out.newline(); _out.newline(); _out << ""; _out << se("init") << attr("type", scoped); _out << ee; } void FreezeScript::AnalyzeInitVisitor::visitEnum(const EnumPtr& v) { if(v->isLocal()) { return; } string scoped = v->scoped(); TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false); if(!l.empty()) { EnumPtr e = EnumPtr::dynamicCast(l.front()); if(!e) { typeChange(l.front(), scoped, "enum"); } else { return; } } _out.newline(); _out.newline(); _out << ""; _out << se("init") << attr("type", scoped); _out << ee; } void FreezeScript::AnalyzeInitVisitor::typeChange(const TypePtr& t, const string& scoped, const string& kind) { BuiltinPtr b = BuiltinPtr::dynamicCast(t); ContainedPtr c = ContainedPtr::dynamicCast(t); ProxyPtr p = ProxyPtr::dynamicCast(t); _out.newline(); _out << ""; } FreezeScript::TransformAnalyzer::TransformAnalyzer(const UnitPtr& oldUnit, const UnitPtr& newUnit, bool ignoreTypeChanges, ostream& os, vector& missingTypes, vector& errors) : _old(oldUnit), _new(newUnit), _out(os), _visitor(new AnalyzeTransformVisitor(_out, newUnit, ignoreTypeChanges, missingTypes, errors)) { _out << se("transformdb"); } FreezeScript::TransformAnalyzer::~TransformAnalyzer() { delete _visitor; } void FreezeScript::TransformAnalyzer::addDatabase(const string& name, const TypePtr& oldKey, const TypePtr& newKey, const TypePtr& oldValue, const TypePtr& newValue) { _visitor->addDatabase(name, oldKey, newKey, oldValue, newValue); } void FreezeScript::TransformAnalyzer::finish() { _old->visit(_visitor, false); AnalyzeInitVisitor initVisitor(_out, _old); _new->visit(&initVisitor, false); _out << ee; _out << '\n'; } Ice-3.5.1/cpp/src/FreezeScript/GrammarUtil.h0000644000076400007640000000627612223561476016760 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_GRAMMAR_UTIL_H #define FREEZE_SCRIPT_GRAMMAR_UTIL_H #include namespace FreezeScript { extern DataFactoryPtr parseDataFactory; extern ErrorReporterPtr parseErrorReporter; extern NodePtr parseResult; extern int parseLine; int getInput(char*, int); class StringTok; class IdentifierTok; class BoolTok; class IntegerTok; class FloatingTok; class NodeListTok; typedef ::IceUtil::Handle StringTokPtr; typedef ::IceUtil::Handle IdentifierTokPtr; typedef ::IceUtil::Handle BoolTokPtr; typedef ::IceUtil::Handle IntegerTokPtr; typedef ::IceUtil::Handle FloatingTokPtr; typedef ::IceUtil::Handle NodeListTokPtr; // ---------------------------------------------------------------------- // Token // ---------------------------------------------------------------------- class Token : public Node { public: Token() { } virtual DataPtr evaluate(const SymbolTablePtr&) { return 0; } virtual void print(std::ostream&) const {} }; // ---------------------------------------------------------------------- // StringTok // ---------------------------------------------------------------------- class StringTok : public Token { public: StringTok() { } std::string v; }; // ---------------------------------------------------------------------- // BoolTok // ---------------------------------------------------------------------- class BoolTok : public Token { public: BoolTok() { } bool v; }; // ---------------------------------------------------------------------- // IntegerTok // ---------------------------------------------------------------------- class IntegerTok : public Token { public: IntegerTok() { } IceUtil::Int64 v; }; // ---------------------------------------------------------------------- // FloatingTok // ---------------------------------------------------------------------- class FloatingTok : public Token { public: FloatingTok() { } double v; }; class NodeListTok : public Token { public: NodeListTok() { } NodeList v; }; } // End of namespace FreezeScript // // Stuff for flex and bison // #define YYSTYPE FreezeScript::NodePtr #define YY_DECL int freeze_script_lex(YYSTYPE* yylvalp) YY_DECL; int freeze_script_parse(); // // I must set the initial stack depth to the maximum stack depth to // disable bison stack resizing. The bison stack resizing routines use // simple malloc/alloc/memcpy calls, which do not work for the // YYSTYPE, since YYSTYPE is a C++ type, with constructor, destructor, // assignment operator, etc. // #define YYMAXDEPTH 10000 #define YYINITDEPTH YYMAXDEPTH // Initial depth is set to max depth, for the reasons described above. // // Newer bison versions allow to disable stack resizing by defining // yyoverflow. // #define yyoverflow(a, b, c, d, e, f) freeze_script_error(a) #endif Ice-3.5.1/cpp/src/FreezeScript/TransformAnalyzer.h0000644000076400007640000000213512223561476020203 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_TRANSFORM_ANALYZER_H #define FREEZE_SCRIPT_TRANSFORM_ANALYZER_H #include #include #include namespace FreezeScript { class AnalyzeTransformVisitor; class TransformAnalyzer { public: TransformAnalyzer(const Slice::UnitPtr&, const Slice::UnitPtr&, bool, std::ostream&, std::vector&, std::vector&); ~TransformAnalyzer(); void addDatabase(const std::string&, const Slice::TypePtr&, const Slice::TypePtr&, const Slice::TypePtr&, const Slice::TypePtr&); void finish(); private: Slice::UnitPtr _old; Slice::UnitPtr _new; IceUtilInternal::XMLOutput _out; AnalyzeTransformVisitor* _visitor; }; } #endif Ice-3.5.1/cpp/src/FreezeScript/Grammar.h0000644000076400007640000000512012223561476016105 0ustar mesmes /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TOK_AND = 258, TOK_OR = 259, TOK_NOT = 260, TOK_ADD = 261, TOK_SUB = 262, TOK_MUL = 263, TOK_DIV = 264, TOK_MOD = 265, TOK_LPAREN = 266, TOK_RPAREN = 267, TOK_LBRACKET = 268, TOK_RBRACKET = 269, TOK_LESS_THAN = 270, TOK_GREATER_THAN = 271, TOK_LESS_EQUAL = 272, TOK_GREATER_EQUAL = 273, TOK_EQUAL = 274, TOK_NEQ = 275, TOK_TRUE = 276, TOK_FALSE = 277, TOK_NIL = 278, TOK_SCOPE_DELIMITER = 279, TOK_IDENTIFIER = 280, TOK_STRING_LITERAL = 281, TOK_INTEGER_LITERAL = 282, TOK_FLOATING_POINT_LITERAL = 283, UNARY_OP = 284 }; #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif Ice-3.5.1/cpp/src/FreezeScript/Functions.cpp0000644000076400007640000002566412223561476017041 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; bool FreezeScript::invokeGlobalFunction(const Ice::CommunicatorPtr& communicator, const string& name, const DataList& args, DataPtr& result, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter) { // // Global function. // if(name == "typeOf") { if(args.size() != 1) { errorReporter->error("typeOf() requires one argument"); } result = factory->createString(typeToString(args.front()->getType()), false); return true; } else if(name == "generateUUID") { if(args.size() != 0) { errorReporter->error("generateUUID() accepts no arguments"); } result = factory->createString(IceUtil::generateUUID(), false); return true; } else if(name == "stringToIdentity") { StringDataPtr str; if(args.size() > 0) { str = StringDataPtr::dynamicCast(args.front()); } if(args.size() != 1 || !str) { errorReporter->error("stringToIdentity() requires a string argument"); } // // Parse the identity string. // string idstr = str->stringValue(); Ice::Identity id; try { id = communicator->stringToIdentity(idstr); } catch(const Ice::IdentityParseException& ex) { errorReporter->error("error in stringToIdentity():\n" + ex.str); } // // Create a data representation of Ice::Identity. // Slice::UnitPtr unit = str->getType()->unit(); Slice::TypeList l = unit->lookupType("::Ice::Identity", false); assert(!l.empty()); DataPtr identity = factory->create(l.front(), false); StringDataPtr member; member = StringDataPtr::dynamicCast(identity->getMember("name")); assert(member); member->setValue(id.name); member = StringDataPtr::dynamicCast(identity->getMember("category")); assert(member); member->setValue(id.category); result = identity; return true; } else if(name == "identityToString") { StructDataPtr identity; if(args.size() > 0) { identity = StructDataPtr::dynamicCast(args.front()); } if(identity) { Slice::TypePtr argType = identity->getType(); Slice::StructPtr st = Slice::StructPtr::dynamicCast(argType); if(!st || st->scoped() != "::Ice::Identity") { identity = 0; } } if(args.size() != 1 || !identity) { errorReporter->error("identityToString() requires a argument of type ::Ice::Identity"); } // // Compose the identity. // Ice::Identity id; StringDataPtr member; member = StringDataPtr::dynamicCast(identity->getMember("name")); assert(member); id.name = member->stringValue(); member = StringDataPtr::dynamicCast(identity->getMember("category")); assert(member); id.category = member->stringValue(); result = factory->createString(communicator->identityToString(id), false); return true; } else if(name == "stringToProxy") { StringDataPtr str; if(args.size() > 0) { str = StringDataPtr::dynamicCast(args.front()); } if(args.size() != 1 || !str) { errorReporter->error("stringToProxy() requires a string argument"); } // // Parse the proxy; // string sprx = str->stringValue(); Ice::ObjectPrx prx; try { prx = factory->getCommunicator()->stringToProxy(sprx); } catch(const Ice::ProxyParseException& ex) { errorReporter->error("error in stringToProxy():\n" + ex.str); } Slice::UnitPtr unit = str->getType()->unit(); ProxyDataPtr p = ProxyDataPtr::dynamicCast(factory->create(unit->builtin(Slice::Builtin::KindObjectProxy), false)); p->setValue(prx); result = p; return true; } else if(name == "proxyToString") { ProxyDataPtr prx; if(args.size() > 0) { prx = ProxyDataPtr::dynamicCast(args.front()); } if(args.size() != 1 || !prx) { errorReporter->error("proxyToString() requires a proxy argument"); } result = factory->createString(prx->toString(), false); return true; } else if(name == "lowercase") { StringDataPtr str; if(args.size() > 0) { str = StringDataPtr::dynamicCast(args.front()); } if(args.size() != 1 || !str) { errorReporter->error("lowercase() requires a string argument"); } string val = IceUtilInternal::toLower(str->stringValue()); result = factory->createString(val, false); return true; } return false; } bool FreezeScript::invokeMemberFunction(const string& name, const DataPtr& target, const DataList& args, DataPtr& result, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter) { // // string // StringDataPtr targetStr = StringDataPtr::dynamicCast(target); if(targetStr) { if(name == "find") { StringDataPtr argData; IntegerDataPtr startData; if(args.size() > 0) { argData = StringDataPtr::dynamicCast(args[0]); } if(args.size() > 1) { startData = IntegerDataPtr::dynamicCast(args[1]); } if(args.size() == 0 || args.size() > 2 || !argData || (args.size() == 2 && !startData)) { errorReporter->error("invalid arguments to find(string str[, int len])"); } string targ = targetStr->stringValue(); string arg = argData->stringValue(); string::size_type pos; if(startData) { string::size_type start = static_cast(startData->integerValue()); pos = targ.find(arg, start); } else { pos = targ.find(arg); } result = factory->createInteger(pos == string::npos ? -1 : static_cast(pos), false); return true; } else if(name == "substr") { IntegerDataPtr startData; IntegerDataPtr lenData; if(args.size() > 0) { startData = IntegerDataPtr::dynamicCast(args[0]); } if(args.size() > 1) { lenData = IntegerDataPtr::dynamicCast(args[1]); } if(args.size() == 0 || args.size() > 2 || !startData || (args.size() == 2 && !lenData)) { errorReporter->error("invalid arguments to substr(int start[, int len])"); } string targ = targetStr->stringValue(); string::size_type start = static_cast(startData->integerValue()); string::size_type len = string::npos; if(lenData) { len = static_cast(lenData->integerValue()); } if(start > targ.size()) { ostringstream ostr; ostr << "substr() starting position (" << start << ") is greater than string length (" << targ.size() << ")"; errorReporter->error(ostr.str()); } result = factory->createString(targ.substr(start, len), false); return true; } else if(name == "replace") { IntegerDataPtr startData; IntegerDataPtr lenData; StringDataPtr strData; if(args.size() == 3) { startData = IntegerDataPtr::dynamicCast(args[0]); lenData = IntegerDataPtr::dynamicCast(args[1]); strData = StringDataPtr::dynamicCast(args[2]); } if(args.size() != 3 || !startData || !lenData || !strData) { errorReporter->error("invalid arguments to replace(int start, int len, string val)"); } string targ = targetStr->stringValue(); string::size_type start = static_cast(startData->integerValue()); string::size_type len = static_cast(lenData->integerValue()); string str = strData->stringValue(); if(start > targ.size()) { ostringstream ostr; ostr << "replace() starting position (" << start << ") is greater than string length (" << targ.size() << ")"; errorReporter->error(ostr.str()); } result = factory->createString(targ.replace(start, len, str), false); return true; } return false; } // // Object // ObjectRefPtr targetObj = ObjectRefPtr::dynamicCast(target); if(targetObj) { if(name == "ice_isA") { ObjectDataPtr value = targetObj->getValue(); if(!value) { errorReporter->error("ice_isA() invoked on nil object"); } StringDataPtr str; if(args.size() > 0) { str = StringDataPtr::dynamicCast(args.front()); } if(args.size() != 1 || !str) { errorReporter->error("invalid arguments to ice_isA(string id)"); } string id = str->stringValue(); if(id == "::Ice::Object") { result = factory->createBoolean(true, false); return true; } Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(value->getType()); if(!decl) { // // Ice::Object // result = factory->createBoolean(false, false); return true; } Slice::ClassDefPtr def = decl->definition(); assert(def); result = factory->createBoolean(def->isA(id), false); return true; } return false; } return false; } Ice-3.5.1/cpp/src/FreezeScript/transformdb.cpp0000644000076400007640000007706612223561476017415 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include using namespace std; #ifdef _WIN32 # define FREEZE_SCRIPT_DB_MODE 0 #else # define FREEZE_SCRIPT_DB_MODE (S_IRUSR | S_IWUSR) #endif static void usage(const std::string& n) { cerr << "Usage:\n"; cerr << "\n"; cerr << n << " -o FILE [-i] [slice-options] [type-options]\n"; cerr << " Generates descriptors in FILE for a database.\n"; cerr << "\n"; cerr << n << " -o FILE [-i] [slice-options] DBENV\n"; cerr << " Generates descriptors in FILE for all databases in the environment DBENV.\n"; cerr << "\n"; cerr << n << " [options] [slice-options] [type-options] DBENV DB NEWDBENV\n"; cerr << " Transform the database DB in the environment DBENV. A database of the\n"; cerr << " same name is created in the environment NEWDBENV.\n"; cerr << "\n"; cerr << n << " [options] [slice-options] DBENV NEWDBENV\n"; cerr << " Transform all databases from the environment DBENV into the\n"; cerr << " environment NEWDBENV.\n"; cerr << "\n"; cerr << "Slice Options:\n" "-DNAME Define NAME as 1.\n" "-DNAME=DEF Define NAME as DEF.\n" "-UNAME Remove any definition for NAME.\n" "-d, --debug Print debug messages.\n" "--underscore Permit underscores in Slice identifiers.\n" "--include-old DIR Put DIR in the include file search path for old Slice\n" " definitions.\n" "--include-new DIR Put DIR in the include file search path for new Slice\n" " definitions.\n" "--old SLICE Load old Slice definitions from the file SLICE.\n" "--new SLICE Load new Slice definitions from the file SLICE.\n" ; cerr << "\n"; cerr << "Type Options:\n" "-e Indicates the database is an Evictor database.\n" "--key TYPE[,TYPE] Specifies the Slice types of the database key. If the\n" " type names have not changed, only one needs to be\n" " specified. Otherwise, the type names are specified as\n" " old-type,new-type.\n" "--value TYPE[,TYPE] Specifies the Slice types of the database value. If the\n" " type names have not changed, only one needs to be\n" " specified. Otherwise, the type names are specified as\n" " old-type,new-type.\n" ; cerr << "\n"; cerr << "Options:\n" "-h, --help Show this message.\n" "-v, --version Display the Ice version.\n" "-i Ignore incompatible type changes.\n" "-p Purge objects whose types no longer exist.\n" "-c Use catastrophic recovery on the old database environment.\n" "-w Suppress duplicate warnings during migration.\n" "-f FILE Execute the transformation descriptors in the file FILE.\n" ; } static Slice::TypePtr findType(const Slice::UnitPtr& u, const string& type) { Slice::TypeList l; string t; if(type == "::Ice::Object") { t = "Object"; } else if(type == "::Ice::Object*") { t = "Object*"; } else { t = type; } l = u->lookupType(t, false); if(l.empty()) { return 0; } return l.front(); } static void transformDb(bool evictor, const Ice::CommunicatorPtr& communicator, const FreezeScript::ObjectFactoryPtr& objectFactory, DbEnv& dbEnv, DbEnv& dbEnvNew, const string& dbName, const Freeze::ConnectionPtr& connectionNew, vector& dbs, const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit, DbTxn* txnNew, bool purgeObjects, bool suppress, string descriptors) { if(evictor) { // // The evictor database file contains multiple databases. We must first // determine the names of those databases, ignoring any whose names // begin with "$index:". Each database represents a separate facet, with // the facet name used as the database name. The database named "$default" // represents the main object. // vector dbNames; { Db db(&dbEnv, 0); db.open(0, dbName.c_str(), 0, DB_UNKNOWN, DB_RDONLY, 0); Dbt dbKey, dbValue; dbKey.set_flags(DB_DBT_MALLOC); dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); Dbc* dbc = 0; db.cursor(0, &dbc, 0); while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0) { string s(static_cast(dbKey.get_data()), dbKey.get_size()); if(s.find("$index:") != 0) { dbNames.push_back(s); } free(dbKey.get_data()); } dbc->close(); db.close(0); } // // Transform each database. We must delay closing the new databases // until after the transaction is committed or aborted. // for(vector::iterator p = dbNames.begin(); p != dbNames.end(); ++p) { string name = p->c_str(); Db db(&dbEnv, 0); db.open(0, dbName.c_str(), name.c_str(), DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); Db* dbNew = new Db(&dbEnvNew, 0); dbs.push_back(dbNew); dbNew->open(txnNew, dbName.c_str(), name.c_str(), DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE); // // Execute the transformation descriptors. // istringstream istr(descriptors); string facet = (name == "$default" ? string("") : name); FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, 0, dbName, facet, purgeObjects, cerr, suppress, istr); db.close(0); } Freeze::Catalog catalogNew(connectionNew, Freeze::catalogName()); Freeze::CatalogData catalogData = { true, "::Ice::Identity", "Object" }; catalogNew.put(Freeze::Catalog::value_type(dbName, catalogData)); } else { // // Transform a map database. // Db db(&dbEnv, 0); db.open(0, dbName.c_str(), 0, DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); Db* dbNew = new Db(&dbEnvNew, 0); dbs.push_back(dbNew); dbNew->open(txnNew, dbName.c_str(), 0, DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE); // // Execute the transformation descriptors. // istringstream istr(descriptors); FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, connectionNew, dbName, "", purgeObjects, cerr, suppress, istr); db.close(0); } } static int run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator) { vector oldCppArgs; vector newCppArgs; bool debug; bool ice = true; // Needs to be true in order to create default definitions. bool underscore; string outputFile; bool ignoreTypeChanges; bool purgeObjects; bool catastrophicRecover; bool suppress; string inputFile; vector oldSlice; vector newSlice; bool evictor; string keyTypeNames; string valueTypeNames; string dbEnvName, dbName, dbEnvNameNew; bool allDb = false; IceUtilInternal::Options opts; opts.addOpt("h", "help"); opts.addOpt("v", "version"); opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("d", "debug"); opts.addOpt("", "underscore"); opts.addOpt("o", "", IceUtilInternal::Options::NeedArg); opts.addOpt("i"); opts.addOpt("p"); opts.addOpt("c"); opts.addOpt("w"); opts.addOpt("f", "", IceUtilInternal::Options::NeedArg); opts.addOpt("", "include-old", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("", "include-new", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("", "old", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("", "new", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("a"); opts.addOpt("e"); opts.addOpt("", "key", IceUtilInternal::Options::NeedArg); opts.addOpt("", "value", IceUtilInternal::Options::NeedArg); const string appName = originalArgs[0]; vector args; try { args = opts.parse(originalArgs); } catch(const IceUtilInternal::BadOptException& e) { cerr << appName << ": " << e.reason << endl; usage(appName); return EXIT_FAILURE; } if(opts.isSet("help")) { usage(appName); return EXIT_SUCCESS; } if(opts.isSet("version")) { cout << ICE_STRING_VERSION << endl; return EXIT_SUCCESS; } if(opts.isSet("D")) { vector optargs = opts.argVec("D"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { oldCppArgs.push_back("-D" + *i); newCppArgs.push_back("-D" + *i); } } if(opts.isSet("U")) { vector optargs = opts.argVec("U"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { oldCppArgs.push_back("-U" + *i); newCppArgs.push_back("-U" + *i); } } debug = opts.isSet("debug"); underscore = opts.isSet("underscore"); if(opts.isSet("o")) { outputFile = opts.optArg("o"); } ignoreTypeChanges = opts.isSet("i"); purgeObjects = opts.isSet("p"); catastrophicRecover = opts.isSet("c"); suppress = opts.isSet("w"); if(opts.isSet("f")) { inputFile = opts.optArg("f"); } if(opts.isSet("include-old")) { vector optargs = opts.argVec("include-old"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { oldCppArgs.push_back("-I" + *i); } } if(opts.isSet("include-new")) { vector optargs = opts.argVec("include-new"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { newCppArgs.push_back("-I" + *i); } } if(opts.isSet("old")) { vector optargs = opts.argVec("old"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { oldSlice.push_back(*i); } } if(opts.isSet("new")) { vector optargs = opts.argVec("new"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { newSlice.push_back(*i); } } evictor = opts.isSet("e"); if(opts.isSet("key")) { keyTypeNames = opts.optArg("key"); } if(opts.isSet("value")) { valueTypeNames = opts.optArg("value"); } if(outputFile.empty()) { if(args.size() == 2) { allDb = true; } else if(args.size() != 3) { usage(appName); return EXIT_FAILURE; } } else { if(args.size() == 1) { allDb = true; } else if(args.size() != 0) { usage(appName); return EXIT_FAILURE; } } if(allDb && (!keyTypeNames.empty() || !valueTypeNames.empty())) { usage(appName); return EXIT_FAILURE; } if(inputFile.empty() && !allDb && !evictor && (keyTypeNames.empty() || valueTypeNames.empty())) { usage(appName); return EXIT_FAILURE; } if(args.size() > 0) { dbEnvName = args[0]; } if(args.size() > 1) { if(allDb) { dbEnvNameNew = args[1]; } else { dbName = args[1]; } } if(args.size() > 2) { dbEnvNameNew = args[2]; } if(args.size() > 3) { cerr << appName << ": too many arguments" << endl; usage(appName); return EXIT_FAILURE; } // // Freeze creates a lock file by default to prevent multiple processes from opening // the same database environment simultaneously. In the case of a read-only program // such as transformdb, however, we still want to be able to open the environment despite // the lock. This assumes of course that the other process has opened the environment // with DbPrivate=0. If DbPrivate=0 is also set for dumpdb, we disable the lock. // if(!catastrophicRecover && outputFile.empty()) { Ice::PropertiesPtr props = communicator->getProperties(); string prefix = "Freeze.DbEnv." + args[0]; if(props->getPropertyAsIntWithDefault(prefix + ".DbPrivate", 1) == 0) { props->setProperty(prefix + ".LockFile", "0"); } } Slice::UnitPtr oldUnit = Slice::Unit::createUnit(true, true, ice, underscore); FreezeScript::Destroyer oldD(oldUnit); if(!FreezeScript::parseSlice(appName, oldUnit, oldSlice, oldCppArgs, debug, "-D__TRANSFORMDB__")) { return EXIT_FAILURE; } Slice::UnitPtr newUnit = Slice::Unit::createUnit(true, true, ice, underscore); FreezeScript::Destroyer newD(newUnit); if(!FreezeScript::parseSlice(appName, newUnit, newSlice, newCppArgs, debug, "-D__TRANSFORMDB__")) { return EXIT_FAILURE; } // // Install the evictor types in the Slice units. // FreezeScript::createEvictorSliceTypes(oldUnit); FreezeScript::createEvictorSliceTypes(newUnit); // // Read the catalog if necessary. // FreezeScript::CatalogDataMap catalog; if(allDb) { try { catalog = FreezeScript::readCatalog(communicator, dbEnvName); } catch(const FreezeScript::FailureException& ex) { cerr << appName << ": " << ex.reason() << endl; return EXIT_FAILURE; } if(catalog.empty()) { cerr << appName << ": no databases in environment `" << dbEnvName << "'" << endl; return EXIT_FAILURE; } } // // If no input file was provided, then we need to analyze the Slice types. // string descriptors; if(inputFile.empty()) { ostringstream out; vector missingTypes; vector analyzeErrors; FreezeScript::TransformAnalyzer analyzer(oldUnit, newUnit, ignoreTypeChanges, out, missingTypes, analyzeErrors); const string evictorKeyName = "::Ice::Identity"; const string oldEvictorValueName = "::Freeze::ObjectRecord"; const string newEvictorValueName = "Object"; if(allDb) { // // Add a element for each database in the catalog. // for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p) { string keyName, valueName; if(p->second.evictor) { keyName = p->second.key; valueName = p->second.value; if(keyName.empty()) { keyName = evictorKeyName; } if(valueName.empty()) { valueName = oldEvictorValueName; } } else { keyName = p->second.key; valueName = p->second.value; } // // Look up the key and value types in the old and new Slice definitions. // Slice::TypePtr oldKeyType = findType(oldUnit, keyName); if(!oldKeyType) { cerr << appName << ": type `" << keyName << "' from database `" << p->first << "' not found in old Slice definitions" << endl; } Slice::TypePtr newKeyType = findType(newUnit, keyName); if(!newKeyType) { cerr << appName << ": type `" << keyName << "' from database `" << p->first << "' not found in new Slice definitions" << endl; } Slice::TypePtr oldValueType = findType(oldUnit, valueName); if(!oldValueType) { cerr << appName << ": type `" << valueName << "' from database `" << p->first << "' not found in old Slice definitions" << endl; } Slice::TypePtr newValueType; if(p->second.evictor) { // // The new evictor does not keep stats // newValueType = findType(newUnit, newEvictorValueName); } else { newValueType = findType(newUnit, valueName); } if(!newValueType) { cerr << appName << ": type `" << valueName << "' from database `" << p->first << "' not found in new Slice definitions" << endl; } // // If we are generating an output file, we do not consider a missing type to be // an error. Since the type information comes from the catalog of the old // environment, it's possible that the key or value types are not present in // the new Slice definitions. Rather than abort at this point, we simply emit // a partially-defined element that must be edited by the user. // // If we are not generating an output file, we have to stop now. // if(outputFile.empty() && (!oldKeyType || !newKeyType || !oldValueType || !newValueType)) { return EXIT_FAILURE; } analyzer.addDatabase(p->first, oldKeyType, newKeyType, oldValueType, newValueType); } } else { string oldKeyName, newKeyName, oldValueName, newValueName; string::size_type pos; if(!evictor && (keyTypeNames.empty() || valueTypeNames.empty())) { usage(appName); return EXIT_FAILURE; } if(!keyTypeNames.empty()) { pos = keyTypeNames.find(','); if(pos == 0 || pos == keyTypeNames.size()) { usage(appName); return EXIT_FAILURE; } if(pos == string::npos) { oldKeyName = keyTypeNames; newKeyName = keyTypeNames; } else { oldKeyName = keyTypeNames.substr(0, pos); newKeyName = keyTypeNames.substr(pos + 1); } } if(!valueTypeNames.empty()) { pos = valueTypeNames.find(','); if(pos == 0 || pos == valueTypeNames.size()) { usage(appName); return EXIT_FAILURE; } if(pos == string::npos) { oldValueName = valueTypeNames; newValueName = valueTypeNames; } else { oldValueName = valueTypeNames.substr(0, pos); newValueName = valueTypeNames.substr(pos + 1); } } if(evictor) { if(oldKeyName.empty()) { oldKeyName = evictorKeyName; } if(newKeyName.empty()) { newKeyName = evictorKeyName; } if(oldValueName.empty()) { oldValueName = newEvictorValueName; } if(newValueName.empty()) { newValueName = newEvictorValueName; } } // // Look up the key and value types in the old and new Slice definitions. // Slice::TypePtr oldKeyType = findType(oldUnit, oldKeyName); if(!oldKeyType) { cerr << appName << ": type `" << oldKeyName << "' not found in old Slice definitions" << endl; } Slice::TypePtr newKeyType = findType(newUnit, newKeyName); if(!newKeyType) { cerr << appName << ": type `" << newKeyName << "' not found in new Slice definitions" << endl; } Slice::TypePtr oldValueType = findType(oldUnit, oldValueName); if(!oldValueType) { cerr << appName << ": type `" << oldValueName << "' not found in old Slice definitions" << endl; } Slice::TypePtr newValueType = findType(newUnit, newValueName); if(!newValueType) { cerr << appName << ": type `" << newValueName << "' not found in new Slice definitions" << endl; } // // Stop now if any of the types could not be found. // if(!oldKeyType || !newKeyType || !oldValueType || !newValueType) { return EXIT_FAILURE; } analyzer.addDatabase("", oldKeyType, newKeyType, oldValueType, newValueType); } analyzer.finish(); if(!analyzeErrors.empty()) { for(vector::const_iterator p = analyzeErrors.begin(); p != analyzeErrors.end(); ++p) { cerr << appName << ": " << *p << endl; } } if(!missingTypes.empty()) { sort(missingTypes.begin(), missingTypes.end()); unique(missingTypes.begin(), missingTypes.end()); if(!analyzeErrors.empty()) { cerr << endl; } cerr << "The following types had no matching definitions in the new Slice:" << endl; for(vector::const_iterator p = missingTypes.begin(); p != missingTypes.end(); ++p) { cerr << " " << *p << endl; } } if(!analyzeErrors.empty()) { return EXIT_FAILURE; } descriptors = out.str(); if(!outputFile.empty()) { // // No nativeToUTF8 conversion necessary here, no string converter is installed // by wmain() on Windows and args are assumbed to be UTF8 on Unix platforms. // IceUtilInternal::ofstream of(outputFile); if(!of.good()) { cerr << appName << ": unable to open file `" << outputFile << "'" << endl; return EXIT_FAILURE; } of << descriptors; of.close(); return EXIT_SUCCESS; } } else { // // Read the input file. // // No nativeToUTF8 conversion necessary here, no string converter is installed // by wmain() on Windows and args are assumbed to be UTF8 on Unix platforms. // IceUtilInternal::ifstream in(inputFile); char buff[1024]; while(true) { in.read(buff, 1024); descriptors.append(buff, static_cast(in.gcount())); if(in.gcount() < 1024) { break; } } in.close(); } if(dbEnvName == dbEnvNameNew) { cerr << appName << ": database environment names must be different" << endl; return EXIT_FAILURE; } FreezeScript::ObjectFactoryPtr objectFactory = new FreezeScript::ObjectFactory; communicator->addObjectFactory(objectFactory, ""); // // Transform the database. // DbEnv dbEnv(0); DbEnv dbEnvNew(0); Freeze::TransactionPtr txNew; Freeze::ConnectionPtr connection; Freeze::ConnectionPtr connectionNew; vector dbs; int status = EXIT_SUCCESS; try { #ifdef _WIN32 // // Berkeley DB may use a different C++ runtime. // dbEnv.set_alloc(::malloc, ::realloc, ::free); dbEnvNew.set_alloc(::malloc, ::realloc, ::free); #endif // // Open the old database environment. Use DB_RECOVER_FATAL if -c is specified. // No transaction is created for the old environment. // // DB_THREAD is for compatibility with Freeze (the catalog) // { u_int32_t flags = DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_MPOOL; if(catastrophicRecover) { flags |= DB_INIT_LOG | DB_RECOVER_FATAL; } dbEnv.open(dbEnvName.c_str(), flags, FREEZE_SCRIPT_DB_MODE); } // // We're creating a connection just to make sure the database environment // isn't locked. // connection = Freeze::createConnection(communicator, dbEnvName, dbEnv); // // Open the new database environment and start a transaction. // // // DB_THREAD is for compatibility with Freeze (the catalog) // { u_int32_t flags = DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER | DB_CREATE | DB_THREAD; dbEnvNew.open(dbEnvNameNew.c_str(), flags, FREEZE_SCRIPT_DB_MODE); } // // TODO: handle properly DbHome config (currently it will break if it's set for the new env) // // // Open the catalog of the new environment, and start a transaction. // connectionNew = Freeze::createConnection(communicator, dbEnvNameNew, dbEnvNew); txNew = connectionNew->beginTransaction(); DbTxn* txnNew = Freeze::getTxn(txNew); if(allDb) { // // Transform all databases in the old catalog. // for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p) { transformDb(p->second.evictor, communicator, objectFactory, dbEnv, dbEnvNew, p->first, connectionNew, dbs, oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors); } } else { transformDb(evictor, communicator, objectFactory, dbEnv, dbEnvNew, dbName, connectionNew, dbs, oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors); } } catch(const DbException& ex) { cerr << appName << ": database error: " << ex.what() << endl; status = EXIT_FAILURE; } catch(const IceUtil::FileLockException&) { cerr << appName << ": error: database environment is locked" << endl; status = EXIT_FAILURE; } catch(...) { try { if(txNew != 0) { txNew->rollback(); txNew = 0; } if(connectionNew) { connectionNew->close(); connectionNew = 0; } if(connection) { connection->close(); connection = 0; } for(vector::iterator p = dbs.begin(); p != dbs.end(); ++p) { Db* db = *p; db->close(0); delete db; } try { dbEnv.close(0); } catch(const DbException&) { } try { dbEnvNew.close(0); } catch(const DbException&) { } } catch(const DbException& ex) { cerr << appName << ": database error: " << ex.what() << endl; } throw; } if(txNew != 0) { try { if(status == EXIT_FAILURE) { txNew->rollback(); } else { txNew->commit(); // // Checkpoint to migrate changes from the log to the database(s). // dbEnvNew.txn_checkpoint(0, 0, DB_FORCE); } for(vector::iterator p = dbs.begin(); p != dbs.end(); ++p) { Db* db = *p; db->close(0); delete db; } } catch(const DbException& ex) { cerr << appName << ": database error: " << ex.what() << endl; status = EXIT_FAILURE; } } // Clear the transaction before closing the database environment. txNew = 0; if(connectionNew) { connectionNew->close(); connectionNew = 0; } if(connection) { connection->close(); connection = 0; } try { dbEnv.close(0); } catch(const DbException&) { } try { dbEnvNew.close(0); } catch(const DbException&) { } return status; } #ifdef _WIN32 int wmain(int argc, wchar_t* argv[]) #else int main(int argc, char* argv[]) #endif { Ice::StringSeq args = Ice::argsToStringSeq(argc, argv); assert(args.size() > 0); const string appName = args[0]; Ice::CommunicatorPtr communicator; int status = EXIT_SUCCESS; try { communicator = Ice::initialize(args); status = run(args, communicator); } catch(const FreezeScript::FailureException& ex) { string reason = ex.reason(); cerr << appName << ": " << reason; if(reason[reason.size() - 1] != '\n') { cerr << endl; } status = EXIT_FAILURE; } catch(const std::exception& ex) { cerr << appName << ": " << ex.what() << endl; status = EXIT_FAILURE; } catch(...) { cerr << appName << ": unknown exception" << endl; status = EXIT_FAILURE; } if(communicator) { communicator->destroy(); } return status; } Ice-3.5.1/cpp/src/FreezeScript/dummyinclude/0000755000076400007640000000000012223561476017047 5ustar mesmesIce-3.5.1/cpp/src/FreezeScript/dummyinclude/unistd.h0000644000076400007640000000015412223561476020526 0ustar mesmes// // Files generated by flex need unistd.h, which is not available on // Windows. Thus this dummy file. // Ice-3.5.1/cpp/src/FreezeScript/Exception.h0000644000076400007640000000167512223561476016470 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_EXCEPTION_H #define FREEZE_SCRIPT_EXCEPTION_H #include namespace FreezeScript { class FailureException : public IceUtil::Exception { public: FailureException(const char*, int, const std::string&); virtual ~FailureException() throw(); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual FailureException* ice_clone() const; virtual void ice_throw() const; std::string reason() const; private: std::string _reason; static const char* _name; }; } // End of namespace FreezeScript #endif Ice-3.5.1/cpp/src/FreezeScript/Data.cpp0000644000076400007640000015562612223561476015744 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace IceUtil; namespace FreezeScript { // // ObjectWriter // class ObjectWriter : public Ice::ObjectWriter { public: ObjectWriter(const ObjectDataPtr&); virtual void write(const Ice::OutputStreamPtr&) const; private: ObjectDataPtr _value; }; // // ReadObjectCallback // class ReadObjectCallback : public Ice::ReadObjectCallback { public: ReadObjectCallback(const ObjectRefPtr&); virtual void invoke(const Ice::ObjectPtr&); private: ObjectRefPtr _ref; }; // // ObjectReader // class ObjectReader : public Ice::ObjectReader { public: ObjectReader(const DataFactoryPtr&, const Slice::TypePtr&); virtual void read(const Ice::InputStreamPtr&); ObjectDataPtr getValue() const; private: DataFactoryPtr _factory; Slice::TypePtr _type; ObjectDataPtr _value; }; typedef IceUtil::Handle ObjectReaderPtr; } // End of namespace Transform // // ObjectWriter // FreezeScript::ObjectWriter::ObjectWriter(const ObjectDataPtr& value) : _value(value) { } void FreezeScript::ObjectWriter::write(const Ice::OutputStreamPtr& out) const { out->startObject(0); Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(_value->_type); Slice::ClassDefPtr type; if(decl) { type = decl->definition(); } while(type) { Slice::ClassDefPtr base; Slice::ClassList bases = type->bases(); if(!bases.empty() && !bases.front()->isInterface()) { base = bases.front(); } out->startSlice(type->scoped(), type->compactId(), !base); Slice::DataMemberList members = type->dataMembers(); for(Slice::DataMemberList::iterator p = members.begin(); p != members.end(); ++p) { DataMemberMap::const_iterator q = _value->_members.find((*p)->name()); assert(q != _value->_members.end()); q->second->marshal(out); } out->endSlice(); type = base; } out->endObject(); } // // ObjectReader // FreezeScript::ObjectReader::ObjectReader(const DataFactoryPtr& factory, const Slice::TypePtr& type) : _factory(factory), _type(type) { } void FreezeScript::ObjectReader::read(const Ice::InputStreamPtr& in) { const_cast(_value) = new ObjectData(_factory, _type, true); Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(_type); Slice::ClassDefPtr type; if(decl) { type = decl->definition(); } in->startObject(); while(type) { Slice::ClassDefPtr base; Slice::ClassList bases = type->bases(); if(!bases.empty() && !bases.front()->isInterface()) { base = bases.front(); } in->startSlice(); Slice::DataMemberList members = type->dataMembers(); for(Slice::DataMemberList::iterator p = members.begin(); p != members.end(); ++p) { DataMemberMap::iterator q = _value->_members.find((*p)->name()); assert(q != _value->_members.end()); q->second->unmarshal(in); } in->endSlice(); type = base; } in->endObject(false); } FreezeScript::ObjectDataPtr FreezeScript::ObjectReader::getValue() const { return _value; } // // DataFactory // FreezeScript::DataFactory::DataFactory(const Ice::CommunicatorPtr& communicator, const Slice::UnitPtr& unit, const ErrorReporterPtr& errorReporter) : _communicator(communicator), _unit(unit), _errorReporter(errorReporter) { } FreezeScript::DataPtr FreezeScript::DataFactory::create(const Slice::TypePtr& type, bool readOnly) { DataPtr data = createImpl(type, readOnly); if(!readOnly) { initialize(data); } return data; } FreezeScript::DataPtr FreezeScript::DataFactory::createBoolean(bool b, bool readOnly) { DataPtr data = new BooleanData(getBuiltin(Slice::Builtin::KindBool), _errorReporter, readOnly, b); if(!readOnly) { initialize(data); } return data; } FreezeScript::DataPtr FreezeScript::DataFactory::createInteger(Ice::Long i, bool readOnly) { DataPtr data = new IntegerData(getBuiltin(Slice::Builtin::KindLong), _errorReporter, readOnly, i); if(!readOnly) { initialize(data); } return data; } FreezeScript::DataPtr FreezeScript::DataFactory::createDouble(double d, bool readOnly) { DataPtr data = new DoubleData(getBuiltin(Slice::Builtin::KindDouble), _errorReporter, readOnly, d); if(!readOnly) { initialize(data); } return data; } FreezeScript::DataPtr FreezeScript::DataFactory::createString(const string& s, bool readOnly) { DataPtr data = new StringData(this, getBuiltin(Slice::Builtin::KindString), _errorReporter, readOnly, s); if(!readOnly) { initialize(data); } return data; } FreezeScript::DataPtr FreezeScript::DataFactory::createNil(bool readOnly) { DataPtr data = new ObjectRef(this, getBuiltin(Slice::Builtin::KindObject), readOnly); if(!readOnly) { initialize(data); } return data; } FreezeScript::DataPtr FreezeScript::DataFactory::createObject(const Slice::TypePtr& type, bool readOnly) { ObjectRefPtr obj; Slice::ClassDeclPtr cl = Slice::ClassDeclPtr::dynamicCast(type); if(cl) { Slice::ClassDefPtr def = cl->definition(); if(!def) { _errorReporter->error("class " + cl->scoped() + " declared but not defined"); } obj = new ObjectRef(this, cl, readOnly); } else { Slice::BuiltinPtr b = Slice::BuiltinPtr::dynamicCast(type); if(b && b->kind() == Slice::Builtin::KindObject) { obj = new ObjectRef(this, b, readOnly); } } if(!obj) { _errorReporter->error("type `" + typeToString(type) + "' is not a class"); } obj->instantiate(); if(!readOnly) { initialize(obj); } return obj; } Slice::BuiltinPtr FreezeScript::DataFactory::getBuiltin(Slice::Builtin::Kind kind) const { return _unit->builtin(kind); } Ice::CommunicatorPtr FreezeScript::DataFactory::getCommunicator() const { return _communicator; } FreezeScript::ErrorReporterPtr FreezeScript::DataFactory::getErrorReporter() const { return _errorReporter; } FreezeScript::DataPtr FreezeScript::DataFactory::createImpl(const Slice::TypePtr& type, bool readOnly) { Slice::BuiltinPtr builtin = Slice::BuiltinPtr::dynamicCast(type); if(builtin) { switch(builtin->kind()) { case Slice::Builtin::KindBool: return new BooleanData(builtin, _errorReporter, readOnly); case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: return new IntegerData(builtin, _errorReporter, readOnly); case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: return new DoubleData(builtin, _errorReporter, readOnly); case Slice::Builtin::KindString: return new StringData(this, builtin, _errorReporter, readOnly); case Slice::Builtin::KindObject: return new ObjectRef(this, builtin, readOnly); case Slice::Builtin::KindObjectProxy: return new ProxyData(builtin, _communicator, _errorReporter, readOnly); case Slice::Builtin::KindLocalObject: assert(false); return 0; } } Slice::SequencePtr seq = Slice::SequencePtr::dynamicCast(type); if(seq) { return new SequenceData(this, seq, _errorReporter, readOnly); } Slice::ProxyPtr proxy = Slice::ProxyPtr::dynamicCast(type); if(proxy) { return new ProxyData(proxy, _communicator, _errorReporter, readOnly); } Slice::StructPtr st = Slice::StructPtr::dynamicCast(type); if(st) { return new StructData(this, st, _errorReporter, readOnly); } Slice::EnumPtr en = Slice::EnumPtr::dynamicCast(type); if(en) { return new EnumData(en, _errorReporter, readOnly); } Slice::DictionaryPtr dict = Slice::DictionaryPtr::dynamicCast(type); if(dict) { return new DictionaryData(this, dict, _errorReporter, readOnly); } Slice::ClassDeclPtr cl = Slice::ClassDeclPtr::dynamicCast(type); if(cl) { Slice::ClassDefPtr def = cl->definition(); if(!def) { _errorReporter->error("class " + cl->scoped() + " declared but not defined"); } return new ObjectRef(this, cl, readOnly); } return 0; } void FreezeScript::DataFactory::initialize(const DataPtr&) { } // // Data // FreezeScript::Data::Data(const ErrorReporterPtr& errorReporter, bool readOnly) : _errorReporter(errorReporter), _readOnly(readOnly) { } FreezeScript::Data::~Data() { } bool FreezeScript::Data::readOnly() const { return _readOnly; } // // PrimitiveData // FreezeScript::PrimitiveData::PrimitiveData(const ErrorReporterPtr& errorReporter, bool readOnly) : Data(errorReporter, readOnly) { } FreezeScript::DataPtr FreezeScript::PrimitiveData::getMember(const string&) const { return 0; } FreezeScript::DataPtr FreezeScript::PrimitiveData::getElement(const DataPtr&) const { _errorReporter->error("element requested of primitive value"); return 0; } void FreezeScript::PrimitiveData::destroy() { } // // BooleanData // FreezeScript::BooleanData::BooleanData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly) : PrimitiveData(errorReporter, readOnly), _type(type), _value(false) { } FreezeScript::BooleanData::BooleanData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly, bool value) : PrimitiveData(errorReporter, readOnly), _type(type), _value(value) { } bool FreezeScript::BooleanData::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::BooleanData::operator!=(const Data& rhs) const { const BooleanData* b = dynamic_cast(&rhs); if(!b) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value != b->_value; } bool FreezeScript::BooleanData::operator<(const Data& rhs) const { const BooleanData* b = dynamic_cast(&rhs); if(!b) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value < b->_value; } FreezeScript::DataPtr FreezeScript::BooleanData::clone() const { return new BooleanData(_type, _errorReporter, _readOnly, _value); } Slice::TypePtr FreezeScript::BooleanData::getType() const { return _type; } void FreezeScript::BooleanData::marshal(const Ice::OutputStreamPtr& out) const { out->write(_value); } void FreezeScript::BooleanData::unmarshal(const Ice::InputStreamPtr& in) { in->read(_value); } bool FreezeScript::BooleanData::booleanValue(bool) const { return _value; } Ice::Long FreezeScript::BooleanData::integerValue(bool) const { _errorReporter->error("boolean cannot be converted to integer"); return 0; } double FreezeScript::BooleanData::doubleValue(bool) const { _errorReporter->error("boolean cannot be converted to double"); return 0; } string FreezeScript::BooleanData::stringValue(bool convert) const { if(convert) { return toString(); } else { return string(); } } string FreezeScript::BooleanData::toString() const { return (_value ? "true" : "false"); } void FreezeScript::BooleanData::visit(DataVisitor& visitor) { visitor.visitBoolean(this); } bool FreezeScript::BooleanData::getValue() const { return _value; } void FreezeScript::BooleanData::setValue(bool v) { _value = v; } // // IntegerData // FreezeScript::IntegerData::IntegerData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly) : PrimitiveData(errorReporter, readOnly), _type(type), _value(0) { } FreezeScript::IntegerData::IntegerData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly, Ice::Long value) : PrimitiveData(errorReporter, readOnly), _type(type), _value(value) { } bool FreezeScript::IntegerData::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::IntegerData::operator!=(const Data& rhs) const { const IntegerData* i = dynamic_cast(&rhs); if(!i) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value != i->_value; } bool FreezeScript::IntegerData::operator<(const Data& rhs) const { const IntegerData* i = dynamic_cast(&rhs); if(!i) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value < i->_value; } FreezeScript::DataPtr FreezeScript::IntegerData::clone() const { return new IntegerData(_type, _errorReporter, _readOnly, _value); } Slice::TypePtr FreezeScript::IntegerData::getType() const { return _type; } void FreezeScript::IntegerData::marshal(const Ice::OutputStreamPtr& out) const { rangeCheck(_value, true); switch(_type->kind()) { case Slice::Builtin::KindByte: { out->write(static_cast(_value)); break; } case Slice::Builtin::KindShort: { out->write(static_cast(_value)); break; } case Slice::Builtin::KindInt: { out->write(static_cast(_value)); break; } case Slice::Builtin::KindLong: { out->write(_value); break; } case Slice::Builtin::KindBool: case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: case Slice::Builtin::KindString: case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: assert(false); } } void FreezeScript::IntegerData::unmarshal(const Ice::InputStreamPtr& in) { switch(_type->kind()) { case Slice::Builtin::KindByte: { Ice::Byte val; in->read(val); _value = val & 0xff; break; } case Slice::Builtin::KindShort: { Ice::Short val; in->read(val); _value = val; break; } case Slice::Builtin::KindInt: { Ice::Int val; in->read(val); _value = val; break; } case Slice::Builtin::KindLong: { Ice::Long val; in->read(val); _value = val; break; } case Slice::Builtin::KindBool: case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: case Slice::Builtin::KindString: case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: assert(false); } } bool FreezeScript::IntegerData::booleanValue(bool) const { _errorReporter->error("integer cannot be converted to boolean"); return 0; } Ice::Long FreezeScript::IntegerData::integerValue(bool) const { return _value; } double FreezeScript::IntegerData::doubleValue(bool convert) const { if(convert) { return static_cast(_value); } else { _errorReporter->error("integer cannot be converted to double"); return 0; } } string FreezeScript::IntegerData::stringValue(bool convert) const { if(convert) { return toString(); } else { _errorReporter->error("integer cannot be converted to string"); return string(); } } string FreezeScript::IntegerData::toString() const { return toString(_value); } void FreezeScript::IntegerData::visit(DataVisitor& visitor) { visitor.visitInteger(this); } Ice::Long FreezeScript::IntegerData::getValue() const { return _value; } void FreezeScript::IntegerData::setValue(Ice::Long v, bool fatal) { if(rangeCheck(v, fatal)) { _value = v; } } bool FreezeScript::IntegerData::rangeCheck(Ice::Long value, bool fatal) const { switch(_type->kind()) { case Slice::Builtin::KindByte: { if(value < 0 || value > 255) { _errorReporter->rangeError(toString(value), _type, fatal); } else { return true; } break; } case Slice::Builtin::KindShort: { if(value < SHRT_MIN || value > SHRT_MAX) { _errorReporter->rangeError(toString(value), _type, fatal); } else { return true; } break; } case Slice::Builtin::KindInt: { if(value < INT_MIN || value > INT_MAX) { _errorReporter->rangeError(toString(value), _type, fatal); } else { return true; } break; } case Slice::Builtin::KindLong: { return true; } case Slice::Builtin::KindBool: case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: case Slice::Builtin::KindString: case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: assert(false); } return false; } string FreezeScript::IntegerData::toString(Ice::Long value) { char buf[64]; #ifdef _WIN32 sprintf_s(buf, "%I64d", value); #elif defined(ICE_64) sprintf(buf, "%ld", value); #else sprintf(buf, "%lld", value); #endif return string(buf); } // // DoubleData // FreezeScript::DoubleData::DoubleData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly) : PrimitiveData(errorReporter, readOnly), _type(type), _value(0) { } FreezeScript::DoubleData::DoubleData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly, double value) : PrimitiveData(errorReporter, readOnly), _type(type), _value(value) { } bool FreezeScript::DoubleData::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::DoubleData::operator!=(const Data& rhs) const { const DoubleData* d = dynamic_cast(&rhs); if(!d) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value != d->_value; } bool FreezeScript::DoubleData::operator<(const Data& rhs) const { const DoubleData* d = dynamic_cast(&rhs); if(!d) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value < d->_value; } FreezeScript::DataPtr FreezeScript::DoubleData::clone() const { return new DoubleData(_type, _errorReporter, _readOnly, _value); } Slice::TypePtr FreezeScript::DoubleData::getType() const { return _type; } void FreezeScript::DoubleData::marshal(const Ice::OutputStreamPtr& out) const { switch(_type->kind()) { case Slice::Builtin::KindFloat: { out->write(static_cast(_value)); break; } case Slice::Builtin::KindDouble: { out->write(_value); break; } case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: case Slice::Builtin::KindBool: case Slice::Builtin::KindString: case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: assert(false); } } void FreezeScript::DoubleData::unmarshal(const Ice::InputStreamPtr& in) { switch(_type->kind()) { case Slice::Builtin::KindFloat: { Ice::Float val; in->read(val); _value = val; break; } case Slice::Builtin::KindDouble: { in->read(_value); break; } case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: case Slice::Builtin::KindBool: case Slice::Builtin::KindString: case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: assert(false); } } bool FreezeScript::DoubleData::booleanValue(bool) const { _errorReporter->error("double cannot be converted to boolean"); return 0; } Ice::Long FreezeScript::DoubleData::integerValue(bool convert) const { if(convert) { return static_cast(_value); } else { _errorReporter->error("double cannot be converted to integer"); return 0; } } double FreezeScript::DoubleData::doubleValue(bool) const { return _value; } string FreezeScript::DoubleData::stringValue(bool convert) const { if(convert) { return toString(); } else { _errorReporter->error("double cannot be converted to string"); return string(); } } string FreezeScript::DoubleData::toString() const { char buff[64]; sprintf(buff, "%g", _value); return string(buff); } void FreezeScript::DoubleData::visit(DataVisitor& visitor) { visitor.visitDouble(this); } double FreezeScript::DoubleData::getValue() const { return _value; } void FreezeScript::DoubleData::setValue(double v) { _value = v; } // // StringData // FreezeScript::StringData::StringData(const DataFactoryPtr& factory, const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly) : PrimitiveData(errorReporter, readOnly), _factory(factory), _type(type) { setValue(""); } FreezeScript::StringData::StringData(const DataFactoryPtr& factory, const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly, const string& value) : PrimitiveData(errorReporter, readOnly), _factory(factory), _type(type) { setValue(value); } FreezeScript::DataPtr FreezeScript::StringData::getMember(const string& member) const { if(member == "length") { _length->setValue(static_cast(_value.size()), false); return _length; } return 0; } bool FreezeScript::StringData::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::StringData::operator!=(const Data& rhs) const { const StringData* s = dynamic_cast(&rhs); if(!s) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value != s->_value; } bool FreezeScript::StringData::operator<(const Data& rhs) const { const StringData* s = dynamic_cast(&rhs); if(!s) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value < s->_value; } FreezeScript::DataPtr FreezeScript::StringData::clone() const { return new StringData(_factory, _type, _errorReporter, _readOnly, _value); } Slice::TypePtr FreezeScript::StringData::getType() const { return _type; } void FreezeScript::StringData::marshal(const Ice::OutputStreamPtr& out) const { out->write(_value); } void FreezeScript::StringData::unmarshal(const Ice::InputStreamPtr& in) { string val; in->read(val); setValue(val); } bool FreezeScript::StringData::booleanValue(bool) const { _errorReporter->error("string cannot be converted to boolean"); return false; } Ice::Long FreezeScript::StringData::integerValue(bool) const { _errorReporter->error("string cannot be converted to integer"); return 0; } double FreezeScript::StringData::doubleValue(bool) const { _errorReporter->error("string cannot be converted to double"); return 0; } string FreezeScript::StringData::stringValue(bool) const { return _value; } string FreezeScript::StringData::toString() const { return _value; } void FreezeScript::StringData::visit(DataVisitor& visitor) { visitor.visitString(this); } string FreezeScript::StringData::getValue() const { return _value; } void FreezeScript::StringData::setValue(const string& v) { _value = v; _length = IntegerDataPtr::dynamicCast(_factory->createInteger(static_cast(_value.size()), true)); } // // ProxyData // FreezeScript::ProxyData::ProxyData(const Slice::TypePtr& type, const Ice::CommunicatorPtr& communicator, const ErrorReporterPtr& errorReporter, bool readOnly) : Data(errorReporter, readOnly), _type(type), _communicator(communicator) { } FreezeScript::ProxyData::ProxyData(const Slice::TypePtr& type, const Ice::CommunicatorPtr& communicator, const ErrorReporterPtr& errorReporter, bool readOnly, const Ice::ObjectPrx& value) : Data(errorReporter, readOnly), _type(type), _communicator(communicator), _value(value) { } FreezeScript::DataPtr FreezeScript::ProxyData::getMember(const string& /*member*/) const { // TODO: Support members (id, facet, etc.)? return 0; } FreezeScript::DataPtr FreezeScript::ProxyData::getElement(const DataPtr&) const { _errorReporter->error("element requested of proxy value"); return 0; } bool FreezeScript::ProxyData::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::ProxyData::operator!=(const Data& rhs) const { const ProxyData* p = dynamic_cast(&rhs); if(!p) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value != p->_value; } bool FreezeScript::ProxyData::operator<(const Data& rhs) const { const ProxyData* p = dynamic_cast(&rhs); if(!p) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value < p->_value; } FreezeScript::DataPtr FreezeScript::ProxyData::clone() const { return new ProxyData(_type, _communicator, _errorReporter, _readOnly, _value); } Slice::TypePtr FreezeScript::ProxyData::getType() const { return _type; } void FreezeScript::ProxyData::destroy() { } void FreezeScript::ProxyData::marshal(const Ice::OutputStreamPtr& out) const { out->write(_value); } void FreezeScript::ProxyData::unmarshal(const Ice::InputStreamPtr& in) { in->read(_value); } bool FreezeScript::ProxyData::booleanValue(bool) const { _errorReporter->error("proxy cannot be converted to boolean"); return 0; } Ice::Long FreezeScript::ProxyData::integerValue(bool) const { _errorReporter->error("proxy cannot be converted to integer"); return 0; } double FreezeScript::ProxyData::doubleValue(bool) const { _errorReporter->error("proxy cannot be converted to double"); return 0; } string FreezeScript::ProxyData::stringValue(bool) const { _errorReporter->error("proxy cannot be converted to string"); return string(); } string FreezeScript::ProxyData::toString() const { if(_value && _str.empty()) { const_cast(_str) = _communicator->proxyToString(_value); } return _str; } void FreezeScript::ProxyData::visit(DataVisitor& visitor) { visitor.visitProxy(this); } Ice::ObjectPrx FreezeScript::ProxyData::getValue() const { return _value; } void FreezeScript::ProxyData::setValue(const string& str, bool fatal) { try { _value = _communicator->stringToProxy(str); _str = str; } catch(const Ice::LocalException&) { _errorReporter->conversionError(str, _type, fatal); } } void FreezeScript::ProxyData::setValue(const Ice::ObjectPrx& v) { _value = v; _str.clear(); } // // StructData // FreezeScript::StructData::StructData(const DataFactoryPtr& factory, const Slice::StructPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly) : Data(errorReporter, readOnly), _type(type) { Slice::DataMemberList members = type->dataMembers(); for(Slice::DataMemberList::iterator q = members.begin(); q != members.end(); ++q) { DataPtr value = factory->create((*q)->type(), _readOnly); assert(value); _members[(*q)->name()] = value; } } FreezeScript::StructData::StructData(const Slice::StructPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly, const DataMemberMap& members) : Data(errorReporter, readOnly), _type(type) { for(DataMemberMap::const_iterator p = members.begin(); p != members.end(); ++p) { _members[p->first] = p->second->clone(); } } FreezeScript::DataPtr FreezeScript::StructData::getMember(const string& member) const { DataMemberMap::const_iterator p = _members.find(member); if(p != _members.end()) { return p->second; } return 0; } FreezeScript::DataPtr FreezeScript::StructData::getElement(const DataPtr&) const { _errorReporter->error("element requested of struct value"); return 0; } bool FreezeScript::StructData::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::StructData::operator!=(const Data& rhs) const { const StructData* s = dynamic_cast(&rhs); if(!s || _type->scoped() != s->_type->scoped()) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } assert(_members.size() == s->_members.size()); for(DataMemberMap::const_iterator p = _members.begin(); p != _members.end(); ++p) { DataMemberMap::const_iterator q = s->_members.find(p->first); assert(q != s->_members.end()); if(p->second != q->second) { return true; } } return false; } bool FreezeScript::StructData::operator<(const Data& rhs) const { const StructData* s = dynamic_cast(&rhs); if(!s || _type->scoped() != s->_type->scoped()) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } assert(_members.size() == s->_members.size()); for(DataMemberMap::const_iterator p = _members.begin(); p != _members.end(); ++p) { DataMemberMap::const_iterator q = s->_members.find(p->first); assert(q != s->_members.end()); if(p->second < q->second) { return true; } else if(q->second < p->second) { return false; } } return false; } FreezeScript::DataPtr FreezeScript::StructData::clone() const { return new StructData(_type, _errorReporter, _readOnly, _members); } Slice::TypePtr FreezeScript::StructData::getType() const { return _type; } void FreezeScript::StructData::destroy() { for(DataMemberMap::const_iterator p = _members.begin(); p != _members.end(); ++p) { p->second->destroy(); } } void FreezeScript::StructData::marshal(const Ice::OutputStreamPtr& out) const { Slice::DataMemberList members = _type->dataMembers(); for(Slice::DataMemberList::iterator p = members.begin(); p != members.end(); ++p) { DataMemberMap::const_iterator q = _members.find((*p)->name()); assert(q != _members.end()); q->second->marshal(out); } } void FreezeScript::StructData::unmarshal(const Ice::InputStreamPtr& in) { Slice::DataMemberList members = _type->dataMembers(); for(Slice::DataMemberList::iterator p = members.begin(); p != members.end(); ++p) { DataMemberMap::const_iterator q = _members.find((*p)->name()); assert(q != _members.end()); q->second->unmarshal(in); } } bool FreezeScript::StructData::booleanValue(bool) const { _errorReporter->error("struct " + typeToString(_type) + " cannot be converted to boolean"); return 0; } Ice::Long FreezeScript::StructData::integerValue(bool) const { _errorReporter->error("struct " + typeToString(_type) + " cannot be converted to integer"); return 0; } double FreezeScript::StructData::doubleValue(bool) const { _errorReporter->error("struct " + typeToString(_type) + " cannot be converted to double"); return 0; } string FreezeScript::StructData::stringValue(bool) const { _errorReporter->error("struct " + typeToString(_type) + " cannot be converted to string"); return string(); } string FreezeScript::StructData::toString() const { return stringValue(); } void FreezeScript::StructData::visit(DataVisitor& visitor) { visitor.visitStruct(this); } FreezeScript::DataMemberMap& FreezeScript::StructData::getMembers() { return _members; } // // SequenceData // FreezeScript::SequenceData::SequenceData(const DataFactoryPtr& factory, const Slice::SequencePtr& type, const ErrorReporterPtr& errorReporter, bool readOnly) : Data(errorReporter, readOnly), _factory(factory), _type(type) { _length = IntegerDataPtr::dynamicCast(_factory->createInteger(0, true)); } FreezeScript::SequenceData::SequenceData(const DataFactoryPtr& factory, const Slice::SequencePtr& type, const ErrorReporterPtr& errorReporter, bool readOnly, const DataList& elements) : Data(errorReporter, readOnly), _factory(factory), _type(type) { for(DataList::const_iterator p = elements.begin(); p != elements.end(); ++p) { _elements.push_back((*p)->clone()); } _length = IntegerDataPtr::dynamicCast(_factory->createInteger(static_cast(_elements.size()), true)); } FreezeScript::DataPtr FreezeScript::SequenceData::getMember(const string& member) const { if(member == "length") { _length->setValue(static_cast(_elements.size()), false); return _length; } return 0; } FreezeScript::DataPtr FreezeScript::SequenceData::getElement(const DataPtr& element) const { IntegerDataPtr i = IntegerDataPtr::dynamicCast(element); if(!i) { _errorReporter->error("invalid sequence index type " + typeToString(element->getType())); } Ice::Long iv = i->integerValue(); if(iv < 0 || iv >= static_cast(_elements.size())) { _errorReporter->error("sequence index " + i->toString() + " out of range"); } return _elements[static_cast(iv)]; } bool FreezeScript::SequenceData::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::SequenceData::operator!=(const Data& rhs) const { const SequenceData* s = dynamic_cast(&rhs); if(!s || _type->scoped() != s->_type->scoped()) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _elements != s->_elements; } bool FreezeScript::SequenceData::operator<(const Data& rhs) const { const SequenceData* s = dynamic_cast(&rhs); if(!s || _type->scoped() != s->_type->scoped()) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _elements < s->_elements; } FreezeScript::DataPtr FreezeScript::SequenceData::clone() const { return new SequenceData(_factory, _type, _errorReporter, _readOnly, _elements); } Slice::TypePtr FreezeScript::SequenceData::getType() const { return _type; } void FreezeScript::SequenceData::destroy() { for(DataList::const_iterator p = _elements.begin(); p != _elements.end(); ++p) { (*p)->destroy(); } } void FreezeScript::SequenceData::marshal(const Ice::OutputStreamPtr& out) const { out->writeSize(static_cast(_elements.size())); for(DataList::const_iterator p = _elements.begin(); p != _elements.end(); ++p) { (*p)->marshal(out); } } void FreezeScript::SequenceData::unmarshal(const Ice::InputStreamPtr& in) { Slice::TypePtr type = _type->type(); Ice::Int sz = in->readSize(); _elements.reserve(sz); for(Ice::Int i = 0; i < sz; ++i) { DataPtr v = _factory->create(type, _readOnly); v->unmarshal(in); _elements.push_back(v); } _length->setValue(sz, false); } bool FreezeScript::SequenceData::booleanValue(bool) const { _errorReporter->error("sequence " + typeToString(_type) + " cannot be converted to boolean"); return 0; } Ice::Long FreezeScript::SequenceData::integerValue(bool) const { _errorReporter->error("sequence " + typeToString(_type) + " cannot be converted to integer"); return 0; } double FreezeScript::SequenceData::doubleValue(bool) const { _errorReporter->error("sequence " + typeToString(_type) + " cannot be converted to double"); return 0; } string FreezeScript::SequenceData::stringValue(bool) const { _errorReporter->error("sequence " + typeToString(_type) + " cannot be converted to string"); return string(); } string FreezeScript::SequenceData::toString() const { return stringValue(); } void FreezeScript::SequenceData::visit(DataVisitor& visitor) { visitor.visitSequence(this); } FreezeScript::DataList& FreezeScript::SequenceData::getElements() { return _elements; } // // EnumData // FreezeScript::EnumData::EnumData(const Slice::EnumPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly) : Data(errorReporter, readOnly), _type(type), _value(0) { _count = static_cast(type->getEnumerators().size()); } FreezeScript::EnumData::EnumData(const Slice::EnumPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly, Ice::Int value) : Data(errorReporter, readOnly), _type(type), _value(value) { _count = static_cast(type->getEnumerators().size()); } FreezeScript::DataPtr FreezeScript::EnumData::getMember(const string&) const { return 0; } FreezeScript::DataPtr FreezeScript::EnumData::getElement(const DataPtr&) const { _errorReporter->error("element requested of enum value"); return 0; } bool FreezeScript::EnumData::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::EnumData::operator!=(const Data& rhs) const { const EnumData* e = dynamic_cast(&rhs); if(!e || _type->scoped() != e->_type->scoped()) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value != e->_value; } bool FreezeScript::EnumData::operator<(const Data& rhs) const { const EnumData* e = dynamic_cast(&rhs); if(!e || _type->scoped() != e->_type->scoped()) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _value < e->_value; } FreezeScript::DataPtr FreezeScript::EnumData::clone() const { return new EnumData(_type, _errorReporter, _value); } Slice::TypePtr FreezeScript::EnumData::getType() const { return _type; } void FreezeScript::EnumData::destroy() { } void FreezeScript::EnumData::marshal(const Ice::OutputStreamPtr& out) const { if(_count <= 127) { out->write(static_cast(_value)); } else if(_count <= 32767) { out->write(static_cast(_value)); } else { out->write(_value); } } void FreezeScript::EnumData::unmarshal(const Ice::InputStreamPtr& in) { if(_count <= 127) { Ice::Byte val; in ->read(val); _value = val & 0xff; } else if(_count <= 32767) { Ice::Short val; in->read(val); _value = val; } else { in->read(_value); } } bool FreezeScript::EnumData::booleanValue(bool) const { _errorReporter->error("enum " + typeToString(_type) + " cannot be converted to boolean"); return 0; } Ice::Long FreezeScript::EnumData::integerValue(bool convert) const { if(convert) { return _value; } else { _errorReporter->error("enum " + typeToString(_type) + " cannot be converted to integer"); return 0; } } double FreezeScript::EnumData::doubleValue(bool) const { _errorReporter->error("enum " + typeToString(_type) + " cannot be converted to double"); return 0; } string FreezeScript::EnumData::stringValue(bool) const { _errorReporter->error("enum " + typeToString(_type) + " cannot be converted to string"); return string(); } string FreezeScript::EnumData::toString() const { if(_name.empty()) { Slice::EnumeratorList l = _type->getEnumerators(); Slice::EnumeratorList::const_iterator p = l.begin(); Ice::Int i = _value; while(i > 0) { ++p; assert(p != l.end()); --i; } const_cast(_name) = (*p)->name(); } return _name; } void FreezeScript::EnumData::visit(DataVisitor& visitor) { visitor.visitEnum(this); } Ice::Int FreezeScript::EnumData::getValue() const { return _value; } bool FreezeScript::EnumData::setValue(Ice::Int v) { if(v >= 0 && v < _count) { _value = v; _name.clear(); return true; } return false; } bool FreezeScript::EnumData::setValueAsString(const string& v) { Slice::EnumeratorList l = _type->getEnumerators(); Slice::EnumeratorList::const_iterator p; Ice::Int i = 0; for(p = l.begin(); p != l.end(); ++p, ++i) { if((*p)->name() == v) { _value = i; _name = v; break; } } return p != l.end(); } // // DictionaryData // FreezeScript::DictionaryData::DictionaryData(const DataFactoryPtr& factory, const Slice::DictionaryPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly) : Data(errorReporter, readOnly), _factory(factory), _type(type) { _length = IntegerDataPtr::dynamicCast(_factory->createInteger(0, true)); } FreezeScript::DictionaryData::DictionaryData(const DataFactoryPtr& factory, const Slice::DictionaryPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly, const DataMap& m) : Data(errorReporter, readOnly), _factory(factory), _type(type) { for(DataMap::const_iterator p = m.begin(); p != m.end(); ++p) { _map.insert(DataMap::value_type(p->first->clone(), p->second->clone())); } _length = IntegerDataPtr::dynamicCast(_factory->createInteger(static_cast(_map.size()), true)); } FreezeScript::DataPtr FreezeScript::DictionaryData::getMember(const string& member) const { if(member == "length") { _length->setValue(static_cast(_map.size()), false); return _length; } return 0; } FreezeScript::DataPtr FreezeScript::DictionaryData::getElement(const DataPtr& element) const { DataMap::const_iterator p = _map.find(element); if(p != _map.end()) { return p->second; } return 0; } bool FreezeScript::DictionaryData::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::DictionaryData::operator!=(const Data& rhs) const { const DictionaryData* d = dynamic_cast(&rhs); if(!d || _type->scoped() != d->_type->scoped()) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _map != d->_map; } bool FreezeScript::DictionaryData::operator<(const Data& rhs) const { const DictionaryData* d = dynamic_cast(&rhs); if(!d || _type->scoped() != d->_type->scoped()) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); assert(false); } return _map < d->_map; } FreezeScript::DataPtr FreezeScript::DictionaryData::clone() const { return new DictionaryData(_factory, _type, _errorReporter, _readOnly, _map); } Slice::TypePtr FreezeScript::DictionaryData::getType() const { return _type; } void FreezeScript::DictionaryData::destroy() { for(DataMap::const_iterator p = _map.begin(); p != _map.end(); ++p) { p->first->destroy(); p->second->destroy(); } } void FreezeScript::DictionaryData::marshal(const Ice::OutputStreamPtr& out) const { out->writeSize(static_cast(_map.size())); for(DataMap::const_iterator p = _map.begin(); p != _map.end(); ++p) { p->first->marshal(out); p->second->marshal(out); } } void FreezeScript::DictionaryData::unmarshal(const Ice::InputStreamPtr& in) { Slice::TypePtr keyType = _type->keyType(); Slice::TypePtr valueType = _type->valueType(); Ice::Int sz = in->readSize(); for(Ice::Int i = 0; i < sz; ++i) { DataPtr key = _factory->create(keyType, _readOnly); key->unmarshal(in); DataPtr value = _factory->create(valueType, _readOnly); value->unmarshal(in); _map.insert(DataMap::value_type(key, value)); } _length->setValue(static_cast(_map.size()), false); } bool FreezeScript::DictionaryData::booleanValue(bool) const { _errorReporter->error("dictionary " + typeToString(_type) + " cannot be converted to boolean"); return 0; } Ice::Long FreezeScript::DictionaryData::integerValue(bool) const { _errorReporter->error("dictionary " + typeToString(_type) + " cannot be converted to integer"); return 0; } double FreezeScript::DictionaryData::doubleValue(bool) const { _errorReporter->error("dictionary " + typeToString(_type) + " cannot be converted to double"); return 0; } string FreezeScript::DictionaryData::stringValue(bool) const { _errorReporter->error("dictionary " + typeToString(_type) + " cannot be converted to string"); return string(); } string FreezeScript::DictionaryData::toString() const { return stringValue(); } void FreezeScript::DictionaryData::visit(DataVisitor& visitor) { visitor.visitDictionary(this); } FreezeScript::DataMap& FreezeScript::DictionaryData::getElements() { return _map; } // // ObjectData // FreezeScript::ObjectData::ObjectData(const DataFactoryPtr& factory, const Slice::TypePtr& type, bool readOnly) : Data(factory->getErrorReporter(), readOnly), _type(type), _refCount(0) { Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(type); if(decl) { Slice::ClassDefPtr def = decl->definition(); assert(def); Slice::DataMemberList members = def->allDataMembers(); for(Slice::DataMemberList::iterator p = members.begin(); p != members.end(); ++p) { _members[(*p)->name()] = factory->create((*p)->type(), _readOnly); } _id = factory->createString(decl->scoped(), true); } else { _id = factory->createString("::Ice::Object", true); } } FreezeScript::DataPtr FreezeScript::ObjectData::getMember(const string& member) const { if(member == "ice_id") { return _id; } DataMemberMap::const_iterator p = _members.find(member); if(p != _members.end()) { return p->second; } return 0; } FreezeScript::DataPtr FreezeScript::ObjectData::getElement(const DataPtr& /*element*/) const { _errorReporter->error("element requested of object value"); return 0; } bool FreezeScript::ObjectData::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::ObjectData::operator!=(const Data& /*rhs*/) const { _errorReporter->error("object comparison not supported"); return false; } bool FreezeScript::ObjectData::operator<(const Data& /*rhs*/) const { _errorReporter->error("object comparison not supported"); return false; } FreezeScript::DataPtr FreezeScript::ObjectData::clone() const { assert(false); return 0; } Slice::TypePtr FreezeScript::ObjectData::getType() const { return _type; } void FreezeScript::ObjectData::destroy() { assert(false); } void FreezeScript::ObjectData::marshal(const Ice::OutputStreamPtr& out) const { if(!_marshaler) { const_cast(_marshaler) = new ObjectWriter(const_cast(this)); } out->writeObject(_marshaler); } void FreezeScript::ObjectData::unmarshal(const Ice::InputStreamPtr& /*in*/) { // // Unmarshaling is done by ObjectReader. // assert(false); } bool FreezeScript::ObjectData::booleanValue(bool) const { assert(false); return 0; } Ice::Long FreezeScript::ObjectData::integerValue(bool) const { assert(false); return 0; } double FreezeScript::ObjectData::doubleValue(bool) const { assert(false); return 0; } string FreezeScript::ObjectData::stringValue(bool) const { assert(false); return string(); } string FreezeScript::ObjectData::toString() const { assert(false); return string(); } void FreezeScript::ObjectData::visit(DataVisitor& /*visitor*/) { assert(false); } FreezeScript::DataMemberMap& FreezeScript::ObjectData::getMembers() { return _members; } void FreezeScript::ObjectData::incRef() { _refCount++; } void FreezeScript::ObjectData::decRef() { assert(_refCount > 0); _refCount--; if(_refCount == 0) { destroyI(); } } void FreezeScript::ObjectData::destroyI() { DataMemberMap members = _members; _members.clear(); _marshaler = 0; for(DataMemberMap::const_iterator p = members.begin(); p != members.end(); ++p) { p->second->destroy(); } } // // ObjectRef // FreezeScript::ObjectRef::ObjectRef(const DataFactoryPtr& factory, const Slice::TypePtr& type, bool readOnly) : Data(factory->getErrorReporter(), readOnly), _factory(factory), _type(type) { } FreezeScript::ObjectRef::ObjectRef(const DataFactoryPtr& factory, const Slice::TypePtr& type, bool readOnly, const ObjectDataPtr& value) : Data(factory->getErrorReporter(), readOnly), _factory(factory), _type(type), _value(value) { _value->incRef(); } FreezeScript::DataPtr FreezeScript::ObjectRef::getMember(const string& member) const { if(!_value) { _errorReporter->error("member `" + member + "' requested of nil object"); } return _value->getMember(member); } FreezeScript::DataPtr FreezeScript::ObjectRef::getElement(const DataPtr&) const { _errorReporter->error("element requested of object value"); return 0; } bool FreezeScript::ObjectRef::operator==(const Data& rhs) const { return !operator!=(rhs); } bool FreezeScript::ObjectRef::operator!=(const Data& rhs) const { const ObjectRef* r = dynamic_cast(&rhs); if(!r) { _errorReporter->typeMismatchError(_type, rhs.getType(), true); } // // Reference comparison. // return _value.get() != r->_value.get(); } bool FreezeScript::ObjectRef::operator<(const Data& /*rhs*/) const { _errorReporter->error("object comparison not supported"); return false; } FreezeScript::DataPtr FreezeScript::ObjectRef::clone() const { return new ObjectRef(_factory, _type, _value); } Slice::TypePtr FreezeScript::ObjectRef::getType() const { return _type; } void FreezeScript::ObjectRef::destroy() { if(_value) { _value->decRef(); _value = 0; } } void FreezeScript::ObjectRef::marshal(const Ice::OutputStreamPtr& out) const { if(!_value) { out->writeObject(0); return; } _value->marshal(out); } FreezeScript::ReadObjectCallback::ReadObjectCallback(const ObjectRefPtr& ref) : _ref(ref) { } void FreezeScript::ReadObjectCallback::invoke(const Ice::ObjectPtr& p) { if(p) { ObjectReaderPtr reader = ObjectReaderPtr::dynamicCast(p); assert(reader); _ref->setValue(reader->getValue()); } } void FreezeScript::ObjectRef::unmarshal(const Ice::InputStreamPtr& in) { in->readObject(new ReadObjectCallback(this)); } bool FreezeScript::ObjectRef::booleanValue(bool) const { _errorReporter->error(typeToString(_type) + " cannot be converted to boolean"); return 0; } Ice::Long FreezeScript::ObjectRef::integerValue(bool) const { _errorReporter->error(typeToString(_type) + " cannot be converted to integer"); return 0; } double FreezeScript::ObjectRef::doubleValue(bool) const { _errorReporter->error(typeToString(_type) + " cannot be converted to double"); return 0; } string FreezeScript::ObjectRef::stringValue(bool) const { _errorReporter->error(typeToString(_type) + " cannot be converted to string"); return string(); } string FreezeScript::ObjectRef::toString() const { return stringValue(); } void FreezeScript::ObjectRef::visit(DataVisitor& visitor) { visitor.visitObject(this); } void FreezeScript::ObjectRef::instantiate() { ObjectDataPtr data = new ObjectData(_factory, _type, _readOnly); setValue(data); } FreezeScript::ObjectDataPtr FreezeScript::ObjectRef::getValue() const { return _value; } void FreezeScript::ObjectRef::setValue(const ObjectDataPtr& value) { // TODO: Type check? ObjectDataPtr oldValue = _value; _value = value; if(_value) { _value->incRef(); } if(oldValue) { oldValue->decRef(); } } // // ObjectFactory // Ice::ObjectPtr FreezeScript::ObjectFactory::create(const string& id) { Ice::ObjectPtr result; if(_factory) { if(id == Ice::Object::ice_staticId()) { result = new ObjectReader(_factory, _unit->builtin(Slice::Builtin::KindObject)); } else { Slice::TypeList l = _unit->lookupTypeNoBuiltin(id); if(!l.empty()) { Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(l.front()); if(!decl) { _factory->getErrorReporter()->error("Slice definition for `" + id + "' is not a class"); } Slice::ClassDefPtr def = decl->definition(); if(!def) { _factory->getErrorReporter()->error("no class definition for `" + id + "'"); } result = new ObjectReader(_factory, decl); } } } return result; } void FreezeScript::ObjectFactory::destroy() { } void FreezeScript::ObjectFactory::activate(const DataFactoryPtr& factory, const Slice::UnitPtr& unit) { assert(!_factory && !_unit); _factory = factory; _unit = unit; } void FreezeScript::ObjectFactory::deactivate() { _factory = 0; _unit = 0; } // // DataVisitor // FreezeScript::DataVisitor::~DataVisitor() { } void FreezeScript::DataVisitor::visitBoolean(const BooleanDataPtr&) { } void FreezeScript::DataVisitor::visitInteger(const IntegerDataPtr&) { } void FreezeScript::DataVisitor::visitDouble(const DoubleDataPtr&) { } void FreezeScript::DataVisitor::visitString(const StringDataPtr&) { } void FreezeScript::DataVisitor::visitProxy(const ProxyDataPtr&) { } void FreezeScript::DataVisitor::visitStruct(const StructDataPtr&) { } void FreezeScript::DataVisitor::visitSequence(const SequenceDataPtr&) { } void FreezeScript::DataVisitor::visitEnum(const EnumDataPtr&) { } void FreezeScript::DataVisitor::visitDictionary(const DictionaryDataPtr&) { } void FreezeScript::DataVisitor::visitObject(const ObjectRefPtr&) { } Ice-3.5.1/cpp/src/FreezeScript/AssignVisitor.cpp0000644000076400007640000004030712223561476017664 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; FreezeScript::AssignVisitor::AssignVisitor(const DataPtr& src, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, bool convert, const string& context) : _src(src), _factory(factory), _errorReporter(errorReporter), _convert(convert), _context(context) { } void FreezeScript::AssignVisitor::visitBoolean(const BooleanDataPtr& dest) { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { string v = s->getValue(); if(v == "true") { dest->setValue(true); } else if(v == "false") { dest->setValue(false); } else { conversionError(dest->getType(), _src->getType(), v); } } else { dest->setValue(_src->booleanValue(_convert)); } } void FreezeScript::AssignVisitor::visitInteger(const IntegerDataPtr& dest) { dest->setValue(_src->integerValue(_convert), true); } void FreezeScript::AssignVisitor::visitDouble(const DoubleDataPtr& dest) { dest->setValue(_src->doubleValue(_convert)); } void FreezeScript::AssignVisitor::visitString(const StringDataPtr& dest) { dest->setValue(_src->stringValue(_convert)); } void FreezeScript::AssignVisitor::visitProxy(const ProxyDataPtr& dest) { ProxyDataPtr p = ProxyDataPtr::dynamicCast(_src); if(p) { dest->setValue(p->getValue()); } else { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { dest->setValue(s->getValue(), false); } else { typeMismatchError(dest->getType(), _src->getType()); } } } void FreezeScript::AssignVisitor::visitStruct(const StructDataPtr& dest) { Slice::StructPtr type = Slice::StructPtr::dynamicCast(dest->getType()); assert(type); StructDataPtr src = StructDataPtr::dynamicCast(_src); if(src && isCompatible(type, src->getType())) { // // Assign members with the same name. // DataMemberMap srcMap = src->getMembers(); DataMemberMap destMap = dest->getMembers(); string typeName = typeToString(type); for(DataMemberMap::iterator p = destMap.begin(); p != destMap.end(); ++p) { DataMemberMap::iterator q = srcMap.find(p->first); if(q != srcMap.end()) { string context = typeName + " member " + p->first + " value"; AssignVisitor v(q->second, _factory, _errorReporter, _convert, context); p->second->visit(v); } } } else { typeMismatchError(type, _src->getType()); } } void FreezeScript::AssignVisitor::visitSequence(const SequenceDataPtr& dest) { Slice::TypePtr type = dest->getType(); SequenceDataPtr src = SequenceDataPtr::dynamicCast(_src); if(src && isCompatible(type, src->getType())) { DataList& srcElements = src->getElements(); DataList destElements; Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(type); assert(seqType); Slice::TypePtr elemType = seqType->type(); string typeName = typeToString(type); for(DataList::const_iterator p = srcElements.begin(); p != srcElements.end(); ++p) { DataPtr element = _factory->create(elemType, false); Destroyer elementDestroyer(element); AssignVisitor v(*p, _factory, _errorReporter, _convert, typeName + " element"); element->visit(v); destElements.push_back(element); elementDestroyer.release(); } DataList& l = dest->getElements(); l.swap(destElements); } else { typeMismatchError(type, _src->getType()); } } void FreezeScript::AssignVisitor::visitEnum(const EnumDataPtr& dest) { Slice::TypePtr type = dest->getType(); IntegerDataPtr i = IntegerDataPtr::dynamicCast(_src); if(i) { if(_convert) { Ice::Long l = i->integerValue(); if(l < 0 || l > INT_MAX || !dest->setValue(static_cast(l))) { rangeError(i->toString(), type); } } else { conversionError(type, i->getType(), i->toString()); } } else { string name; EnumDataPtr e = EnumDataPtr::dynamicCast(_src); if(e && isCompatible(type, _src->getType())) { name = e->toString(); } else { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { name = s->getValue(); } else { typeMismatchError(type, _src->getType()); } } if(!dest->setValueAsString(name)) { conversionError(type, _src->getType(), name); } } } void FreezeScript::AssignVisitor::visitDictionary(const DictionaryDataPtr& dest) { Slice::TypePtr type = dest->getType(); DictionaryDataPtr d = DictionaryDataPtr::dynamicCast(_src); if(d && isCompatible(type, _src->getType())) { DataMap& srcMap = d->getElements(); DataMap destMap; Slice::DictionaryPtr dictType = Slice::DictionaryPtr::dynamicCast(type); assert(dictType); Slice::TypePtr keyType = dictType->keyType(); Slice::TypePtr valueType = dictType->valueType(); string typeName = typeToString(type); for(DataMap::const_iterator p = srcMap.begin(); p != srcMap.end(); ++p) { DataPtr key = _factory->create(keyType, false); Destroyer keyDestroyer(key); DataPtr value = _factory->create(valueType, false); Destroyer valueDestroyer(value); AssignVisitor keyVisitor(p->first, _factory, _errorReporter, _convert, typeName + " key"); key->visit(keyVisitor); AssignVisitor valueVisitor(p->second, _factory, _errorReporter, _convert, typeName + " value"); value->visit(valueVisitor); DataMap::const_iterator q = destMap.find(key); if(q != destMap.end()) { error("duplicate dictionary key in " + typeToString(dictType)); } else { destMap.insert(DataMap::value_type(key, value)); keyDestroyer.release(); valueDestroyer.release(); } } DataMap& m = dest->getElements(); m.swap(destMap); } else { typeMismatchError(type, _src->getType()); } } void FreezeScript::AssignVisitor::visitObject(const ObjectRefPtr& dest) { Slice::TypePtr type = dest->getType(); ObjectRefPtr src = ObjectRefPtr::dynamicCast(_src); if(!src) { typeMismatchError(type, _src->getType()); } ObjectDataPtr srcValue = src->getValue(); Slice::TypePtr srcType = src->getType(); if(!srcValue) { // // Allow a nil value from type Object. // if(Slice::BuiltinPtr::dynamicCast(srcType) || isCompatible(type, srcType)) { dest->setValue(0); } else { typeMismatchError(type, srcType); } } else { Slice::TypePtr srcValueType = srcValue->getType(); if(isCompatible(type, srcValueType)) { dest->setValue(srcValue); } else { typeMismatchError(type, srcValueType); } } } bool FreezeScript::AssignVisitor::isCompatible(const Slice::TypePtr& dest, const Slice::TypePtr& src) { Slice::BuiltinPtr b1 = Slice::BuiltinPtr::dynamicCast(dest); if(b1) { Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); switch(b1->kind()) { case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: { if(b2) { switch(b2->kind()) { case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: case Slice::Builtin::KindString: { return true; } case Slice::Builtin::KindBool: case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: { return false; } } } return false; } case Slice::Builtin::KindBool: { if(b2 && (b2->kind() == Slice::Builtin::KindBool || b2->kind() == Slice::Builtin::KindString)) { return true; } return false; } case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: { if(b2) { switch(b2->kind()) { case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: case Slice::Builtin::KindString: { return true; } case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: case Slice::Builtin::KindBool: case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: { return false; } } } return false; } case Slice::Builtin::KindString: { if(b2) { switch(b2->kind()) { case Slice::Builtin::KindByte: case Slice::Builtin::KindBool: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: case Slice::Builtin::KindString: case Slice::Builtin::KindObjectProxy: { return true; } case Slice::Builtin::KindObject: case Slice::Builtin::KindLocalObject: { return false; } } return false; } else if(Slice::EnumPtr::dynamicCast(src)) { return true; } else if(Slice::ProxyPtr::dynamicCast(src)) { return true; } return false; } case Slice::Builtin::KindObject: { // // Allow transformation from Object to class. Validation has to // be done during transformation, when the actual type of // an instance can be compared for compatibility with the // new type. // Slice::ClassDeclPtr cl = Slice::ClassDeclPtr::dynamicCast(src); if(cl || (b2 && b2->kind() == Slice::Builtin::KindObject)) { return true; } return false; } case Slice::Builtin::KindObjectProxy: { Slice::ProxyPtr p = Slice::ProxyPtr::dynamicCast(src); if(p || (b2 && b2->kind() == Slice::Builtin::KindObjectProxy) || (b2 && b2->kind() == Slice::Builtin::KindString)) { return true; } return false; } case Slice::Builtin::KindLocalObject: { assert(false); return false; } } assert(false); } Slice::ClassDeclPtr cl1 = Slice::ClassDeclPtr::dynamicCast(dest); if(cl1) { Slice::ClassDeclPtr cl2 = Slice::ClassDeclPtr::dynamicCast(src); if(cl2 && checkClasses(cl1, cl2)) { return true; } return false; } Slice::StructPtr s1 = Slice::StructPtr::dynamicCast(dest); if(s1) { Slice::StructPtr s2 = Slice::StructPtr::dynamicCast(src); if(s2 && s1->scoped() == s2->scoped()) { return true; } return false; } Slice::ProxyPtr p1 = Slice::ProxyPtr::dynamicCast(dest); if(p1) { Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); if(b2 && (b2->kind() == Slice::Builtin::KindObjectProxy || b2->kind() == Slice::Builtin::KindString)) { return true; } Slice::ProxyPtr p2 = Slice::ProxyPtr::dynamicCast(src); if(p2 && checkClasses(p1->_class(), p2->_class())) { return true; } return false; } Slice::DictionaryPtr d1 = Slice::DictionaryPtr::dynamicCast(dest); if(d1) { Slice::DictionaryPtr d2 = Slice::DictionaryPtr::dynamicCast(src); if(d2) { return isCompatible(d1->keyType(), d2->keyType()) && isCompatible(d1->valueType(), d2->valueType()); } return false; } Slice::SequencePtr seq1 = Slice::SequencePtr::dynamicCast(dest); if(seq1) { Slice::SequencePtr seq2 = Slice::SequencePtr::dynamicCast(src); if(seq2) { return isCompatible(seq1->type(), seq2->type()); } return false; } Slice::EnumPtr e1 = Slice::EnumPtr::dynamicCast(dest); if(e1) { Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); if(b2 && b2->kind() == Slice::Builtin::KindString) { return true; } Slice::EnumPtr e2 = Slice::EnumPtr::dynamicCast(src); if(e2 && e1->scoped() == e2->scoped()) { return true; } return false; } assert(false); return false; } bool FreezeScript::AssignVisitor::checkClasses(const Slice::ClassDeclPtr& dest, const Slice::ClassDeclPtr& src) { string s1 = dest->scoped(); string s2 = src->scoped(); if(s1 == s2) { return true; } else { Slice::ClassDefPtr def = src->definition(); if(!def) { error("class " + s2 + " declared but not defined"); } return def->isA(s1); } return false; } void FreezeScript::AssignVisitor::typeMismatchError(const Slice::TypePtr& dest, const Slice::TypePtr& src) { ostringstream ostr; ostr << "unable to transform"; if(!_context.empty()) { ostr << ' ' << _context; } ostr << " from " << typeToString(src) << " to " << typeToString(dest); error(ostr.str()); } void FreezeScript::AssignVisitor::conversionError(const Slice::TypePtr& dest, const Slice::TypePtr& src, const string& value) { ostringstream ostr; ostr << "unable to convert"; if(!_context.empty()) { ostr << ' ' << _context; } ostr << " `" << value << "' from " << typeToString(src) << " to " << typeToString(dest); error(ostr.str()); } void FreezeScript::AssignVisitor::rangeError(const string& value, const Slice::TypePtr& type) { ostringstream ostr; if(!_context.empty()) { ostr << _context << ' '; } ostr << "`" << value << "' is out of range for type " << typeToString(type); error(ostr.str()); } void FreezeScript::AssignVisitor::error(const string& msg) { _errorReporter->error(msg); } Ice-3.5.1/cpp/src/FreezeScript/Print.cpp0000644000076400007640000001423012223561476016150 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace IceUtil; using namespace IceUtilInternal; namespace FreezeScript { class PrintVisitor : public DataVisitor { public: PrintVisitor(ostream&); ~PrintVisitor(); virtual void visitBoolean(const BooleanDataPtr&); virtual void visitInteger(const IntegerDataPtr&); virtual void visitDouble(const DoubleDataPtr&); virtual void visitString(const StringDataPtr&); virtual void visitProxy(const ProxyDataPtr&); virtual void visitStruct(const StructDataPtr&); virtual void visitSequence(const SequenceDataPtr&); virtual void visitEnum(const EnumDataPtr&); virtual void visitDictionary(const DictionaryDataPtr&); virtual void visitObject(const ObjectRefPtr&); private: void printObjectMembers(const Slice::ClassDefPtr&, const DataMemberMap&); IceUtilInternal::Output _out; typedef map ObjectHistoryMap; ObjectHistoryMap _objectHistory; int _objectCount; }; } // End of namespace FreezeScript // // printData // void FreezeScript::printData(const DataPtr& data, ostream& os) { PrintVisitor visitor(os); data->visit(visitor); } // // PrintVisitor // FreezeScript::PrintVisitor::PrintVisitor(ostream& os) : _out(os), _objectCount(0) { } FreezeScript::PrintVisitor::~PrintVisitor() { } void FreezeScript::PrintVisitor::visitBoolean(const BooleanDataPtr& data) { _out << "bool(" << data->toString() << ")"; } void FreezeScript::PrintVisitor::visitInteger(const IntegerDataPtr& data) { _out << typeToString(data->getType()) << "(" << data->toString() << ")"; } void FreezeScript::PrintVisitor::visitDouble(const DoubleDataPtr& data) { _out << typeToString(data->getType()) << "(" << data->toString() << ")"; } void FreezeScript::PrintVisitor::visitString(const StringDataPtr& data) { _out << "'" << data->toString() << "'"; } void FreezeScript::PrintVisitor::visitProxy(const ProxyDataPtr& data) { string str = data->toString(); _out << typeToString(data->getType()) << '(' << (str.empty() ? string("nil") : str) << ')'; } void FreezeScript::PrintVisitor::visitStruct(const StructDataPtr& data) { Slice::StructPtr type = Slice::StructPtr::dynamicCast(data->getType()); assert(type); _out << "struct " << typeToString(type); _out << sb; // // Print members in order of declaration. // Slice::DataMemberList l = type->dataMembers(); DataMemberMap members = data->getMembers(); for(Slice::DataMemberList::const_iterator p = l.begin(); p != l.end(); ++p) { DataMemberMap::const_iterator q = members.find((*p)->name()); assert(q != members.end()); _out << nl; _out << q->first << " = "; q->second->visit(*this); } _out << eb; } void FreezeScript::PrintVisitor::visitSequence(const SequenceDataPtr& data) { DataList& elements = data->getElements(); _out << "sequence " << typeToString(data->getType()) << " (size = " << elements.size() << ")"; _out << sb; Ice::Int i = 0; for(DataList::const_iterator p = elements.begin(); p != elements.end(); ++p, ++i) { _out << nl << "[" << i << "] = "; (*p)->visit(*this); } _out << eb; } void FreezeScript::PrintVisitor::visitEnum(const EnumDataPtr& data) { _out << typeToString(data->getType()) << "(" << data->toString() << ")"; } void FreezeScript::PrintVisitor::visitDictionary(const DictionaryDataPtr& data) { DataMap& map = data->getElements(); _out << "dictionary " << typeToString(data->getType()) << " (size = " << map.size() << ")"; _out << sb; for(DataMap::const_iterator p = map.begin(); p != map.end(); ++p) { _out << nl; p->first->visit(*this); _out << " => "; p->second->visit(*this); } _out << eb; } void FreezeScript::PrintVisitor::visitObject(const ObjectRefPtr& data) { ObjectDataPtr value = data->getValue(); if(!value) { _out << typeToString(data->getType()) << "(nil)"; } else { Slice::TypePtr type = value->getType(); Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(type); // May be nil for Ice::Object _out << "class " << typeToString(type); ObjectHistoryMap::iterator p = _objectHistory.find(value.get()); if(p != _objectHistory.end()) { ostringstream ostr; ostr << " (object #" << p->second << ")"; _out << ostr.str(); } else { _objectHistory.insert(ObjectHistoryMap::value_type(value.get(), _objectCount)); ostringstream ostr; ostr << " (object #" << _objectCount << ")"; _out << ostr.str(); _objectCount++; _out << sb; DataMemberMap members = value->getMembers(); // // If Ice::Object had any members, this is where we would print them. // if(decl) { Slice::ClassDefPtr def = decl->definition(); assert(def); printObjectMembers(def, members); } _out << eb; } } } void FreezeScript::PrintVisitor::printObjectMembers(const Slice::ClassDefPtr& type, const DataMemberMap& members) { Slice::ClassList bases = type->bases(); if(!bases.empty() && !bases.front()->isAbstract()) { printObjectMembers(bases.front(), members); } // // Print members in order of declaration. // Slice::DataMemberList l = type->dataMembers(); for(Slice::DataMemberList::const_iterator p = l.begin(); p != l.end(); ++p) { DataMemberMap::const_iterator q = members.find((*p)->name()); assert(q != members.end()); _out << nl; _out << q->first << " = "; q->second->visit(*this); } } Ice-3.5.1/cpp/src/FreezeScript/DumpDescriptors.cpp0000644000076400007640000014606012223561476020212 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include using namespace std; namespace FreezeScript { class SymbolTableI; typedef IceUtil::Handle SymbolTableIPtr; class SymbolTableI : public SymbolTable { public: SymbolTableI(const DataFactoryPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&, ExecuteInfo*, const SymbolTablePtr& = SymbolTablePtr()); virtual void add(const string&, const DataPtr&); virtual DataPtr getValue(const EntityNodePtr&) const; virtual DataPtr getConstantValue(const string&) const; virtual SymbolTablePtr createChild(); virtual Slice::TypePtr lookupType(const string&); virtual DataPtr invokeFunction(const string&, const DataPtr&, const DataList&); private: DataPtr findValue(const string&) const; class EntityVisitor : public EntityNodeVisitor { public: EntityVisitor(SymbolTableI*); virtual void visitIdentifier(const string&); virtual void visitElement(const NodePtr&); DataPtr getCurrent() const; private: SymbolTableI* _table; DataPtr _current; bool _error; }; friend class EntityVisitor; DataFactoryPtr _factory; Slice::UnitPtr _unit; ErrorReporterPtr _errorReporter; ExecuteInfo* _info; SymbolTablePtr _parent; typedef map DataMap; DataMap _dataMap; DataMap _constantCache; }; typedef map DumpMap; struct ExecuteInfo { Ice::CommunicatorPtr communicator; Db* db; DbTxn* txn; string facet; SymbolTablePtr symbolTable; DumpMap dumpMap; Slice::TypePtr keyType; Slice::TypePtr valueType; }; class DumpVisitor : public DataVisitor { public: DumpVisitor(const DataFactoryPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&, ExecuteInfo*); virtual void visitBoolean(const BooleanDataPtr&); virtual void visitInteger(const IntegerDataPtr&); virtual void visitDouble(const DoubleDataPtr&); virtual void visitString(const StringDataPtr&); virtual void visitProxy(const ProxyDataPtr&); virtual void visitStruct(const StructDataPtr&); virtual void visitSequence(const SequenceDataPtr&); virtual void visitEnum(const EnumDataPtr&); virtual void visitDictionary(const DictionaryDataPtr&); virtual void visitObject(const ObjectRefPtr&); private: // // Returns true if the contents of the data should be visited. // bool dump(const DataPtr&); DataFactoryPtr _factory; Slice::UnitPtr _unit; ErrorReporterPtr _errorReporter; ExecuteInfo* _info; set _objectHistory; }; } // End of namespace FreezeScript // // Descriptor // FreezeScript::Descriptor::Descriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter) : _parent(parent), _line(line), _factory(factory), _errorReporter(errorReporter) { } FreezeScript::Descriptor::~Descriptor() { } FreezeScript::DescriptorPtr FreezeScript::Descriptor::parent() const { return _parent; } FreezeScript::NodePtr FreezeScript::Descriptor::parse(const string& expr) const { return parseExpression(expr, _factory, _errorReporter); } Slice::TypePtr FreezeScript::Descriptor::findType(const Slice::UnitPtr& u, const string& type) { Slice::TypeList l; l = u->lookupType(type, false); if(l.empty()) { _errorReporter->error("unknown type `" + type + "'"); } return l.front(); } // // SetDescriptor // FreezeScript::SetDescriptor::SetDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes) : Descriptor(parent, line, factory, errorReporter) { DescriptorErrorContext ctx(_errorReporter, "set", _line); IceXML::Attributes::const_iterator p; p = attributes.find("target"); if(p == attributes.end()) { _errorReporter->error("required attribute `target' is missing"); } NodePtr node = parse(p->second); _target = EntityNodePtr::dynamicCast(node); if(!_target) { _errorReporter->error("`target' attribute is not an entity: `" + p->second + "'"); } p = attributes.find("value"); if(p != attributes.end()) { _valueStr = p->second; } p = attributes.find("length"); if(p != attributes.end()) { _lengthStr = p->second; } p = attributes.find("convert"); if(p != attributes.end()) { _convert = p->second == "true"; } if(_valueStr.empty() && _lengthStr.empty()) { _errorReporter->error("requires a value for attributes `value' or 'length'"); } if(!_valueStr.empty()) { _value = parse(_valueStr); } if(!_lengthStr.empty()) { _length = parse(_lengthStr); } } void FreezeScript::SetDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_errorReporter, "set", _line); _errorReporter->error("child elements are not supported"); } void FreezeScript::SetDescriptor::validate() { } void FreezeScript::SetDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) { DescriptorErrorContext ctx(_errorReporter, "set", _line); DataPtr data = sym->getValue(_target); if(data->readOnly()) { ostringstream ostr; ostr << _target; _errorReporter->error("target `" + ostr.str() + "' cannot be modified"); } DataPtr value; if(_value) { try { value = _value->evaluate(sym); } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); } } DataPtr length; if(_length) { SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); if(!seq) { ostringstream ostr; ostr << _target; _errorReporter->error("value `" + ostr.str() + "' is not a sequence"); } try { length = _length->evaluate(sym); } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of length `" + _lengthStr + "' failed:\n" + ex.reason()); } DataList& elements = seq->getElements(); Ice::Long l = length->integerValue(); if(l < 0 || l > INT_MAX) { _errorReporter->error("sequence length " + length->toString() + " is out of range"); } DataList::size_type len = static_cast(l); if(len < elements.size()) { for(DataList::size_type i = len; i < elements.size(); ++i) { elements[i]->destroy(); } elements.resize(len); } else if(len > elements.size()) { Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(seq->getType()); assert(seqType); Slice::TypePtr elemType = seqType->type(); for(DataList::size_type i = elements.size(); i < len; ++i) { DataPtr v = _factory->create(elemType, false); if(value) { AssignVisitor visitor(value, _factory, _errorReporter, _convert); v->visit(visitor); } elements.push_back(v); } } } else { AssignVisitor visitor(value, _factory, _errorReporter, _convert); data->visit(visitor); } } // // DefineDescriptor // FreezeScript::DefineDescriptor::DefineDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes, const Slice::UnitPtr& unit) : Descriptor(parent, line, factory, errorReporter) { DescriptorErrorContext ctx(_errorReporter, "define", _line); IceXML::Attributes::const_iterator p; p = attributes.find("name"); if(p == attributes.end()) { _errorReporter->error("required attribute `name' is missing"); } _name = p->second; p = attributes.find("type"); if(p == attributes.end()) { _errorReporter->error("required attribute `type' is missing"); } _type = findType(unit, p->second); p = attributes.find("value"); if(p != attributes.end()) { _valueStr = p->second; } p = attributes.find("convert"); if(p != attributes.end()) { _convert = p->second == "true"; } if(!_valueStr.empty()) { _value = parse(_valueStr); } } void FreezeScript::DefineDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_errorReporter, "define", _line); _errorReporter->error("child elements are not supported"); } void FreezeScript::DefineDescriptor::validate() { } void FreezeScript::DefineDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) { DescriptorErrorContext ctx(_errorReporter, "define", _line); DataPtr data = _factory->create(_type, false); DataPtr value; if(_value) { try { value = _value->evaluate(sym); } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); } } if(value) { AssignVisitor visitor(value, _factory, _errorReporter, _convert); data->visit(visitor); } sym->add(_name, data); } // // AddDescriptor // FreezeScript::AddDescriptor::AddDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes) : Descriptor(parent, line, factory, errorReporter) { DescriptorErrorContext ctx(_errorReporter, "add", _line); IceXML::Attributes::const_iterator p; string target; p = attributes.find("target"); if(p == attributes.end()) { _errorReporter->error("required attribute `target' is missing"); } target = p->second; p = attributes.find("key"); if(p != attributes.end()) { _keyStr = p->second; } p = attributes.find("index"); if(p != attributes.end()) { _indexStr = p->second; } p = attributes.find("value"); if(p != attributes.end()) { _valueStr = p->second; } p = attributes.find("convert"); if(p != attributes.end()) { _convert = p->second == "true"; } NodePtr node = parse(target); _target = EntityNodePtr::dynamicCast(node); if(!_target) { _errorReporter->error("`target' attribute is not an entity: `" + target + "'"); } if(!_keyStr.empty() && !_indexStr.empty()) { _errorReporter->error("attributes `key' and `index' are mutually exclusive"); } if(_keyStr.empty() && _indexStr.empty()) { _errorReporter->error("one of attributes `key' or `index' is required"); } if(!_keyStr.empty()) { _key = parse(_keyStr); } if(!_indexStr.empty()) { _index = parse(_indexStr); } if(!_valueStr.empty()) { _value = parse(_valueStr); } } void FreezeScript::AddDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_errorReporter, "add", _line); _errorReporter->error("child elements are not supported"); } void FreezeScript::AddDescriptor::validate() { } void FreezeScript::AddDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) { DescriptorErrorContext ctx(_errorReporter, "add", _line); DataPtr data = sym->getValue(_target); if(data->readOnly()) { ostringstream ostr; ostr << _target; _errorReporter->error("target `" + ostr.str() + "' cannot be modified"); } if(_key) { DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); if(!dict) { ostringstream ostr; ostr << _target; _errorReporter->error("target `" + ostr.str() + "' is not a dictionary"); } Slice::DictionaryPtr type = Slice::DictionaryPtr::dynamicCast(dict->getType()); assert(type); DataPtr key; Destroyer keyDestroyer; try { DataPtr v = _key->evaluate(sym); key = _factory->create(type->keyType(), false); keyDestroyer.set(key); AssignVisitor visitor(v, _factory, _errorReporter, _convert); key->visit(visitor); } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of key `" + _keyStr + "' failed:\n" + ex.reason()); } if(dict->getElement(key)) { ostringstream ostr; printData(key, ostr); _errorReporter->error("key " + ostr.str() + " already exists in dictionary"); } DataPtr elem = _factory->create(type->valueType(), false); Destroyer elemDestroyer(elem); DataPtr value; if(_value) { try { value = _value->evaluate(sym); } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); } } if(value) { AssignVisitor visitor(value, _factory, _errorReporter, _convert); elem->visit(visitor); } DataMap& map = dict->getElements(); map.insert(DataMap::value_type(key, elem)); keyDestroyer.release(); elemDestroyer.release(); } else { assert(_index); SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); if(!seq) { ostringstream ostr; ostr << _target; _errorReporter->error("target `" + ostr.str() + "' is not a sequence"); } Slice::SequencePtr type = Slice::SequencePtr::dynamicCast(seq->getType()); assert(type); DataPtr index; Destroyer indexDestroyer; try { index = _index->evaluate(sym); indexDestroyer.set(index); } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of index `" + _indexStr + "' failed:\n" + ex.reason()); } DataList& elements = seq->getElements(); Ice::Long l = index->integerValue(); DataList::size_type i = static_cast(l); if(l < 0 || l > INT_MAX || i > elements.size()) { _errorReporter->error("sequence index " + index->toString() + " is out of range"); } DataPtr elem = _factory->create(type->type(), false); Destroyer elemDestroyer(elem); DataPtr value; if(_value) { try { value = _value->evaluate(sym); } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); } } if(value) { AssignVisitor visitor(value, _factory, _errorReporter, _convert); elem->visit(visitor); } elements.insert(elements.begin() + i, elem); indexDestroyer.release(); elemDestroyer.release(); } } // // RemoveDescriptor // FreezeScript::RemoveDescriptor::RemoveDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes) : Descriptor(parent, line, factory, errorReporter) { DescriptorErrorContext ctx(_errorReporter, "remove", _line); IceXML::Attributes::const_iterator p; string target; p = attributes.find("target"); if(p == attributes.end()) { _errorReporter->error("required attribute `target' is missing"); } target = p->second; p = attributes.find("key"); if(p != attributes.end()) { _keyStr = p->second; } p = attributes.find("index"); if(p != attributes.end()) { _indexStr = p->second; } if(!_keyStr.empty() && !_indexStr.empty()) { _errorReporter->error("attributes `key' and `index' are mutually exclusive"); } if(_keyStr.empty() && _indexStr.empty()) { _errorReporter->error("one of attributes `key' or `index' is required"); } NodePtr node = parse(target); _target = EntityNodePtr::dynamicCast(node); if(!_target) { _errorReporter->error("`target' attribute is not an entity: `" + target + "'"); } if(!_keyStr.empty()) { _key = parse(_keyStr); } if(!_indexStr.empty()) { _index = parse(_indexStr); } } void FreezeScript::RemoveDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_errorReporter, "remove", _line); _errorReporter->error("child elements are not supported"); } void FreezeScript::RemoveDescriptor::validate() { } void FreezeScript::RemoveDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) { DescriptorErrorContext ctx(_errorReporter, "remove", _line); DataPtr data = sym->getValue(_target); if(data->readOnly()) { ostringstream ostr; ostr << _target; _errorReporter->error("target `" + ostr.str() + "' cannot be modified"); } if(_key) { DataPtr key; try { key = _key->evaluate(sym); } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of key `" + _keyStr + "' failed:\n" + ex.reason()); } DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); if(!dict) { ostringstream ostr; ostr << _target; _errorReporter->error("target `" + ostr.str() + "' is not a dictionary"); } DataMap& map = dict->getElements(); DataMap::iterator p = map.find(key); if(p != map.end()) { p->first->destroy(); p->second->destroy(); map.erase(p); } } else { assert(_index); DataPtr index; try { index = _index->evaluate(sym); } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of index `" + _indexStr + "' failed:\n" + ex.reason()); } SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); if(!seq) { ostringstream ostr; ostr << _target; _errorReporter->error("target `" + ostr.str() + "' is not a sequence"); } DataList& elements = seq->getElements(); Ice::Long l = index->integerValue(); DataList::size_type i = static_cast(l); if(l < 0 || l > INT_MAX || i >= elements.size()) { _errorReporter->error("sequence index " + index->toString() + " is out of range"); } elements[i]->destroy(); elements.erase(elements.begin() + i); } } // // FailDescriptor // FreezeScript::FailDescriptor::FailDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes) : Descriptor(parent, line, factory, errorReporter) { IceXML::Attributes::const_iterator p; p = attributes.find("test"); if(p != attributes.end()) { _testStr = p->second; } p = attributes.find("message"); if(p != attributes.end()) { _message = p->second; } if(!_testStr.empty()) { _test = parse(_testStr); } if(_message.empty()) { ostringstream ostr; ostr << " executed at line " << line << endl; _message = ostr.str(); } } void FreezeScript::FailDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_errorReporter, "fail", _line); _errorReporter->error("child elements are not supported"); } void FreezeScript::FailDescriptor::validate() { } void FreezeScript::FailDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) { DescriptorErrorContext ctx(_errorReporter, "fail", _line); if(_test) { try { DataPtr b = _test->evaluate(sym); BooleanDataPtr bd = BooleanDataPtr::dynamicCast(b); if(!bd) { _errorReporter->error("expression `" + _testStr + "' does not evaluate to a boolean"); } if(!bd->booleanValue()) { return; } } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of expression `" + _testStr + "' failed:\n" + ex.reason()); } } throw FailureException(__FILE__, __LINE__, _message); } // // EchoDescriptor // FreezeScript::EchoDescriptor::EchoDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes, ostream& os) : Descriptor(parent, line, factory, errorReporter), _os(os) { IceXML::Attributes::const_iterator p; p = attributes.find("message"); if(p != attributes.end()) { _message = p->second; } p = attributes.find("value"); if(p != attributes.end()) { _valueStr = p->second; } if(!_valueStr.empty()) { _value = parse(_valueStr); } } void FreezeScript::EchoDescriptor::addChild(const DescriptorPtr&) { DescriptorErrorContext ctx(_errorReporter, "echo", _line); _errorReporter->error("child elements are not supported"); } void FreezeScript::EchoDescriptor::validate() { } void FreezeScript::EchoDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) { DescriptorErrorContext ctx(_errorReporter, "echo", _line); if(!_message.empty()) { _os << _message; } if(_value) { DataPtr v; try { v = _value->evaluate(sym); } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); } printData(v, _os); } _os << endl; } // // ExecutableContainerDescriptor // FreezeScript::ExecutableContainerDescriptor::ExecutableContainerDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes&, const string& name) : Descriptor(parent, line, factory, errorReporter), _name(name) { } void FreezeScript::ExecutableContainerDescriptor::addChild(const DescriptorPtr& child) { _children.push_back(child); } void FreezeScript::ExecutableContainerDescriptor::validate() { for(vector::iterator p = _children.begin(); p != _children.end(); ++p) { (*p)->validate(); } } void FreezeScript::ExecutableContainerDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo* info) { for(vector::iterator p = _children.begin(); p != _children.end(); ++p) { (*p)->execute(sym, info); } } // // IfDescriptor // FreezeScript::IfDescriptor::IfDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes) : Descriptor(parent, line, factory, errorReporter), ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "if") { DescriptorErrorContext ctx(_errorReporter, "if", _line); IceXML::Attributes::const_iterator p = attributes.find("test"); if(p == attributes.end()) { _errorReporter->error("required attribute `test' is missing"); } _testStr = p->second; _test = parse(_testStr); } void FreezeScript::IfDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo* info) { DescriptorErrorContext ctx(_errorReporter, "if", _line); try { DataPtr b = _test->evaluate(sym); BooleanDataPtr bd = BooleanDataPtr::dynamicCast(b); if(!bd) { _errorReporter->error("expression `" + _testStr + "' does not evaluate to a boolean"); } if(bd->booleanValue()) { ExecutableContainerDescriptor::execute(sym, info); } } catch(const EvaluateException& ex) { _errorReporter->error("evaluation of conditional expression `" + _testStr + "' failed:\n" + ex.reason()); } } // // IterateDescriptor // FreezeScript::IterateDescriptor::IterateDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes) : Descriptor(parent, line, factory, errorReporter), ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "iterate") { DescriptorErrorContext ctx(_errorReporter, "iterate", _line); IceXML::Attributes::const_iterator p; string target; p = attributes.find("target"); if(p == attributes.end()) { _errorReporter->error("required attribute `target' is missing"); } target = p->second; p = attributes.find("key"); if(p != attributes.end()) { _key = p->second; } p = attributes.find("value"); if(p != attributes.end()) { _value = p->second; } p = attributes.find("element"); if(p != attributes.end()) { _element = p->second; } p = attributes.find("index"); if(p != attributes.end()) { _index = p->second; } NodePtr node = parse(target); _target = EntityNodePtr::dynamicCast(node); if(!_target) { _errorReporter->error("`target' attribute is not an entity: `" + target + "'"); } } void FreezeScript::IterateDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo* info) { DescriptorErrorContext ctx(_errorReporter, "iterate", _line); DataPtr data = sym->getValue(_target); DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); if(!dict && !seq) { ostringstream ostr; ostr << _target; _errorReporter->error("target `" + ostr.str() + "' is not a dictionary or sequence"); } if(dict) { if(!_element.empty()) { _errorReporter->error("attribute `element' specified for dictionary target"); } if(!_index.empty()) { _errorReporter->error("attribute `index' specified for dictionary target"); } string key = _key; if(key.empty()) { key = "key"; } string value = _value; if(value.empty()) { value = "value"; } DataMap& map = dict->getElements(); for(DataMap::iterator p = map.begin(); p != map.end(); ++p) { SymbolTablePtr elemSym = sym->createChild(); elemSym->add(key, p->first); elemSym->add(value, p->second); ExecutableContainerDescriptor::execute(elemSym, info); } } else { if(!_key.empty()) { _errorReporter->error("attribute `key' specified for sequence target"); } if(!_value.empty()) { _errorReporter->error("attribute `value' specified for sequence target"); } string element = _element; if(element.empty()) { element = "elem"; } string index = _index; if(index.empty()) { index = "i"; } // // NOTE: Don't use iterator to traverse vector because child descriptors might remove elements. // DataList& l = seq->getElements(); DataList::size_type i = 0; while(i < l.size()) { SymbolTablePtr elemSym = sym->createChild(); elemSym->add(element, l[i]); elemSym->add(index, _factory->createInteger(i, true)); ExecutableContainerDescriptor::execute(elemSym, info); ++i; } } } // // DumpDescriptor // FreezeScript::DumpDescriptor::DumpDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes, const Slice::UnitPtr& unit) : Descriptor(parent, line, factory, errorReporter), ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "dump"), _base(true), _contents(true) { DescriptorErrorContext ctx(_errorReporter, "dump", _line); for(IceXML::Attributes::const_iterator p = attributes.begin(); p != attributes.end(); ++p) { if(p->first == "type") { if(_type) { _errorReporter->error("duplicate attribute `type'"); } _type = findType(unit, p->second); } else if(p->first == "base") { if(p->second == "false") { _base = false; } else if(p->second != "true") { _errorReporter->error("invalid value `" + p->second + "' for attribute `base'"); } } else if(p->first == "contents") { if(p->second == "false") { _contents = false; } else if(p->second != "true") { _errorReporter->error("invalid value `" + p->second + "' for attribute `contents'"); } } else { _errorReporter->error("unknown attribute `" + p->first + "'"); } } if(!_type) { _errorReporter->error("required attribute `type' is missing"); } } Slice::TypePtr FreezeScript::DumpDescriptor::type() const { return _type; } string FreezeScript::DumpDescriptor::typeName() const { return typeToString(_type); } bool FreezeScript::DumpDescriptor::base() const { return _base; } bool FreezeScript::DumpDescriptor::contents() const { return _contents; } // // RecordDescriptor // FreezeScript::RecordDescriptor::RecordDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes, const Slice::UnitPtr& unit, const FreezeScript::ObjectFactoryPtr& objectFactory) : Descriptor(parent, line, factory, errorReporter), ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "record"), _unit(unit), _objectFactory(objectFactory) { } void FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& /*sym*/, ExecuteInfo* info) { // // Temporarily add an object factory. // _objectFactory->activate(_factory, _unit); // // Iterate over the database. // Dbc* dbc = 0; info->db->cursor(info->txn, &dbc, 0); try { Dbt dbKey, dbValue; while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0) { Ice::ByteSeq keyBytes; keyBytes.resize(dbKey.get_size()); memcpy(&keyBytes[0], dbKey.get_data(), dbKey.get_size()); Ice::InputStreamPtr inKey = Ice::wrapInputStream(info->communicator, keyBytes); Ice::ByteSeq valueBytes; valueBytes.resize(dbValue.get_size()); memcpy(&valueBytes[0], dbValue.get_data(), dbValue.get_size()); Ice::InputStreamPtr inValue = Ice::wrapInputStream(info->communicator, valueBytes); inValue->startEncapsulation(); // // Create data representations of the key and value types. // DataPtr keyData = _factory->create(info->keyType, true); Destroyer keyDataDestroyer(keyData); DataPtr valueData = _factory->create(info->valueType, true); Destroyer valueDataDestroyer(valueData); DataPtr facetData = _factory->createString(info->facet, true); Destroyer facetDataDestroyer(facetData); // // Unmarshal the key and value. // keyData->unmarshal(inKey); valueData->unmarshal(inValue); if(info->valueType->usesClasses()) { inValue->readPendingObjects(); } // // Visit the key and value. // DumpVisitor visitor(_factory, _unit, _errorReporter, info); keyData->visit(visitor); valueData->visit(visitor); if(!_children.empty()) { // // Execute the child descriptors. // SymbolTablePtr st = new SymbolTableI(_factory, _unit, _errorReporter, info, info->symbolTable); st->add("key", keyData); st->add("value", valueData); st->add("facet", facetData); ExecutableContainerDescriptor::execute(st, info); } } } catch(...) { if(dbc) { dbc->close(); } _objectFactory->deactivate(); throw; } if(dbc) { dbc->close(); } _objectFactory->deactivate(); } // // DatabaseDescriptor // FreezeScript::DatabaseDescriptor::DatabaseDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes, const Slice::UnitPtr& unit) : Descriptor(parent, line, factory, errorReporter), ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "database"), _unit(unit) { DescriptorErrorContext ctx(_errorReporter, "database", _line); IceXML::Attributes::const_iterator p = attributes.find("key"); if(p == attributes.end()) { _errorReporter->error("required attribute `key' is missing"); } _key = findType(unit, p->second); p = attributes.find("value"); if(p == attributes.end()) { _errorReporter->error("required attribute `value' is missing"); } _value = findType(unit, p->second); } void FreezeScript::DatabaseDescriptor::addChild(const DescriptorPtr& child) { DescriptorErrorContext ctx(_errorReporter, "database", _line); RecordDescriptorPtr rec = RecordDescriptorPtr::dynamicCast(child); if(rec) { if(_record) { _errorReporter->error("only one element can be specified"); } _record = rec; } ExecutableContainerDescriptor::addChild(child); } void FreezeScript::DatabaseDescriptor::execute(const SymbolTablePtr&, ExecuteInfo* info) { // // Store the key and value types. // info->keyType = _key; info->valueType = _value; ExecutableContainerDescriptor::execute(info->symbolTable, info); } // // DumpDBDescriptor // FreezeScript::DumpDBDescriptor::DumpDBDescriptor(int line, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter, const IceXML::Attributes& /*attributes*/, const Slice::UnitPtr& unit) : Descriptor(0, line, factory, errorReporter), _unit(unit), _info(new ExecuteInfo) { _info->symbolTable = new SymbolTableI(factory, unit, errorReporter, _info); } FreezeScript::DumpDBDescriptor::~DumpDBDescriptor() { delete _info; } void FreezeScript::DumpDBDescriptor::addChild(const DescriptorPtr& child) { DescriptorErrorContext ctx(_errorReporter, "dumpdb", _line); DatabaseDescriptorPtr db = DatabaseDescriptorPtr::dynamicCast(child); DumpDescriptorPtr dump = DumpDescriptorPtr::dynamicCast(child); if(db) { if(_database) { _errorReporter->error("only one element can be specified"); } else { _database = db; _children.push_back(db); } } else if(dump) { string name = dump->typeName(); DumpMap::iterator p = _info->dumpMap.find(name); if(p != _info->dumpMap.end()) { _errorReporter->error(" descriptor for `" + name + "' specified more than once"); } _info->dumpMap.insert(DumpMap::value_type(name, dump)); _children.push_back(dump); } else { _errorReporter->error("invalid child element"); } } void FreezeScript::DumpDBDescriptor::validate() { DescriptorErrorContext ctx(_errorReporter, "dumpdb", _line); if(!_database) { _errorReporter->error("no element specified"); } for(vector::iterator p = _children.begin(); p != _children.end(); ++p) { (*p)->validate(); } } void FreezeScript::DumpDBDescriptor::execute(const SymbolTablePtr&, ExecuteInfo*) { assert(false); } void FreezeScript::DumpDBDescriptor::dump(const Ice::CommunicatorPtr& communicator, Db* db, DbTxn* txn, const string& facet) { _info->communicator = communicator; _info->db = db; _info->txn = txn; _info->facet = facet; try { _database->execute(0, _info); } catch(...) { _info->communicator = 0; _info->db = 0; _info->txn = 0; throw; } _info->communicator = 0; _info->db = 0; _info->txn = 0; } // // SymbolTableI // FreezeScript::SymbolTableI::SymbolTableI(const DataFactoryPtr& factory, const Slice::UnitPtr& unit, const ErrorReporterPtr& errorReporter, ExecuteInfo* info, const SymbolTablePtr& parent) : _factory(factory), _unit(unit), _errorReporter(errorReporter), _info(info), _parent(parent) { } void FreezeScript::SymbolTableI::add(const string& name, const DataPtr& data) { DataMap::const_iterator p = _dataMap.find(name); if(p != _dataMap.end()) { _errorReporter->error("`" + name + "' is already defined"); } _dataMap.insert(DataMap::value_type(name, data)); } FreezeScript::DataPtr FreezeScript::SymbolTableI::getValue(const EntityNodePtr& entity) const { EntityVisitor visitor(const_cast(this)); entity->visit(visitor); DataPtr result = visitor.getCurrent(); if(!result) { ostringstream ostr; ostr << "invalid entity `" << entity << "'"; _errorReporter->error(ostr.str()); } return result; } FreezeScript::DataPtr FreezeScript::SymbolTableI::getConstantValue(const string& name) const { DataMap::const_iterator p = _constantCache.find(name); if(p != _constantCache.end()) { return p->second; } if(_parent) { return _parent->getConstantValue(name); } Slice::ContainedList l = _unit->findContents(name); if(l.empty()) { _errorReporter->error("unknown constant `" + name + "'"); } Slice::EnumeratorPtr e = Slice::EnumeratorPtr::dynamicCast(l.front()); Slice::ConstPtr c = Slice::ConstPtr::dynamicCast(l.front()); if(!e && !c) { _errorReporter->error("`" + name + "' does not refer to a Slice constant or enumerator"); } DataPtr result; if(c) { Slice::TypePtr type = c->type(); string value = c->value(); Slice::BuiltinPtr b = Slice::BuiltinPtr::dynamicCast(type); if(b) { switch(b->kind()) { case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: { Ice::Long n; if(!IceUtilInternal::stringToInt64(value, n)) { assert(false); } result = _factory->createInteger(n, true); break; } case Slice::Builtin::KindBool: { result = _factory->createBoolean(value == "true", true); break; } case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: { double v = strtod(value.c_str(), 0); result = _factory->createDouble(v, true); break; } case Slice::Builtin::KindString: { result = _factory->createString(value, true); break; } case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: assert(false); } } else { Slice::EnumPtr en = Slice::EnumPtr::dynamicCast(type); assert(en); Slice::EnumeratorList el = en->getEnumerators(); for(Slice::EnumeratorList::iterator q = el.begin(); q != el.end(); ++q) { if((*q)->name() == value) { e = *q; break; } } assert(e); } } if(!result) { assert(e); result = _factory->create(e->type(), true); EnumDataPtr ed = EnumDataPtr::dynamicCast(result); assert(ed); ed->setValueAsString(e->name()); } // // Cache the value. // const_cast(_constantCache).insert(DataMap::value_type(name, result)); return result; } FreezeScript::SymbolTablePtr FreezeScript::SymbolTableI::createChild() { return new SymbolTableI(_factory, _unit, _errorReporter, _info, this); } Slice::TypePtr FreezeScript::SymbolTableI::lookupType(const string& name) { Slice::TypeList l = _unit->lookupType(name, false); Slice::TypePtr result; if(!l.empty()) { result = l.front(); } return result; } FreezeScript::DataPtr FreezeScript::SymbolTableI::invokeFunction(const string& name, const DataPtr& target, const DataList& args) { if(target) { DictionaryDataPtr targetDict = DictionaryDataPtr::dynamicCast(target); if(targetDict && name == "containsKey") { if(args.size() != 1) { _errorReporter->error("containsKey() requires one argument"); } Slice::DictionaryPtr dictType = Slice::DictionaryPtr::dynamicCast(targetDict->getType()); assert(dictType); DataPtr key = _factory->create(dictType->keyType(), false); AssignVisitor visitor(args[0], _factory, _errorReporter, false); key->visit(visitor); DataPtr value = targetDict->getElement(key); return _factory->createBoolean(value ? true : false, false); } DataPtr result; if(invokeMemberFunction(name, target, args, result, _factory, _errorReporter)) { return result; } _errorReporter->error("unknown function `" + name + "' invoked on type " + typeToString(target->getType())); } else { // // Global function. // DataPtr result; if(invokeGlobalFunction(_info->communicator, name, args, result, _factory, _errorReporter)) { return result; } else { _errorReporter->error("unknown global function `" + name + "'"); } } return 0; } FreezeScript::DataPtr FreezeScript::SymbolTableI::findValue(const string& name) const { DataMap::const_iterator p = _dataMap.find(name); if(p != _dataMap.end()) { return p->second; } if(_parent) { SymbolTableIPtr parentI = SymbolTableIPtr::dynamicCast(_parent); assert(parentI); return parentI->findValue(name); } return 0; } FreezeScript::SymbolTableI::EntityVisitor::EntityVisitor(SymbolTableI* table) : _table(table), _error(false) { } void FreezeScript::SymbolTableI::EntityVisitor::visitIdentifier(const string& name) { if(!_error) { if(!_current) { _current = _table->findValue(name); } else { _current = _current->getMember(name); } if(!_current) { _error = true; } } } void FreezeScript::SymbolTableI::EntityVisitor::visitElement(const NodePtr& value) { if(!_error) { assert(_current); DataPtr val = value->evaluate(_table); _current = _current->getElement(val); if(!_current) { _error = true; } } } FreezeScript::DataPtr FreezeScript::SymbolTableI::EntityVisitor::getCurrent() const { return _current; } // // DumpVisitor // FreezeScript::DumpVisitor::DumpVisitor(const DataFactoryPtr& factory, const Slice::UnitPtr& unit, const ErrorReporterPtr& errorReporter, ExecuteInfo* info) : _factory(factory), _unit(unit), _errorReporter(errorReporter), _info(info) { } void FreezeScript::DumpVisitor::visitBoolean(const BooleanDataPtr& data) { dump(data); } void FreezeScript::DumpVisitor::visitInteger(const IntegerDataPtr& data) { dump(data); } void FreezeScript::DumpVisitor::visitDouble(const DoubleDataPtr& data) { dump(data); } void FreezeScript::DumpVisitor::visitString(const StringDataPtr& data) { dump(data); } void FreezeScript::DumpVisitor::visitProxy(const ProxyDataPtr& data) { dump(data); } void FreezeScript::DumpVisitor::visitStruct(const StructDataPtr& data) { if(dump(data)) { DataMemberMap& members = data->getMembers(); for(DataMemberMap::iterator p = members.begin(); p != members.end(); ++p) { p->second->visit(*this); } } } void FreezeScript::DumpVisitor::visitSequence(const SequenceDataPtr& data) { if(dump(data)) { DataList& elements = data->getElements(); for(DataList::iterator p = elements.begin(); p != elements.end(); ++p) { (*p)->visit(*this); } } } void FreezeScript::DumpVisitor::visitEnum(const EnumDataPtr& data) { dump(data); } void FreezeScript::DumpVisitor::visitDictionary(const DictionaryDataPtr& data) { if(dump(data)) { DataMap& elements = data->getElements(); for(DataMap::iterator p = elements.begin(); p != elements.end(); ++p) { p->first->visit(*this); p->second->visit(*this); } } } void FreezeScript::DumpVisitor::visitObject(const ObjectRefPtr& data) { if(dump(data)) { ObjectDataPtr value = data->getValue(); if(value) { set::iterator p = _objectHistory.find(value.get()); if(p == _objectHistory.end()) { _objectHistory.insert(value.get()); DataMemberMap& members = value->getMembers(); for(DataMemberMap::iterator q = members.begin(); q != members.end(); ++q) { q->second->visit(*this); } } } } } bool FreezeScript::DumpVisitor::dump(const DataPtr& data) { bool result = true; ObjectRefPtr obj = ObjectRefPtr::dynamicCast(data); if(obj && obj->getValue()) { // // When the value is an object, attempt to find a descriptor for the // object's actual type. If no descriptor is found, attempt to find a // descriptor for the object's base types (including Ice::Object). // ObjectDataPtr objData = obj->getValue(); Slice::TypePtr cls = objData->getType(); // Actual type bool checkContents = true; while(cls) { string type = typeToString(cls); bool base = true; DumpMap::const_iterator p = _info->dumpMap.find(type); if(p != _info->dumpMap.end()) { SymbolTablePtr sym = new SymbolTableI(_factory, _unit, _errorReporter, _info, _info->symbolTable); sym->add("value", objData); p->second->execute(sym, _info); base = p->second->base(); if(checkContents) { result = p->second->contents(); checkContents = false; } } Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(cls); cls = 0; if(base && decl) { Slice::ClassDefPtr def = decl->definition(); assert(def); Slice::ClassList bases = def->bases(); if(!bases.empty() && !bases.front()->isInterface()) { cls = bases.front()->declaration(); } else { cls = _unit->builtin(Slice::Builtin::KindObject); } } } } else { string typeName = typeToString(data->getType()); DumpMap::iterator p = _info->dumpMap.find(typeName); if(p != _info->dumpMap.end()) { SymbolTablePtr st = new SymbolTableI(_factory, _unit, _errorReporter, _info, _info->symbolTable); st->add("value", data); p->second->execute(st, _info); result = p->second->contents(); } } return result; } Ice-3.5.1/cpp/src/FreezeScript/TransformVisitor.h0000644000076400007640000000713712223561476020064 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_TRANSFORM_VISITOR_H #define FREEZE_SCRIPT_TRANSFORM_VISITOR_H #include namespace FreezeScript { // // ObjectDataMap associates old instances of ObjectData to their // transformed equivalents. // typedef std::map ObjectDataMap; // // TransformInfo supplies information required by TransformVisitor. // class TransformInfo : public IceUtil::SimpleShared { public: virtual ~TransformInfo() {} // // Get data factory. // virtual DataFactoryPtr getDataFactory() = 0; // // Get error reporter. // virtual ErrorReporterPtr getErrorReporter() = 0; // // Indicates whether the default transformation should be performed. // virtual bool doDefaultTransform(const Slice::TypePtr&) = 0; // // Indicates whether a base class transformation should be performed. // virtual bool doBaseTransform(const Slice::ClassDefPtr&) = 0; // // Given an old type, return the equivalent new type if the type // has been renamed. // virtual Slice::TypePtr getRenamedType(const Slice::TypePtr&) = 0; // // Execute the custom transformation for the given old and new Data values. // virtual void executeCustomTransform(const DataPtr&, const DataPtr&) = 0; // // The facet name of the database (evictor only). // virtual std::string facetName() = 0; // // Indicates whether objects should be removed if no class definition is found. // virtual bool purgeObjects() = 0; // // Associates old object instances with their transformed equivalents. // virtual ObjectDataMap& getObjectDataMap() = 0; }; typedef IceUtil::Handle TransformInfoPtr; // // TransformVisitor is used to visit a destination Data value and // preserve as much information as possible from the source Data value. // class TransformVisitor : public DataVisitor { public: TransformVisitor(const DataPtr&, const TransformInfoPtr&, const std::string& = std::string()); virtual void visitBoolean(const BooleanDataPtr&); virtual void visitInteger(const IntegerDataPtr&); virtual void visitDouble(const DoubleDataPtr&); virtual void visitString(const StringDataPtr&); virtual void visitProxy(const ProxyDataPtr&); virtual void visitStruct(const StructDataPtr&); virtual void visitSequence(const SequenceDataPtr&); virtual void visitEnum(const EnumDataPtr&); virtual void visitDictionary(const DictionaryDataPtr&); virtual void visitObject(const ObjectRefPtr&); private: void transformObject(const ObjectDataPtr&, const ObjectDataPtr&); bool checkRename(const Slice::TypePtr&, const Slice::TypePtr&); bool isCompatible(const Slice::TypePtr&, const Slice::TypePtr&); bool checkClasses(const Slice::ClassDeclPtr&, const Slice::ClassDeclPtr&); void typeMismatchError(const Slice::TypePtr&, const Slice::TypePtr&); void conversionError(const Slice::TypePtr&, const Slice::TypePtr&, const std::string&); void rangeError(const std::string&, const Slice::TypePtr&); void warning(const std::string&); DataPtr _src; TransformInfoPtr _info; std::string _context; // Provides additional detail for use in warning messages. }; } // End of namespace FreezeScript #endif Ice-3.5.1/cpp/src/FreezeScript/Parser.cpp0000644000076400007640000003522512223561476016317 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; namespace FreezeScript { class EntityNodePrinter : public EntityNodeVisitor { public: EntityNodePrinter(ostream& os) : _os(os), _first(true) { } virtual void visitIdentifier(const std::string& name) { if(_first) { _first = false; } else { _os << '.'; } _os << name; } virtual void visitElement(const NodePtr& value) { assert(!_first); _os << '['; value->print(_os); _os << ']'; } private: ostream& _os; bool _first; }; } // End of namespace FreezeScript // // Globals required by the Bison grammar. // FreezeScript::DataFactoryPtr FreezeScript::parseDataFactory; FreezeScript::ErrorReporterPtr FreezeScript::parseErrorReporter; FreezeScript::NodePtr FreezeScript::parseResult; int FreezeScript::parseLine; namespace { string _input; string::size_type _pos; IceUtil::Mutex* _parserMutex = 0; class Init { public: Init() { _parserMutex = new IceUtil::Mutex; } ~Init() { delete _parserMutex; _parserMutex = 0; } }; Init init; } // // parseExpression // FreezeScript::NodePtr FreezeScript::parseExpression(const string& expr, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter) { // // The bison grammar is not thread-safe. // IceUtilInternal::MutexPtrLock sync(_parserMutex); parseDataFactory = factory; parseErrorReporter = errorReporter; parseLine = 1; parseErrorReporter->setExpression(expr); _input = expr; _pos = 0; int status = freeze_script_parse(); if(status != 0) { parseResult = 0; } parseErrorReporter->clearExpression(); parseErrorReporter = 0; return parseResult; } // // getInput supplies characters to the lexical scanner. // int FreezeScript::getInput(char* buf, int /*maxSize*/) { if(_pos < _input.length()) { buf[0] = _input[_pos]; _pos++; return 1; } else { return 0; } } // // EvaluateException // FreezeScript::EvaluateException::EvaluateException(const char* file, int line, const string& reason) : IceUtil::Exception(file, line), _reason(reason) { } FreezeScript::EvaluateException::~EvaluateException() throw() { } const char* FreezeScript::EvaluateException::_name = "FreezeScript::EvaluateException"; string FreezeScript::EvaluateException::ice_name() const { return _name; } void FreezeScript::EvaluateException::ice_print(ostream& out) const { Ice::Exception::ice_print(out); out << ":\nerror occurred while evaluating expression"; if(!_reason.empty()) { out << ":\n" << _reason; } } FreezeScript::EvaluateException* FreezeScript::EvaluateException::ice_clone() const { return new EvaluateException(ice_file(), ice_line(), _reason); } void FreezeScript::EvaluateException::ice_throw() const { throw *this; } string FreezeScript::EvaluateException::reason() const { return _reason; } // // SymbolTable // FreezeScript::SymbolTable::~SymbolTable() { } // // Node // FreezeScript::Node::~Node() { } // // BinaryNode // FreezeScript::BinaryNode::BinaryNode(BinaryOperator op, const DataFactoryPtr& factory, const NodePtr& left, const NodePtr& right) : _op(op), _factory(factory), _left(left), _right(right) { } FreezeScript::DataPtr FreezeScript::BinaryNode::evaluate(const SymbolTablePtr& st) { DataPtr result; switch(_op) { case BinOpOr: { DataPtr leftValue = _left->evaluate(st); if(leftValue->booleanValue()) { result = leftValue; } else { result = _right->evaluate(st); } break; } case BinOpAnd: { DataPtr leftValue = _left->evaluate(st); if(!leftValue->booleanValue()) { result = leftValue; } else { result = _right->evaluate(st); } break; } case BinOpMul: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); IntegerDataPtr ileft = IntegerDataPtr::dynamicCast(leftValue); IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); if(ileft && iright) { result = _factory->createInteger(leftValue->integerValue() * rightValue->integerValue(), true); } else { result = _factory->createDouble(leftValue->doubleValue(true) * rightValue->doubleValue(true), true); } break; } case BinOpDiv: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); IntegerDataPtr ileft = IntegerDataPtr::dynamicCast(leftValue); IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); if(ileft && iright) { result = _factory->createInteger(leftValue->integerValue() / rightValue->integerValue(), true); } else { result = _factory->createDouble(leftValue->doubleValue(true) / rightValue->doubleValue(true), true); } break; } case BinOpMod: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); result = _factory->createInteger(leftValue->integerValue() % rightValue->integerValue(), true); break; } case BinOpAdd: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); StringDataPtr sleft = StringDataPtr::dynamicCast(leftValue); StringDataPtr sright = StringDataPtr::dynamicCast(rightValue); IntegerDataPtr ileft = IntegerDataPtr::dynamicCast(leftValue); IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); if(sleft || sright) { if(sleft && sright) { result = _factory->createString(leftValue->stringValue() + rightValue->stringValue(), true); } else { _factory->getErrorReporter()->error("string concatenation requires two string arguments"); } } else if(ileft && iright) { result = _factory->createInteger(leftValue->integerValue() + rightValue->integerValue(), true); } else { result = _factory->createDouble(leftValue->doubleValue(true) + rightValue->doubleValue(true), true); } break; } case BinOpSub: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); IntegerDataPtr ileft = IntegerDataPtr::dynamicCast(leftValue); IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); if(ileft && iright) { result = _factory->createInteger(leftValue->integerValue() - rightValue->integerValue(), true); } else { result = _factory->createDouble(leftValue->doubleValue(true) - rightValue->doubleValue(true), true); } break; } case BinOpLess: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); bool b = leftValue < rightValue; result = _factory->createBoolean(b, true); break; } case BinOpGreater: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); bool b = (leftValue < rightValue) || (leftValue == rightValue); result = _factory->createBoolean(!b, true); break; } case BinOpLessEq: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); bool b = (leftValue < rightValue) || (leftValue == rightValue); result = _factory->createBoolean(b, true); break; } case BinOpGrEq: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); bool b = leftValue < rightValue; result = _factory->createBoolean(!b, true); break; } case BinOpEq: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); bool b = leftValue == rightValue; result = _factory->createBoolean(b, true); break; } case BinOpNotEq: { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); bool b = leftValue == rightValue; result = _factory->createBoolean(!b, true); break; } } if(!result) { throw EvaluateException(__FILE__, __LINE__, "invalid operands to operator " + opToString(_op)); } return result; } void FreezeScript::BinaryNode::print(ostream& os) const { os << opToString(_op) << ": left="; _left->print(os); os << ", right="; _right->print(os); } string FreezeScript::BinaryNode::opToString(BinaryOperator op) { switch(op) { case BinOpOr: return "OR"; case BinOpAnd: return "AND"; case BinOpMul: return "*"; case BinOpDiv: return "/"; case BinOpMod: return "%"; case BinOpAdd: return "+"; case BinOpSub: return "-"; case BinOpLess: return "<"; case BinOpGreater: return ">"; case BinOpLessEq: return "<="; case BinOpGrEq: return ">="; case BinOpEq: return "=="; case BinOpNotEq: return "!="; } assert(false); return string(); } // // UnaryNode // FreezeScript::UnaryNode::UnaryNode(UnaryOperator op, const DataFactoryPtr& factory, const NodePtr& right) : _op(op), _factory(factory), _right(right) { } FreezeScript::DataPtr FreezeScript::UnaryNode::evaluate(const SymbolTablePtr& st) { DataPtr result; switch(_op) { case UnaryOpNeg: { DataPtr rightValue = _right->evaluate(st); IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); if(iright) { result = _factory->createInteger(-rightValue->integerValue(), true); } else { result = _factory->createDouble(-rightValue->doubleValue(), true); } break; } case UnaryOpNot: { DataPtr rightValue = _right->evaluate(st); result = _factory->createBoolean(!rightValue->booleanValue(), true); break; } } if(!result) { throw EvaluateException(__FILE__, __LINE__, "invalid operand to operator " + opToString(_op)); } return result; } void FreezeScript::UnaryNode::print(ostream& os) const { os << opToString(_op) << ": right="; _right->print(os); } string FreezeScript::UnaryNode::opToString(UnaryOperator op) { switch(op) { case UnaryOpNeg: return "-"; case UnaryOpNot: return "!"; } assert(false); return string(); } // // DataNode // FreezeScript::DataNode::DataNode(const DataPtr& data) : _data(data) { } FreezeScript::DataPtr FreezeScript::DataNode::evaluate(const SymbolTablePtr&) { return _data; } void FreezeScript::DataNode::print(ostream& /*os*/) const { // TODO //_data->print(os); } // // EntityNodeVisitor // FreezeScript::EntityNodeVisitor::~EntityNodeVisitor() { } // // EntityNode // FreezeScript::DataPtr FreezeScript::EntityNode::evaluate(const SymbolTablePtr& st) { DataPtr result = st->getValue(this); if(!result) { ostringstream ostr; print(ostr); throw EvaluateException(__FILE__, __LINE__, "unknown entity `" + ostr.str() + "'"); } return result; } void FreezeScript::EntityNode::print(ostream& os) const { EntityNodePrinter printer(os); visit(printer); } void FreezeScript::EntityNode::append(const EntityNodePtr& next) { if(_next) { _next->append(next); } else { _next = next; } } // // IdentNode // FreezeScript::IdentNode::IdentNode(const string& value) : _value(value) { } string FreezeScript::IdentNode::getValue() const { return _value; } void FreezeScript::IdentNode::visit(EntityNodeVisitor& visitor) const { visitor.visitIdentifier(_value); if(_next) { _next->visit(visitor); } } // // ElementNode // FreezeScript::ElementNode::ElementNode(const NodePtr& value) : _value(value) { } FreezeScript::NodePtr FreezeScript::ElementNode::getValue() const { return _value; } void FreezeScript::ElementNode::visit(EntityNodeVisitor& visitor) const { visitor.visitElement(_value); if(_next) { _next->visit(visitor); } } // // FunctionNode // FreezeScript::FunctionNode::FunctionNode(const string& name, const NodeList& args) : _name(name), _args(args) { } FreezeScript::DataPtr FreezeScript::FunctionNode::evaluate(const SymbolTablePtr& st) { DataPtr target; if(_target) { target = _target->evaluate(st); } DataList args; for(NodeList::iterator p = _args.begin(); p != _args.end(); ++p) { args.push_back((*p)->evaluate(st)); } return st->invokeFunction(_name, target, args); } void FreezeScript::FunctionNode::print(ostream& os) const { if(_target) { _target->print(os); os << '.'; } os << _name << '('; for(NodeList::const_iterator p = _args.begin(); p != _args.end(); ++p) { if(p != _args.begin()) { os << ", "; } (*p)->print(os); } os << ')'; } void FreezeScript::FunctionNode::setTarget(const EntityNodePtr& target) { _target = target; } // // ConstantNode // FreezeScript::ConstantNode::ConstantNode(const string& value) : _value(value) { } FreezeScript::DataPtr FreezeScript::ConstantNode::evaluate(const SymbolTablePtr& st) { DataPtr result = st->getConstantValue(_value); if(!result) { throw EvaluateException(__FILE__, __LINE__, "unknown constant `" + _value + "'"); } return result; } void FreezeScript::ConstantNode::print(ostream& os) const { os << _value; } // // Stream insertion for an entity node. // ostream& operator<<(ostream& os, const FreezeScript::EntityNodePtr& entity) { FreezeScript::EntityNodePrinter printer(os); entity->visit(printer); return os; } Ice-3.5.1/cpp/src/FreezeScript/TransformVisitor.cpp0000644000076400007640000006627712223561476020431 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; FreezeScript::TransformVisitor::TransformVisitor(const DataPtr& src, const TransformInfoPtr& info, const string& context) : _src(src), _info(info), _context(context) { assert(_info); } void FreezeScript::TransformVisitor::visitBoolean(const BooleanDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { BooleanDataPtr b = BooleanDataPtr::dynamicCast(_src); if(b) { dest->setValue(b->getValue()); } else { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { string v = s->getValue(); if(v == "true") { dest->setValue(true); } else if(v == "false") { dest->setValue(false); } else { conversionError(type, _src->getType(), v); } } else { typeMismatchError(type, _src->getType()); } } } _info->executeCustomTransform(dest, _src); } void FreezeScript::TransformVisitor::visitInteger(const IntegerDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { IntegerDataPtr i = IntegerDataPtr::dynamicCast(_src); if(i) { dest->setValue(i->getValue(), false); } else { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { string str = s->getValue(); Ice::Long value; if(IceUtilInternal::stringToInt64(str, value)) { dest->setValue(value, false); } else { conversionError(type, _src->getType(), str); } } else { typeMismatchError(type, _src->getType()); } } } _info->executeCustomTransform(dest, _src); } void FreezeScript::TransformVisitor::visitDouble(const DoubleDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { DoubleDataPtr d = DoubleDataPtr::dynamicCast(_src); if(d) { dest->setValue(d->doubleValue()); } else { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { string str = s->stringValue(); const char* start = str.c_str(); char* end; double v = strtod(start, &end); if(errno == ERANGE) { rangeError(str, type); } else { while(*end) { if(!isspace(static_cast(*end))) { conversionError(type, _src->getType(), str); return; } end++; } if(!*end) { dest->setValue(v); } } } else { typeMismatchError(type, _src->getType()); } } } _info->executeCustomTransform(dest, _src); } void FreezeScript::TransformVisitor::visitString(const StringDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { StringDataPtr s = StringDataPtr::dynamicCast(_src); BooleanDataPtr b = BooleanDataPtr::dynamicCast(_src); IntegerDataPtr i = IntegerDataPtr::dynamicCast(_src); DoubleDataPtr d = DoubleDataPtr::dynamicCast(_src); EnumDataPtr e = EnumDataPtr::dynamicCast(_src); ProxyDataPtr p = ProxyDataPtr::dynamicCast(_src); if(s || b || i || d || e || p) { dest->setValue(_src->toString()); } else { typeMismatchError(type, _src->getType()); } } _info->executeCustomTransform(dest, _src); } void FreezeScript::TransformVisitor::visitProxy(const ProxyDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { ProxyDataPtr p = ProxyDataPtr::dynamicCast(_src); if(p) { dest->setValue(p->getValue()); } else { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { dest->setValue(s->getValue(), false); } else { typeMismatchError(type, _src->getType()); } } } _info->executeCustomTransform(dest, _src); } void FreezeScript::TransformVisitor::visitStruct(const StructDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { StructDataPtr s = StructDataPtr::dynamicCast(_src); if(s && isCompatible(type, _src->getType())) { // // Transform members with the same name. // DataMemberMap srcMap = s->getMembers(); DataMemberMap destMap = dest->getMembers(); string typeName = typeToString(type); for(DataMemberMap::iterator p = destMap.begin(); p != destMap.end(); ++p) { DataMemberMap::iterator q = srcMap.find(p->first); if(q != srcMap.end()) { string context = typeName + " member " + p->first + " value"; TransformVisitor v(q->second, _info, context); p->second->visit(v); } } } else { typeMismatchError(type, _src->getType()); } } _info->executeCustomTransform(dest, _src); } void FreezeScript::TransformVisitor::visitSequence(const SequenceDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { SequenceDataPtr s = SequenceDataPtr::dynamicCast(_src); if(s && isCompatible(type, _src->getType())) { DataList& srcElements = s->getElements(); DataList destElements; Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(type); assert(seqType); Slice::TypePtr elemType = seqType->type(); string typeName = typeToString(type); for(DataList::const_iterator p = srcElements.begin(); p != srcElements.end(); ++p) { DataPtr element = _info->getDataFactory()->create(elemType, false); Destroyer elementDestroyer(element); try { TransformVisitor v(*p, _info, typeName + " element"); element->visit(v); destElements.push_back(element); elementDestroyer.release(); } catch(const ClassNotFoundException& ex) { // // If transformation of the sequence element fails because a class // could not be found, then we invoke purgeObjects() to determine // whether we should ignore the situation (and remove the element // from the sequence) or raise the exception again. // if(!_info->purgeObjects()) { throw; } warning("purging element of sequence " + typeToString(type) + " due to missing class type " + ex.id); } } DataList& l = dest->getElements(); l.swap(destElements); } else { typeMismatchError(type, _src->getType()); } } _info->executeCustomTransform(dest, _src); } void FreezeScript::TransformVisitor::visitEnum(const EnumDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { string name; EnumDataPtr e = EnumDataPtr::dynamicCast(_src); if(e && isCompatible(type, _src->getType())) { name = e->toString(); } else { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { name = s->getValue(); } else { typeMismatchError(type, _src->getType()); return; } } if(!dest->setValueAsString(name)) { conversionError(type, _src->getType(), name); } } _info->executeCustomTransform(dest, _src); } void FreezeScript::TransformVisitor::visitDictionary(const DictionaryDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { DictionaryDataPtr d = DictionaryDataPtr::dynamicCast(_src); if(d && isCompatible(type, _src->getType())) { DataMap& srcMap = d->getElements(); DataMap destMap; Slice::DictionaryPtr dictType = Slice::DictionaryPtr::dynamicCast(type); assert(dictType); Slice::TypePtr keyType = dictType->keyType(); Slice::TypePtr valueType = dictType->valueType(); string typeName = typeToString(type); for(DataMap::const_iterator p = srcMap.begin(); p != srcMap.end(); ++p) { DataPtr key = _info->getDataFactory()->create(keyType, false); Destroyer keyDestroyer(key); DataPtr value = _info->getDataFactory()->create(valueType, false); Destroyer valueDestroyer(value); TransformVisitor keyVisitor(p->first, _info, typeName + " key"); key->visit(keyVisitor); try { TransformVisitor valueVisitor(p->second, _info, typeName + " value"); value->visit(valueVisitor); } catch(const ClassNotFoundException& ex) { // // If transformation of the dictionary value fails because a class // could not be found, then we invoke purgeObjects() to determine // whether we should ignore the situation (and remove the element // from the dictionary) or raise the exception again. // if(!_info->purgeObjects()) { throw; } warning("purging element of dictionary " + typeToString(dictType) + " due to missing class type " + ex.id); continue; } DataMap::const_iterator q = destMap.find(key); if(q != destMap.end()) { warning("duplicate dictionary key in " + typeToString(dictType)); } else { destMap.insert(DataMap::value_type(key, value)); keyDestroyer.release(); valueDestroyer.release(); } } DataMap& m = dest->getElements(); m.swap(destMap); } else { typeMismatchError(type, _src->getType()); } } _info->executeCustomTransform(dest, _src); } void FreezeScript::TransformVisitor::visitObject(const ObjectRefPtr& dest) { Slice::TypePtr type = dest->getType(); ObjectRefPtr src = ObjectRefPtr::dynamicCast(_src); if(!src) { typeMismatchError(type, _src->getType()); } else if(_info->doDefaultTransform(type)) { ObjectDataPtr srcValue = src->getValue(); Slice::TypePtr srcType = src->getType(); if(!srcValue) { // // Allow a nil value from type Object. // if(Slice::BuiltinPtr::dynamicCast(srcType) || isCompatible(type, srcType)) { dest->setValue(0); } else { typeMismatchError(type, srcType); } } else { Slice::TypePtr srcValueType = srcValue->getType(); if(isCompatible(type, srcValueType)) { // // If the types are in the same Slice unit, then we can simply // copy the reference. Otherwise, we check the object map to // see if an equivalent object has already been created, and // if not, then we have to create one. // if(type->unit().get() == srcValueType->unit().get()) { dest->setValue(srcValue); } else { ObjectDataMap& objectDataMap = _info->getObjectDataMap(); ObjectDataMap::iterator p = objectDataMap.find(srcValue.get()); if(p != objectDataMap.end() && p->second) { dest->setValue(p->second); } else { // // If the type has been renamed, we need to get its equivalent // in the new Slice definitions. // Slice::TypePtr newType = _info->getRenamedType(srcValueType); if(!newType) { string name = typeToString(srcValueType); Slice::TypeList l = type->unit()->lookupType(name, false); if(l.empty()) { throw ClassNotFoundException(name); } newType = l.front(); } // // Use createObject() so that an initializer is invoked if necessary. // DataPtr newObj = _info->getDataFactory()->createObject(newType, false); ObjectRefPtr newRef = ObjectRefPtr::dynamicCast(newObj); assert(newRef); ObjectDataPtr newValue = newRef->getValue(); try { transformObject(newValue, srcValue); } catch(...) { newObj->destroy(); throw; } dest->setValue(newValue); newObj->destroy(); } } } else { typeMismatchError(type, srcValueType); } } } _info->executeCustomTransform(dest, _src); } void FreezeScript::TransformVisitor::transformObject(const ObjectDataPtr& dest, const ObjectDataPtr& src) { // // The source object must be present in the object map (we currently don't support // transforming two ObjectData instances from the same Slice unit - this transform // would be handled by-reference at the ObjectRef level). We must update the object // map before transforming members in order to handle cycles. // ObjectDataMap& objectDataMap = _info->getObjectDataMap(); ObjectDataMap::iterator p = objectDataMap.find(src.get()); assert(p != objectDataMap.end()); assert(p->second == 0); objectDataMap.erase(p); objectDataMap.insert(ObjectDataMap::value_type(src.get(), dest)); p = objectDataMap.find(src.get()); try { // // Transform members with the same name. // DataMemberMap srcMap = src->getMembers(); DataMemberMap destMap = dest->getMembers(); string typeName = typeToString(dest->getType()); for(DataMemberMap::iterator p = destMap.begin(); p != destMap.end(); ++p) { DataMemberMap::iterator q = srcMap.find(p->first); if(q != srcMap.end()) { string context = typeName + " member " + p->first + " value"; TransformVisitor v(q->second, _info, context); p->second->visit(v); } } } catch(...) { objectDataMap.erase(p); #if (defined(_MSC_VER) && (_MSC_VER >= 1600)) objectDataMap.insert(ObjectDataMap::value_type(src.get(), static_cast(nullptr))); #else objectDataMap.insert(ObjectDataMap::value_type(src.get(), 0)); #endif throw; } } bool FreezeScript::TransformVisitor::checkRename(const Slice::TypePtr& dest, const Slice::TypePtr& src) { if(dest->unit().get() != src->unit().get()) { Slice::TypePtr t = _info->getRenamedType(src); return t.get() == dest.get(); } return false; } bool FreezeScript::TransformVisitor::isCompatible(const Slice::TypePtr& dest, const Slice::TypePtr& src) { Slice::BuiltinPtr b1 = Slice::BuiltinPtr::dynamicCast(dest); if(b1) { Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); switch(b1->kind()) { case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: { if(b2) { switch(b2->kind()) { case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: case Slice::Builtin::KindString: { return true; } case Slice::Builtin::KindBool: case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: { return false; } } } return false; } case Slice::Builtin::KindBool: { if(b2 && (b2->kind() == Slice::Builtin::KindBool || b2->kind() == Slice::Builtin::KindString)) { return true; } return false; } case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: { if(b2) { switch(b2->kind()) { case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: case Slice::Builtin::KindString: { return true; } case Slice::Builtin::KindByte: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: case Slice::Builtin::KindBool: case Slice::Builtin::KindObject: case Slice::Builtin::KindObjectProxy: case Slice::Builtin::KindLocalObject: { return false; } } } return false; } case Slice::Builtin::KindString: { if(b2) { switch(b2->kind()) { case Slice::Builtin::KindByte: case Slice::Builtin::KindBool: case Slice::Builtin::KindShort: case Slice::Builtin::KindInt: case Slice::Builtin::KindLong: case Slice::Builtin::KindFloat: case Slice::Builtin::KindDouble: case Slice::Builtin::KindString: case Slice::Builtin::KindObjectProxy: { return true; } case Slice::Builtin::KindObject: case Slice::Builtin::KindLocalObject: { return false; } } return false; } else if(Slice::EnumPtr::dynamicCast(src)) { return true; } else if(Slice::ProxyPtr::dynamicCast(src)) { return true; } return false; } case Slice::Builtin::KindObject: { // // Allow transformation from Object to class. Validation has to // be done during transformation, when the actual type of // an instance can be compared for compatibility with the // new type. // Slice::ClassDeclPtr cl = Slice::ClassDeclPtr::dynamicCast(src); if(cl || (b2 && b2->kind() == Slice::Builtin::KindObject)) { return true; } return false; } case Slice::Builtin::KindObjectProxy: { Slice::ProxyPtr p = Slice::ProxyPtr::dynamicCast(src); if(p || (b2 && b2->kind() == Slice::Builtin::KindObjectProxy) || (b2 && b2->kind() == Slice::Builtin::KindString)) { return true; } return false; } case Slice::Builtin::KindLocalObject: { assert(false); return false; } } assert(false); } Slice::ClassDeclPtr cl1 = Slice::ClassDeclPtr::dynamicCast(dest); if(cl1) { Slice::ClassDeclPtr cl2 = Slice::ClassDeclPtr::dynamicCast(src); if(cl2 && checkClasses(cl1, cl2)) { return true; } return false; } Slice::StructPtr s1 = Slice::StructPtr::dynamicCast(dest); if(s1) { if(checkRename(dest, src)) { return true; } Slice::StructPtr s2 = Slice::StructPtr::dynamicCast(src); if(s2 && s1->scoped() == s2->scoped()) { return true; } return false; } Slice::ProxyPtr p1 = Slice::ProxyPtr::dynamicCast(dest); if(p1) { Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); if(b2 && (b2->kind() == Slice::Builtin::KindObjectProxy || b2->kind() == Slice::Builtin::KindString)) { return true; } Slice::ProxyPtr p2 = Slice::ProxyPtr::dynamicCast(src); if(p2 && checkClasses(p1->_class(), p2->_class())) { return true; } return false; } Slice::DictionaryPtr d1 = Slice::DictionaryPtr::dynamicCast(dest); if(d1) { Slice::DictionaryPtr d2 = Slice::DictionaryPtr::dynamicCast(src); if(d2) { return isCompatible(d1->keyType(), d2->keyType()) && isCompatible(d1->valueType(), d2->valueType()); } return false; } Slice::SequencePtr seq1 = Slice::SequencePtr::dynamicCast(dest); if(seq1) { Slice::SequencePtr seq2 = Slice::SequencePtr::dynamicCast(src); if(seq2) { return isCompatible(seq1->type(), seq2->type()); } return false; } Slice::EnumPtr e1 = Slice::EnumPtr::dynamicCast(dest); if(e1) { Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); if(b2 && b2->kind() == Slice::Builtin::KindString) { return true; } if(checkRename(dest, src)) { return true; } Slice::EnumPtr e2 = Slice::EnumPtr::dynamicCast(src); if(e2 && e1->scoped() == e2->scoped()) { return true; } return false; } assert(false); return false; } bool FreezeScript::TransformVisitor::checkClasses(const Slice::ClassDeclPtr& dest, const Slice::ClassDeclPtr& src) { // // Here are the rules for verifying class compatibility: // // 1. If the type ids are the same, assume they are compatible. // 2. If the source type has been renamed, then check its equivalent new definition for compatibility. // 3. Otherwise, the types are only compatible if they are defined in the same Slice unit, and if the // destination type is a base type of the source type. // string s1 = dest->scoped(); string s2 = src->scoped(); if(s1 == s2) { return true; } else { Slice::TypePtr t = _info->getRenamedType(src); Slice::ClassDeclPtr s = Slice::ClassDeclPtr::dynamicCast(t); if(s) { return checkClasses(dest, s); } if(dest->unit().get() != src->unit().get()) { Slice::TypeList l = dest->unit()->lookupTypeNoBuiltin(s2, false); if(l.empty()) { _info->getErrorReporter()->error("class " + s2 + " not found in new Slice definitions"); } s = Slice::ClassDeclPtr::dynamicCast(l.front()); } else { s = src; } if(s) { Slice::ClassDefPtr def = s->definition(); if(!def) { _info->getErrorReporter()->error("class " + s2 + " declared but not defined"); } return def->isA(s1); } } return false; } void FreezeScript::TransformVisitor::typeMismatchError(const Slice::TypePtr& dest, const Slice::TypePtr& src) { ostringstream ostr; ostr << "unable to transform"; if(!_context.empty()) { ostr << ' ' << _context; } ostr << " from " << typeToString(src) << " to " << typeToString(dest); warning(ostr.str()); } void FreezeScript::TransformVisitor::conversionError(const Slice::TypePtr& dest, const Slice::TypePtr& src, const string& value) { ostringstream ostr; ostr << "unable to convert"; if(!_context.empty()) { ostr << ' ' << _context; } ostr << " `" << value << "' from " << typeToString(src) << " to " << typeToString(dest); warning(ostr.str()); } void FreezeScript::TransformVisitor::rangeError(const string& value, const Slice::TypePtr& type) { ostringstream ostr; if(!_context.empty()) { ostr << _context << ' '; } ostr << "`" << value << "' is out of range for type " << typeToString(type); warning(ostr.str()); } void FreezeScript::TransformVisitor::warning(const string& msg) { _info->getErrorReporter()->warning(msg); } Ice-3.5.1/cpp/src/FreezeScript/Data.h0000644000076400007640000004203612223561476015377 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_DATA_H #define FREEZE_SCRIPT_DATA_H #include #include #include namespace FreezeScript { class Data; typedef IceUtil::Handle DataPtr; class DataVisitor; typedef std::map DataMemberMap; typedef std::vector DataList; typedef std::map DataMap; class ObjectWriter; class ObjectReader; class ObjectData; typedef IceUtil::Handle ObjectDataPtr; class DataFactory : public IceUtil::SimpleShared { public: DataFactory(const Ice::CommunicatorPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&); DataPtr create(const Slice::TypePtr&, bool); DataPtr createBoolean(bool, bool); DataPtr createInteger(Ice::Long, bool); DataPtr createDouble(double, bool); DataPtr createString(const std::string&, bool); DataPtr createNil(bool); DataPtr createObject(const Slice::TypePtr&, bool); Slice::BuiltinPtr getBuiltin(Slice::Builtin::Kind) const; Ice::CommunicatorPtr getCommunicator() const; ErrorReporterPtr getErrorReporter() const; protected: DataPtr createImpl(const Slice::TypePtr&, bool); virtual void initialize(const DataPtr&); Ice::CommunicatorPtr _communicator; Slice::UnitPtr _unit; // Only used for creating builtin types. ErrorReporterPtr _errorReporter; }; typedef IceUtil::Handle DataFactoryPtr; class Data : public IceUtil::SimpleShared { public: virtual ~Data(); virtual DataPtr getMember(const std::string&) const = 0; virtual DataPtr getElement(const DataPtr&) const = 0; virtual bool operator==(const Data&) const = 0; virtual bool operator!=(const Data&) const = 0; virtual bool operator<(const Data&) const = 0; virtual DataPtr clone() const = 0; bool readOnly() const; virtual Slice::TypePtr getType() const = 0; virtual void destroy() = 0; virtual void marshal(const Ice::OutputStreamPtr&) const = 0; virtual void unmarshal(const Ice::InputStreamPtr&) = 0; virtual bool booleanValue(bool = false) const = 0; virtual Ice::Long integerValue(bool = false) const = 0; virtual double doubleValue(bool = false) const = 0; virtual std::string stringValue(bool = false) const = 0; virtual std::string toString() const = 0; virtual void visit(DataVisitor&) = 0; protected: Data(const ErrorReporterPtr&, bool); ErrorReporterPtr _errorReporter; bool _readOnly; }; class PrimitiveData : public Data { public: virtual DataPtr getMember(const std::string&) const; virtual DataPtr getElement(const DataPtr&) const; virtual void destroy(); protected: PrimitiveData(const ErrorReporterPtr&, bool); }; typedef IceUtil::Handle PrimitiveDataPtr; class BooleanData : public PrimitiveData { public: BooleanData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool); BooleanData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool, bool); virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); bool getValue() const; void setValue(bool); private: Slice::BuiltinPtr _type; bool _value; }; typedef IceUtil::Handle BooleanDataPtr; class IntegerData : public PrimitiveData { public: IntegerData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool); IntegerData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool, Ice::Long); virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); Ice::Long getValue() const; void setValue(Ice::Long, bool); private: bool rangeCheck(Ice::Long, bool) const; static std::string toString(Ice::Long); Slice::BuiltinPtr _type; Ice::Long _value; }; typedef IceUtil::Handle IntegerDataPtr; class DoubleData : public PrimitiveData { public: DoubleData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool); DoubleData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool, double); virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); double getValue() const; void setValue(double); private: Slice::BuiltinPtr _type; double _value; }; typedef IceUtil::Handle DoubleDataPtr; class StringData : public PrimitiveData { public: StringData(const DataFactoryPtr&, const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool); StringData(const DataFactoryPtr&, const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool, const std::string&); virtual DataPtr getMember(const std::string&) const; virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); std::string getValue() const; void setValue(const std::string&); private: DataFactoryPtr _factory; Slice::BuiltinPtr _type; std::string _value; IntegerDataPtr _length; }; typedef IceUtil::Handle StringDataPtr; class ProxyData : public Data { public: ProxyData(const Slice::TypePtr&, const Ice::CommunicatorPtr&, const ErrorReporterPtr&, bool); ProxyData(const Slice::TypePtr&, const Ice::CommunicatorPtr&, const ErrorReporterPtr&, bool, const Ice::ObjectPrx&); virtual DataPtr getMember(const std::string&) const; virtual DataPtr getElement(const DataPtr&) const; virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void destroy(); virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); Ice::ObjectPrx getValue() const; void setValue(const std::string&, bool); void setValue(const Ice::ObjectPrx&); private: Slice::TypePtr _type; // Can be Builtin or Proxy Ice::CommunicatorPtr _communicator; Ice::ObjectPrx _value; std::string _str; }; typedef IceUtil::Handle ProxyDataPtr; class StructData : public Data { public: StructData(const DataFactoryPtr&, const Slice::StructPtr&, const ErrorReporterPtr&, bool); virtual DataPtr getMember(const std::string&) const; virtual DataPtr getElement(const DataPtr&) const; virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual void destroy(); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); DataMemberMap& getMembers(); private: StructData(const Slice::StructPtr&, const ErrorReporterPtr&, bool, const DataMemberMap&); Slice::StructPtr _type; DataMemberMap _members; }; typedef IceUtil::Handle StructDataPtr; class SequenceData : public Data { public: SequenceData(const DataFactoryPtr&, const Slice::SequencePtr&, const ErrorReporterPtr&, bool); virtual DataPtr getMember(const std::string&) const; virtual DataPtr getElement(const DataPtr&) const; virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void destroy(); virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); DataList& getElements(); private: SequenceData(const DataFactoryPtr&, const Slice::SequencePtr&, const ErrorReporterPtr&, bool, const DataList&); DataFactoryPtr _factory; Slice::SequencePtr _type; DataList _elements; IntegerDataPtr _length; }; typedef IceUtil::Handle SequenceDataPtr; class EnumData : public Data { public: EnumData(const Slice::EnumPtr&, const ErrorReporterPtr&, bool); EnumData(const Slice::EnumPtr&, const ErrorReporterPtr&, bool, Ice::Int); virtual DataPtr getMember(const std::string&) const; virtual DataPtr getElement(const DataPtr&) const; virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void destroy(); virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); Ice::Int getValue() const; bool setValue(Ice::Int); bool setValueAsString(const std::string&); private: Slice::EnumPtr _type; Ice::Int _value; std::string _name; Ice::Int _count; }; typedef IceUtil::Handle EnumDataPtr; class DictionaryData : public Data { public: DictionaryData(const DataFactoryPtr&, const Slice::DictionaryPtr&, const ErrorReporterPtr&, bool); virtual DataPtr getMember(const std::string&) const; virtual DataPtr getElement(const DataPtr&) const; virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void destroy(); virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); DataMap& getElements(); private: DictionaryData(const DataFactoryPtr&, const Slice::DictionaryPtr&, const ErrorReporterPtr&, bool, const DataMap&); DataFactoryPtr _factory; Slice::DictionaryPtr _type; DataMap _map; IntegerDataPtr _length; }; typedef IceUtil::Handle DictionaryDataPtr; class ObjectData : public Data { public: ObjectData(const DataFactoryPtr&, const Slice::TypePtr&, bool); virtual DataPtr getMember(const std::string&) const; virtual DataPtr getElement(const DataPtr&) const; virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void destroy(); virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); DataMemberMap& getMembers(); void incRef(); void decRef(); private: void destroyI(); Slice::TypePtr _type; // Can be Builtin (Object) or ClassDecl DataPtr _facetMap; DataMemberMap _members; Ice::ObjectPtr _marshaler; Ice::Int _refCount; DataPtr _id; friend class ObjectWriter; friend class ObjectReader; }; class ObjectRef : public Data { public: ObjectRef(const DataFactoryPtr&, const Slice::TypePtr&, bool); ObjectRef(const DataFactoryPtr&, const Slice::TypePtr&, bool, const ObjectDataPtr&); virtual DataPtr getMember(const std::string&) const; virtual DataPtr getElement(const DataPtr&) const; virtual bool operator==(const Data&) const; virtual bool operator!=(const Data&) const; virtual bool operator<(const Data&) const; virtual DataPtr clone() const; virtual Slice::TypePtr getType() const; virtual void destroy(); virtual void marshal(const Ice::OutputStreamPtr&) const; virtual void unmarshal(const Ice::InputStreamPtr&); virtual bool booleanValue(bool = false) const; virtual Ice::Long integerValue(bool = false) const; virtual double doubleValue(bool = false) const; virtual std::string stringValue(bool = false) const; virtual std::string toString() const; virtual void visit(DataVisitor&); void instantiate(); ObjectDataPtr getValue() const; void setValue(const ObjectDataPtr&); private: DataFactoryPtr _factory; Slice::TypePtr _type; // Formal type: can be Builtin (Object) or ClassDecl ObjectDataPtr _value; }; typedef IceUtil::Handle ObjectRefPtr; class ObjectFactory : public Ice::ObjectFactory { public: virtual Ice::ObjectPtr create(const std::string&); virtual void destroy(); void activate(const DataFactoryPtr&, const Slice::UnitPtr&); void deactivate(); private: DataFactoryPtr _factory; Slice::UnitPtr _unit; }; typedef IceUtil::Handle ObjectFactoryPtr; class ClassNotFoundException { public: ClassNotFoundException(const std::string& s) : id(s) {} std::string id; }; class DataVisitor { public: virtual ~DataVisitor(); virtual void visitBoolean(const BooleanDataPtr&); virtual void visitInteger(const IntegerDataPtr&); virtual void visitDouble(const DoubleDataPtr&); virtual void visitString(const StringDataPtr&); virtual void visitProxy(const ProxyDataPtr&); virtual void visitStruct(const StructDataPtr&); virtual void visitSequence(const SequenceDataPtr&); virtual void visitEnum(const EnumDataPtr&); virtual void visitDictionary(const DictionaryDataPtr&); virtual void visitObject(const ObjectRefPtr&); }; } // End of namespace FreezeScript #endif Ice-3.5.1/cpp/src/FreezeScript/Util.h0000644000076400007640000000262212223561476015440 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_UTIL_H #define FREEZE_SCRIPT_UTIL_H #include #include #include namespace FreezeScript { template class Destroyer { public: Destroyer() {} Destroyer(T p) : _p(p) {} ~Destroyer() { if(_p) { _p->destroy(); } } void set(T p) { if(_p) { _p->destroy(); } _p = p; } void release() { _p = 0; } private: T _p; }; std::string typeName(const Slice::TypePtr&); std::string typeToString(const Slice::TypePtr&); bool ignoreType(const std::string&); void createEvictorSliceTypes(const Slice::UnitPtr&); bool parseSlice(const std::string&, const Slice::UnitPtr&, const std::vector&, const std::vector&, bool, const std::string&); typedef std::map CatalogDataMap; CatalogDataMap readCatalog(const Ice::CommunicatorPtr&, const std::string&); } // End of namespace FreezeScript #endif Ice-3.5.1/cpp/src/FreezeScript/Makefile0000644000076400007640000000351312223561477016013 0ustar mesmes# ********************************************************************** # # 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 = ../.. TRANSFORMDB = $(bindir)/transformdb DUMPDB = $(bindir)/dumpdb TARGETS = $(TRANSFORMDB) $(DUMPDB) COMMON_OBJS = ../FreezeScript/Grammar.o \ Scanner.o \ AssignVisitor.o \ Data.o \ Error.o \ Functions.o \ Exception.o \ Parser.o \ Print.o \ Util.o TRANSFORM_OBJS = TransformAnalyzer.o \ TransformVisitor.o \ Transformer.o \ transformdb.o DUMP_OBJS = DumpDescriptors.o \ DumpDB.o SRCS = $(COMMON_OBJS:.o=.cpp) $(TRANSFORM_OBJS:.o=.cpp) $(DUMP_OBJS:.o=.cpp) HDIR = $(headerdir)/FreezeScript ifeq ($(CPP11),yes) RPATH_DIR = @loader_path/../../lib/c++11 else RPATH_DIR = @loader_path/../lib endif include $(top_srcdir)/config/Make.rules CPPFLAGS := -I.. $(CPPFLAGS) $(DB_FLAGS) BISONFLAGS := --name-prefix "freeze_script_" $(BISONFLAGS) $(TRANSFORMDB): $(TRANSFORM_OBJS) $(COMMON_OBJS) rm -f $@ $(CXX) $(LDFLAGS) -o $@ $(TRANSFORM_OBJS) $(COMMON_OBJS) -lSlice $(EXPAT_RPATH_LINK) -lIceXML $(DB_RPATH_LINK) -lFreeze $(LIBS) $(DB_LIBS) $(DUMPDB): $(DUMP_OBJS) $(COMMON_OBJS) rm -f $@ $(CXX) $(LDFLAGS) -o $@ $(DUMP_OBJS) $(COMMON_OBJS) -lSlice $(EXPAT_RPATH_LINK) -lIceXML $(DB_RPATH_LINK) -lFreeze $(LIBS) $(DB_LIBS) install:: all $(call installprogram,$(TRANSFORMDB),$(DESTDIR)$(install_bindir)) $(call installdata,$(top_srcdir)/../man/man1/transformdb.1,$(DESTDIR)$(install_mandir)) $(call installprogram,$(DUMPDB),$(DESTDIR)$(install_bindir)) $(call installdata,$(top_srcdir)/../man/man1/dumpdb.1,$(DESTDIR)$(install_mandir)) include .depend Ice-3.5.1/cpp/src/FreezeScript/Functions.h0000644000076400007640000000146512223561476016477 0ustar mesmes// ********************************************************************** // // 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 FREEZE_SCRIPT_FUNCTIONS_H #define FREEZE_SCRIPT_FUNCTIONS_H #include namespace FreezeScript { bool invokeGlobalFunction(const Ice::CommunicatorPtr&, const std::string&, const DataList&, DataPtr&, const DataFactoryPtr&, const ErrorReporterPtr&); bool invokeMemberFunction(const std::string&, const DataPtr&, const DataList&, DataPtr&, const DataFactoryPtr&, const ErrorReporterPtr&); } #endif Ice-3.5.1/cpp/src/FreezeScript/Error.cpp0000644000076400007640000001024412223561476016146 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; // // ErrorReporter // FreezeScript::ErrorReporter::ErrorReporter(ostream& out, bool suppress) : _out(out), _suppress(suppress) { } ostream& FreezeScript::ErrorReporter::stream() const { return _out; } void FreezeScript::ErrorReporter::warning(const string& msg) { ostringstream ostr; if(!_descName.empty()) { ostr << "warning in <" << _descName << "> descriptor, line " << _descLine << ": " << msg << endl; } else { ostr << "warning: " << msg << endl; } string warn = ostr.str(); if(_suppress) { map::iterator p = _warningHistory.find(warn); if(p != _warningHistory.end()) { return; } _warningHistory.insert(map::value_type(warn, true)); } _out << warn; } void FreezeScript::ErrorReporter::error(const string& msg) { ostringstream ostr; if(!_descName.empty()) { ostr << "error in <" << _descName << "> descriptor, line " << _descLine << ": " << msg << endl; } else { ostr << "error: " << msg << endl; } throw FailureException(__FILE__, __LINE__, ostr.str()); } void FreezeScript::ErrorReporter::typeMismatchError(const Slice::TypePtr& expected, const Slice::TypePtr& received, bool fatal) { ostringstream ostr; ostr << "type mismatch: expected " << typeToString(expected) << " but received " << typeToString(received); if(fatal) { error(ostr.str()); } else { warning(ostr.str()); } } void FreezeScript::ErrorReporter::conversionError(const string& value, const Slice::TypePtr& type, bool fatal) { ostringstream ostr; ostr << "unable to convert `" << value << "' to " << typeToString(type); if(fatal) { error(ostr.str()); } else { warning(ostr.str()); } } void FreezeScript::ErrorReporter::rangeError(const string& value, const Slice::TypePtr& type, bool fatal) { ostringstream ostr; ostr << "value `" << value << "' is out of range for type " << typeToString(type); if(fatal) { error(ostr.str()); } else { warning(ostr.str()); } } void FreezeScript::ErrorReporter::expressionSyntaxError(const string& msg) { assert(!_expression.empty()); ostringstream ostr; ostr << "syntax error in expression `" << _expression << "': " << msg; error(ostr.str()); } void FreezeScript::ErrorReporter::descriptorError(const string& msg, int line) { ostringstream ostr; ostr << "XML error on line " << line << ":" << endl << msg; error(ostr.str()); } void FreezeScript::ErrorReporter::setDescriptor(const string& name, int line) { _descName = name; _descLine = line; } void FreezeScript::ErrorReporter::getDescriptor(string& name, int& line) { name = _descName; line = _descLine; } void FreezeScript::ErrorReporter::clearDescriptor() { _descName.clear(); } void FreezeScript::ErrorReporter::setExpression(const string& expr) { _expression = expr; } void FreezeScript::ErrorReporter::clearExpression() { _expression.clear(); } // // DescriptorErrorContext // FreezeScript::DescriptorErrorContext::DescriptorErrorContext(const ErrorReporterPtr& errorReporter, const string& name, int line) : _errorReporter(errorReporter) { // // Save the existing descriptor information before changing it. // _errorReporter->getDescriptor(_name, _line); _errorReporter->setDescriptor(name, line); } FreezeScript::DescriptorErrorContext::~DescriptorErrorContext() { // // Restore the original descriptor information. // _errorReporter->setDescriptor(_name, _line); } Ice-3.5.1/cpp/src/FreezeScript/Grammar.cpp0000644000076400007640000015343112223561476016451 0ustar mesmes /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse freeze_script_parse #define yylex freeze_script_lex #define yyerror freeze_script_error #define yylval freeze_script_lval #define yychar freeze_script_char #define yydebug freeze_script_debug #define yynerrs freeze_script_nerrs /* Copy the first part of user declarations. */ /* Line 189 of yacc.c */ #line 1 "Grammar.y" // ********************************************************************** // // 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 #ifdef _MSC_VER // I get these warnings from some bison versions: // warning C4102: 'yyoverflowlab' : unreferenced label # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) #endif using namespace std; using namespace FreezeScript; void freeze_script_error(const char* s) { // yacc and recent versions of Bison use "syntax error" instead // of "parse error". if(strcmp(s, "parse error") == 0) { parseErrorReporter->expressionSyntaxError("syntax error"); } else { parseErrorReporter->expressionSyntaxError(s); } } /* Line 189 of yacc.c */ #line 124 "Grammar.tab.c" /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TOK_AND = 258, TOK_OR = 259, TOK_NOT = 260, TOK_ADD = 261, TOK_SUB = 262, TOK_MUL = 263, TOK_DIV = 264, TOK_MOD = 265, TOK_LPAREN = 266, TOK_RPAREN = 267, TOK_LBRACKET = 268, TOK_RBRACKET = 269, TOK_LESS_THAN = 270, TOK_GREATER_THAN = 271, TOK_LESS_EQUAL = 272, TOK_GREATER_EQUAL = 273, TOK_EQUAL = 274, TOK_NEQ = 275, TOK_TRUE = 276, TOK_FALSE = 277, TOK_NIL = 278, TOK_SCOPE_DELIMITER = 279, TOK_IDENTIFIER = 280, TOK_STRING_LITERAL = 281, TOK_INTEGER_LITERAL = 282, TOK_FLOATING_POINT_LITERAL = 283, UNARY_OP = 284 }; #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif /* Copy the second part of user declarations. */ /* Line 264 of yacc.c */ #line 195 "Grammar.tab.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int yyi) #else static int YYID (yyi) int yyi; #endif { return yyi; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 24 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 111 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 32 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 9 /* YYNRULES -- Number of rules. */ #define YYNRULES 39 /* YYNRULES -- Number of states. */ #define YYNSTATES 65 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 284 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 31, 2, 30, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 61, 65, 68, 71, 73, 75, 77, 79, 81, 83, 85, 89, 91, 93, 98, 102, 104, 109, 113, 115, 116, 120 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 33, 0, -1, 34, -1, 35, -1, 35, 15, 35, -1, 35, 16, 35, -1, 35, 17, 35, -1, 35, 18, 35, -1, 35, 19, 35, -1, 35, 20, 35, -1, 35, 4, 35, -1, 35, 3, 35, -1, 35, 8, 35, -1, 35, 9, 35, -1, 35, 10, 35, -1, 35, 6, 35, -1, 35, 7, 35, -1, 36, -1, 11, 34, 12, -1, 7, 36, -1, 5, 36, -1, 27, -1, 28, -1, 26, -1, 21, -1, 22, -1, 23, -1, 37, -1, 37, 30, 38, -1, 38, -1, 40, -1, 37, 13, 34, 14, -1, 37, 30, 25, -1, 25, -1, 25, 11, 39, 12, -1, 39, 31, 34, -1, 34, -1, -1, 40, 24, 25, -1, 24, 25, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 84, 84, 93, 102, 106, 110, 114, 118, 122, 126, 130, 134, 138, 142, 146, 150, 154, 163, 167, 171, 175, 181, 187, 193, 197, 201, 205, 209, 218, 222, 233, 240, 249, 260, 273, 280, 287, 295, 304 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "TOK_AND", "TOK_OR", "TOK_NOT", "TOK_ADD", "TOK_SUB", "TOK_MUL", "TOK_DIV", "TOK_MOD", "TOK_LPAREN", "TOK_RPAREN", "TOK_LBRACKET", "TOK_RBRACKET", "TOK_LESS_THAN", "TOK_GREATER_THAN", "TOK_LESS_EQUAL", "TOK_GREATER_EQUAL", "TOK_EQUAL", "TOK_NEQ", "TOK_TRUE", "TOK_FALSE", "TOK_NIL", "TOK_SCOPE_DELIMITER", "TOK_IDENTIFIER", "TOK_STRING_LITERAL", "TOK_INTEGER_LITERAL", "TOK_FLOATING_POINT_LITERAL", "UNARY_OP", "'.'", "','", "$accept", "start", "expr", "binary", "unary", "entity", "function", "arg_list", "constant", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 46, 44 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 32, 33, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 38, 39, 39, 39, 40, 40 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 4, 3, 1, 4, 3, 1, 0, 3, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 0, 0, 0, 24, 25, 26, 0, 33, 23, 21, 22, 0, 2, 3, 17, 27, 29, 30, 20, 19, 0, 39, 37, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 36, 0, 11, 10, 15, 16, 12, 13, 14, 4, 5, 6, 7, 8, 9, 0, 32, 28, 38, 34, 0, 31, 35 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 12, 13, 14, 15, 16, 17, 43, 18 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -20 static const yytype_int8 yypact[] = { 0, 0, 0, 0, -20, -20, -20, -19, 1, -20, -20, -20, 13, -20, 30, -20, -12, -20, -10, -20, -20, 3, -20, 0, -20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -9, -8, -20, -20, -2, 63, 48, -6, -6, -20, -20, -20, 78, 78, 78, 78, 78, 78, 5, 1, -20, -20, -20, 0, -20, -20 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -20, -20, -3, 74, 7, -20, -7, -20, -20 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_int8 yytable[] = { 21, 38, 29, 30, 31, 1, 22, 2, 19, 20, 61, 3, 23, 24, 40, 41, 58, 60, 39, 63, 42, 4, 5, 6, 7, 8, 9, 10, 11, 62, 0, 0, 59, 25, 26, 57, 27, 28, 29, 30, 31, 0, 0, 0, 0, 32, 33, 34, 35, 36, 37, 25, 0, 0, 27, 28, 29, 30, 31, 64, 0, 0, 0, 32, 33, 34, 35, 36, 37, 27, 28, 29, 30, 31, 0, 0, 0, 0, 32, 33, 34, 35, 36, 37, 27, 28, 29, 30, 31, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 }; static const yytype_int8 yycheck[] = { 3, 13, 8, 9, 10, 5, 25, 7, 1, 2, 12, 11, 11, 0, 24, 12, 25, 25, 30, 14, 23, 21, 22, 23, 24, 25, 26, 27, 28, 31, -1, -1, 39, 3, 4, 38, 6, 7, 8, 9, 10, -1, -1, -1, -1, 15, 16, 17, 18, 19, 20, 3, -1, -1, 6, 7, 8, 9, 10, 62, -1, -1, -1, 15, 16, 17, 18, 19, 20, 6, 7, 8, 9, 10, -1, -1, -1, -1, 15, 16, 17, 18, 19, 20, 6, 7, 8, 9, 10, -1, -1, -1, -1, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 5, 7, 11, 21, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 40, 36, 36, 34, 25, 11, 0, 3, 4, 6, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 13, 30, 24, 12, 34, 39, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 25, 38, 25, 12, 31, 14, 34 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) #else # define YYLEX yylex (&yylval) #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void yy_stack_print (yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /*-------------------------. | yyparse or yypush_parse. | `-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yytoken = 0; yyss = yyssa; yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: /* Line 1455 of yacc.c */ #line 85 "Grammar.y" { parseResult = (yyvsp[(1) - (1)]); ;} break; case 3: /* Line 1455 of yacc.c */ #line 94 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; case 4: /* Line 1455 of yacc.c */ #line 103 "Grammar.y" { (yyval) = new BinaryNode(BinOpLess, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 5: /* Line 1455 of yacc.c */ #line 107 "Grammar.y" { (yyval) = new BinaryNode(BinOpGreater, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 6: /* Line 1455 of yacc.c */ #line 111 "Grammar.y" { (yyval) = new BinaryNode(BinOpLessEq, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 7: /* Line 1455 of yacc.c */ #line 115 "Grammar.y" { (yyval) = new BinaryNode(BinOpGrEq, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 8: /* Line 1455 of yacc.c */ #line 119 "Grammar.y" { (yyval) = new BinaryNode(BinOpEq, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 9: /* Line 1455 of yacc.c */ #line 123 "Grammar.y" { (yyval) = new BinaryNode(BinOpNotEq, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 10: /* Line 1455 of yacc.c */ #line 127 "Grammar.y" { (yyval) = new BinaryNode(BinOpOr, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 11: /* Line 1455 of yacc.c */ #line 131 "Grammar.y" { (yyval) = new BinaryNode(BinOpAnd, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 12: /* Line 1455 of yacc.c */ #line 135 "Grammar.y" { (yyval) = new BinaryNode(BinOpMul, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 13: /* Line 1455 of yacc.c */ #line 139 "Grammar.y" { (yyval) = new BinaryNode(BinOpDiv, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 14: /* Line 1455 of yacc.c */ #line 143 "Grammar.y" { (yyval) = new BinaryNode(BinOpMod, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 15: /* Line 1455 of yacc.c */ #line 147 "Grammar.y" { (yyval) = new BinaryNode(BinOpAdd, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 16: /* Line 1455 of yacc.c */ #line 151 "Grammar.y" { (yyval) = new BinaryNode(BinOpSub, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 17: /* Line 1455 of yacc.c */ #line 155 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; case 18: /* Line 1455 of yacc.c */ #line 164 "Grammar.y" { (yyval) = (yyvsp[(2) - (3)]); ;} break; case 19: /* Line 1455 of yacc.c */ #line 168 "Grammar.y" { (yyval) = new UnaryNode(UnaryOpNeg, parseDataFactory, (yyvsp[(2) - (2)])); ;} break; case 20: /* Line 1455 of yacc.c */ #line 172 "Grammar.y" { (yyval) = new UnaryNode(UnaryOpNot, parseDataFactory, (yyvsp[(2) - (2)])); ;} break; case 21: /* Line 1455 of yacc.c */ #line 176 "Grammar.y" { IntegerTokPtr intVal = IntegerTokPtr::dynamicCast((yyvsp[(1) - (1)])); assert(intVal); (yyval) = new DataNode(parseDataFactory->createInteger(intVal->v, true)); ;} break; case 22: /* Line 1455 of yacc.c */ #line 182 "Grammar.y" { FloatingTokPtr floatVal = FloatingTokPtr::dynamicCast((yyvsp[(1) - (1)])); assert(floatVal); (yyval) = new DataNode(parseDataFactory->createDouble(floatVal->v, true)); ;} break; case 23: /* Line 1455 of yacc.c */ #line 188 "Grammar.y" { StringTokPtr stringVal = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); assert(stringVal); (yyval) = new DataNode(parseDataFactory->createString(stringVal->v, true)); ;} break; case 24: /* Line 1455 of yacc.c */ #line 194 "Grammar.y" { (yyval) = new DataNode(parseDataFactory->createBoolean(true, true)); ;} break; case 25: /* Line 1455 of yacc.c */ #line 198 "Grammar.y" { (yyval) = new DataNode(parseDataFactory->createBoolean(false, true)); ;} break; case 26: /* Line 1455 of yacc.c */ #line 202 "Grammar.y" { (yyval) = new DataNode(parseDataFactory->createNil(true)); ;} break; case 27: /* Line 1455 of yacc.c */ #line 206 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; case 28: /* Line 1455 of yacc.c */ #line 210 "Grammar.y" { EntityNodePtr entity = EntityNodePtr::dynamicCast((yyvsp[(1) - (3)])); assert(entity); FunctionNodePtr func = FunctionNodePtr::dynamicCast((yyvsp[(3) - (3)])); assert(func); func->setTarget(entity); (yyval) = (yyvsp[(3) - (3)]); ;} break; case 29: /* Line 1455 of yacc.c */ #line 219 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; case 30: /* Line 1455 of yacc.c */ #line 223 "Grammar.y" { StringTokPtr stringVal = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); assert(stringVal); (yyval) = new ConstantNode(stringVal->v); ;} break; case 31: /* Line 1455 of yacc.c */ #line 234 "Grammar.y" { EntityNodePtr entity = EntityNodePtr::dynamicCast((yyvsp[(1) - (4)])); assert(entity); entity->append(new ElementNode((yyvsp[(3) - (4)]))); (yyval) = (yyvsp[(1) - (4)]); ;} break; case 32: /* Line 1455 of yacc.c */ #line 241 "Grammar.y" { StringTokPtr stringVal = StringTokPtr::dynamicCast((yyvsp[(3) - (3)])); assert(stringVal); EntityNodePtr entity = EntityNodePtr::dynamicCast((yyvsp[(1) - (3)])); assert(entity); entity->append(new IdentNode(stringVal->v)); (yyval) = (yyvsp[(1) - (3)]); ;} break; case 33: /* Line 1455 of yacc.c */ #line 250 "Grammar.y" { StringTokPtr stringVal = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); assert(stringVal); (yyval) = new IdentNode(stringVal->v); ;} break; case 34: /* Line 1455 of yacc.c */ #line 261 "Grammar.y" { StringTokPtr func = StringTokPtr::dynamicCast((yyvsp[(1) - (4)])); assert(func); NodeListTokPtr args = NodeListTokPtr::dynamicCast((yyvsp[(3) - (4)])); assert(args); (yyval) = new FunctionNode(func->v, args->v); ;} break; case 35: /* Line 1455 of yacc.c */ #line 274 "Grammar.y" { NodeListTokPtr l = NodeListTokPtr::dynamicCast((yyvsp[(1) - (3)])); assert(l); l->v.push_back((yyvsp[(3) - (3)])); (yyval) = (yyvsp[(1) - (3)]); ;} break; case 36: /* Line 1455 of yacc.c */ #line 281 "Grammar.y" { NodeListTokPtr result = new NodeListTok; result->v.push_back((yyvsp[(1) - (1)])); (yyval) = result; ;} break; case 37: /* Line 1455 of yacc.c */ #line 287 "Grammar.y" { (yyval) = new NodeListTok; ;} break; case 38: /* Line 1455 of yacc.c */ #line 296 "Grammar.y" { StringTokPtr stringVal = StringTokPtr::dynamicCast((yyvsp[(1) - (3)])); assert(stringVal); StringTokPtr idVal = StringTokPtr::dynamicCast((yyvsp[(3) - (3)])); assert(idVal); stringVal->v.append("::" + idVal->v); (yyval) = (yyvsp[(1) - (3)]); ;} break; case 39: /* Line 1455 of yacc.c */ #line 305 "Grammar.y" { StringTokPtr idVal = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); assert(idVal); StringTokPtr stringVal = new StringTok; stringVal->v.append("::" + idVal->v); (yyval) = stringVal; ;} break; /* Line 1455 of yacc.c */ #line 1831 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /* Line 1675 of yacc.c */ #line 314 "Grammar.y" Ice-3.5.1/cpp/src/slice2freezej/0000755000076400007640000000000012223561476014477 5ustar mesmesIce-3.5.1/cpp/src/slice2freezej/.depend0000644000076400007640000000125212223561476015737 0ustar mesmesMain$(OBJEXT): Main.cpp $(includedir)/IceUtil/Options.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/Slice/Preprocessor.h $(includedir)/Slice/FileTracker.h $(includedir)/Slice/Parser.h $(includedir)/Slice/JavaUtil.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/Slice/Util.h Ice-3.5.1/cpp/src/slice2freezej/Main.cpp0000644000076400007640000021034012223561476016067 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include using namespace std; using namespace Slice; using namespace IceUtil; using namespace IceUtilInternal; namespace { IceUtil::Mutex* globalMutex = 0; bool interrupted = false; class Init { public: Init() { globalMutex = new IceUtil::Mutex; } ~Init() { delete globalMutex; globalMutex = 0; } }; Init init; } void interruptedCallback(int /*signal*/) { IceUtilInternal::MutexPtrLock lock(globalMutex); interrupted = true; } struct DictIndex { string member; bool caseSensitive; bool operator==(const DictIndex& rhs) const { return member == rhs.member; } bool operator!=(const DictIndex& rhs) const { return member != rhs.member; } }; struct Dict { string name; string key; string value; vector indices; }; struct Index { string name; string type; string member; bool caseSensitive; }; class FreezeGenerator : public JavaGenerator { public: FreezeGenerator(const string&, const string&); virtual ~FreezeGenerator(); void generate(UnitPtr&, const Dict&); void generate(UnitPtr&, const Index&); #ifdef __SUNPRO_CC protected: using JavaGenerator::typeToObjectString; #endif private: string typeToObjectString(const TypePtr&); string varToObject(const TypePtr&, const string&); string objectToVar(const TypePtr&, const string&); const string _prog; }; FreezeGenerator::FreezeGenerator(const string& prog, const string& dir) : JavaGenerator(dir), _prog(prog) { } FreezeGenerator::~FreezeGenerator() { } string FreezeGenerator::typeToObjectString(const TypePtr& type) { static const char* builtinTable[] = { "java.lang.Byte", "java.lang.Boolean", "java.lang.Short", "java.lang.Integer", "java.lang.Long", "java.lang.Float", "java.lang.Double", "java.lang.String", "Ice.Object", "Ice.ObjectPrx", "Ice.LocalObject" }; BuiltinPtr b = BuiltinPtr::dynamicCast(type); if(b) { return builtinTable[b->kind()]; } else { return typeToString(type, TypeModeIn); } } string FreezeGenerator::varToObject(const TypePtr& type, const string& param) { string result = param; BuiltinPtr b = BuiltinPtr::dynamicCast(type); if(b != 0) { switch(b->kind()) { case Builtin::KindByte: { result = string("java.lang.Byte.valueOf(") + param + ")"; break; } case Builtin::KindBool: { result = string("java.lang.Boolean.valueOf(") + param + ")"; break; } case Builtin::KindShort: { result = string("java.lang.Short.valueOf(") + param + ")"; break; } case Builtin::KindInt: { result = string("java.lang.Integer.valueOf(") + param + ")"; break; } case Builtin::KindLong: { result = string("java.lang.Long.valueOf(") + param + ")"; break; } case Builtin::KindFloat: { result = string("java.lang.Float.valueOf(") + param + ")"; break; } case Builtin::KindDouble: { result = string("java.lang.Double.valueOf(") + param + ")"; break; } case Builtin::KindString: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: break; } } return result; } string FreezeGenerator::objectToVar(const TypePtr& type, const string& param) { string result = param; BuiltinPtr b = BuiltinPtr::dynamicCast(type); if(b != 0) { switch(b->kind()) { case Builtin::KindByte: { result = param + ".byteValue()"; break; } case Builtin::KindBool: { result = param + ".booleanValue()"; break; } case Builtin::KindShort: { result = param + ".shortValue()"; break; } case Builtin::KindInt: { result = param + ".intValue()"; break; } case Builtin::KindLong: { result = param + ".longValue()"; break; } case Builtin::KindFloat: { result = param + ".floatValue()"; break; } case Builtin::KindDouble: { result = param + ".doubleValue()"; break; } case Builtin::KindString: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: break; } } return result; } void FreezeGenerator::generate(UnitPtr& u, const Dict& dict) { // // The dictionary name may include a package. // string name; string::size_type pos = dict.name.rfind('.'); if(pos == string::npos) { name = dict.name; } else { name = dict.name.substr(pos + 1); } TypeList keyTypes = u->lookupType(dict.key, false); if(keyTypes.empty()) { ostringstream os; os << "`" << dict.key << "' is not a valid type" << endl; throw os.str(); } TypePtr keyType = keyTypes.front(); TypeList valueTypes = u->lookupType(dict.value, false); if(valueTypes.empty()) { ostringstream os; os << "`" << dict.value << "' is not a valid type" << endl; throw os.str(); } TypePtr valueType = valueTypes.front(); vector indexTypes; vector members; vector capitalizedMembers; vector indexNames; for(size_t i = 0; i < dict.indices.size(); ++i) { const DictIndex& index = dict.indices[i]; const string& member = index.member; if(index.member.empty()) { // // No member was specified, which means we use the map's value type as the index key. // if(dict.indices.size() > 1) { ostringstream os; os << "bad index for dictionary `" << dict.name << "'" << endl; throw os.str(); } bool containsSequence = false; if(!Dictionary::legalKeyType(valueType, containsSequence)) { ostringstream os; os << "`" << dict.value << "' is not a valid index type" << endl; throw os.str(); } if(containsSequence) { getErrorStream() << _prog << ": warning: use of sequences in dictionary keys has been deprecated" << endl; } if(index.caseSensitive == false) { // // Verify that value type is a string. // BuiltinPtr b = BuiltinPtr::dynamicCast(valueType); if(b == 0 || b->kind() != Builtin::KindString) { ostringstream os; os << "VALUE is a `" << dict.value << "', not a string" << endl; throw os.str(); } } indexTypes.push_back(valueType); members.push_back("value"); capitalizedMembers.push_back("Value"); indexNames.push_back("index"); } else { DataMemberPtr dataMember = 0; DataMemberList dataMembers; ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(valueType); if(classDecl != 0) { dataMembers = classDecl->definition()->allDataMembers(); } else { StructPtr structDecl = StructPtr::dynamicCast(valueType); if(structDecl == 0) { ostringstream os; os << "`" << dict.value << "' is neither a class nor a struct" << endl; throw os.str(); } dataMembers = structDecl->dataMembers(); } DataMemberList::const_iterator q = dataMembers.begin(); while(q != dataMembers.end() && dataMember == 0) { if((*q)->name() == index.member) { dataMember = *q; } else { ++q; } } if(dataMember == 0) { ostringstream os; os << "The value of `" << dict.name << "' has no data member named `" << index.member << "'" << endl; throw os.str(); } TypePtr dataMemberType = dataMember->type(); bool containsSequence = false; if(!Dictionary::legalKeyType(dataMemberType, containsSequence)) { ostringstream os; os << "`" << index.member << "' cannot be used as an index key" << endl; throw os.str(); } if(containsSequence) { getErrorStream() << _prog << ": warning: use of sequences in dictionary keys has been deprecated" << endl; } if(index.caseSensitive == false) { // // Verify that member type is a string. // BuiltinPtr b = BuiltinPtr::dynamicCast(dataMemberType); if(b == 0 || b->kind() != Builtin::KindString) { ostringstream os; os << "`" << index.member << "' is not a string" << endl; throw os.str(); } } indexTypes.push_back(dataMemberType); members.push_back(member); string capitalizedMember = member; capitalizedMember[0] = toupper(static_cast(capitalizedMember[0])); capitalizedMembers.push_back(capitalizedMember); indexNames.push_back(member); } } open(dict.name, u->currentFile()); Output& out = output(); string keyTypeS = typeToObjectString(keyType); string valueTypeS = typeToObjectString(valueType); out << sp << nl << "public class " << name << " extends Freeze.MapInternal.MapI<" << keyTypeS << ", " << valueTypeS << ">"; out << sb; if(dict.indices.size() > 0) { out << sp; out << nl << "/**" << nl << " * Supplies a comparator for each index key." << nl << " */"; out << nl << "public static class IndexComparators"; out << sb; out << sp; out << nl << "/**" << nl << " * Default constructor assigns null to the comparator for each index key." << nl << " */"; out << nl << "public" << nl << "IndexComparators()"; out << sb; out << eb; out << sp; out << nl << "/**" << nl << " * This constructor accepts a comparator for each index key."; for(size_t i = 0; i < dict.indices.size(); ++i) { out << nl << " * @param " << members[i] << "Comparator Comparator for " << members[i] << "."; } out << nl << " */"; out << nl << "public" << nl << "IndexComparators("; for(size_t i = 0; i < dict.indices.size(); ++i) { if(i > 0) { out << ", "; } out << "java.util.Comparator<" << typeToObjectString(indexTypes[i]) << "> " << members[i] << "Comparator"; } out << ")"; out << sb; for(size_t i = 0; i < dict.indices.size(); ++i) { out << nl << "this." << members[i] << "Comparator = " << members[i] << "Comparator;"; } out << eb; out << sp; for(size_t i = 0; i < dict.indices.size(); ++i) { out << nl << "/** Comparator for " << members[i] << ". */"; out << nl << "public java.util.Comparator<" << typeToObjectString(indexTypes[i]) << "> " << members[i] << "Comparator;"; } out << eb; } // // Constructors // out << sp << nl << "private" << nl << name << "(Freeze.Connection __connection, String __dbName, java.util.Comparator<" << keyTypeS << "> __comparator"; if(dict.indices.size() > 0) { out << ", IndexComparators __indexComparators"; } out << ")"; out << sb; out << nl << "super(__connection, __dbName, __comparator);"; if(dict.indices.size() > 0) { out << nl << "_indices = new Freeze.MapIndex[" << dict.indices.size() << "];"; for(size_t i = 0; i < dict.indices.size(); ++i) { out << nl << "_" << members[i] << "Index = new " << capitalizedMembers[i] << "Index(\"" << indexNames[i] << "\", __indexComparators == null ? null : __indexComparators." << members[i] << "Comparator);"; out << nl << "_indices[" << i << "] = _" << members[i] << "Index;"; } } out << eb; if(dict.indices.size() > 0) { out << sp; out << nl << "/**" << nl << " * Instantiates a Freeze map using the given connection. If the database" << nl << " * named in __dbName does not exist and __createDb" << nl << " * is true, the database is created automatically, otherwise this constructor" << nl << " * raises DatabaseException." << nl << " * @param __connection The Freeze connection associated with this map." << nl << " * @param __dbName The name of the Berkeley DB database." << nl << " * @param __createDb True if the database should be created if it does not" << nl << " * already exist, false otherwise." << nl << " * @param __comparator A comparator for the map's main key, or null to use the" << nl << " * default key comparison strategy." << nl << " * @param __indexComparators A map of string to comparator, representing the" << nl << " * key comparator for each of the map's indices. The map uses the default" << nl << " * key comparison strategy for an index if __indexComparators" << nl << " * is null, or if no entry can be found in the comparators map for an index." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */" << nl << "public" << nl << name << "(Freeze.Connection __connection, String __dbName, boolean __createDb, " << "java.util.Comparator<" << keyTypeS << "> __comparator, " << "IndexComparators __indexComparators)"; out << sb; out << nl << "this(__connection, __dbName, __comparator, __indexComparators);"; out << nl << "init(_indices, __dbName, \"" << keyType->typeId() << "\", \"" << valueType->typeId() << "\", __createDb);"; out << eb; } out << sp; out << nl << "/**" << nl << " * Instantiates a Freeze map using the given connection. If the database" << nl << " * named in __dbName does not exist and __createDb" << nl << " * is true, the database is created automatically, otherwise this constructor" << nl << " * raises DatabaseException." << nl << " * @param __connection The Freeze connection associated with this map." << nl << " * @param __dbName The name of the Berkeley DB database." << nl << " * @param __createDb True if the database should be created if it does not" << nl << " * already exist, false otherwise." << nl << " * @param __comparator A comparator for the map's main key, or null to use the" << nl << " * default key comparison strategy." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public" << nl << name << "(Freeze.Connection __connection, String __dbName, boolean __createDb, " << "java.util.Comparator<" << keyTypeS << "> __comparator)"; out << sb; if(dict.indices.size() > 0) { out << nl << "this(__connection, __dbName, __createDb, __comparator, null);"; } else { out << nl << "super(__connection, __dbName, \"" << keyType->typeId() << "\", \"" << valueType->typeId() << "\", __createDb, __comparator);"; } out << eb; out << sp; out << nl << "/**" << nl << " * Instantiates a Freeze map using the given connection. If the database" << nl << " * named in __dbName does not exist and __createDb" << nl << " * is true, the database is created automatically, otherwise this constructor" << nl << " * raises DatabaseException. The map uses the default key" << nl << " * comparison strategy." << nl << " * @param __connection The Freeze connection associated with this map." << nl << " * @param __dbName The name of the Berkeley DB database." << nl << " * @param __createDb True if the database should be created if it does not" << nl << " * already exist, false otherwise." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public" << nl << name << "(Freeze.Connection __connection, String __dbName, boolean __createDb)"; out << sb; out << nl << "this(__connection, __dbName, __createDb, null);"; out << eb; out << sp; out << nl << "/**" << nl << " * Instantiates a Freeze map using the given connection. If the database" << nl << " * named in __dbName does not exist, it is created automatically." << nl << " * The map uses the default key comparison strategy." << nl << " * @param __connection The Freeze connection associated with this map." << nl << " * @param __dbName The name of the Berkeley DB database." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public" << nl << name << "(Freeze.Connection __connection, String __dbName)"; out << sb; out << nl << "this(__connection, __dbName, true);"; out << eb; // // recreate // if(dict.indices.size() > 0) { out << sp; out << nl << "/**" << nl << " * Copies an existing database. The new database has the name given in" << nl << " * __dbName, and the old database is renamed with a UUID" << nl << " * suffix." << nl << " * @param __connection The Freeze connection associated with this map." << nl << " * @param __dbName The name of the Berkeley DB database." << nl << " * @param __comparator A comparator for the map's main key, or null to use the" << nl << " * default key comparison strategy." << nl << " * @param __indexComparators A map of string to comparator, representing the" << nl << " * key comparator for each of the map's indices. The map uses the default" << nl << " * key comparison strategy for an index if __indexComparators" << nl << " * is null, or if no entry can be found in the comparators map for an index." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public static void" << nl << "recreate(Freeze.Connection __connection, String __dbName, " << "java.util.Comparator<" << keyTypeS << "> __comparator, " << "IndexComparators __indexComparators)"; out << sb; out << nl << name << " __tmpMap = new " << name << "(__connection, __dbName, __comparator, __indexComparators);"; out << nl << "recreate(__tmpMap, __dbName, \"" << keyType->typeId() << "\", \"" << valueType->typeId() << "\", __tmpMap._indices);"; out << eb; } out << sp; out << nl << "/**" << nl << " * Copies an existing database. The new database has the name given in" << nl << " * __dbName, and the old database is renamed with a UUID" << nl << " * suffix." << nl << " * @param __connection The Freeze connection associated with this map." << nl << " * @param __dbName The name of the Berkeley DB database." << nl << " * @param __comparator A comparator for the map's main key, or null to use the" << nl << " * default key comparison strategy." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public static void" << nl << "recreate(Freeze.Connection __connection, String __dbName, " << "java.util.Comparator<" << keyTypeS << "> __comparator)"; out << sb; if(dict.indices.size() > 0) { out << nl << "recreate(__connection, __dbName, __comparator, null);"; } else { out << nl << name << " __tmpMap = new " << name << "(__connection, __dbName, __comparator);"; out << nl << "recreate(__tmpMap, __dbName, \"" << keyType->typeId() << "\", \"" << valueType->typeId() << "\", null);"; } out << eb; // // Index methods // for(size_t i = 0; i < capitalizedMembers.size(); ++i) { string indexClassName = capitalizedMembers[i] + "Index"; string indexTypeS = typeToString(indexTypes[i], TypeModeIn); string indexObjTypeS = typeToObjectString(indexTypes[i]); string indexObj = varToObject(indexTypes[i], "__key"); out << sp; out << nl << "/**" << nl << " * Obtains an iterator ordered using the index value." << nl << " * The iterator's initial position is an element whose key matches __key; if" << nl << " * no such element exists, the returned iterator is empty (hasNext returns" << nl << " * false). If __onlyDups is true, the iterator only returns elements whose" << nl << " * key exactly matches __key; otherwise, the iterator continues to iterate over" << nl << " * the remaining elements in the map." << nl << " * @param __key The value at which the iterator begins." << nl << " * @param __onlyDups True if the iterator should be limited to elements whose key" << nl << " * exactly matches __key, false otherwise." << nl << " * @return A new iterator." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public Freeze.Map.EntryIterator>"; out << nl << "findBy" << capitalizedMembers[i] << "(" << indexTypeS << " __key, boolean __onlyDups)"; out << sb; out << nl << "return _" << members[i] << "Index.find(" << indexObj << ", __onlyDups);"; out << eb; out << sp; out << nl << "/**" << nl << " * Obtains an iterator ordered using the values of member " << members[i] << "." << nl << " * The iterator's initial position is an element whose key matches __key; if" << nl << " * no such element exists, the returned iterator is empty (hasNext returns" << nl << " * false). This iterator only returns elements whose key exactly matches __key." << nl << " * @param __key The value at which the iterator begins." << nl << " * @return A new iterator." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public Freeze.Map.EntryIterator>"; out << nl << "findBy" << capitalizedMembers[i] << "(" << indexTypeS << " __key)"; out << sb; out << nl << "return _" << members[i] << "Index.find(" << indexObj << ", true);"; out << eb; out << sp; out << nl << "/**" << nl << " * Determines the number of elements whose index values match __key." << nl << " * @return The number of matching elements." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; string countMethod = dict.indices[i].member.empty() ? string("valueCount") : dict.indices[i].member + "Count"; out << nl << "public int"; out << nl << countMethod << "(" << indexTypeS << " __key)"; out << sb; out << nl << "return _" << members[i] << "Index.count(" << indexObj << ");"; out << eb; string subMap = "Freeze.NavigableMap<" + indexObjTypeS + ", java.util.Set>>"; out << sp; out << nl << "/**" << nl << " * Returns a view of the portion of this map whose keys are strictly less than" << nl << " * __toKey, or less than or equal to __toKey if" << nl << " * __inclusive is true. Insertions and removals via this map are" << nl << " * not supported." << nl << " * @param __toKey High endpoint of the keys in the returned map." << nl << " * @param __inclusive If true, the endpoint is included in the returned map;" << nl << " * otherwise, the endpoint is excluded." << nl << " * @return A view of the portion of this map whose keys are strictly less than" << nl << " * __toKey, or less than or equal to __toKey if" << nl << " * __inclusive is true." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public " + subMap; out << nl << "headMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __toKey, boolean __inclusive)"; out << sb; out << nl << "return _" << members[i] << "Index.createHeadMap(" << varToObject(indexTypes[i], "__toKey") << ", __inclusive);"; out << eb; out << sp; out << nl << "/**" << nl << " * Returns a view of the portion of this map whose keys are strictly less than" << nl << " * __toKey. Insertions and removals via this map are not supported." << nl << " * @param __toKey High endpoint of the keys in the returned map." << nl << " * @return A view of the portion of this map whose keys are strictly less than" << nl << " * __toKey>" << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public " + subMap; out << nl << "headMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __toKey)"; out << sb; out << nl << "return headMapFor" << capitalizedMembers[i] << "(__toKey, false);"; out << eb; out << sp; out << nl << "/**" << nl << " * Returns a view of the portion of this map whose keys are strictly greater than" << nl << " * __fromKey, or greater than or equal to __fromKey if" << nl << " * __inclusive is true. Insertions and removals via this map are" << nl << " * not supported." << nl << " * @param __fromKey Low endpoint of the keys in the returned map." << nl << " * @param __inclusive If true, the endpoint is included in the returned map;" << nl << " * otherwise, the endpoint is excluded." << nl << " * @return A view of the portion of this map whose keys are strictly greater than" << nl << " * __fromKey, or greater than or equal to __fromKey if" << nl << " * __inclusive is true." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public " + subMap; out << nl << "tailMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __fromKey, boolean __inclusive)"; out << sb; out << nl << "return _" << members[i] << "Index.createTailMap(" << varToObject(indexTypes[i], "__fromKey") << ", __inclusive);"; out << eb; out << sp; out << nl << "/**" << nl << " * Returns a view of the portion of this map whose keys are greater than or equal" << nl << " * to __fromKey. Insertions and removals via this map are not supported." << nl << " * @param __fromKey Low endpoint of the keys in the returned map." << nl << " * @return A view of the portion of this map whose keys are greater than or equal" << nl << " * to __fromKey." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public " + subMap; out << nl << "tailMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __fromKey)"; out << sb; out << nl << "return tailMapFor" << capitalizedMembers[i] << "(__fromKey, true);"; out << eb; out << sp; out << nl << "/**" << nl << " * Returns a view of the portion of this map whose keys range from" << nl << " * __fromKey to __toKey. If __fromKey" << nl << " * and __toKey are equal, the returned map is empty unless" << nl << " * __fromInclusive and __toInclusive are both true." << nl << " * Insertions and removals via this map are not supported." << nl << " * @param __fromKey Low endpoint of the keys in the returned map." << nl << " * @param __fromInclusive If true, the low endpoint is included in the returned map;" << nl << " * otherwise, the endpoint is excluded." << nl << " * @param __toKey High endpoint of the keys in the returned map." << nl << " * @param __toInclusive If true, the high endpoint is included in the returned map;" << nl << " * otherwise, the endpoint is excluded." << nl << " * @return A view of the portion of this map whose keys range from" << nl << " * __fromKey to __toKey." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public " + subMap; out << nl << "subMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __fromKey, boolean __fromInclusive, " << indexTypeS << " __toKey, boolean __toInclusive)"; out << sb; out << nl << "return _" << members[i] << "Index.createSubMap(" << varToObject(indexTypes[i], "__fromKey") << ", __fromInclusive, " << varToObject(indexTypes[i], "__toKey") << ", __toInclusive);"; out << eb; out << sp; out << nl << "/**" << nl << " * Returns a view of the portion of this map whose keys are greater than" << nl << " * or equal to __fromKey and strictly less than __toKey." << nl << " * Insertions and removals via this map are not supported." << nl << " * @param __fromKey Low endpoint of the keys in the returned map." << nl << " * @param __toKey High endpoint of the keys in the returned map." << nl << " * @return A view of the portion of this map whose keys range from" << nl << " * __fromKey to __toKey." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public " + subMap; out << nl << "subMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __fromKey, " << indexTypeS << " __toKey)"; out << sb; out << nl << "return subMapFor" << capitalizedMembers[i] << "(__fromKey, true, __toKey, false);"; out << eb; out << sp; out << nl << "/**" << nl << " * Returns a view of this map whose keys are ordered by the index value." << nl << " * Insertions and removals via this map are not supported." << nl << " * @return A view of this map whose keys range are ordered by the index value." << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." << nl << " */"; out << nl << "public " + subMap; out << nl << "mapFor" << capitalizedMembers[i] << "()"; out << sb; out << nl << "return _" << members[i] << "Index.createMap();"; out << eb; } // // Top-level encode/decode // for(size_t i = 0; i < 2; i++) { string keyValue; TypePtr type; bool encaps; string typeS; if(i == 0) { keyValue = "Key"; type = keyType; typeS = keyTypeS; encaps = false; // Do not encapsulate keys. } else { keyValue = "Value"; type = valueType; typeS = valueTypeS; encaps = true; } string valS = objectToVar(type, "v"); int iter; // // encode // out << sp << nl << "public byte[]" << nl << "encode" << keyValue << "(" << typeS << " v, Ice.Communicator communicator, Ice.EncodingVersion encoding)"; out << sb; out << nl << "IceInternal.BasicStream __os = " << "new IceInternal.BasicStream(IceInternal.Util.getInstance(communicator), encoding, true, false);"; if(encaps) { out << nl << "__os.startWriteEncaps();"; } iter = 0; writeMarshalUnmarshalCode(out, "", type, OptionalNone, false, 0, valS, true, iter, false); if(type->usesClasses()) { out << nl << "__os.writePendingObjects();"; } if(encaps) { out << nl << "__os.endWriteEncaps();"; } out << nl << "IceInternal.Buffer __buf = __os.prepareWrite();"; out << nl << "byte[] __r = new byte[__buf.size()];"; out << nl << "__buf.b.get(__r);"; out << nl << "return __r;"; out << eb; // // decode // out << sp << nl << "public " << typeS << nl << "decode" << keyValue << "(byte[] b, Ice.Communicator communicator, Ice.EncodingVersion encoding)"; out << sb; out << nl << "IceInternal.BasicStream __is = " << "new IceInternal.BasicStream(IceInternal.Util.getInstance(communicator), encoding, b);"; if(type->usesClasses()) { out << nl << "__is.sliceObjects(false);"; } if(encaps) { out << nl << "__is.startReadEncaps();"; } iter = 0; list metaData; string patchParams; BuiltinPtr b = BuiltinPtr::dynamicCast(type); if((b && b->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(type)) { out << nl << "Patcher __p = new Patcher();"; patchParams = "__p"; } else { out << nl << typeS << " __r;"; } if(b) { switch(b->kind()) { case Builtin::KindByte: { out << nl << "__r = java.lang.Byte.valueOf(__is.readByte());"; break; } case Builtin::KindBool: { out << nl << "__r = java.lang.Boolean.valueOf(__is.readBool());"; break; } case Builtin::KindShort: { out << nl << "__r = java.lang.Short.valueOf(__is.readShort());"; break; } case Builtin::KindInt: { out << nl << "__r = java.lang.Integer.valueOf(__is.readInt());"; break; } case Builtin::KindLong: { out << nl << "__r = java.lang.Long.valueOf(__is.readLong());"; break; } case Builtin::KindFloat: { out << nl << "__r = java.lang.Float.valueOf(__is.readFloat());"; break; } case Builtin::KindDouble: { out << nl << "__r = java.lang.Double.valueOf(__is.readDouble());"; break; } case Builtin::KindString: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { writeMarshalUnmarshalCode(out, "", type, OptionalNone, false, 0, "__r", false, iter, false, metaData, patchParams); break; } } } else { writeMarshalUnmarshalCode(out, "", type, OptionalNone, false, 0, "__r", false, iter, false, metaData, patchParams); } if(type->usesClasses()) { out << nl << "__is.readPendingObjects();"; } if(encaps) { out << nl << "__is.endReadEncaps();"; } if((b && b->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(type)) { out << nl << "return __p.value;"; } else { out << nl << "return __r;"; } out << eb; } // // Inner index classes // for(size_t i = 0; i < capitalizedMembers.size(); ++i) { string indexClassName = capitalizedMembers[i] + "Index"; string indexKeyTypeS = typeToObjectString(indexTypes[i]); out << sp << nl << "private class " << indexClassName << " extends Freeze.MapInternal.Index<" << keyTypeS << ", " << valueTypeS << ", " << indexKeyTypeS << ">"; out << sb; // // encodeKey // out << sp << nl << "public byte[]"; out << nl << "encodeKey(" << indexKeyTypeS << " key, Ice.Communicator communicator, " << "Ice.EncodingVersion encoding)"; out << sb; if(dict.indices[i].member.empty()) { // // Encode the full value (with an encaps!) // string keyS = "key"; if(!dict.indices[i].caseSensitive) { keyS = "key.toLowerCase()"; } out << nl << "return encodeValue(" << keyS << ", communicator, encoding);"; } else { // // No encaps // string keyS = dict.indices[i].caseSensitive ? "key" : "key.toLowerCase()"; keyS = objectToVar(indexTypes[i], keyS); out << nl << "IceInternal.BasicStream __os = " << "new IceInternal.BasicStream(IceInternal.Util.getInstance(communicator), encoding, true, false);"; int iter = 0; writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, false, 0, keyS, true, iter, false); assert(!indexTypes[i]->usesClasses()); out << nl << "IceInternal.Buffer buf = __os.prepareWrite();"; out << nl << "byte[] r = new byte[buf.size()];"; out << nl << "buf.b.get(r);"; out << nl << "return r;"; } out << eb; // // decodeKey // out << sp << nl << "public " << indexKeyTypeS; out << nl << "decodeKey(byte[] bytes, Ice.Communicator communicator, Ice.EncodingVersion encoding)"; out << sb; if(dict.indices[i].member.empty()) { // // Decode the full value (with an encaps!) // out << nl << "return decodeValue(bytes, communicator, encoding);"; } else { out << nl << "IceInternal.BasicStream __is = " << "new IceInternal.BasicStream(IceInternal.Util.getInstance(communicator), encoding, bytes);"; int iter = 0; list metaData; string patchParams; out << nl << indexKeyTypeS << " r;"; BuiltinPtr b = BuiltinPtr::dynamicCast(indexTypes[i]); if(b != 0) { switch(b->kind()) { case Builtin::KindByte: { out << nl << "r = java.lang.Byte.valueOf(__is.readByte());"; break; } case Builtin::KindBool: { out << nl << "r = java.lang.Boolean.valueOf(__is.readBool());"; break; } case Builtin::KindShort: { out << nl << "r = java.lang.Short.valueOf(__is.readShort());"; break; } case Builtin::KindInt: { out << nl << "r = java.lang.Integer.valueOf(__is.readInt());"; break; } case Builtin::KindLong: { out << nl << "r = java.lang.Long.valueOf(__is.readLong());"; break; } case Builtin::KindFloat: { out << nl << "r = java.lang.Float.valueOf(__is.readFloat());"; break; } case Builtin::KindDouble: { out << nl << "r = java.lang.Double.valueOf(__is.readDouble());"; break; } case Builtin::KindString: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, false, 0, "r", false, iter, false, metaData, patchParams); break; } } } else { writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, false, 0, "r", false, iter, false, metaData, patchParams); } out << nl << "return r;"; } out << eb; // // extractKey // out << sp << nl << "protected " << indexKeyTypeS; out << nl << "extractKey(" << valueTypeS << " value)"; out << sb; if(dict.indices[i].member.empty()) { if(dict.indices[i].caseSensitive) { out << nl << "return value;"; } else { out << nl << "return value.toLowerCase();"; } } else { string member = "value." + dict.indices[i].member; if(!dict.indices[i].caseSensitive) { member += ".toLowerCase()"; } out << nl << "return " << varToObject(indexTypes[i], member) << ";"; } out << eb; // // marshalKey optimization // if(dict.indices[i].member.empty() && dict.indices[i].caseSensitive) { out << sp << nl << "protected byte[]"; out << nl << "marshalKey(byte[] value)"; out << sb; out << nl << "return value;"; out << eb; } // // Constructor // out << sp << nl << "private" << nl << indexClassName << "(String name, java.util.Comparator<" << indexKeyTypeS << "> comparator)"; out << sb; out << nl << "super(" << name << ".this, name, comparator);"; out << eb; out << eb; } // // Patcher class. // BuiltinPtr b = BuiltinPtr::dynamicCast(valueType); if((b && b->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(valueType)) { string typeS = typeToString(valueType, TypeModeIn); out << sp << nl << "private static class Patcher implements IceInternal.Patcher"; out << sb; out << sp << nl << "public void" << nl << "patch(Ice.Object v)"; out << sb; if(b) { out << nl << "value = v;"; } else { out << nl << "value = (" << typeS << ")v;"; } out << eb; out << sp << nl << "public String" << nl << "type()"; out << sb; if(b) { out << nl << "return \"::Ice::Object\";"; } else { ClassDeclPtr decl = ClassDeclPtr::dynamicCast(valueType); out << nl << "return \"" << decl->scoped() << "\";"; } out << eb; out << sp << nl << typeS << " value;"; out << eb; } // // Fields // if(!dict.indices.empty()) { out << sp << nl << "private Freeze.MapIndex[] _indices;"; } for(size_t i = 0; i < dict.indices.size(); ++i) { out << nl << "private " << capitalizedMembers[i] << "Index _" << members[i] << "Index;"; } out << eb; close(); } void FreezeGenerator::generate(UnitPtr& u, const Index& index) { string name; string::size_type pos = index.name.rfind('.'); if(pos == string::npos) { name = index.name; } else { name = index.name.substr(pos + 1); } TypeList types = u->lookupType(index.type, false); if(types.empty()) { ostringstream os; os << "`" << index.type << "' is not a valid type" << endl; throw os.str(); } TypePtr type = types.front(); ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type); if(classDecl == 0) { ostringstream os; os << "`" << index.type << "' is not a class" << endl; throw os.str(); } DataMemberList dataMembers = classDecl->definition()->allDataMembers(); DataMemberPtr dataMember = 0; DataMemberList::const_iterator p = dataMembers.begin(); while(p != dataMembers.end() && dataMember == 0) { if((*p)->name() == index.member) { dataMember = *p; } else { ++p; } } if(dataMember == 0) { ostringstream os; os << "`" << index.type << "' has no data member named `" << index.member << "'" << endl; throw os.str(); } if(index.caseSensitive == false) { // // Let's check member is a string // BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMember->type()); if(memberType == 0 || memberType->kind() != Builtin::KindString) { ostringstream os; os << "`" << index.member << "'is not a string " << endl; throw os.str(); } } string memberTypeString = typeToString(dataMember->type(), TypeModeIn); open(index.name, u->currentFile()); Output& out = output(); out << sp << nl << "public class " << name << " extends Freeze.Index"; out << sb; // // Constructors // out << sp << nl << "public" << nl << name << "(String __indexName, String __facet)"; out << sb; out << nl << "super(__indexName, __facet);"; out << eb; out << sp << nl << "public" << nl << name << "(String __indexName)"; out << sb; out << nl << "super(__indexName, \"\");"; out << eb; // // find and count // out << sp << nl << "public Ice.Identity[]" << nl << "findFirst(" << memberTypeString << " __index, int __firstN)"; out << sb; out << nl << "return untypedFindFirst(marshalKey(__index), __firstN);"; out << eb; out << sp << nl << "public Ice.Identity[]" << nl << "find(" << memberTypeString << " __index)"; out << sb; out << nl << "return untypedFind(marshalKey(__index));"; out << eb; out << sp << nl << "public int" << nl << "count(" << memberTypeString << " __index)"; out << sb; out << nl << "return untypedCount(marshalKey(__index));"; out << eb; // // Key marshalling // string typeString = typeToString(type, TypeModeIn); out << sp << nl << "protected byte[]" << nl << "marshalKey(Ice.Object __servant)"; out << sb; out << nl << "if(__servant instanceof " << typeString << ")"; out << sb; out << nl << memberTypeString << " __key = ((" << typeString << ")__servant)." << index.member << ";"; out << nl << "return marshalKey(__key);"; out << eb; out << nl << "else"; out << sb; out << nl << "return null;"; out << eb; out << eb; string valueS = index.caseSensitive ? "__key" : "__key.toLowerCase()"; out << sp << nl << "private byte[]" << nl << "marshalKey(" << memberTypeString << " __key)"; out << sb; out << nl << "IceInternal.BasicStream __os = " << "new IceInternal.BasicStream(IceInternal.Util.getInstance(communicator()), encoding(), true, false);"; int iter = 0; writeMarshalUnmarshalCode(out, "", dataMember->type(), OptionalNone, false, 0, valueS, true, iter, false); if(dataMember->type()->usesClasses()) { out << nl << "__os.writePendingObjects();"; } out << nl << "IceInternal.Buffer __buf = __os.prepareWrite();"; out << nl << "byte[] __r = new byte[__buf.size()];"; out << nl << "__buf.b.get(__r);"; out << nl << "return __r;"; out << eb; out << eb; close(); } void usage(const char* n) { getErrorStream() << "Usage: " << n << " [options] [slice-files...]\n"; getErrorStream() << "Options:\n" "-h, --help Show this message.\n" "-v, --version Display the Ice version.\n" "-DNAME Define NAME as 1.\n" "-DNAME=DEF Define NAME as DEF.\n" "-UNAME Remove any definition for NAME.\n" "-IDIR Put DIR in the include file search path.\n" "-E Print preprocessor output on stdout.\n" "--include-dir DIR Use DIR as the header include directory.\n" "--dict NAME,KEY,VALUE Create a Freeze dictionary with the name NAME,\n" " using KEY as key, and VALUE as value. This\n" " option may be specified multiple times for\n" " different names. NAME may be a scoped name.\n" "--index NAME,TYPE,MEMBER[,{case-sensitive|case-insensitive}]\n" " Create a Freeze evictor index with the name\n" " NAME for member MEMBER of class TYPE. This\n" " option may be specified multiple times for\n" " different names. NAME may be a scoped name.\n" " When member is a string, the case can be\n" " sensitive or insensitive (default is sensitive).\n" "--dict-index DICT[,MEMBER][,{case-sensitive|case-insensitive}] \n" " Add an index to dictionary DICT. If MEMBER is \n" " specified, then DICT's VALUE must be a class or\n" " a struct, and MEMBER must designate a member of\n" " VALUE. Otherwise, the entire VALUE is used for \n" " indexing. When the secondary key is a string, \n" " the case can be sensitive or insensitive (default\n" " is sensitive).\n" "--output-dir DIR Create files in the directory DIR.\n" "--depend Generate Makefile dependencies.\n" "--depend-xml Generate dependencies in XML format.\n" "-d, --debug Print debug messages.\n" "--ice Permit `Ice' prefix (for building Ice source code only).\n" "--underscore Permit underscores in Slice identifiers.\n" "--meta META Define global metadata directive META.\n" ; } int compile(int argc, char* argv[]) { IceUtilInternal::Options opts; opts.addOpt("h", "help"); opts.addOpt("v", "version"); opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("I", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("E"); opts.addOpt("", "include-dir", IceUtilInternal::Options::NeedArg); opts.addOpt("", "dict", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("", "index", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("", "dict-index", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("", "output-dir", IceUtilInternal::Options::NeedArg); opts.addOpt("", "depend"); opts.addOpt("", "depend-xml"); opts.addOpt("d", "debug"); opts.addOpt("", "ice"); opts.addOpt("", "underscore"); opts.addOpt("", "meta", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); vector args; try { args = opts.parse(argc, (const char**)argv); } catch(const IceUtilInternal::BadOptException& e) { getErrorStream() << argv[0] << ": error: " << e.reason << endl; usage(argv[0]); return EXIT_FAILURE; } if(opts.isSet("help")) { usage(argv[0]); return EXIT_SUCCESS; } if(opts.isSet("version")) { getErrorStream() << ICE_STRING_VERSION << endl; return EXIT_SUCCESS; } vector cppArgs; vector optargs = opts.argVec("D"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { cppArgs.push_back("-D" + *i); } optargs = opts.argVec("U"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { cppArgs.push_back("-U" + *i); } vector includePaths = opts.argVec("I"); for(vector::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i) { cppArgs.push_back("-I" + Preprocessor::normalizeIncludePath(*i)); } bool preprocess = opts.isSet("E"); string include = opts.optArg("include-dir"); vector dicts; optargs = opts.argVec("dict"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { string s = IceUtilInternal::removeWhitespace(*i); Dict dict; string::size_type pos; pos = s.find(','); if(pos != string::npos) { dict.name = s.substr(0, pos); s.erase(0, pos + 1); } pos = s.find(','); if(pos != string::npos) { dict.key = s.substr(0, pos); s.erase(0, pos + 1); } dict.value = s; if(dict.name.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl; usage(argv[0]); return EXIT_FAILURE; } if(dict.key.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no key specified" << endl; usage(argv[0]); return EXIT_FAILURE; } if(dict.value.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no value specified" << endl; usage(argv[0]); return EXIT_FAILURE; } dicts.push_back(dict); } vector indices; optargs = opts.argVec("index"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { string s = IceUtilInternal::removeWhitespace(*i); Index index; string::size_type pos; pos = s.find(','); if(pos != string::npos) { index.name = s.substr(0, pos); s.erase(0, pos + 1); } pos = s.find(','); if(pos != string::npos) { index.type = s.substr(0, pos); s.erase(0, pos + 1); } pos = s.find(','); string caseString; if(pos != string::npos) { index.member = s.substr(0, pos); s.erase(0, pos + 1); caseString = s; } else { index.member = s; caseString = "case-sensitive"; } if(index.name.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl; usage(argv[0]); return EXIT_FAILURE; } if(index.type.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no type specified" << endl; usage(argv[0]); return EXIT_FAILURE; } if(index.member.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no member specified" << endl; usage(argv[0]); return EXIT_FAILURE; } if(caseString != "case-sensitive" && caseString != "case-insensitive") { getErrorStream() << argv[0] << ": error: " << *i << ": the case can be `case-sensitive' or " << "`case-insensitive'" << endl; usage(argv[0]); return EXIT_FAILURE; } index.caseSensitive = (caseString == "case-sensitive"); indices.push_back(index); } if(opts.isSet("dict-index")) { vector optargs = opts.argVec("dict-index"); for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { string s = IceUtilInternal::removeWhitespace(*i); string dictName; DictIndex index; string::size_type pos; string caseString = "case-sensitive"; pos = s.find(','); if(pos != string::npos) { dictName = s.substr(0, pos); s.erase(0, pos + 1); pos = s.find(','); if(pos != string::npos) { index.member = s.substr(0, pos); s.erase(0, pos + 1); caseString = s; } else { if(s == "case-sensitive" || s == "case-insensitive") { caseString = s; } else { index.member = s; } } } else { dictName = s; } if(dictName.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no dictionary specified" << endl; usage(argv[0]); return EXIT_FAILURE; } if(caseString != "case-sensitive" && caseString != "case-insensitive") { getErrorStream() << argv[0] << ": error: " << *i << ": the case can be `case-sensitive' or " << "`case-insensitive'" << endl; usage(argv[0]); return EXIT_FAILURE; } index.caseSensitive = (caseString == "case-sensitive"); bool found = false; for(vector::iterator p = dicts.begin(); p != dicts.end(); ++p) { if(p->name == dictName) { if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end()) { getErrorStream() << argv[0] << ": error: --dict-index " << *i << ": this dict-index is defined twice" << endl; return EXIT_FAILURE; } p->indices.push_back(index); found = true; break; } } if(!found) { getErrorStream() << argv[0] << ": error: " << *i << ": unknown dictionary" << endl; usage(argv[0]); return EXIT_FAILURE; } } } string output = opts.optArg("output-dir"); bool depend = opts.isSet("depend"); bool dependxml = opts.isSet("depend-xml"); bool debug = opts.isSet("debug"); bool ice = opts.isSet("ice"); bool underscore = opts.isSet("underscore"); StringList globalMetadata; vector v = opts.argVec("meta"); copy(v.begin(), v.end(), back_inserter(globalMetadata)); if(dicts.empty() && indices.empty()) { getErrorStream() << argv[0] << ": error: no Freeze types specified" << endl; usage(argv[0]); return EXIT_FAILURE; } UnitPtr u = Unit::createUnit(true, false, ice, underscore, globalMetadata); int status = EXIT_SUCCESS; IceUtil::CtrlCHandler ctrlCHandler; ctrlCHandler.setCallback(interruptedCallback); if(dependxml) { cout << "\n" << endl; } for(vector::size_type idx = 0; idx < args.size(); ++idx) { if(depend || dependxml) { PreprocessorPtr icecpp = Preprocessor::create(argv[0], args[idx], cppArgs); FILE* cppHandle = icecpp->preprocess(false, "-DICE_COMPILER=ICE_SLICE2FREEZEJ"); if(cppHandle == 0) { u->destroy(); return EXIT_FAILURE; } status = u->parse(args[idx], cppHandle, debug); if(status == EXIT_FAILURE) { u->destroy(); return EXIT_FAILURE; } if(!icecpp->printMakefileDependencies(depend ? Preprocessor::Java : Preprocessor::JavaXML, includePaths, "-DICE_COMPILER=ICE_SLICE2FREEZEJ")) { u->destroy(); return EXIT_FAILURE; } if(!icecpp->close()) { u->destroy(); return EXIT_FAILURE; } } else { PreprocessorPtr icecpp = Preprocessor::create(argv[0], args[idx], cppArgs); FILE* cppHandle = icecpp->preprocess(false, "-DICE_COMPILER=ICE_SLICE2FREEZEJ"); if(cppHandle == 0) { u->destroy(); return EXIT_FAILURE; } if(preprocess) { char buf[4096]; while(fgets(buf, static_cast(sizeof(buf)), cppHandle) != NULL) { if(fputs(buf, stdout) == EOF) { u->destroy(); return EXIT_FAILURE; } } } else { status = u->parse(args[idx], cppHandle, debug); } if(!icecpp->close()) { u->destroy(); return EXIT_FAILURE; } } { IceUtilInternal::MutexPtrLock sync(globalMutex); if(interrupted) { return EXIT_FAILURE; } } } if(dependxml) { cout << "\n"; } if(depend || dependxml) { u->destroy(); return EXIT_SUCCESS; } if(status == EXIT_SUCCESS && !preprocess) { u->mergeModules(); u->sort(); FreezeGenerator gen(argv[0], output); JavaGenerator::validateMetaData(u); for(vector::const_iterator p = dicts.begin(); p != dicts.end(); ++p) { try { gen.generate(u, *p); } catch(const string& ex) { // If a file could not be created, then cleanup any // created files. FileTracker::instance()->cleanup(); u->destroy(); getErrorStream() << argv[0] << ": error: " << ex << endl; return EXIT_FAILURE; } catch(const Slice::FileException& ex) { // If a file could not be created, then cleanup any // created files. FileTracker::instance()->cleanup(); u->destroy(); getErrorStream() << argv[0] << ": error: " << ex.reason() << endl; return EXIT_FAILURE; } catch(...) { FileTracker::instance()->cleanup(); getErrorStream() << argv[0] << ": error: unknown exception" << endl; u->destroy(); return EXIT_FAILURE; } } for(vector::const_iterator q = indices.begin(); q != indices.end(); ++q) { try { gen.generate(u, *q); } catch(const string& ex) { // If a file could not be created, then cleanup any // created files. FileTracker::instance()->cleanup(); u->destroy(); getErrorStream() << argv[0] << ": error: " << ex << endl; return EXIT_FAILURE; } catch(const Slice::FileException& ex) { // If a file could not be created, then cleanup any // created files. FileTracker::instance()->cleanup(); u->destroy(); getErrorStream() << argv[0] << ": error: " << ex.reason() << endl; return EXIT_FAILURE; } catch(...) { getErrorStream() << argv[0] << ": error: unknown exception" << endl; FileTracker::instance()->cleanup(); u->destroy(); return EXIT_FAILURE; } } } u->destroy(); { IceUtilInternal::MutexPtrLock sync(globalMutex); if(interrupted) { FileTracker::instance()->cleanup(); return EXIT_FAILURE; } } return status; } int main(int argc, char* argv[]) { try { return compile(argc, argv); } catch(const std::exception& ex) { getErrorStream() << argv[0] << ": error:" << ex.what() << endl; return EXIT_FAILURE; } catch(const std::string& msg) { getErrorStream() << argv[0] << ": error:" << msg << endl; return EXIT_FAILURE; } catch(const char* msg) { getErrorStream() << argv[0] << ": error:" << msg << endl; return EXIT_FAILURE; } catch(...) { getErrorStream() << argv[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } Ice-3.5.1/cpp/src/slice2freezej/Makefile0000644000076400007640000000160212223561476016136 0ustar mesmes# ********************************************************************** # # 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 = ../.. NAME = $(bindir)/slice2freezej TARGETS = $(NAME) OBJS = Main.o SRCS = $(OBJS:.o=.cpp) ifeq ($(CPP11),yes) RPATH_DIR = @loader_path/../../lib/c++11 else RPATH_DIR = @loader_path/../lib endif include $(top_srcdir)/config/Make.rules CPPFLAGS := -I. $(CPPFLAGS) $(NAME): $(OBJS) rm -f $@ $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SLICE_LIBS) $(MCPP_RPATH_LINK) install:: all $(call installprogram,$(NAME),$(DESTDIR)$(install_bindir)) $(call installdata,$(top_srcdir)/../man/man1/slice2freezej.1,$(DESTDIR)$(install_mandir)) include .depend Ice-3.5.1/cpp/src/IceDB/0000755000076400007640000000000012223561476012651 5ustar mesmesIce-3.5.1/cpp/src/IceDB/.depend0000644000076400007640000000122412223561476014110 0ustar mesmesIceDB$(OBJEXT): IceDB.cpp ../IceDB/IceDB.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Version.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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 Ice-3.5.1/cpp/src/IceDB/SqlTypes.h0000644000076400007640000001064412223561476014613 0ustar mesmes// ********************************************************************** // // 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 SQL_TYPES_H #define SQL_TYPES_H #include #include #include #include #include #include // For ThreadHook #include #include namespace SqlDB { // // Generic expcetion for database failures. // class DatabaseException : public IceDB::DatabaseException { public: DatabaseException(const char*, int, const QSqlError&); virtual ~DatabaseException() throw(); virtual void ice_print(::std::ostream&) const; virtual DatabaseException* ice_clone() const; virtual void ice_throw() const; private: QSqlError error; }; class DeadlockException : public IceDB::DeadlockException { public: DeadlockException(const char*, int, const QSqlError&); virtual ~DeadlockException() throw(); virtual void ice_print(::std::ostream&) const; virtual DeadlockException* ice_clone() const; virtual void ice_throw() const; private: QSqlError error; }; class NotFoundException : public IceDB::NotFoundException { public: NotFoundException(const char*, int); virtual ~NotFoundException() throw(); virtual NotFoundException* ice_clone() const; virtual void ice_throw() const; }; void throwDatabaseException(const char*, int, const QSqlError&); // // Database connection // class DatabaseConnection : public virtual IceDB::DatabaseConnection { public: DatabaseConnection(const QSqlDatabase&, const QString&, const Ice::EncodingVersion&); virtual Ice::EncodingVersion getEncoding() const; virtual void beginTransaction(); virtual void commitTransaction(); virtual void rollbackTransaction(); QSqlDatabase sqlConnection() const { return _connection; } QString sqlConnectionName() const { return _connectionName; } private: const QSqlDatabase _connection; const QString _connectionName; const Ice::EncodingVersion _encoding; }; typedef IceUtil::Handle DatabaseConnectionPtr; // // Connection pool // class ConnectionPool : public virtual IceDB::ConnectionPool { public: IceDB::DatabaseConnectionPtr getConnection(); IceDB::DatabaseConnectionPtr newConnection(); void threadStopped(); protected: ConnectionPool(const Ice::CommunicatorPtr&, const std::string&, const std::string&, const std::string&, int, const std::string&, const std::string&, bool, const Ice::EncodingVersion&); virtual ~ConnectionPool(); typedef std::map ThreadDatabaseMap; QSqlDatabase _connection; ThreadDatabaseMap _cache; private: IceUtilInternal::FileLockPtr _fileLock; const Ice::EncodingVersion _encoding; IceUtil::Mutex _mutex; }; typedef IceUtil::Handle ConnectionPoolPtr; class ThreadHook : public Ice::ThreadNotification { public: ThreadHook(); void setConnectionPool(const ConnectionPoolPtr&); virtual void start(); virtual void stop(); private: ConnectionPoolPtr _cache; IceUtil::Mutex _mutex; }; typedef IceUtil::Handle ThreadHookPtr; template class Wrapper : public virtual IceDB::Wrapper { typedef IceUtil::Handle TablePtr; public: virtual std::map getMap() { std::map m; _table->getMap(_connection, m); return m; } virtual void put(const Key& key, const Value& data) { _table->put(_connection, key, data); } virtual Value find(const Key& key) { return _table->find(_connection, key); } virtual void erase(const Key& key) { _table->erase(_connection, key); } void clear() { _table->clear(_connection); } Wrapper(const DatabaseConnectionPtr& connection, const TablePtr& table) : _table(table), _connection(connection) { } protected: const TablePtr _table; const DatabaseConnectionPtr _connection; }; } #endif Ice-3.5.1/cpp/src/IceDB/FreezeTypes.h0000644000076400007640000001075312223561476015275 0ustar mesmes// ********************************************************************** // // 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 FREEZE_TYPES_H #define FREEZE_TYPES_H #include #include namespace FreezeDB { class DatabaseException : public IceDB::DatabaseException { public: DatabaseException(const char*, int, const Freeze::DatabaseException&); virtual ~DatabaseException() throw(); virtual void ice_print(::std::ostream&) const; virtual DatabaseException* ice_clone() const; virtual void ice_throw() const; private: std::string message; }; class DeadlockException : public IceDB::DeadlockException { public: DeadlockException(const char*, int, const Freeze::DatabaseException&); virtual ~DeadlockException() throw(); virtual void ice_print(::std::ostream&) const; virtual DeadlockException* ice_clone() const; virtual void ice_throw() const; private: std::string message; }; class NotFoundException : public IceDB::NotFoundException { public: NotFoundException(const char*, int); virtual ~NotFoundException() throw(); virtual NotFoundException* ice_clone() const; virtual void ice_throw() const; }; void throwDatabaseException(const char*, int, const Freeze::DatabaseException&); class DatabaseConnection : public virtual IceDB::DatabaseConnection { public: DatabaseConnection(const Freeze::ConnectionPtr&); virtual Ice::EncodingVersion getEncoding() const; virtual void beginTransaction(); virtual void commitTransaction(); virtual void rollbackTransaction(); Freeze::ConnectionPtr freezeConnection() const { return _connection; } private: Freeze::ConnectionPtr _connection; }; class ConnectionPool : public virtual IceDB::ConnectionPool { public: ConnectionPool(const Ice::CommunicatorPtr&, const std::string&); virtual IceDB::DatabaseConnectionPtr getConnection(); virtual IceDB::DatabaseConnectionPtr newConnection(); private: const Ice::CommunicatorPtr _communicator; const std::string _envName; const IceDB::DatabaseConnectionPtr _connection; }; template class Wrapper : public virtual IceDB::Wrapper { public: Wrapper(const Freeze::ConnectionPtr& connection, const std::string& dbName) : _dict(connection, dbName), _dbName(dbName) { } virtual std::map getMap() { try { std::map m; for(typename Dict::const_iterator p = _dict.begin(); p != _dict.end(); ++p) { #ifdef __SUNPRO_CC std::map::value_type v(p->first, p->second); m.insert(v); #else m.insert(*p); #endif } return m; } catch(const Freeze::DatabaseException& ex) { throwDatabaseException(__FILE__, __LINE__, ex); return std::map(); // Keep the compiler happy. } } virtual void put(const Key& key, const Value& data) { try { _dict.put(typename Dict::value_type(key, data)); } catch(const Freeze::DatabaseException& ex) { throwDatabaseException(__FILE__, __LINE__, ex); } } virtual Value find(const Key& key) { try { typename Dict::const_iterator p = _dict.find(key); if(p == _dict.end()) { throw NotFoundException(__FILE__, __LINE__); } return p->second; } catch(const Freeze::DatabaseException& ex) { throwDatabaseException(__FILE__, __LINE__, ex); return Value(); // Keep the compiler happy } } void erase(const Key& key) { try { _dict.erase(key); } catch(const Freeze::DatabaseException& ex) { throwDatabaseException(__FILE__, __LINE__, ex); } } void clear() { try { _dict.clear(); } catch(const Freeze::DatabaseException& ex) { throwDatabaseException(__FILE__, __LINE__, ex); } } protected: Dict _dict; std::string _dbName; }; } #endif Ice-3.5.1/cpp/src/IceDB/IceDB.cpp0000644000076400007640000000362512223561476014271 0ustar mesmes// ********************************************************************** // // 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 ICE_DB_API_EXPORTS # define ICE_DB_API_EXPORTS #endif #include using namespace IceDB; using namespace std; IceDB::DatabaseException::DatabaseException(const char* file, int line) : IceUtil::Exception(file, line) { } string DatabaseException::ice_name() const { return "IceDB::DatabaseException"; } DeadlockException::DeadlockException(const char* file, int line) : DatabaseException(file, line) { } string DeadlockException::ice_name() const { return "IceDB::DeadlockException"; } NotFoundException::NotFoundException(const char* file, int line) : DatabaseException(file, line) { } string NotFoundException::ice_name() const { return "IceDB::NotFoundException"; } TransactionHolder::TransactionHolder(const DatabaseConnectionPtr& connection) : _connection(connection) { _connection->beginTransaction(); } TransactionHolder::~TransactionHolder() { try { rollback(); } catch(...) { // // Ignored to avoid crash during stack unwinding // } } void TransactionHolder::commit() { if(_connection != 0) { try { _connection->commitTransaction(); _connection = 0; } catch(...) { _connection = 0; throw; } } } void TransactionHolder::rollback() { if(_connection != 0) { try { _connection->rollbackTransaction(); _connection = 0; } catch(...) { _connection = 0; throw; } } } Ice-3.5.1/cpp/src/IceDB/FreezeTypes.cpp0000644000076400007640000000632212223561476015625 0ustar mesmes// ********************************************************************** // // 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 using namespace FreezeDB; using namespace std; DatabaseException::DatabaseException(const char* file, int line, const Freeze::DatabaseException& ex) : IceDB::DatabaseException(file, line), message(ex.message) { } DatabaseException::~DatabaseException() throw() { } void DatabaseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n" << message; } DatabaseException* DatabaseException::ice_clone() const { return new DatabaseException(*this); } void DatabaseException::ice_throw() const { throw *this; } DeadlockException::DeadlockException(const char* file, int line, const Freeze::DatabaseException& ex) : IceDB::DeadlockException(file, line), message(ex.message) { } DeadlockException::~DeadlockException() throw() { } void DeadlockException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n" << message; } DeadlockException* DeadlockException::ice_clone() const { return new DeadlockException(*this); } void DeadlockException::ice_throw() const { throw *this; } NotFoundException::NotFoundException(const char* file, int line) : IceDB::NotFoundException(file, line) { } NotFoundException::~NotFoundException() throw() { } NotFoundException* NotFoundException::ice_clone() const { return new NotFoundException(*this); } void NotFoundException::ice_throw() const { throw *this; } void FreezeDB::throwDatabaseException(const char* file, int line, const Freeze::DatabaseException& ex) { if(dynamic_cast(&ex)) { throw DeadlockException(file, line, ex); } else if(dynamic_cast(&ex)) { throw NotFoundException(file, line); } else { throw DatabaseException(file, line, ex); } } DatabaseConnection::DatabaseConnection(const Freeze::ConnectionPtr& connection) : _connection(connection) { } Ice::EncodingVersion DatabaseConnection::getEncoding() const { return _connection->getEncoding(); } void DatabaseConnection::beginTransaction() { assert(!_connection->currentTransaction()); _connection->beginTransaction(); } void DatabaseConnection::commitTransaction() { assert(_connection->currentTransaction()); _connection->currentTransaction()->commit(); } void DatabaseConnection::rollbackTransaction() { assert(_connection->currentTransaction()); _connection->currentTransaction()->rollback(); } ConnectionPool::ConnectionPool(const Ice::CommunicatorPtr& communicator, const string& envName) : _communicator(communicator), _envName(envName), _connection(newConnection()) { } IceDB::DatabaseConnectionPtr ConnectionPool::getConnection() { return _connection; } IceDB::DatabaseConnectionPtr ConnectionPool::newConnection() { return new DatabaseConnection(Freeze::createConnection(_communicator, _envName)); } Ice-3.5.1/cpp/src/IceDB/IceDB.h0000644000076400007640000000461312223561476013734 0ustar mesmes// ********************************************************************** // // 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 ICE_DB_H #define ICE_DB_H #include #include #include #include #include #ifndef ICE_DB_API # ifdef ICE_DB_API_EXPORTS # define ICE_DB_API ICE_DECLSPEC_EXPORT # else # define ICE_DB_API ICE_DECLSPEC_IMPORT # endif #endif namespace IceDB { class ICE_DB_API DatabaseException : public IceUtil::Exception { protected: DatabaseException(const char*, int); virtual std::string ice_name() const; }; class ICE_DB_API DeadlockException : public DatabaseException { protected: DeadlockException(const char*, int); virtual std::string ice_name() const; }; class ICE_DB_API NotFoundException : public DatabaseException { protected: NotFoundException(const char*, int); virtual std::string ice_name() const; }; class ICE_DB_API DatabaseConnection : public IceUtil::Shared { public: virtual Ice::EncodingVersion getEncoding() const = 0; virtual void beginTransaction() = 0; virtual void commitTransaction() = 0; virtual void rollbackTransaction() = 0; }; typedef IceUtil::Handle DatabaseConnectionPtr; class ICE_DB_API TransactionHolder { public: TransactionHolder(const DatabaseConnectionPtr&); ~TransactionHolder(); void commit(); void rollback(); private: // // Not implemented // TransactionHolder(const TransactionHolder&); TransactionHolder& operator=(const TransactionHolder&); DatabaseConnectionPtr _connection; }; class ICE_DB_API ConnectionPool : public IceUtil::Shared { public: virtual DatabaseConnectionPtr getConnection() = 0; virtual DatabaseConnectionPtr newConnection() = 0; }; typedef IceUtil::Handle ConnectionPoolPtr; template class Wrapper : public IceUtil::Shared { public: virtual std::map getMap() = 0; virtual void put(const Key&, const Value&) = 0; virtual Value find(const Key&) = 0; virtual void erase(const Key&) = 0; virtual void clear() = 0; }; } #endif Ice-3.5.1/cpp/src/IceDB/SqlTypes.cpp0000644000076400007640000002256512223561476015153 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include using namespace SqlDB; using namespace std; DatabaseException::DatabaseException(const char* file, int line, const QSqlError& err) : IceDB::DatabaseException(file, line), error(err) { } DatabaseException::~DatabaseException() throw() { } void DatabaseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n database error: " << error.databaseText().toUtf8().data(); out << "\n driver error: " << error.driverText().toUtf8().data(); } DatabaseException* DatabaseException::ice_clone() const { return new DatabaseException(*this); } void DatabaseException::ice_throw() const { throw *this; } DeadlockException::DeadlockException(const char* file, int line, const QSqlError& err) : IceDB::DeadlockException(file, line), error(err) { } DeadlockException::~DeadlockException() throw() { } void DeadlockException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n database error: " << error.databaseText().toUtf8().data(); out << "\n driver error: " << error.driverText().toUtf8().data(); } DeadlockException* DeadlockException::ice_clone() const { return new DeadlockException(*this); } void DeadlockException::ice_throw() const { throw *this; } NotFoundException::NotFoundException(const char* file, int line) : IceDB::NotFoundException(file, line) { } NotFoundException::~NotFoundException() throw() { } NotFoundException* NotFoundException::ice_clone() const { return new NotFoundException(*this); } void NotFoundException::ice_throw() const { throw *this; } void SqlDB::throwDatabaseException(const char* file, int line, const QSqlError& err) { string s = IceUtilInternal::toLower(err.databaseText().toUtf8().data()); if(s.find("deadlock") != string::npos || s.find("database is locked") != string::npos || s.find("could not serialize") != string::npos) { throw DeadlockException(file, line, err); } else { throw DatabaseException(file, line, err); } } DatabaseConnection::DatabaseConnection(const QSqlDatabase& c, const QString& cn, const Ice::EncodingVersion& encoding) : _connection(c), _connectionName(cn), _encoding(encoding) { } Ice::EncodingVersion DatabaseConnection::getEncoding() const { return _encoding; } void DatabaseConnection::beginTransaction() { if(_connection.driverName() == "QSQLITE") { QSqlQuery query(_connection); string queryString = "BEGIN EXCLUSIVE;"; if(!query.exec(queryString.c_str())) { throwDatabaseException(__FILE__, __LINE__, query.lastError()); } } else { if(!const_cast(_connection).transaction()) { throwDatabaseException(__FILE__, __LINE__, _connection.lastError()); } } } void DatabaseConnection::commitTransaction() { if(!const_cast(_connection).commit()) { throwDatabaseException(__FILE__, __LINE__, _connection.lastError()); } } void DatabaseConnection::rollbackTransaction() { if(!const_cast(_connection).rollback()) { throwDatabaseException(__FILE__, __LINE__, _connection.lastError()); } } ConnectionPool::ConnectionPool(const Ice::CommunicatorPtr& communicator, const string& type, const string& name, const string& host, int port, const string& user, const string& password, bool requiresBlob, const Ice::EncodingVersion& encoding) : _encoding(encoding) { // // File lock to prevent multiple process open the same db env. // if(type == "QSQLITE") { _fileLock = new IceUtilInternal::FileLock(name + ".lock"); } _connection = QSqlDatabase::addDatabase(type.c_str(), IceUtil::generateUUID().c_str()); _connection.setDatabaseName(name.c_str()); _connection.setHostName(host.c_str()); if(port != 0) { _connection.setPort(port); } _connection.setUserName(user.c_str()); _connection.setPassword(password.c_str()); DatabaseConnectionPtr connection = DatabaseConnectionPtr::dynamicCast(getConnection()); QSqlDriver* driver = connection->sqlConnection().driver(); if(!driver->hasFeature(QSqlDriver::Transactions)) { throw Ice::InitializationException(__FILE__, __LINE__, "SQL database driver requires transaction support"); } if(!driver->hasFeature(QSqlDriver::Unicode)) { throw Ice::InitializationException(__FILE__, __LINE__, "SQL database driver requires unicode support"); } if(requiresBlob && connection->sqlConnection().driverName() != "QODBC" && !driver->hasFeature(QSqlDriver::BLOB)) { throw Ice::InitializationException(__FILE__, __LINE__, "SQL database driver requires blob support"); } } ConnectionPool::~ConnectionPool() { // // QSqlDatabase references must be removed before calling removeDatabase. // vector names; for(ThreadDatabaseMap::iterator p = _cache.begin(); p != _cache.end(); ++p) { names.push_back(p->second->sqlConnectionName()); } _cache.clear(); for(unsigned int i = 0; i < names.size(); ++i) { QSqlDatabase::removeDatabase(names[i]); } } IceDB::DatabaseConnectionPtr ConnectionPool::getConnection() { IceUtil::Mutex::Lock lock(_mutex); ThreadDatabaseMap::iterator p = _cache.find(IceUtil::ThreadControl().id()); if(p != _cache.end()) { // // We have a cached connection. Perform a simple query to make sure // connection has not been lost. // { QSqlQuery query(p->second->sqlConnection()); if(query.exec("SELECT 1")) { return p->second; } } // // QSqlDatabase reference must be removed before calling removeDatabase. // QString connectionName = p->second->sqlConnectionName(); _cache.erase(p); QSqlDatabase::removeDatabase(connectionName); } // // Create a new connection // QString connectionName = IceUtil::generateUUID().c_str(); QSqlDatabase connection = QSqlDatabase::cloneDatabase(_connection, connectionName); if(!connection.open()) { throwDatabaseException(__FILE__, __LINE__, connection.lastError()); } // // Set isolation level, for SQLite this is done on a per transaction level. // if(connection.driverName() != "QSQLITE") { QSqlQuery query(connection); string queryString; if(connection.driverName() == "QPSQL") { queryString = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE"; } else if(connection.driverName() == "QMYSQL") { queryString = "SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;"; } else if(connection.driverName() == "QODBC") { queryString = "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;"; } if(!query.exec(queryString.c_str())) { throwDatabaseException(__FILE__, __LINE__, query.lastError()); } } // // Set storage engine for MySQL. // if(connection.driverName() == "QMYSQL") { QSqlQuery query(connection); if(!query.exec("SET storage_engine=INNODB;")) { throwDatabaseException(__FILE__, __LINE__, query.lastError()); } } // // Set UTF-8 character set for MySQL and PostgreSQL. // if(connection.driverName() == "QMYSQL" || connection.driverName() == "QPSQL") { QSqlQuery query(connection); if(!query.exec("SET NAMES 'UTF8';")) { throwDatabaseException(__FILE__, __LINE__, query.lastError()); } } DatabaseConnectionPtr db = new DatabaseConnection(connection, connectionName, _encoding); _cache[IceUtil::ThreadControl().id()] = db; return db; } IceDB::DatabaseConnectionPtr ConnectionPool::newConnection() { return getConnection(); } void ConnectionPool::threadStopped() { IceUtil::Mutex::Lock lock(_mutex); ThreadDatabaseMap::iterator p = _cache.find(IceUtil::ThreadControl().id()); if(p != _cache.end()) { // // QSqlDatabase reference must be removed before calling removeDatabase. // QString connectionName = p->second->sqlConnectionName(); _cache.erase(p); QSqlDatabase::removeDatabase(connectionName); } } ThreadHook::ThreadHook() { } void ThreadHook::setConnectionPool(const ConnectionPoolPtr& cache) { IceUtil::Mutex::Lock sync(_mutex); _cache = cache; } void ThreadHook::start() { } void ThreadHook::stop() { IceUtil::Mutex::Lock sync(_mutex); if(_cache) { _cache->threadStopped(); } } Ice-3.5.1/cpp/src/IceDB/Makefile0000644000076400007640000000217312223561476014314 0ustar mesmes# ********************************************************************** # # 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,IceDB,$(VERSION)) SONAME = $(call mksoname,IceDB,$(SOVERSION)) LIBNAME = $(call mklibname,IceDB) TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME)) OBJS = IceDB.o SRCS = $(OBJS:.o=.cpp) include $(top_srcdir)/config/Make.rules CPPFLAGS := -I.. -DICE_DB_API_EXPORTS $(CPPFLAGS) LINKWITH := -lIce -lIceUtil $(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) $@ install:: all $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME)) include .depend Ice-3.5.1/cpp/src/IceSSL/0000755000076400007640000000000012223561476013025 5ustar mesmesIce-3.5.1/cpp/src/IceSSL/TransceiverI.cpp0000644000076400007640000011754112223561476016140 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceSSL; // // BUGFIX: an openssl bug that affects OpensSSL < 1.0.0k // could cause a deadlock when decoding public keys. // // See: http://cvs.openssl.org/chngview?cn=22569 // #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x100000bfL namespace { IceUtil::Mutex* sslMutex = 0; class Init { public: Init() { sslMutex = new IceUtil::Mutex; } ~Init() { delete sslMutex; sslMutex = 0; } }; Init init; } #endif IceInternal::NativeInfoPtr IceSSL::TransceiverI::getNativeInfo() { return this; } #ifdef ICE_USE_IOCP IceInternal::AsyncInfo* IceSSL::TransceiverI::getAsyncInfo(IceInternal::SocketOperation status) { switch(status) { case IceInternal::SocketOperationRead: return &_read; case IceInternal::SocketOperationWrite: return &_write; default: assert(false); return 0; } } #endif IceInternal::SocketOperation IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& writeBuffer) { try { if(_state == StateNeedConnect) { _state = StateConnectPending; return IceInternal::SocketOperationConnect; } else if(_state <= StateConnectPending) { #ifdef ICE_USE_IOCP IceInternal::doFinishConnectAsync(_fd, _write); #else IceInternal::doFinishConnect(_fd); #endif _desc = IceInternal::fdToString(_fd, _proxy, _addr, true); if(_proxy) { // // Prepare the read & write buffers in advance. // _proxy->beginWriteConnectRequest(_addr, writeBuffer); _proxy->beginReadConnectRequestResponse(readBuffer); #ifdef ICE_USE_IOCP // // Return SocketOperationWrite to indicate we need to start a write. // _state = StateProxyConnectRequest; // Send proxy connect request return IceInternal::SocketOperationWrite; #else // // Write the proxy connection message using TCP. // if(writeRaw(writeBuffer)) { // // Write completed without blocking. // _proxy->endWriteConnectRequest(writeBuffer); // // Try to read the response using TCP. // if(readRaw(readBuffer)) { // // Read completed without blocking - fall through. // _proxy->endReadConnectRequestResponse(readBuffer); } else { // // Return SocketOperationRead to indicate we need to complete the read. // _state = StateProxyConnectRequestPending; // Wait for proxy response return IceInternal::SocketOperationRead; } } else { // // Return SocketOperationWrite to indicate we need to complete the write. // _state = StateProxyConnectRequest; // Send proxy connect request return IceInternal::SocketOperationWrite; } #endif } _state = StateConnected; } else if(_state == StateProxyConnectRequest) { // // Write completed. // _proxy->endWriteConnectRequest(writeBuffer); _state = StateProxyConnectRequestPending; // Wait for proxy response return IceInternal::SocketOperationRead; } else if(_state == StateProxyConnectRequestPending) { // // Read completed. // _proxy->endReadConnectRequestResponse(readBuffer); _state = StateConnected; } assert(_state == StateConnected); if(!_ssl) { #ifdef ICE_USE_IOCP // // On Windows, limiting the buffer size is important to prevent // poor throughput performances when transfering large amount of // data. See Microsoft KB article KB823764. // _maxSendPacketSize = IceInternal::getSendBufferSize(_fd) / 2; if(_maxSendPacketSize < 512) { _maxSendPacketSize = 0; } _maxReceivePacketSize = IceInternal::getRecvBufferSize(_fd); if(_maxReceivePacketSize < 512) { _maxReceivePacketSize = 0; } _readI = _readBuffer.end(); _writeI = _writeBuffer.end(); _sentBytes = 0; #endif #ifdef ICE_USE_IOCP BIO* bio; if(!BIO_new_bio_pair(&bio, _maxSendPacketSize, &_iocpBio, _maxReceivePacketSize)) { bio = 0; _iocpBio = 0; } #else // // This static_cast is necessary due to 64bit windows. There SOCKET is a non-int type. // BIO* bio = BIO_new_socket(static_cast(_fd), 0); #endif if(!bio) { SecurityException ex(__FILE__, __LINE__); ex.reason = "openssl failure"; throw ex; } _ssl = SSL_new(_instance->context()); if(!_ssl) { BIO_free(bio); #ifdef ICE_USE_IOCP BIO_free(_iocpBio); _iocpBio = 0; #endif SecurityException ex(__FILE__, __LINE__); ex.reason = "openssl failure"; throw ex; } SSL_set_bio(_ssl, bio, bio); } while(!SSL_is_init_finished(_ssl)) { // // Only one thread calls initialize(), so synchronization is not necessary here. // // // BUGFIX: an openssl bug that affects OpensSSL < 1.0.0k // could cause a deadlock when decoding public keys. // // See: http://cvs.openssl.org/chngview?cn=22569 // #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x100000bfL IceUtilInternal::MutexPtrLock sync(sslMutex); #endif int ret = _incoming ? SSL_accept(_ssl) : SSL_connect(_ssl); #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x100000bfL sync.release(); #endif #ifdef ICE_USE_IOCP if(BIO_ctrl_pending(_iocpBio)) { if(!send()) { return IceInternal::SocketOperationWrite; } continue; } #endif if(ret <= 0) { switch(SSL_get_error(_ssl, ret)) { case SSL_ERROR_NONE: assert(SSL_is_init_finished(_ssl)); break; case SSL_ERROR_ZERO_RETURN: { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } case SSL_ERROR_WANT_READ: { #ifdef ICE_USE_IOCP if(receive()) { continue; } #endif return IceInternal::SocketOperationRead; } case SSL_ERROR_WANT_WRITE: { #ifdef ICE_USE_IOCP if(send()) { continue; } #endif return IceInternal::SocketOperationWrite; } case SSL_ERROR_SYSCALL: { if(ret == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } #ifndef ICE_USE_IOCP if(ret == -1) { if(IceInternal::interrupted()) { break; } if(IceInternal::wouldBlock()) { if(SSL_want_read(_ssl)) { return IceInternal::SocketOperationRead; } else if(SSL_want_write(_ssl)) { return IceInternal::SocketOperationWrite; } break; } if(IceInternal::connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } #endif SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } case SSL_ERROR_SSL: { IceInternal::Address remoteAddr; string desc = ""; if(IceInternal::fdToRemoteAddress(_fd, remoteAddr)) { desc = IceInternal::addrToString(remoteAddr); } ostringstream ostr; ostr << "SSL error occurred for new " << (_incoming ? "incoming" : "outgoing") << " connection:\nremote address = " << desc << "\n" << _instance->sslErrors(); ProtocolException ex(__FILE__, __LINE__); ex.reason = ostr.str(); throw ex; } } } } _instance->verifyPeer(_ssl, _fd, _host, getNativeConnectionInfo()); _state = StateHandshakeComplete; } catch(const Ice::LocalException& ex) { if(_instance->networkTraceLevel() >= 2) { Trace out(_logger, _instance->networkTraceCategory()); out << "failed to establish ssl connection\n"; if(_incoming) { out << IceInternal::fdToString(_fd) << "\n" << ex; } else { out << IceInternal::fdToString(_fd, _proxy, _addr, false) << "\n" << ex; } } throw; } if(_instance->networkTraceLevel() >= 1) { Trace out(_logger, _instance->networkTraceCategory()); if(_incoming) { out << "accepted ssl connection\n" << _desc; } else { out << "ssl connection established\n" << _desc; } } if(_instance->securityTraceLevel() >= 1) { _instance->traceConnection(_ssl, _incoming); } return IceInternal::SocketOperationNone; } void IceSSL::TransceiverI::close() { if(_state == StateHandshakeComplete && _instance->networkTraceLevel() >= 1) { Trace out(_logger, _instance->networkTraceCategory()); out << "closing ssl connection\n" << toString(); } if(_ssl) { int err = SSL_shutdown(_ssl); // // Call it one more time if it returned 0. // if(err == 0) { SSL_shutdown(_ssl); } SSL_free(_ssl); _ssl = 0; } #ifdef ICE_USE_IOCP if(_iocpBio) { BIO_free(_iocpBio); _iocpBio = 0; } #endif assert(_fd != INVALID_SOCKET); try { IceInternal::closeSocket(_fd); _fd = INVALID_SOCKET; } catch(const SocketException&) { _fd = INVALID_SOCKET; throw; } } bool IceSSL::TransceiverI::write(IceInternal::Buffer& buf) { if(_state == StateProxyConnectRequest) { // // We need to write the proxy message, but we have to use TCP and not SSL. // return writeRaw(buf); } #ifdef ICE_USE_IOCP if(_writeI != _writeBuffer.end()) { if(!send()) { return false; } } #endif // // It's impossible for packetSize to be more than an Int. // int packetSize = static_cast(buf.b.end() - buf.i); while(buf.i != buf.b.end()) { ERR_clear_error(); // Clear any spurious errors. assert(_fd != INVALID_SOCKET); #ifdef ICE_USE_IOCP int ret; if(_sentBytes) { ret = _sentBytes; _sentBytes = 0; } else { ret = SSL_write(_ssl, reinterpret_cast(&*buf.i), packetSize); if(ret > 0) { if(!send()) { _sentBytes = ret; return false; } } } #else int ret = SSL_write(_ssl, reinterpret_cast(&*buf.i), packetSize); #endif if(ret <= 0) { switch(SSL_get_error(_ssl, ret)) { case SSL_ERROR_NONE: assert(false); break; case SSL_ERROR_ZERO_RETURN: { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } case SSL_ERROR_WANT_READ: { assert(false); break; } case SSL_ERROR_WANT_WRITE: { #ifdef ICE_USE_IOCP if(send()) { continue; } #endif return false; } case SSL_ERROR_SYSCALL: { #ifndef ICE_USE_IOCP if(ret == -1) { if(IceInternal::interrupted()) { continue; } if(IceInternal::noBuffers() && packetSize > 1024) { packetSize /= 2; continue; } if(IceInternal::wouldBlock()) { assert(SSL_want_write(_ssl)); return false; } if(IceInternal::connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } #endif if(ret == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } case SSL_ERROR_SSL: { ProtocolException ex(__FILE__, __LINE__); ex.reason = "SSL protocol error during write:\n" + _instance->sslErrors(); throw ex; } } } if(_instance->networkTraceLevel() >= 3) { Trace out(_logger, _instance->networkTraceCategory()); out << "sent " << ret << " of " << packetSize << " bytes via ssl\n" << toString(); } if(_stats) { _stats->bytesSent(type(), static_cast(ret)); } buf.i += ret; if(packetSize > buf.b.end() - buf.i) { packetSize = static_cast(buf.b.end() - buf.i); } } return true; } bool IceSSL::TransceiverI::read(IceInternal::Buffer& buf) { if(_state == StateProxyConnectRequestPending) { // // We need to read the proxy reply, but we have to use TCP and not SSL. // return readRaw(buf); } #ifdef ICE_USE_IOCP if(_readI != _readBuffer.end()) { if(!receive()) { return false; } } #endif // // It's impossible for packetSize to be more than an Int. // int packetSize = static_cast(buf.b.end() - buf.i); while(buf.i != buf.b.end()) { ERR_clear_error(); // Clear any spurious errors. assert(_fd != INVALID_SOCKET); int ret = SSL_read(_ssl, reinterpret_cast(&*buf.i), packetSize); if(ret <= 0) { switch(SSL_get_error(_ssl, ret)) { case SSL_ERROR_NONE: assert(false); break; case SSL_ERROR_ZERO_RETURN: { // // If the connection is lost when reading data, we shut // down the write end of the socket. This helps to unblock // threads that are stuck in send() or select() while // sending data. Note: I don't really understand why // send() or select() sometimes don't detect a connection // loss. Therefore this helper to make them detect it. // //assert(_fd != INVALID_SOCKET); //shutdownSocketReadWrite(_fd); ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } case SSL_ERROR_WANT_READ: { #ifdef ICE_USE_IOCP if(receive()) { continue; } #endif return false; } case SSL_ERROR_WANT_WRITE: { assert(false); break; } case SSL_ERROR_SYSCALL: { #ifndef ICE_USE_IOCP if(ret == -1) { if(IceInternal::interrupted()) { continue; } if(IceInternal::noBuffers() && packetSize > 1024) { packetSize /= 2; continue; } if(IceInternal::wouldBlock()) { assert(SSL_want_read(_ssl)); return false; } if(IceInternal::connectionLost()) { // // See the commment above about shutting down the // socket if the connection is lost while reading // data. // //assert(_fd != INVALID_SOCKET); //shutdownSocketReadWrite(_fd); ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } #endif if(ret == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } case SSL_ERROR_SSL: { // // Forcefully closing a connection can result in SSL_read reporting // "decryption failed or bad record mac". We trap that error and // treat it as the loss of a connection. // // NOTE: We have to compare the reason string instead // of the error codes because the error code values // changed between OpenSSL 0.9.7i and 0.9.7j and // between OpenSSL 0.9.8a and 0.9.8b... // //unsigned long e = ERR_peek_error(); //if(ERR_GET_LIB(e) == ERR_LIB_SSL && ERR_GET_REASON(e) == SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC) // unsigned long e = ERR_peek_error(); const char* estr = ERR_GET_LIB(e) == ERR_LIB_SSL ? ERR_reason_error_string(e) : 0; if(estr && strcmp(estr, "decryption failed or bad record mac") == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } else { ProtocolException ex(__FILE__, __LINE__); ex.reason = "SSL protocol error during read:\n" + _instance->sslErrors(); throw ex; } } } } if(_instance->networkTraceLevel() >= 3) { Trace out(_logger, _instance->networkTraceCategory()); out << "received " << ret << " of " << packetSize << " bytes via ssl\n" << toString(); } if(_stats) { _stats->bytesReceived(type(), static_cast(ret)); } buf.i += ret; if(packetSize > buf.b.end() - buf.i) { packetSize = static_cast(buf.b.end() - buf.i); } } return true; } #ifdef ICE_USE_IOCP bool IceSSL::TransceiverI::startWrite(IceInternal::Buffer& buf) { if(_state == StateConnectPending) { IceInternal::Address addr = _proxy ? _proxy->getAddress() : _addr; IceInternal::doConnectAsync(_fd, addr, _write); return false; } else if(_state == StateProxyConnectRequest) { // // We need to write the proxy message, but we have to use TCP and not SSL. // assert(!buf.b.empty() && buf.i != buf.b.end()); const int packetSize = static_cast(buf.b.end() - buf.i); const int actualSize = writeAsync(reinterpret_cast(&*buf.i), packetSize); return packetSize == actualSize; } assert(!_writeBuffer.empty() && _writeI != _writeBuffer.end()); const int packetSize = static_cast(_writeBuffer.end() - _writeI); const int actualSize = writeAsync(reinterpret_cast(&*_writeI), packetSize); return packetSize == actualSize; } void IceSSL::TransceiverI::finishWrite(IceInternal::Buffer& buf) { if(_state < StateConnected && _state != StateProxyConnectRequest) { return; } if(static_cast(_write.count) == SOCKET_ERROR) { WSASetLastError(_write.error); if(IceInternal::connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } if(_state == StateProxyConnectRequest) { buf.i += _write.count; } else { _writeI += _write.count; } } void IceSSL::TransceiverI::startRead(IceInternal::Buffer& buf) { if(_state == StateProxyConnectRequestPending) { // // We need to read the proxy reply, but we have to use TCP and not SSL. // assert(!buf.b.empty() && buf.i != buf.b.end()); const int packetSize = static_cast(buf.b.end() - buf.i); readAsync(reinterpret_cast(&*buf.i), packetSize); return; } if(_readI == _readBuffer.end()) { assert(!buf.b.empty() && buf.i != buf.b.end()); assert(!BIO_ctrl_get_read_request(_iocpBio)); ERR_clear_error(); // Clear any spurious errors. #ifndef NDEBUG int ret = #endif SSL_read(_ssl, reinterpret_cast(&*buf.i), static_cast(buf.b.end() - buf.i)); assert(ret <= 0 && SSL_get_error(_ssl, ret) == SSL_ERROR_WANT_READ); assert(BIO_ctrl_get_read_request(_iocpBio)); _readBuffer.resize(BIO_ctrl_get_read_request(_iocpBio)); _readI = _readBuffer.begin(); } assert(!_readBuffer.empty() && _readI != _readBuffer.end()); const int packetSize = static_cast(_readBuffer.end() - _readI); readAsync(reinterpret_cast(&*_readI), packetSize); } void IceSSL::TransceiverI::finishRead(IceInternal::Buffer& buf) { if(static_cast(_read.count) == SOCKET_ERROR) { WSASetLastError(_read.error); if(IceInternal::connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } else if(_read.count == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } if(_state == StateProxyConnectRequestPending) { buf.i += _read.count; } else { _readI += _read.count; if(_iocpBio && _readI == _readBuffer.end()) { assert(_readI == _readBuffer.end()); int n = BIO_write(_iocpBio, &_readBuffer[0], static_cast(_readBuffer.size())); if(n < 0) // Expected if the transceiver was closed. { SecurityException ex(__FILE__, __LINE__); ex.reason = "SSL bio write failed"; throw ex; } assert(n == static_cast(_readBuffer.size())); } } } #endif string IceSSL::TransceiverI::type() const { return "ssl"; } string IceSSL::TransceiverI::toString() const { return _desc; } Ice::ConnectionInfoPtr IceSSL::TransceiverI::getInfo() const { return getNativeConnectionInfo(); } void IceSSL::TransceiverI::checkSendSize(const IceInternal::Buffer& buf, size_t messageSizeMax) { if(buf.b.size() > messageSizeMax) { IceInternal::Ex::throwMemoryLimitException(__FILE__, __LINE__, buf.b.size(), messageSizeMax); } } IceSSL::TransceiverI::TransceiverI(const InstancePtr& instance, SOCKET fd, const IceInternal::NetworkProxyPtr& proxy, const string& host, const IceInternal::Address& addr) : IceInternal::NativeInfo(fd), _instance(instance), _logger(instance->communicator()->getLogger()), _stats(instance->communicator()->getStats()), _proxy(proxy), _host(host), _addr(addr), _incoming(false), _ssl(0), _state(StateNeedConnect) #ifdef ICE_USE_IOCP , _iocpBio(0), _read(IceInternal::SocketOperationRead), _write(IceInternal::SocketOperationWrite) #endif { IceInternal::setBlock(fd, false); IceInternal::setTcpBufSize(fd, _instance->communicator()->getProperties(), _logger); #ifndef ICE_USE_IOCP IceInternal::Address connectAddr = proxy ? proxy->getAddress() : addr; if(IceInternal::doConnect(_fd, connectAddr)) { _state = StateConnected; _desc = IceInternal::fdToString(_fd, _proxy, _addr, true); if(_instance->networkTraceLevel() >= 1) { Trace out(_logger, _instance->networkTraceCategory()); out << "ssl connection established\n" << _desc; } } else { _desc = IceInternal::fdToString(_fd, _proxy, _addr, true); } #endif } IceSSL::TransceiverI::TransceiverI(const InstancePtr& instance, SOCKET fd, const string& adapterName) : IceInternal::NativeInfo(fd), _instance(instance), _logger(instance->communicator()->getLogger()), _stats(instance->communicator()->getStats()), _addr(IceInternal::Address()), _adapterName(adapterName), _incoming(true), _ssl(0), _state(StateConnected), _desc(IceInternal::fdToString(fd)) #ifdef ICE_USE_IOCP , _iocpBio(0), _read(IceInternal::SocketOperationRead), _write(IceInternal::SocketOperationWrite) #endif { IceInternal::setBlock(fd, false); IceInternal::setTcpBufSize(fd, _instance->communicator()->getProperties(), _logger); } IceSSL::TransceiverI::~TransceiverI() { assert(_fd == INVALID_SOCKET); } NativeConnectionInfoPtr IceSSL::TransceiverI::getNativeConnectionInfo() const { NativeConnectionInfoPtr info = new NativeConnectionInfo(); IceInternal::fdToAddressAndPort(_fd, info->localAddress, info->localPort, info->remoteAddress, info->remotePort); if(_ssl != 0) { // // On the client side, SSL_get_peer_cert_chain returns the entire chain of certs. // On the server side, the peer certificate must be obtained separately. // // Since we have no clear idea whether the connection is server or client side, // the peer certificate is obtained separately and compared against the first // certificate in the chain. If they are not the same, it is added to the chain. // X509* cert = SSL_get_peer_certificate(_ssl); STACK_OF(X509)* chain = SSL_get_peer_cert_chain(_ssl); if(cert != 0 && (chain == 0 || sk_X509_num(chain) == 0 || cert != sk_X509_value(chain, 0))) { CertificatePtr certificate = new Certificate(cert); info->nativeCerts.push_back(certificate); info->certs.push_back(certificate->encode()); } else { X509_free(cert); } if(chain != 0) { for(int i = 0; i < sk_X509_num(chain); ++i) { // // Duplicate the certificate since the stack comes straight from the SSL connection. // CertificatePtr certificate = new Certificate(X509_dup(sk_X509_value(chain, i))); info->nativeCerts.push_back(certificate); info->certs.push_back(certificate->encode()); } } info->cipher = SSL_get_cipher_name(_ssl); // Nothing needs to be free'd. } info->adapterName = _adapterName; info->incoming = _incoming; return info; } #ifdef ICE_USE_IOCP bool IceSSL::TransceiverI::receive() { if(_readI == _readBuffer.end()) { assert(BIO_ctrl_get_read_request(_iocpBio)); _readBuffer.resize(BIO_ctrl_get_read_request(_iocpBio)); _readI = _readBuffer.begin(); } int packetSize = static_cast(_readBuffer.end() - _readI); while(_readI != _readBuffer.end()) { assert(_fd != INVALID_SOCKET); ssize_t ret = ::recv(_fd, reinterpret_cast(&*_readI), packetSize, 0); if(ret == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } if(ret == SOCKET_ERROR) { if(IceInternal::interrupted()) { continue; } if(IceInternal::noBuffers() && packetSize > 1024) { packetSize /= 2; continue; } if(IceInternal::wouldBlock()) { return false; } if(IceInternal::connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } _readI += ret; if(packetSize > _readBuffer.end() - _readI) { packetSize = static_cast(_readBuffer.end() - _readI); } } assert(_readI == _readBuffer.end()); #ifndef NDEBUG int n = #endif BIO_write(_iocpBio, &_readBuffer[0], static_cast(_readBuffer.size())); assert(n == static_cast(_readBuffer.size())); return true; } bool IceSSL::TransceiverI::send() { if(_writeI == _writeBuffer.end()) { assert(BIO_ctrl_pending(_iocpBio)); _writeBuffer.resize(BIO_ctrl_pending(_iocpBio)); #ifndef NDEBUG int n = #endif BIO_read(_iocpBio, &_writeBuffer[0], static_cast(_writeBuffer.size())); assert(n == static_cast(_writeBuffer.size())); _writeI = _writeBuffer.begin(); } int packetSize = static_cast(_writeBuffer.end() - _writeI); if(_maxSendPacketSize > 0 && packetSize > _maxSendPacketSize) { packetSize = _maxSendPacketSize; } while(_writeI != _writeBuffer.end()) { int ret = ::send(_fd, reinterpret_cast(&*_writeI), packetSize, 0); if(ret == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } if(ret == SOCKET_ERROR) { if(IceInternal::interrupted()) { continue; } if(IceInternal::noBuffers() && packetSize > 1024) { packetSize /= 2; continue; } if(IceInternal::wouldBlock()) { return false; } if(IceInternal::connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } _writeI += ret; if(packetSize > _writeBuffer.end() - _writeI) { packetSize = static_cast(_writeBuffer.end() - _writeI); } } return true; } int IceSSL::TransceiverI::writeAsync(char* buf, int packetSize) { if(_maxSendPacketSize > 0 && packetSize > _maxSendPacketSize) { packetSize = _maxSendPacketSize; } _write.buf.len = packetSize; _write.buf.buf = buf; int err = WSASend(_fd, &_write.buf, 1, &_write.count, 0, &_write, NULL); if(err == SOCKET_ERROR) { if(!IceInternal::wouldBlock()) { if(IceInternal::connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } } return packetSize; } int IceSSL::TransceiverI::readAsync(char* buf, int packetSize) { if(_maxReceivePacketSize > 0 && packetSize > _maxReceivePacketSize) { packetSize = _maxReceivePacketSize; } _read.buf.len = packetSize; _read.buf.buf = buf; int err = WSARecv(_fd, &_read.buf, 1, &_read.count, &_read.flags, &_read, NULL); if(err == SOCKET_ERROR) { if(!IceInternal::wouldBlock()) { if(IceInternal::connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } } return packetSize; } #endif bool IceSSL::TransceiverI::writeRaw(IceInternal::Buffer& buf) { // // It's impossible for packetSize to be more than an Int. // int packetSize = static_cast(buf.b.end() - buf.i); #ifdef ICE_USE_IOCP // // Limit packet size to avoid performance problems on WIN32 // if(_maxSendPacketSize > 0 && packetSize > _maxSendPacketSize) { packetSize = _maxSendPacketSize; } #endif while(buf.i != buf.b.end()) { assert(_fd != INVALID_SOCKET); ssize_t ret = ::send(_fd, reinterpret_cast(&*buf.i), packetSize, 0); if(ret == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } if(ret == SOCKET_ERROR) { if(IceInternal::interrupted()) { continue; } if(IceInternal::noBuffers() && packetSize > 1024) { packetSize /= 2; continue; } if(IceInternal::wouldBlock()) { return false; } if(IceInternal::connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } if(_instance->networkTraceLevel() >= 3) { Trace out(_logger, _instance->networkTraceCategory()); out << "sent " << ret << " of " << packetSize << " bytes via tcp\n" << toString(); } if(_stats) { _stats->bytesSent("tcp", static_cast(ret)); } buf.i += ret; if(packetSize > buf.b.end() - buf.i) { packetSize = static_cast(buf.b.end() - buf.i); } } return true; } bool IceSSL::TransceiverI::readRaw(IceInternal::Buffer& buf) { // // It's impossible for packetSize to be more than an Int. // int packetSize = static_cast(buf.b.end() - buf.i); while(buf.i != buf.b.end()) { assert(_fd != INVALID_SOCKET); ssize_t ret = ::recv(_fd, reinterpret_cast(&*buf.i), packetSize, 0); if(ret == 0) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = 0; throw ex; } if(ret == SOCKET_ERROR) { if(IceInternal::interrupted()) { continue; } if(IceInternal::noBuffers() && packetSize > 1024) { packetSize /= 2; continue; } if(IceInternal::wouldBlock()) { return false; } if(IceInternal::connectionLost()) { ConnectionLostException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } else { SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } if(_instance->networkTraceLevel() >= 3) { Trace out(_logger, _instance->networkTraceCategory()); out << "received " << ret << " of " << packetSize << " bytes via tcp\n" << toString(); } if(_stats) { _stats->bytesReceived("tcp", static_cast(ret)); } buf.i += ret; packetSize = static_cast(buf.b.end() - buf.i); } return true; } Ice-3.5.1/cpp/src/IceSSL/ConnectorI.cpp0000644000076400007640000000644012223561476015600 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceSSL; IceInternal::TransceiverPtr IceSSL::ConnectorI::connect() { // // The plug-in may not be initialized. // if(!_instance->context()) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: plug-in is not initialized"; throw ex; } if(_instance->networkTraceLevel() >= 2) { Trace out(_logger, _instance->networkTraceCategory()); out << "trying to establish ssl connection to " << toString(); } try { return new TransceiverI(_instance, IceInternal::createSocket(false, _addr), _proxy, _host, _addr); } catch(const Ice::LocalException& ex) { if(_instance->networkTraceLevel() >= 2) { Trace out(_logger, _instance->networkTraceCategory()); out << "failed to establish ssl connection to " << toString() << "\n" << ex; } throw; } } Short IceSSL::ConnectorI::type() const { return IceSSL::EndpointType; } string IceSSL::ConnectorI::toString() const { return IceInternal::addrToString(!_proxy ? _addr : _proxy->getAddress()); } bool IceSSL::ConnectorI::operator==(const IceInternal::Connector& r) const { const ConnectorI* p = dynamic_cast(&r); if(!p) { return false; } if(IceInternal::compareAddress(_addr, p->_addr) != 0) { return false; } if(_timeout != p->_timeout) { return false; } if(_connectionId != p->_connectionId) { return false; } return true; } bool IceSSL::ConnectorI::operator!=(const IceInternal::Connector& r) const { return !operator==(r); } bool IceSSL::ConnectorI::operator<(const IceInternal::Connector& r) const { const ConnectorI* p = dynamic_cast(&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; } return IceInternal::compareAddress(_addr, p->_addr) == -1; } IceSSL::ConnectorI::ConnectorI(const InstancePtr& instance, const string& host, const IceInternal::Address& addr, const IceInternal::NetworkProxyPtr& proxy, Ice::Int timeout, const string& connectionId) : _instance(instance), _logger(instance->communicator()->getLogger()), _host(host), _addr(addr), _proxy(proxy), _timeout(timeout), _connectionId(connectionId) { } IceSSL::ConnectorI::~ConnectorI() { } Ice-3.5.1/cpp/src/IceSSL/.depend0000644000076400007640000007731512223561476014302 0ustar mesmesAcceptorI$(OBJEXT): AcceptorI.cpp ../IceSSL/AcceptorI.h $(includedir)/Ice/LoggerF.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h ../Ice/TransceiverF.h ../Ice/Acceptor.h ../Ice/AcceptorF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.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/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 ../IceSSL/InstanceF.h ../IceSSL/Instance.h ../IceSSL/UtilF.h $(includedir)/Ice/ProtocolPluginFacadeF.h $(includedir)/IceSSL/Plugin.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Endpoint.h ../IceSSL/TrustManagerF.h ../IceSSL/TransceiverI.h $(includedir)/Ice/StatsF.h ../Ice/Transceiver.h ../IceSSL/Util.h $(includedir)/Ice/Communicator.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/InstrumentationF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/IceUtil/StringUtil.h Certificate$(OBJEXT): Certificate.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceSSL/Plugin.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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/LoggerF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/Ice/Proxy.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/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/Connection.h $(includedir)/Ice/Endpoint.h ../IceSSL/Util.h ../IceSSL/UtilF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h ../IceSSL/RFC2253.h ConnectorI$(OBJEXT): ConnectorI.cpp ../IceSSL/ConnectorI.h $(includedir)/Ice/LoggerF.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h ../Ice/TransceiverF.h ../Ice/Connector.h ../Ice/ConnectorF.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/Version.h ../IceSSL/InstanceF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.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/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h ../IceSSL/Instance.h ../IceSSL/UtilF.h $(includedir)/Ice/ProtocolPluginFacadeF.h $(includedir)/IceSSL/Plugin.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Endpoint.h ../IceSSL/TrustManagerF.h ../IceSSL/TransceiverI.h $(includedir)/Ice/StatsF.h ../Ice/Transceiver.h ../IceSSL/EndpointI.h ../Ice/EndpointI.h ../Ice/AcceptorF.h $(includedir)/Ice/EndpointFactory.h $(includedir)/Ice/EndpointFactoryF.h $(includedir)/IceSSL/EndpointInfo.h ../IceSSL/Util.h $(includedir)/Ice/Communicator.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/InstrumentationF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h EndpointInfo$(OBJEXT): EndpointInfo.cpp $(includedir)/IceSSL/EndpointInfo.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)/IceUtil/Optional.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/Version.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Object.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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)/IceUtil/DisableWarnings.h ConnectionInfo$(OBJEXT): ConnectionInfo.cpp $(includedir)/IceSSL/ConnectionInfo.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/Connection.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/DisableWarnings.h EndpointI$(OBJEXT): EndpointI.cpp ../IceSSL/EndpointI.h ../Ice/EndpointI.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/Version.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/InstanceF.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h $(includedir)/Ice/Protocol.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.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/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/EndpointFactory.h $(includedir)/Ice/EndpointFactoryF.h ../IceSSL/InstanceF.h $(includedir)/IceSSL/EndpointInfo.h ../IceSSL/AcceptorI.h ../Ice/Acceptor.h ../IceSSL/ConnectorI.h ../Ice/Connector.h ../IceSSL/TransceiverI.h $(includedir)/IceSSL/Plugin.h $(includedir)/Ice/Plugin.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/Ice/Connection.h $(includedir)/Ice/StatsF.h ../Ice/Transceiver.h ../IceSSL/Instance.h ../IceSSL/UtilF.h $(includedir)/Ice/ProtocolPluginFacadeF.h ../IceSSL/TrustManagerF.h $(includedir)/Ice/LocalException.h ../Ice/DefaultsAndOverrides.h ../Ice/DefaultsAndOverridesF.h ../Ice/HashUtil.h Instance$(OBJEXT): Instance.cpp $(includedir)/IceUtil/Config.h ../IceSSL/Instance.h ../IceSSL/InstanceF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h ../IceSSL/UtilF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/LoggerF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.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/ProtocolPluginFacadeF.h $(includedir)/IceSSL/Plugin.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Endpoint.h ../IceSSL/TrustManagerF.h ../IceSSL/EndpointI.h ../Ice/EndpointI.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h $(includedir)/Ice/EndpointFactory.h $(includedir)/Ice/EndpointFactoryF.h $(includedir)/IceSSL/EndpointInfo.h ../IceSSL/Util.h ../IceSSL/TrustManager.h ../IceSSL/RFC2253.h $(includedir)/Ice/Communicator.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/StatsF.h $(includedir)/Ice/InstrumentationF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/ProtocolPluginFacade.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/DisableWarnings.h PluginI$(OBJEXT): PluginI.cpp ../IceSSL/PluginI.h $(includedir)/IceSSL/Plugin.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Plugin.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/LoggerF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.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/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/Connection.h $(includedir)/Ice/Endpoint.h ../IceSSL/InstanceF.h ../IceSSL/Instance.h ../IceSSL/UtilF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/ProtocolPluginFacadeF.h ../IceSSL/TrustManagerF.h ../IceSSL/TransceiverI.h $(includedir)/Ice/StatsF.h ../Ice/Transceiver.h ../Ice/TransceiverF.h $(includedir)/Ice/LocalException.h TransceiverI$(OBJEXT): TransceiverI.cpp ../IceSSL/TransceiverI.h ../IceSSL/InstanceF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/IceSSL/Plugin.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/LoggerF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.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/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/Connection.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/StatsF.h ../Ice/Transceiver.h ../Ice/TransceiverF.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h ../IceSSL/Instance.h ../IceSSL/UtilF.h $(includedir)/Ice/ProtocolPluginFacadeF.h ../IceSSL/TrustManagerF.h ../IceSSL/Util.h $(includedir)/Ice/Communicator.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/InstrumentationF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LocalException.h $(includedir)/IceUtil/DisableWarnings.h $(includedir)/Ice/Stats.h Util$(OBJEXT): Util.cpp $(includedir)/IceUtil/Config.h ../IceSSL/Util.h ../IceSSL/UtilF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.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/LoggerF.h $(includedir)/IceSSL/Plugin.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Endpoint.h $(includedir)/IceUtil/FileUtil.h $(includedir)/Ice/LocalException.h $(includedir)/IceUtil/DisableWarnings.h RFC2253$(OBJEXT): RFC2253.cpp $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceSSL/Plugin.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/Plugin.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/LoggerF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.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/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/Connection.h $(includedir)/Ice/Endpoint.h ../IceSSL/RFC2253.h TrustManager$(OBJEXT): TrustManager.cpp ../IceSSL/TrustManager.h $(includedir)/Ice/CommunicatorF.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h ../IceSSL/TrustManagerF.h $(includedir)/IceSSL/Plugin.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.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/Connection.h $(includedir)/Ice/Endpoint.h ../IceSSL/RFC2253.h $(includedir)/Ice/Properties.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/PropertiesAdmin.h $(includedir)/Ice/Communicator.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/LocalException.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/PropertiesF.h $(HDIR)/EndpointInfo.h EndpointInfo.cpp: $(slicedir)/IceSSL/EndpointInfo.ice $(slicedir)/Ice/Endpoint.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/EndpointF.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/ConnectionInfo.h ConnectionInfo.cpp: $(slicedir)/IceSSL/ConnectionInfo.ice $(slicedir)/Ice/Connection.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/Endpoint.ice $(slicedir)/Ice/Version.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/EndpointF.ice $(SLICE2CPP) $(SLICEPARSERLIB) Ice-3.5.1/cpp/src/IceSSL/TransceiverI.h0000644000076400007640000000613712223561476015603 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_TRANSCEIVER_I_H #define ICE_SSL_TRANSCEIVER_I_H #include #include #include #include #include #include typedef struct ssl_st SSL; typedef struct bio_st BIO; namespace IceSSL { class ConnectorI; class AcceptorI; class TransceiverI : public IceInternal::Transceiver, public IceInternal::NativeInfo { enum State { StateNeedConnect, StateConnectPending, StateProxyConnectRequest, StateProxyConnectRequestPending, StateConnected, StateHandshakeComplete }; public: virtual IceInternal::NativeInfoPtr getNativeInfo(); #ifdef ICE_USE_IOCP virtual IceInternal::AsyncInfo* getAsyncInfo(IceInternal::SocketOperation); #endif virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); virtual void close(); virtual bool write(IceInternal::Buffer&); virtual bool read(IceInternal::Buffer&); #ifdef ICE_USE_IOCP virtual bool startWrite(IceInternal::Buffer&); virtual void finishWrite(IceInternal::Buffer&); virtual void startRead(IceInternal::Buffer&); virtual void finishRead(IceInternal::Buffer&); #endif virtual std::string type() const; virtual std::string toString() const; virtual Ice::ConnectionInfoPtr getInfo() const; virtual void checkSendSize(const IceInternal::Buffer&, size_t); private: TransceiverI(const InstancePtr&, SOCKET, const IceInternal::NetworkProxyPtr&, const std::string&, const IceInternal::Address&); TransceiverI(const InstancePtr&, SOCKET, const std::string&); virtual ~TransceiverI(); virtual NativeConnectionInfoPtr getNativeConnectionInfo() const; #ifdef ICE_USE_IOCP bool receive(); bool send(); int writeAsync(char*, int); int readAsync(char*, int); #endif bool writeRaw(IceInternal::Buffer&); bool readRaw(IceInternal::Buffer&); friend class ConnectorI; friend class AcceptorI; const InstancePtr _instance; const Ice::LoggerPtr _logger; const Ice::StatsPtr _stats; const IceInternal::NetworkProxyPtr _proxy; const std::string _host; const IceInternal::Address _addr; const std::string _adapterName; const bool _incoming; SSL* _ssl; State _state; std::string _desc; #ifdef ICE_USE_IOCP int _maxSendPacketSize; int _maxReceivePacketSize; BIO* _iocpBio; IceInternal::AsyncInfo _read; IceInternal::AsyncInfo _write; std::vector _writeBuffer; std::vector::iterator _writeI; std::vector _readBuffer; std::vector::iterator _readI; int _sentBytes; int _sentPacketSize; #endif }; typedef IceUtil::Handle TransceiverIPtr; } #endif Ice-3.5.1/cpp/src/IceSSL/Util.cpp0000644000076400007640000002603112223561476014450 0ustar mesmes// ********************************************************************** // // 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 #ifdef _WIN32 # include #endif #include #include #include #include #include #ifdef _WIN32 # include # include #endif #include #include using namespace std; using namespace Ice; using namespace IceSSL; namespace { #ifndef OPENSSL_NO_DH // The following arrays are predefined Diffie Hellman group parameters. // These are known strong primes, distributed with the OpenSSL library // in the files dh512.pem, dh1024.pem, dh2048.pem and dh4096.pem. // They are not keys themselves, but the basis for generating DH keys // on the fly. unsigned char dh512_p[] = { 0xF5,0x2A,0xFF,0x3C,0xE1,0xB1,0x29,0x40,0x18,0x11,0x8D,0x7C, 0x84,0xA7,0x0A,0x72,0xD6,0x86,0xC4,0x03,0x19,0xC8,0x07,0x29, 0x7A,0xCA,0x95,0x0C,0xD9,0x96,0x9F,0xAB,0xD0,0x0A,0x50,0x9B, 0x02,0x46,0xD3,0x08,0x3D,0x66,0xA4,0x5D,0x41,0x9F,0x9C,0x7C, 0xBD,0x89,0x4B,0x22,0x19,0x26,0xBA,0xAB,0xA2,0x5E,0xC3,0x55, 0xE9,0x2A,0x05,0x5F, }; unsigned char dh512_g[] = { 0x02 }; unsigned char dh1024_p[] = { 0xF4,0x88,0xFD,0x58,0x4E,0x49,0xDB,0xCD,0x20,0xB4,0x9D,0xE4, 0x91,0x07,0x36,0x6B,0x33,0x6C,0x38,0x0D,0x45,0x1D,0x0F,0x7C, 0x88,0xB3,0x1C,0x7C,0x5B,0x2D,0x8E,0xF6,0xF3,0xC9,0x23,0xC0, 0x43,0xF0,0xA5,0x5B,0x18,0x8D,0x8E,0xBB,0x55,0x8C,0xB8,0x5D, 0x38,0xD3,0x34,0xFD,0x7C,0x17,0x57,0x43,0xA3,0x1D,0x18,0x6C, 0xDE,0x33,0x21,0x2C,0xB5,0x2A,0xFF,0x3C,0xE1,0xB1,0x29,0x40, 0x18,0x11,0x8D,0x7C,0x84,0xA7,0x0A,0x72,0xD6,0x86,0xC4,0x03, 0x19,0xC8,0x07,0x29,0x7A,0xCA,0x95,0x0C,0xD9,0x96,0x9F,0xAB, 0xD0,0x0A,0x50,0x9B,0x02,0x46,0xD3,0x08,0x3D,0x66,0xA4,0x5D, 0x41,0x9F,0x9C,0x7C,0xBD,0x89,0x4B,0x22,0x19,0x26,0xBA,0xAB, 0xA2,0x5E,0xC3,0x55,0xE9,0x2F,0x78,0xC7, }; unsigned char dh1024_g[] = { 0x02 }; unsigned char dh2048_p[] = { 0xF6,0x42,0x57,0xB7,0x08,0x7F,0x08,0x17,0x72,0xA2,0xBA,0xD6, 0xA9,0x42,0xF3,0x05,0xE8,0xF9,0x53,0x11,0x39,0x4F,0xB6,0xF1, 0x6E,0xB9,0x4B,0x38,0x20,0xDA,0x01,0xA7,0x56,0xA3,0x14,0xE9, 0x8F,0x40,0x55,0xF3,0xD0,0x07,0xC6,0xCB,0x43,0xA9,0x94,0xAD, 0xF7,0x4C,0x64,0x86,0x49,0xF8,0x0C,0x83,0xBD,0x65,0xE9,0x17, 0xD4,0xA1,0xD3,0x50,0xF8,0xF5,0x59,0x5F,0xDC,0x76,0x52,0x4F, 0x3D,0x3D,0x8D,0xDB,0xCE,0x99,0xE1,0x57,0x92,0x59,0xCD,0xFD, 0xB8,0xAE,0x74,0x4F,0xC5,0xFC,0x76,0xBC,0x83,0xC5,0x47,0x30, 0x61,0xCE,0x7C,0xC9,0x66,0xFF,0x15,0xF9,0xBB,0xFD,0x91,0x5E, 0xC7,0x01,0xAA,0xD3,0x5B,0x9E,0x8D,0xA0,0xA5,0x72,0x3A,0xD4, 0x1A,0xF0,0xBF,0x46,0x00,0x58,0x2B,0xE5,0xF4,0x88,0xFD,0x58, 0x4E,0x49,0xDB,0xCD,0x20,0xB4,0x9D,0xE4,0x91,0x07,0x36,0x6B, 0x33,0x6C,0x38,0x0D,0x45,0x1D,0x0F,0x7C,0x88,0xB3,0x1C,0x7C, 0x5B,0x2D,0x8E,0xF6,0xF3,0xC9,0x23,0xC0,0x43,0xF0,0xA5,0x5B, 0x18,0x8D,0x8E,0xBB,0x55,0x8C,0xB8,0x5D,0x38,0xD3,0x34,0xFD, 0x7C,0x17,0x57,0x43,0xA3,0x1D,0x18,0x6C,0xDE,0x33,0x21,0x2C, 0xB5,0x2A,0xFF,0x3C,0xE1,0xB1,0x29,0x40,0x18,0x11,0x8D,0x7C, 0x84,0xA7,0x0A,0x72,0xD6,0x86,0xC4,0x03,0x19,0xC8,0x07,0x29, 0x7A,0xCA,0x95,0x0C,0xD9,0x96,0x9F,0xAB,0xD0,0x0A,0x50,0x9B, 0x02,0x46,0xD3,0x08,0x3D,0x66,0xA4,0x5D,0x41,0x9F,0x9C,0x7C, 0xBD,0x89,0x4B,0x22,0x19,0x26,0xBA,0xAB,0xA2,0x5E,0xC3,0x55, 0xE9,0x32,0x0B,0x3B, }; unsigned char dh2048_g[] = { 0x02 }; unsigned char dh4096_p[] = { 0xFA,0x14,0x72,0x52,0xC1,0x4D,0xE1,0x5A,0x49,0xD4,0xEF,0x09, 0x2D,0xC0,0xA8,0xFD,0x55,0xAB,0xD7,0xD9,0x37,0x04,0x28,0x09, 0xE2,0xE9,0x3E,0x77,0xE2,0xA1,0x7A,0x18,0xDD,0x46,0xA3,0x43, 0x37,0x23,0x90,0x97,0xF3,0x0E,0xC9,0x03,0x50,0x7D,0x65,0xCF, 0x78,0x62,0xA6,0x3A,0x62,0x22,0x83,0xA1,0x2F,0xFE,0x79,0xBA, 0x35,0xFF,0x59,0xD8,0x1D,0x61,0xDD,0x1E,0x21,0x13,0x17,0xFE, 0xCD,0x38,0x87,0x9E,0xF5,0x4F,0x79,0x10,0x61,0x8D,0xD4,0x22, 0xF3,0x5A,0xED,0x5D,0xEA,0x21,0xE9,0x33,0x6B,0x48,0x12,0x0A, 0x20,0x77,0xD4,0x25,0x60,0x61,0xDE,0xF6,0xB4,0x4F,0x1C,0x63, 0x40,0x8B,0x3A,0x21,0x93,0x8B,0x79,0x53,0x51,0x2C,0xCA,0xB3, 0x7B,0x29,0x56,0xA8,0xC7,0xF8,0xF4,0x7B,0x08,0x5E,0xA6,0xDC, 0xA2,0x45,0x12,0x56,0xDD,0x41,0x92,0xF2,0xDD,0x5B,0x8F,0x23, 0xF0,0xF3,0xEF,0xE4,0x3B,0x0A,0x44,0xDD,0xED,0x96,0x84,0xF1, 0xA8,0x32,0x46,0xA3,0xDB,0x4A,0xBE,0x3D,0x45,0xBA,0x4E,0xF8, 0x03,0xE5,0xDD,0x6B,0x59,0x0D,0x84,0x1E,0xCA,0x16,0x5A,0x8C, 0xC8,0xDF,0x7C,0x54,0x44,0xC4,0x27,0xA7,0x3B,0x2A,0x97,0xCE, 0xA3,0x7D,0x26,0x9C,0xAD,0xF4,0xC2,0xAC,0x37,0x4B,0xC3,0xAD, 0x68,0x84,0x7F,0x99,0xA6,0x17,0xEF,0x6B,0x46,0x3A,0x7A,0x36, 0x7A,0x11,0x43,0x92,0xAD,0xE9,0x9C,0xFB,0x44,0x6C,0x3D,0x82, 0x49,0xCC,0x5C,0x6A,0x52,0x42,0xF8,0x42,0xFB,0x44,0xF9,0x39, 0x73,0xFB,0x60,0x79,0x3B,0xC2,0x9E,0x0B,0xDC,0xD4,0xA6,0x67, 0xF7,0x66,0x3F,0xFC,0x42,0x3B,0x1B,0xDB,0x4F,0x66,0xDC,0xA5, 0x8F,0x66,0xF9,0xEA,0xC1,0xED,0x31,0xFB,0x48,0xA1,0x82,0x7D, 0xF8,0xE0,0xCC,0xB1,0xC7,0x03,0xE4,0xF8,0xB3,0xFE,0xB7,0xA3, 0x13,0x73,0xA6,0x7B,0xC1,0x0E,0x39,0xC7,0x94,0x48,0x26,0x00, 0x85,0x79,0xFC,0x6F,0x7A,0xAF,0xC5,0x52,0x35,0x75,0xD7,0x75, 0xA4,0x40,0xFA,0x14,0x74,0x61,0x16,0xF2,0xEB,0x67,0x11,0x6F, 0x04,0x43,0x3D,0x11,0x14,0x4C,0xA7,0x94,0x2A,0x39,0xA1,0xC9, 0x90,0xCF,0x83,0xC6,0xFF,0x02,0x8F,0xA3,0x2A,0xAC,0x26,0xDF, 0x0B,0x8B,0xBE,0x64,0x4A,0xF1,0xA1,0xDC,0xEE,0xBA,0xC8,0x03, 0x82,0xF6,0x62,0x2C,0x5D,0xB6,0xBB,0x13,0x19,0x6E,0x86,0xC5, 0x5B,0x2B,0x5E,0x3A,0xF3,0xB3,0x28,0x6B,0x70,0x71,0x3A,0x8E, 0xFF,0x5C,0x15,0xE6,0x02,0xA4,0xCE,0xED,0x59,0x56,0xCC,0x15, 0x51,0x07,0x79,0x1A,0x0F,0x25,0x26,0x27,0x30,0xA9,0x15,0xB2, 0xC8,0xD4,0x5C,0xCC,0x30,0xE8,0x1B,0xD8,0xD5,0x0F,0x19,0xA8, 0x80,0xA4,0xC7,0x01,0xAA,0x8B,0xBA,0x53,0xBB,0x47,0xC2,0x1F, 0x6B,0x54,0xB0,0x17,0x60,0xED,0x79,0x21,0x95,0xB6,0x05,0x84, 0x37,0xC8,0x03,0xA4,0xDD,0xD1,0x06,0x69,0x8F,0x4C,0x39,0xE0, 0xC8,0x5D,0x83,0x1D,0xBE,0x6A,0x9A,0x99,0xF3,0x9F,0x0B,0x45, 0x29,0xD4,0xCB,0x29,0x66,0xEE,0x1E,0x7E,0x3D,0xD7,0x13,0x4E, 0xDB,0x90,0x90,0x58,0xCB,0x5E,0x9B,0xCD,0x2E,0x2B,0x0F,0xA9, 0x4E,0x78,0xAC,0x05,0x11,0x7F,0xE3,0x9E,0x27,0xD4,0x99,0xE1, 0xB9,0xBD,0x78,0xE1,0x84,0x41,0xA0,0xDF, }; unsigned char dh4096_g[] = { 0x02 }; } // // Convert a predefined parameter set into a DH value. // static DH* convertDH(unsigned char* p, int plen, unsigned char* g, int glen) { assert(p != 0); assert(g != 0); DH* dh = DH_new(); if(dh != 0) { dh->p = BN_bin2bn(p, plen, 0); dh->g = BN_bin2bn(g, glen, 0); if((dh->p == 0) || (dh->g == 0)) { DH_free(dh); dh = 0; } } return dh; } IceUtil::Shared* IceSSL::upCast(IceSSL::DHParams* p) { return p; } IceSSL::DHParams::DHParams() : _dh512(0), _dh1024(0), _dh2048(0), _dh4096(0) { } IceSSL::DHParams::~DHParams() { for(ParamList::iterator p = _params.begin(); p != _params.end(); ++p) { DH_free(p->second); } DH_free(_dh512); DH_free(_dh1024); DH_free(_dh2048); DH_free(_dh4096); } bool IceSSL::DHParams::add(int keyLength, const string& file) { BIO* bio = BIO_new(BIO_s_file()); if(BIO_read_filename(bio, file.c_str()) <= 0) { BIO_free(bio); return false; } DH* dh = PEM_read_bio_DHparams(bio, 0, 0, 0); BIO_free(bio); if(!dh) { return false; } ParamList::iterator p = _params.begin(); while(p != _params.end() && keyLength > p->first) { ++p; } _params.insert(p, KeyParamPair(keyLength, dh)); return true; } DH* IceSSL::DHParams::get(int keyLength) { // // First check the set of parameters specified by the user. // Return the first set whose key length is at least keyLength. // for(ParamList::iterator p = _params.begin(); p != _params.end(); ++p) { if(p->first >= keyLength) { return p->second; } } // // No match found. Use one of the predefined parameter sets instead. // IceUtil::Mutex::Lock sync(*this); if(keyLength >= 4096) { if(!_dh4096) { _dh4096 = convertDH(dh4096_p, (int) sizeof(dh4096_p), dh4096_g, (int) sizeof(dh4096_g)); } return _dh4096; } else if(keyLength >= 2048) { if(!_dh2048) { _dh2048 = convertDH(dh2048_p, (int) sizeof(dh2048_p), dh2048_g, (int) sizeof(dh2048_g)); } return _dh2048; } else if(keyLength >= 1024) { if(!_dh1024) { _dh1024 = convertDH(dh1024_p, (int) sizeof(dh1024_p), dh1024_g, (int) sizeof(dh1024_g)); } return _dh1024; } else { if(!_dh512) { _dh512 = convertDH(dh512_p, (int) sizeof(dh512_p), dh512_g, (int) sizeof(dh512_g)); } return _dh512; } } #endif bool IceSSL::checkPath(string& path, const string& defaultDir, bool dir) { // // Check if file exists. If not, try prepending the default // directory and check again. If the path exists, the string // argument is modified and true is returned. Otherwise // false is returned. // IceUtilInternal::structstat st; int err = IceUtilInternal::stat(path, &st); if(err == 0) { return dir ? S_ISDIR(st.st_mode) != 0 : S_ISREG(st.st_mode) != 0; } if(!defaultDir.empty()) { #ifdef _WIN32 string s = defaultDir + "\\" + path; #else string s = defaultDir + "/" + path; #endif err = ::IceUtilInternal::stat(s.c_str(), &st); if(err == 0 && ((!dir && S_ISREG(st.st_mode)) || (dir && S_ISDIR(st.st_mode)))) { path = s; return true; } } return false; } string IceSSL::getSslErrors(bool verbose) { ostringstream ostr; const char* file; const char* data; int line; int flags; unsigned long err; int count = 0; while((err = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0) { if(count > 0) { ostr << endl; } if(verbose) { if(count > 0) { ostr << endl; } char buf[200]; ERR_error_string_n(err, buf, sizeof(buf)); ostr << "error # = " << err << endl; ostr << "message = " << buf << endl; ostr << "location = " << file << ", " << line; if(flags & ERR_TXT_STRING) { ostr << endl; ostr << "data = " << data; } } else { const char* reason = ERR_reason_error_string(err); ostr << (reason == NULL ? "unknown reason" : reason); if(flags & ERR_TXT_STRING) { ostr << ": " << data; } } ++count; } ERR_clear_error(); return ostr.str(); } Ice-3.5.1/cpp/src/IceSSL/PluginI.h0000644000076400007640000000174612223561476014555 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_PLUGIN_I_H #define ICE_SSL_PLUGIN_I_H #include #include #include namespace IceSSL { class PluginI : public IceSSL::Plugin { public: PluginI(const Ice::CommunicatorPtr&); // // From Ice::Plugin. // virtual void initialize(); virtual void destroy(); // // From IceSSL::Plugin. // virtual void setContext(SSL_CTX*); virtual SSL_CTX* getContext(); virtual void setCertificateVerifier(const CertificateVerifierPtr&); virtual void setPasswordPrompt(const PasswordPromptPtr&); private: InstancePtr _instance; }; } #endif Ice-3.5.1/cpp/src/IceSSL/TrustManager.cpp0000644000076400007640000001634212223561476016153 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include using namespace std; using namespace IceSSL; IceUtil::Shared* IceSSL::upCast(IceSSL::TrustManager* p) { return p; } TrustManager::TrustManager(const Ice::CommunicatorPtr& communicator) : _communicator(communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); _traceLevel = properties->getPropertyAsInt("IceSSL.Trace.Security"); string key; try { key = "IceSSL.TrustOnly"; parse(properties->getProperty(key), _rejectAll, _acceptAll); key = "IceSSL.TrustOnly.Client"; parse(properties->getProperty(key), _rejectClient, _acceptClient); key = "IceSSL.TrustOnly.Server"; parse(properties->getProperty(key), _rejectAllServer, _acceptAllServer); Ice::PropertyDict dict = properties->getPropertiesForPrefix("IceSSL.TrustOnly.Server."); for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p) { string name = p->first.substr(string("IceSSL.TrustOnly.Server.").size()); key = p->first; list reject, accept; parse(p->second, reject, accept); if(!reject.empty()) { _rejectServer[name] = reject; } if(!accept.empty()) { _acceptServer[name] = accept; } } } catch(const ParseException& e) { Ice::PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: invalid property " + key + ":\n" + e.reason; throw ex; } } bool TrustManager::verify(const NativeConnectionInfoPtr& info) { list > reject, accept; if(_rejectAll.size() > 0) { reject.push_back(_rejectAll); } if(info->incoming) { if(_rejectAllServer.size() > 0) { reject.push_back(_rejectAllServer); } if(info->adapterName.size() > 0) { map >::const_iterator p = _rejectServer.find(info->adapterName); if(p != _rejectServer.end()) { reject.push_back(p->second); } } } else { if(_rejectClient.size() > 0) { reject.push_back(_rejectClient); } } if(_acceptAll.size() > 0) { accept.push_back(_acceptAll); } if(info->incoming) { if(_acceptAllServer.size() > 0) { accept.push_back(_acceptAllServer); } if(info->adapterName.size() > 0) { map >::const_iterator p = _acceptServer.find(info->adapterName); if(p != _acceptServer.end()) { accept.push_back(p->second); } } } else { if(_acceptClient.size() > 0) { accept.push_back(_acceptClient); } } // // If there is nothing to match against, then we accept the cert. // if(reject.empty() && accept.empty()) { return true; } // // If there is no certificate then we match false. // if(info->nativeCerts.size() != 0) { DistinguishedName subject = info->nativeCerts[0]->getSubjectDN(); if(_traceLevel > 0) { Ice::Trace trace(_communicator->getLogger(), "Security"); if(info->incoming) { trace << "trust manager evaluating client:\n" << "subject = " << string(subject) << '\n' << "adapter = " << info->adapterName << '\n' << "local addr = " << info->localAddress << ":" << info->localPort << '\n' << "remote addr = " << info->remoteAddress << ":" << info->remotePort; } else { trace << "trust manager evaluating server:\n" << "subject = " << string(subject) << '\n' << "local addr = " << info->localAddress << ":" << info->localPort << '\n' << "remote addr = " << info->remoteAddress << ":" << info->remotePort; } } // // Fail if we match anything in the reject set. // for(list >::const_iterator p = reject.begin(); p != reject.end(); ++p) { if(_traceLevel > 1) { Ice::Trace trace(_communicator->getLogger(), "Security"); trace << "trust manager rejecting PDNs:\n"; for(list::const_iterator r = p->begin(); r != p->end(); ++r) { if(r != p->begin()) { trace << ';'; } trace << string(*r); } } if(match(*p, subject)) { return false; } } // // Succeed if we match anything in the accept set. // for(list >::const_iterator p = accept.begin(); p != accept.end(); ++p) { if(_traceLevel > 1) { Ice::Trace trace(_communicator->getLogger(), "Security"); trace << "trust manager accepting PDNs:\n"; for(list::const_iterator r = p->begin(); r != p->end(); ++r) { if(r != p->begin()) { trace << ';'; } trace << string(*r); } } if(match(*p, subject)) { return true; } } // // At this point we accept the connection if there are no explicit accept rules. // return accept.empty(); } return false; } bool TrustManager::match(const list< DistinguishedName>& matchSet, const DistinguishedName& subject) const { for(list::const_iterator r = matchSet.begin(); r != matchSet.end(); ++r) { if(subject.match(*r)) { return true; } } return false; } void TrustManager::parse(const string& value, list& reject, list& accept) const { if(!value.empty()) { RFC2253::RDNEntrySeq dns = RFC2253::parse(value); for(RFC2253::RDNEntrySeq::const_iterator p = dns.begin(); p != dns.end(); ++p) { if(p->negate) { reject.push_back(DistinguishedName(p->rdn)); } else { accept.push_back(DistinguishedName(p->rdn)); } } } } Ice-3.5.1/cpp/src/IceSSL/AcceptorI.cpp0000644000076400007640000001610212223561476015402 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #ifdef ICE_USE_IOCP # include #endif using namespace std; using namespace Ice; using namespace IceSSL; IceInternal::NativeInfoPtr IceSSL::AcceptorI::getNativeInfo() { return this; } #ifdef ICE_USE_IOCP IceInternal::AsyncInfo* # ifndef NDEBUG IceSSL::AcceptorI::getAsyncInfo(IceInternal::SocketOperation status) # else IceSSL::AcceptorI::getAsyncInfo(IceInternal::SocketOperation) # endif { assert(status == IceInternal::SocketOperationRead); return &_info; } #endif void IceSSL::AcceptorI::close() { if(_instance->networkTraceLevel() >= 1) { Trace out(_logger, _instance->networkTraceCategory()); out << "stopping to accept ssl connections at " << toString(); } SOCKET fd = _fd; _fd = INVALID_SOCKET; IceInternal::closeSocket(fd); } void IceSSL::AcceptorI::listen() { try { IceInternal::doListen(_fd, _backlog); } catch(...) { _fd = INVALID_SOCKET; throw; } if(_instance->networkTraceLevel() >= 1) { Trace out(_logger, _instance->networkTraceCategory()); out << "listening for ssl connections at " << toString(); vector interfaces = IceInternal::getHostsForEndpointExpand(IceInternal::inetAddrToString(_addr), _instance->protocolSupport(), true); if(!interfaces.empty()) { out << "\nlocal interfaces: "; out << IceUtilInternal::joinString(interfaces, ", "); } } } #ifdef ICE_USE_IOCP void IceSSL::AcceptorI::startAccept() { LPFN_ACCEPTEX AcceptEx = NULL; // a pointer to the 'AcceptEx()' function GUID GuidAcceptEx = WSAID_ACCEPTEX; // The Guid DWORD dwBytes; if(WSAIoctl(_fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &GuidAcceptEx, sizeof(GuidAcceptEx), &AcceptEx, sizeof(AcceptEx), &dwBytes, NULL, NULL) == SOCKET_ERROR) { SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } assert(_acceptFd == INVALID_SOCKET); _acceptFd = IceInternal::createSocket(false, _addr); const int sz = static_cast(_acceptBuf.size() / 2); if(!AcceptEx(_fd, _acceptFd, &_acceptBuf[0], 0, sz, sz, &_info.count, &_info)) { if(!IceInternal::wouldBlock()) { SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } } } void IceSSL::AcceptorI::finishAccept() { if(static_cast(_info.count) == SOCKET_ERROR || _fd == INVALID_SOCKET) { IceInternal::closeSocketNoThrow(_acceptFd); _acceptFd = INVALID_SOCKET; _acceptError = _info.error; } } #endif IceInternal::TransceiverPtr IceSSL::AcceptorI::accept() { // // The plug-in may not be initialized. // if(!_instance->context()) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: plug-in is not initialized"; throw ex; } #ifndef ICE_USE_IOCP SOCKET fd = IceInternal::doAccept(_fd); #else if(_acceptFd == INVALID_SOCKET) { SocketException ex(__FILE__, __LINE__); ex.error = _acceptError; throw ex; } if(setsockopt(_acceptFd, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char*)&_acceptFd, sizeof(_acceptFd)) == SOCKET_ERROR) { IceInternal::closeSocketNoThrow(_acceptFd); _acceptFd = INVALID_SOCKET; SocketException ex(__FILE__, __LINE__); ex.error = IceInternal::getSocketErrno(); throw ex; } SOCKET fd = _acceptFd; _acceptFd = INVALID_SOCKET; #endif if(_instance->networkTraceLevel() >= 1) { Trace out(_logger, _instance->networkTraceCategory()); out << "attempting to accept ssl connection\n" << IceInternal::fdToString(fd); } // // SSL handshaking is performed in TransceiverI::initialize, since // accept must not block. // return new TransceiverI(_instance, fd, _adapterName); } string IceSSL::AcceptorI::toString() const { return IceInternal::addrToString(_addr); } int IceSSL::AcceptorI::effectivePort() const { if(_addr.saStorage.ss_family == AF_INET) { return ntohs(_addr.saIn.sin_port); } else { return ntohs(_addr.saIn6.sin6_port); } } IceSSL::AcceptorI::AcceptorI(const InstancePtr& instance, const string& adapterName, const string& host, int port) : _instance(instance), _adapterName(adapterName), _logger(instance->communicator()->getLogger()), _addr(IceInternal::getAddressForServer(host, port, instance->protocolSupport(), instance->preferIPv6())) #ifdef ICE_USE_IOCP , _acceptFd(INVALID_SOCKET), _info(IceInternal::SocketOperationRead) #endif { #ifdef SOMAXCONN _backlog = instance->communicator()->getProperties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", SOMAXCONN); #else _backlog = instance->communicator()->getProperties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511); #endif IceInternal::ProtocolSupport protocol = instance->protocolSupport(); _fd = IceInternal::createServerSocket(false, _addr, protocol); #ifdef ICE_USE_IOCP _acceptBuf.resize((sizeof(sockaddr_storage) + 16) * 2); #endif IceInternal::setBlock(_fd, false); IceInternal::setTcpBufSize(_fd, _instance->communicator()->getProperties(), _logger); #ifndef _WIN32 // // Enable SO_REUSEADDR on Unix platforms to allow re-using the // socket even if it's in the TIME_WAIT state. On Windows, // this doesn't appear to be necessary and enabling // SO_REUSEADDR would actually not be a good thing since it // allows a second process to bind to an address even it's // already bound by another process. // // TODO: using SO_EXCLUSIVEADDRUSE on Windows would probably // be better but it's only supported by recent Windows // versions (XP SP2, Windows Server 2003). // IceInternal::setReuseAddress(_fd, true); #endif if(_instance->networkTraceLevel() >= 2) { Trace out(_logger, _instance->networkTraceCategory()); out << "attempting to bind to ssl socket " << toString(); } const_cast(_addr) = IceInternal::doBind(_fd, _addr); } IceSSL::AcceptorI::~AcceptorI() { assert(_fd == INVALID_SOCKET); #ifdef ICE_USE_IOCP assert(_acceptFd == INVALID_SOCKET); #endif } Ice-3.5.1/cpp/src/IceSSL/UtilF.h0000644000076400007640000000120312223561476014215 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_UTIL_F_H #define ICE_SSL_UTIL_F_H #include #include #include #ifndef OPENSSL_NO_DH namespace IceSSL { class DHParams; IceUtil::Shared* upCast(IceSSL::DHParams*); typedef IceInternal::Handle DHParamsPtr; } #endif #endif Ice-3.5.1/cpp/src/IceSSL/EndpointI.h0000644000076400007640000000610612223561476015072 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_ENDPOINT_I_H #define ICE_SSL_ENDPOINT_I_H #include #include #include #include #include namespace IceSSL { class EndpointI : public IceInternal::EndpointI { public: EndpointI(const InstancePtr&, const std::string&, Ice::Int, Ice::Int, const std::string&, bool); EndpointI(const InstancePtr&, const std::string&, bool); EndpointI(const InstancePtr&, IceInternal::BasicStream*); virtual void streamWrite(IceInternal::BasicStream*) const; virtual std::string toString() const; virtual Ice::EndpointInfoPtr getInfo() const; virtual Ice::Short type() const; virtual std::string protocol() const; virtual Ice::Int timeout() const; virtual IceInternal::EndpointIPtr timeout(Ice::Int) const; virtual IceInternal::EndpointIPtr connectionId(const ::std::string&) const; virtual bool compress() const; virtual IceInternal::EndpointIPtr compress(bool) const; virtual bool datagram() const; virtual bool secure() const; virtual IceInternal::TransceiverPtr transceiver(IceInternal::EndpointIPtr&) const; virtual std::vector connectors(Ice::EndpointSelectionType) const; virtual void connectors_async(Ice::EndpointSelectionType, const IceInternal::EndpointI_connectorsPtr&) const; virtual IceInternal::AcceptorPtr acceptor(IceInternal::EndpointIPtr&, const std::string&) const; virtual std::vector expand() const; virtual bool equivalent(const IceInternal::EndpointIPtr&) const; virtual std::vector connectors(const std::vector&, const IceInternal::NetworkProxyPtr&) const; virtual bool operator==(const Ice::LocalObject&) const; virtual bool operator<(const Ice::LocalObject&) const; #ifdef __SUNPRO_CC using IceInternal::EndpointI::connectionId; #endif private: virtual ::Ice::Int hashInit() const; // // All members are const, because endpoints are immutable. // const InstancePtr _instance; const std::string _host; const Ice::Int _port; const Ice::Int _timeout; const bool _compress; }; class EndpointFactoryI : public IceInternal::EndpointFactory { public: virtual ~EndpointFactoryI(); virtual Ice::Short type() const; virtual std::string protocol() const; virtual IceInternal::EndpointIPtr create(const std::string&, bool) const; virtual IceInternal::EndpointIPtr read(IceInternal::BasicStream*) const; virtual void destroy(); private: EndpointFactoryI(const InstancePtr&); friend class Instance; InstancePtr _instance; }; } #endif Ice-3.5.1/cpp/src/IceSSL/PluginI.cpp0000644000076400007640000000300212223561476015073 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace Ice; using namespace IceSSL; // // Plug-in factory function. // extern "C" { ICE_DECLSPEC_EXPORT Ice::Plugin* createIceSSL(const CommunicatorPtr& communicator, const string& /*name*/, const StringSeq& /*args*/) { PluginI* plugin = new PluginI(communicator); return plugin; } } // // Plugin implementation. // IceSSL::PluginI::PluginI(const Ice::CommunicatorPtr& communicator) { _instance = new Instance(communicator); } void IceSSL::PluginI::initialize() { _instance->initialize(); } void IceSSL::PluginI::destroy() { _instance->destroy(); _instance = 0; } void IceSSL::PluginI::setContext(SSL_CTX* context) { _instance->context(context); } SSL_CTX* IceSSL::PluginI::getContext() { return _instance->context(); } void IceSSL::PluginI::setCertificateVerifier(const CertificateVerifierPtr& verifier) { _instance->setCertificateVerifier(verifier); } void IceSSL::PluginI::setPasswordPrompt(const PasswordPromptPtr& prompt) { _instance->setPasswordPrompt(prompt); } Ice-3.5.1/cpp/src/IceSSL/Instance.h0000644000076400007640000000505312223561476014745 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_INSTANCE_H #define ICE_SSL_INSTANCE_H #include #include #include #include #include #include #include #include #include namespace IceSSL { class Instance : public IceUtil::Shared { public: Instance(const Ice::CommunicatorPtr&); ~Instance(); void initialize(); void context(SSL_CTX*); SSL_CTX* context() const; void setCertificateVerifier(const CertificateVerifierPtr&); void setPasswordPrompt(const PasswordPromptPtr&); Ice::CommunicatorPtr communicator() const; IceInternal::EndpointHostResolverPtr endpointHostResolver() const; IceInternal::ProtocolSupport protocolSupport() const; bool preferIPv6() const; IceInternal::NetworkProxyPtr networkProxy() const; std::string defaultHost() const; Ice::EncodingVersion defaultEncoding() const; int networkTraceLevel() const; std::string networkTraceCategory() const; int securityTraceLevel() const; std::string securityTraceCategory() const; void verifyPeer(SSL*, SOCKET, const std::string&, const NativeConnectionInfoPtr&); std::string sslErrors() const; void traceConnection(SSL*, bool); void destroy(); // // OpenSSL callbacks. // std::string password(bool); int verifyCallback(int, SSL*, X509_STORE_CTX*); #ifndef OPENSSL_NO_DH DH* dhParams(int); #endif private: enum Protocols { SSLv3 = 0x01, TLSv1_0 = 0x02, TLSv1_1 = 0x04, TLSv1_2 = 0x08 }; static int parseProtocols(const Ice::StringSeq&); static SSL_METHOD* getMethod(int); void setOptions(int); Ice::LoggerPtr _logger; bool _initOpenSSL; IceInternal::ProtocolPluginFacadePtr _facade; int _securityTraceLevel; std::string _securityTraceCategory; bool _initialized; SSL_CTX* _ctx; std::string _defaultDir; bool _checkCertName; int _verifyDepthMax; int _verifyPeer; std::string _password; #ifndef OPENSSL_NO_DH DHParamsPtr _dhParams; #endif CertificateVerifierPtr _verifier; PasswordPromptPtr _prompt; TrustManagerPtr _trustManager; }; } #endif Ice-3.5.1/cpp/src/IceSSL/Certificate.cpp0000644000076400007640000003161112223561476015755 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #ifdef __SUNPRO_CC // // The call to sk_GENERAL_NAME_pop_free fails to compile if we don't // remove the extern "C" vs non extern "C" check with the macro below: // extern "C" typedef void (*FreeFunc)(void*); #undef CHECKED_SK_FREE_FUNC #define CHECKED_SK_FREE_FUNC(type, p) \ (FreeFunc) (p) #endif using namespace std; using namespace Ice; using namespace IceSSL; const char* IceSSL::CertificateReadException::_name = "IceSSL::CertificateReadException"; CertificateReadException::CertificateReadException(const char* file, int line, const string& r) : Exception(file, line), reason(r) { } CertificateReadException::~CertificateReadException() throw() { } string CertificateReadException::ice_name() const { return _name; } CertificateReadException* CertificateReadException::ice_clone() const { return new CertificateReadException(*this); } void CertificateReadException::ice_throw() const { throw *this; } const char* IceSSL::CertificateEncodingException::_name = "IceSSL::CertificateEncodingException"; CertificateEncodingException::CertificateEncodingException(const char* file, int line, const string& r) : Exception(file, line), reason(r) { } CertificateEncodingException::~CertificateEncodingException() throw() { } string CertificateEncodingException::ice_name() const { return _name; } CertificateEncodingException* CertificateEncodingException::ice_clone() const { return new CertificateEncodingException(*this); } void CertificateEncodingException::ice_throw() const { throw *this; } namespace { IceUtil::Mutex* mut = 0; class Init { public: Init() { mut = new IceUtil::Mutex; } ~Init() { delete mut; mut = 0; } }; Init init; } static IceUtil::Time ASMUtcTimeToIceUtilTime(const ASN1_UTCTIME* s) { struct tm tm; int offset; memset(&tm, '\0', sizeof tm); #define g2(p) (((p)[0]-'0')*10+(p)[1]-'0') tm.tm_year = g2(s->data); if(tm.tm_year < 50) tm.tm_year += 100; tm.tm_mon = g2(s->data + 2) - 1; tm.tm_mday = g2(s->data + 4); tm.tm_hour = g2(s->data + 6); tm.tm_min = g2(s->data + 8); tm.tm_sec = g2(s->data + 10); if(s->data[12] == 'Z') { offset = 0; } else { offset = g2(s->data + 13) * 60 + g2(s->data + 15); if(s->data[12] == '-') { offset = -offset; } } #undef g2 // // If timegm was on all systems this code could be // return IceUtil::Time::seconds(timegm(&tm) - offset*60); // // Windows doesn't support the re-entrant _r versions. // time_t tzone; { IceUtilInternal::MutexPtrLock sync(mut); time_t now = time(0); tzone = mktime(localtime(&now)) - mktime(gmtime(&now)); } return IceUtil::Time::seconds(mktime(&tm) - offset*60 + tzone); } static string convertX509NameToString(X509NAME* name) { BIO* out = BIO_new(BIO_s_mem()); X509_NAME_print_ex(out, name, 0, XN_FLAG_RFC2253); BUF_MEM* p; BIO_get_mem_ptr(out, &p); string result = string(p->data, p->length); BIO_free(out); return result; } static vector > convertGeneralNames(GENERAL_NAMES* gens) { vector > alt; if(gens == 0) { return alt; } for(int i = 0; i < sk_GENERAL_NAME_num(gens); ++i) { GENERAL_NAME* gen = sk_GENERAL_NAME_value(gens, i); pair p; p.first = gen->type; switch(gen->type) { case GEN_EMAIL: { ASN1_IA5STRING* str = gen->d.rfc822Name; if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0) { p.second = string(reinterpret_cast(str->data), str->length); } break; } case GEN_DNS: { ASN1_IA5STRING* str = gen->d.dNSName; if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0) { p.second = string(reinterpret_cast(str->data), str->length); } break; } case GEN_DIRNAME: { p.second = convertX509NameToString(gen->d.directoryName); break; } case GEN_URI: { ASN1_IA5STRING* str = gen->d.uniformResourceIdentifier; if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0) { p.second = string(reinterpret_cast(str->data), str->length); } break; } case GEN_IPADD: { ASN1_OCTET_STRING* addr = gen->d.iPAddress; // TODO: Support IPv6 someday. if(addr && addr->type == V_ASN1_OCTET_STRING && addr->data && addr->length == 4) { ostringstream ostr; for(int j = 0; j < 4; ++j) { if(j > 0) { ostr << '.'; } ostr << static_cast(addr->data[j]); } p.second = ostr.str(); } break; } case GEN_OTHERNAME: case GEN_EDIPARTY: case GEN_X400: case GEN_RID: { // // TODO: These types are not supported. If the user wants // them, they have to get at the certificate data. Another // alternative is to DER encode the data (as the Java // certificate does). // break; } } alt.push_back(p); } sk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free); return alt; } const char* ParseException::_name = "IceSSL::ParseException"; ParseException::ParseException(const char* file, int line, const string& r) : Exception(file, line), reason(r) { } ParseException::~ParseException() throw() { } string ParseException::ice_name() const { return _name; } ParseException* ParseException::ice_clone() const { return new ParseException(*this); } void ParseException::ice_throw() const { throw *this; } DistinguishedName::DistinguishedName(X509NAME* name) : _rdns(RFC2253::parseStrict(convertX509NameToString(name))) { unescape(); } DistinguishedName::DistinguishedName(const string& dn) : _rdns(RFC2253::parseStrict(dn)) { unescape(); } DistinguishedName::DistinguishedName(const list >& rdns) : _rdns(rdns) { unescape(); } bool DistinguishedName::operator==(const DistinguishedName& other) const { return other._unescaped == _unescaped; } bool DistinguishedName::operator!=(const DistinguishedName& other) const { return other._unescaped != _unescaped; } bool DistinguishedName::operator<(const DistinguishedName& other) const { return other._unescaped < _unescaped; } bool DistinguishedName::match(const DistinguishedName& other) const { for(list< pair >::const_iterator p = other._unescaped.begin(); p != other._unescaped.end(); ++p) { bool found = false; for(list< pair >::const_iterator q = _unescaped.begin(); q != _unescaped.end(); ++q) { if(p->first == q->first) { found = true; if(p->second != q->second) { return false; } } } if(!found) { return false; } } return true; } // // This always produces the same output as the input DN -- the type of // escaping is not changed. // DistinguishedName::operator string() const { ostringstream os; bool first = true; for(list< pair >::const_iterator p = _rdns.begin(); p != _rdns.end(); ++p) { if(!first) { os << ","; } first = false; os << p->first << "=" << p->second; } return os.str(); } void DistinguishedName::unescape() { for(list< pair >::const_iterator q = _rdns.begin(); q != _rdns.end(); ++q) { pair rdn = *q; rdn.second = RFC2253::unescape(rdn.second); _unescaped.push_back(rdn); } } PublicKey::PublicKey(EVP_PKEY* key) : _key(key) { } PublicKey::~PublicKey() { EVP_PKEY_free(_key); } EVP_PKEY* PublicKey::key() const { return _key; } // // The caller is responsible for incrementing the reference count. // Certificate::Certificate(X509* cert) : _cert(cert) { assert(_cert != 0); } Certificate::~Certificate() { X509_free(_cert); } CertificatePtr Certificate::load(const string& file) { BIO *cert = BIO_new(BIO_s_file()); if(BIO_read_filename(cert, file.c_str()) <= 0) { BIO_free(cert); throw CertificateReadException(__FILE__, __LINE__, "error opening file"); } X509* x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL); if(x == NULL) { BIO_free(cert); throw CertificateReadException(__FILE__, __LINE__, "error reading file:\n" + getSslErrors(false)); } BIO_free(cert); return new Certificate(x); } CertificatePtr Certificate::decode(const string& encoding) { BIO *cert = BIO_new_mem_buf(static_cast(const_cast(&encoding[0])), static_cast(encoding.size())); X509* x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL); if(x == NULL) { BIO_free(cert); throw CertificateReadException(__FILE__, __LINE__, "error decoding certificate:\n" + getSslErrors(false)); } BIO_free(cert); return new Certificate(x); } bool Certificate::operator==(const Certificate& other) const { return X509_cmp(_cert, other._cert) == 0; } bool Certificate::operator!=(const Certificate& other) const { return X509_cmp(_cert, other._cert) != 0; } PublicKeyPtr Certificate::getPublicKey() const { return new PublicKey(X509_get_pubkey(_cert)); } bool Certificate::verify(const PublicKeyPtr& key) const { return X509_verify(_cert, key->key()) > 0; } string Certificate::encode() const { BIO* out = BIO_new(BIO_s_mem()); int i = PEM_write_bio_X509_AUX(out, _cert); if(i <= 0) { BIO_free(out); throw CertificateEncodingException(__FILE__, __LINE__, getSslErrors(false)); } BUF_MEM* p; BIO_get_mem_ptr(out, &p); string result = string(p->data, p->length); BIO_free(out); return result; } bool Certificate::checkValidity() const { IceUtil::Time now = IceUtil::Time::now(); return now > getNotBefore() && now <= getNotAfter(); } bool Certificate::checkValidity(const IceUtil::Time& now) const { return now > getNotBefore() && now <= getNotAfter(); } IceUtil::Time Certificate::getNotAfter() const { return ASMUtcTimeToIceUtilTime(X509_get_notAfter(_cert)); } IceUtil::Time Certificate::getNotBefore() const { return ASMUtcTimeToIceUtilTime(X509_get_notBefore(_cert)); } string Certificate::getSerialNumber() const { BIGNUM* bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(_cert), 0); char* dec = BN_bn2dec(bn); string result = dec; OPENSSL_free(dec); BN_free(bn); return result; } //string //Certificate::getSigAlgName() const //{ //} //string //Certificate::getSigAlgOID() const //{ //} DistinguishedName Certificate::getIssuerDN() const { return DistinguishedName(X509_get_issuer_name(_cert)); } vector > Certificate::getIssuerAlternativeNames() { return convertGeneralNames(reinterpret_cast( X509_get_ext_d2i(_cert, NID_issuer_alt_name, 0, 0))); } DistinguishedName Certificate::getSubjectDN() const { return DistinguishedName(X509_get_subject_name(_cert)); } vector > Certificate::getSubjectAlternativeNames() { return convertGeneralNames( reinterpret_cast(X509_get_ext_d2i(_cert, NID_subject_alt_name, 0, 0))); } int Certificate::getVersion() const { return static_cast(X509_get_version(_cert)); } string Certificate::toString() const { ostringstream os; os << "serial: " << getSerialNumber() << "\n"; os << "issuer: " << string(getIssuerDN()) << "\n"; os << "subject: " << string(getSubjectDN()) << "\n"; os << "notBefore: " << getNotBefore().toDateTime() << "\n"; os << "notAfter: " << getNotAfter().toDateTime(); return os.str(); } X509* Certificate::getCert() const { return _cert; } Ice-3.5.1/cpp/src/IceSSL/TrustManager.h0000644000076400007640000000263112223561476015614 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_TRUST_MANAGER_H #define ICE_SSL_TRUST_MANAGER_H #include #include #include #include #include namespace IceSSL { class TrustManager : public IceUtil::Shared { public: TrustManager(const Ice::CommunicatorPtr&); bool verify(const NativeConnectionInfoPtr&); private: bool match(const std::list< DistinguishedName> &, const DistinguishedName&) const; void parse(const std::string&, std::list&, std::list&) const; const Ice::CommunicatorPtr _communicator; int _traceLevel; std::list _rejectAll; std::list _rejectClient; std::list _rejectAllServer; std::map > _rejectServer; std::list _acceptAll; std::list _acceptClient; std::list _acceptAllServer; std::map > _acceptServer; }; } #endif Ice-3.5.1/cpp/src/IceSSL/Util.h0000644000076400007640000000230712223561476014115 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_UTIL_H #define ICE_SSL_UTIL_H #include #include #include #include #include #include #include namespace IceSSL { #ifndef OPENSSL_NO_DH class DHParams : public IceUtil::Shared, public IceUtil::Mutex { public: DHParams(); ~DHParams(); bool add(int, const std::string&); DH* get(int); private: typedef std::pair KeyParamPair; typedef std::list ParamList; ParamList _params; DH* _dh512; DH* _dh1024; DH* _dh2048; DH* _dh4096; }; #endif // // Determine if a file or directory exists, with an optional default directory. // bool checkPath(std::string&, const std::string&, bool); // // Accumulate the OpenSSL error stack into a string. // std::string getSslErrors(bool); } #endif Ice-3.5.1/cpp/src/IceSSL/EndpointI.cpp0000644000076400007640000003327012223561476015427 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceSSL; IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& ho, Int po, Int ti, const string& conId, bool co) : IceInternal::EndpointI(conId), _instance(instance), _host(ho), _port(po), _timeout(ti), _compress(co) { } IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& str, bool oaEndpoint) : IceInternal::EndpointI(""), _instance(instance), _port(0), _timeout(-1), _compress(false) { const string delim = " \t\n\r"; string::size_type beg; string::size_type end = 0; while(true) { beg = str.find_first_not_of(delim, end); if(beg == string::npos) { break; } end = str.find_first_of(delim, beg); if(end == string::npos) { end = str.length(); } string option = str.substr(beg, end - beg); if(option.length() != 2 || option[0] != '-') { EndpointParseException ex(__FILE__, __LINE__); ex.str = "expected an endpoint option but found `" + option + "' in endpoint `ssl " + str + "'"; throw ex; } string argument; string::size_type argumentBeg = str.find_first_not_of(delim, end); if(argumentBeg != string::npos && str[argumentBeg] != '-') { beg = argumentBeg; end = str.find_first_of(delim, beg); if(end == string::npos) { end = str.length(); } argument = str.substr(beg, end - beg); if(argument[0] == '\"' && argument[argument.size() - 1] == '\"') { argument = argument.substr(1, argument.size() - 2); } } switch(option[1]) { case 'h': { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -h option in endpoint `ssl " + str + "'"; throw ex; } const_cast(_host) = argument; break; } case 'p': { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -p option in endpoint `ssl " + str + "'"; throw ex; } istringstream p(argument); if(!(p >> const_cast(_port)) || !p.eof()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid port value `" + argument + "' in endpoint `ssl " + str + "'"; throw ex; } else if(_port < 0 || _port > 65535) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "port value `" + argument + "' out of range in endpoint `ssl " + str + "'"; throw ex; } break; } case 't': { if(argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "no argument provided for -t option in endpoint `ssl " + str + "'"; throw ex; } istringstream t(argument); if(!(t >> const_cast(_timeout)) || !t.eof()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "invalid timeout value `" + argument + "' in endpoint `ssl " + str + "'"; throw ex; } break; } case 'z': { if(!argument.empty()) { EndpointParseException ex(__FILE__, __LINE__); ex.str = "unexpected argument `" + argument + "' provided for -z option in `ssl " + str + "'"; throw ex; } const_cast(_compress) = true; break; } default: { Ice::EndpointParseException ex(__FILE__, __LINE__); ex.str = "unknown option `" + option + "' in endpoint `ssl " + str + "'"; throw ex; } } } if(_host.empty()) { const_cast(_host) = _instance->defaultHost(); } else if(_host == "*") { if(oaEndpoint) { const_cast(_host) = string(); } else { EndpointParseException ex(__FILE__, __LINE__); ex.str = "`-h *' not valid for proxy endpoint `ssl " + str + "'"; throw ex; } } } IceSSL::EndpointI::EndpointI(const InstancePtr& instance, IceInternal::BasicStream* s) : _instance(instance), _port(0), _timeout(-1), _compress(false) { s->startReadEncaps(); s->read(const_cast(_host), false); s->read(const_cast(_port)); s->read(const_cast(_timeout)); s->read(const_cast(_compress)); s->endReadEncaps(); } void IceSSL::EndpointI::streamWrite(IceInternal::BasicStream* s) const { s->write(EndpointType); s->startWriteEncaps(); s->write(_host, false); s->write(_port); s->write(_timeout); s->write(_compress); s->endWriteEncaps(); } string IceSSL::EndpointI::toString() 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 << "ssl"; if(!_host.empty()) { s << " -h "; bool addQuote = _host.find(':') != string::npos; if(addQuote) { s << "\""; } s << _host; if(addQuote) { s << "\""; } } s << " -p " << _port; if(_timeout != -1) { s << " -t " << _timeout; } if(_compress) { s << " -z"; } return s.str(); } Ice::EndpointInfoPtr IceSSL::EndpointI::getInfo() const { class InfoI : public IceSSL::EndpointInfo { public: InfoI(Int to, bool comp, const string& host, Int port) : IceSSL::EndpointInfo(to, comp, host, port) { } virtual Short type() const { return EndpointType; } virtual bool datagram() const { return false; } virtual bool secure() const { return true; } }; return new InfoI(_timeout, _compress, _host, _port); } Short IceSSL::EndpointI::type() const { return EndpointType; } std::string IceSSL::EndpointI::protocol() const { return "ssl"; } Int IceSSL::EndpointI::timeout() const { return _timeout; } IceInternal::EndpointIPtr IceSSL::EndpointI::timeout(Int timeout) const { if(timeout == _timeout) { return const_cast(this); } else { return new EndpointI(_instance, _host, _port, timeout, _connectionId, _compress); } } IceInternal::EndpointIPtr IceSSL::EndpointI::connectionId(const string& connectionId) const { if(connectionId == _connectionId) { return const_cast(this); } else { return new EndpointI(_instance, _host, _port, _timeout, connectionId, _compress); } } bool IceSSL::EndpointI::compress() const { return _compress; } IceInternal::EndpointIPtr IceSSL::EndpointI::compress(bool compress) const { if(compress == _compress) { return const_cast(this); } else { return new EndpointI(_instance, _host, _port, _timeout, _connectionId, compress); } } bool IceSSL::EndpointI::datagram() const { return false; } bool IceSSL::EndpointI::secure() const { return true; } IceInternal::TransceiverPtr IceSSL::EndpointI::transceiver(IceInternal::EndpointIPtr& endp) const { endp = const_cast(this); return 0; } vector IceSSL::EndpointI::connectors(Ice::EndpointSelectionType selType) const { return _instance->endpointHostResolver()->resolve(_host, _port, selType, const_cast(this)); } void IceSSL::EndpointI::connectors_async(Ice::EndpointSelectionType selType, const IceInternal::EndpointI_connectorsPtr& callback) const { _instance->endpointHostResolver()->resolve(_host, _port, selType, const_cast(this), callback); } IceInternal::AcceptorPtr IceSSL::EndpointI::acceptor(IceInternal::EndpointIPtr& endp, const string& adapterName) const { AcceptorI* p = new AcceptorI(_instance, adapterName, _host, _port); endp = new EndpointI(_instance, _host, p->effectivePort(), _timeout, _connectionId, _compress); return p; } vector IceSSL::EndpointI::expand() const { vector endps; vector hosts = IceInternal::getHostsForEndpointExpand(_host, _instance->protocolSupport(), false); if(hosts.empty()) { endps.push_back(const_cast(this)); } else { for(vector::const_iterator p = hosts.begin(); p != hosts.end(); ++p) { endps.push_back(new EndpointI(_instance, *p, _port, _timeout, _connectionId, _compress)); } } return endps; } bool IceSSL::EndpointI::equivalent(const IceInternal::EndpointIPtr& endpoint) const { const EndpointI* sslEndpointI = dynamic_cast(endpoint.get()); if(!sslEndpointI) { return false; } return sslEndpointI->_host == _host && sslEndpointI->_port == _port; } vector IceSSL::EndpointI::connectors(const vector& addresses, const IceInternal::NetworkProxyPtr& proxy) const { vector connectors; for(unsigned int i = 0; i < addresses.size(); ++i) { connectors.push_back(new ConnectorI(_instance, _host, addresses[i], proxy, _timeout, _connectionId)); } return connectors; } bool IceSSL::EndpointI::operator==(const Ice::LocalObject& r) const { const EndpointI* p = dynamic_cast(&r); if(!p) { return false; } if(this == p) { return true; } if(_host != p->_host) { return false; } if(_port != p->_port) { return false; } if(_timeout != p->_timeout) { return false; } if(_connectionId != p->_connectionId) { return false; } if(_compress != p->_compress) { return false; } return true; } bool IceSSL::EndpointI::operator<(const Ice::LocalObject& r) const { const EndpointI* p = dynamic_cast(&r); if(!p) { const IceInternal::EndpointI* e = dynamic_cast(&r); if(!e) { return false; } return type() < e->type(); } if(this == p) { return false; } if(_host < p->_host) { return true; } else if (p->_host < _host) { return false; } if(_port < p->_port) { return true; } else if(p->_port < _port) { 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; } Ice::Int IceSSL::EndpointI::hashInit() const { Int h = 5381; IceInternal::hashAdd(h, EndpointType); IceInternal::hashAdd(h, _host); IceInternal::hashAdd(h, _port); IceInternal::hashAdd(h, _timeout); IceInternal::hashAdd(h, _connectionId); IceInternal::hashAdd(h, _compress); return h; } IceSSL::EndpointFactoryI::EndpointFactoryI(const InstancePtr& instance) : _instance(instance) { } IceSSL::EndpointFactoryI::~EndpointFactoryI() { } Short IceSSL::EndpointFactoryI::type() const { return EndpointType; } string IceSSL::EndpointFactoryI::protocol() const { return "ssl"; } IceInternal::EndpointIPtr IceSSL::EndpointFactoryI::create(const string& str, bool oaEndpoint) const { return new EndpointI(_instance, str, oaEndpoint); } IceInternal::EndpointIPtr IceSSL::EndpointFactoryI::read(IceInternal::BasicStream* s) const { return new EndpointI(_instance, s); } void IceSSL::EndpointFactoryI::destroy() { _instance = 0; } Ice-3.5.1/cpp/src/IceSSL/TrustManagerF.h0000644000076400007640000000115612223561476015723 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_TRUST_MANAGER_F_H #define ICE_SSL_TRUST_MANAGER_F_H #include #include namespace IceSSL { class TrustManager; IceUtil::Shared* upCast(IceSSL::TrustManager*); typedef IceInternal::Handle TrustManagerPtr; } #endif Ice-3.5.1/cpp/src/IceSSL/InstanceF.h0000644000076400007640000000112412223561476015046 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_INSTANCE_F_H #define ICE_SSL_INSTANCE_F_H #include #include namespace IceSSL { class Instance; IceUtil::Shared* upCast(IceSSL::Instance*); typedef IceInternal::Handle InstancePtr; } #endif Ice-3.5.1/cpp/src/IceSSL/ConnectorI.h0000644000076400007640000000273012223561476015243 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_CONNECTOR_I_H #define ICE_SSL_CONNECTOR_I_H #include #include #include #include #include #include namespace IceSSL { class EndpointI; class ConnectorI : 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: ConnectorI(const InstancePtr&, const std::string&, const IceInternal::Address&, const IceInternal::NetworkProxyPtr&, Ice::Int, const std::string&); virtual ~ConnectorI(); friend class EndpointI; const InstancePtr _instance; const Ice::LoggerPtr _logger; const std::string _host; const IceInternal::Address _addr; const IceInternal::NetworkProxyPtr _proxy; const Ice::Int _timeout; const std::string _connectionId; }; } #endif Ice-3.5.1/cpp/src/IceSSL/Makefile0000644000076400007640000000345412223561476014473 0ustar mesmes # ********************************************************************** # # 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,IceSSL,$(VERSION)) SONAME = $(call mksoname,IceSSL,$(SOVERSION)) LIBNAME = $(call mklibname,IceSSL) TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME)) OBJS = AcceptorI.o \ Certificate.o \ ConnectorI.o \ EndpointInfo.o \ ConnectionInfo.o \ EndpointI.o \ Instance.o \ PluginI.o \ TransceiverI.o \ Util.o \ RFC2253.o \ TrustManager.o SRCS = $(OBJS:.o=.cpp) SLICE_SRCS = $(SDIR)/EndpointInfo.ice \ $(SDIR)/ConnectionInfo.ice HDIR = $(headerdir)/IceSSL SDIR = $(slicedir)/IceSSL include $(top_srcdir)/config/Make.rules CPPFLAGS := -I.. $(CPPFLAGS) -DICE_SSL_API_EXPORTS $(OPENSSL_FLAGS) SLICE2CPPFLAGS := --ice --include-dir IceSSL --dll-export ICE_SSL_API $(SLICE2CPPFLAGS) LINKWITH := $(BZIP2_RPATH_LINK) -lIce -lIceUtil $(OPENSSL_LIBS) $(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 install:: all $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME)) include .depend Ice-3.5.1/cpp/src/IceSSL/RFC2253.cpp0000644000076400007640000003230612223561476014463 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace IceSSL; namespace { // // See RFC 2253 and RFC 1779. // string special = ",=+<>#;"; string hexvalid = "0123456789abcdefABCDEF"; } static char unescapeHex(const string&, size_t); static pair parseNameComponent(const string&, size_t&); static pair parseAttributeTypeAndValue(const string&, size_t&); static string parseAttributeType(const string&, size_t&); static string parseAttributeValue(const string&, size_t&); static string parsePair(const string&, size_t&); static string parseHexPair(const string&, size_t&, bool); static void eatWhite(const string&, size_t&); IceSSL::RFC2253::RDNEntrySeq IceSSL::RFC2253::parse(const string& data) { RDNEntrySeq results; RDNEntry current; current.negate = false; size_t pos = 0; while(pos < data.size()) { eatWhite(data, pos); if(pos < data.size() && data[pos] == '!') { if(!current.rdn.empty()) { throw ParseException(__FILE__, __LINE__, "negation symbol '!' must appear at start of list"); } ++pos; current.negate = true; } current.rdn.push_back(parseNameComponent(data, pos)); eatWhite(data, pos); if(pos < data.size() && data[pos] == ',') { ++pos; } else if(pos < data.size() && data[pos] == ';') { ++pos; results.push_back(current); current.rdn.clear(); current.negate = false; } else if(pos < data.size()) { throw ParseException(__FILE__, __LINE__, "expected ',' or ';' at `" + data.substr(pos) + "'"); } } if(!current.rdn.empty()) { results.push_back(current); } return results; } IceSSL::RFC2253::RDNSeq IceSSL::RFC2253::parseStrict(const string& data) { RDNSeq results; size_t pos = 0; while(pos < data.size()) { results.push_back(parseNameComponent(data, pos)); eatWhite(data, pos); if(pos < data.size() && (data[pos] == ',' || data[pos] == ';')) { ++pos; } else if(pos < data.size()) { throw ParseException(__FILE__, __LINE__, "expected ',' or ';' at `" + data.substr(pos) + "'"); } } return results; } string IceSSL::RFC2253::unescape(const string& data) { if(data.size() == 0) { return data; } if(data[0] == '"') { if(data[data.size() - 1] != '"') { throw ParseException(__FILE__, __LINE__, "unescape: missing \""); } // // Return the string without quotes. // return data.substr(1, data.size() - 2); } // // Unescape the entire string. // string result; if(data[0] == '#') { size_t pos = 1; while(pos < data.size()) { result += unescapeHex(data, pos); pos += 2; } } else { size_t pos = 0; while(pos < data.size()) { if(data[pos] != '\\') { result += data[pos]; ++pos; } else { ++pos; if(pos >= data.size()) { throw ParseException(__FILE__, __LINE__, "unescape: invalid escape sequence"); } if(special.find(data[pos]) != string::npos || data[pos] != '\\' || data[pos] != '"') { result += data[pos]; ++pos; } else { result += unescapeHex(data, pos); pos += 2; } } } } return result; } static int hexToInt(char v) { if(v >= '0' && v <= '9') { return v - '0'; } if(v >= 'a' && v <= 'f') { return 10 + (v - 'a'); } if(v >= 'A' && v <= 'F') { return 10 + (v - 'A'); } throw ParseException(__FILE__, __LINE__, "unescape: invalid hex pair"); return 0; // To satisfy the compiler. } static char unescapeHex(const string& data, size_t pos) { assert(pos < data.size()); if(pos + 2 >= data.size()) { throw ParseException(__FILE__, __LINE__, "unescape: invalid hex pair"); } return (char)(hexToInt(data[pos]) * 16 + hexToInt(data[pos + 1])); } static pair parseNameComponent(const string& data, size_t& pos) { pair final = parseAttributeTypeAndValue(data, pos); while(pos < data.size()) { eatWhite(data, pos); if(pos < data.size() && data[pos] == '+') { ++pos; } else { break; } pair p = parseAttributeTypeAndValue(data, pos); final.second += "+"; final.second += p.first; final.second += '='; final.second += p.second; } return final; } static pair parseAttributeTypeAndValue(const string& data, size_t& pos) { pair p; p.first = parseAttributeType(data, pos); eatWhite(data, pos); if(pos >= data.size()) { throw ParseException(__FILE__, __LINE__, "invalid attribute type/value pair (unexpected end of data)"); } if(data[pos] != '=') { throw ParseException(__FILE__, __LINE__, "invalid attribute type/value pair (missing =)"); } ++pos; p.second = parseAttributeValue(data, pos); return p; } static string parseAttributeType(const string& data, size_t& pos) { eatWhite(data, pos); if(pos >= data.size()) { throw ParseException(__FILE__, __LINE__, "invalid attribute type (expected end of data)"); } string result; // // RFC 1779. // ::= 1*( ) | "OID." | "oid." // ::= | "." // RFC 2253: // attributeType = (ALPHA 1*keychar) | oid // keychar = ALPHA | DIGIT | "-" // oid = 1*DIGIT *("." 1*DIGIT) // // In section 4 of RFC 2253 the document says: // Implementations MUST allow an oid in the attribute type to be // prefixed by one of the character strings "oid." or "OID.". // // Here we must also check for "oid." and "OID." before parsing // according to the ALPHA KEYCHAR* rule. // // First the OID case. // if(IceUtilInternal::isDigit(data[pos]) || (data.size() - pos >= 4 && (data.substr(pos, 4) == "oid." || data.substr(pos, 4) == "OID."))) { if(!IceUtilInternal::isDigit(data[pos])) { result += data.substr(pos, 4); pos += 4; } while(true) { // 1*DIGIT while(pos < data.size() && IceUtilInternal::isDigit(data[pos])) { result += data[pos]; ++pos; } // "." 1*DIGIT if(pos < data.size() && data[pos] == '.') { result += data[pos]; ++pos; // 1*DIGIT must follow "." if(pos < data.size() && !IceUtilInternal::isDigit(data[pos])) { throw ParseException(__FILE__, __LINE__, "invalid attribute type (expected end of data)"); } } else { break; } } } else if(IceUtilInternal::isAlpha(data[pos])) { // // The grammar is wrong in this case. It should be ALPHA // KEYCHAR* otherwise it will not accept "O" as a valid // attribute type. // result += data[pos]; ++pos; // 1* KEYCHAR while(pos < data.size() && (IceUtilInternal::isAlpha(data[pos]) || IceUtilInternal::isDigit(data[pos]) || data[pos] == '-')) { result += data[pos]; ++pos; } } else { throw ParseException(__FILE__, __LINE__, "invalid attribute type"); } return result; } static string parseAttributeValue(const string& data, size_t& pos) { eatWhite(data, pos); string result; if(pos >= data.size()) { return result; } // // RFC 2253 // # hexstring // if(data[pos] == '#') { result += data[pos]; ++pos; while(true) { string h = parseHexPair(data, pos, true); if(h.size() == 0) { break; } result += h; } } // // RFC 2253 // QUOTATION *( quotechar | pair ) QUOTATION ; only from v2 // quotechar = // else if(data[pos] == '"') { result += data[pos]; ++pos; while(true) { if(pos >= data.size()) { throw ParseException(__FILE__, __LINE__, "invalid attribute value (unexpected end of data)"); } // final terminating " if(data[pos] == '"') { result += data[pos]; ++pos; break; } // any character except '\' else if(data[pos] != '\\') { result += data[pos]; ++pos; } // pair '\' else { result += parsePair(data, pos); } } } // // RFC 2253 // * (stringchar | pair) // stringchar = // else { while(pos < data.size()) { if(data[pos] == '\\') { result += parsePair(data, pos); } else if(special.find(data[pos]) == string::npos && data[pos] != '"') { result += data[pos]; ++pos; } else { break; } } } return result; } // // RFC2253: // pair = "\" ( special | "\" | QUOTATION | hexpair ) // static string parsePair(const string& data, size_t& pos) { string result; assert(data[pos] == '\\'); result += data[pos]; ++pos; if(pos >= data.size()) { throw ParseException(__FILE__, __LINE__, "invalid escape format (unexpected end of data)"); } if(special.find(data[pos]) != string::npos || data[pos] != '\\' || data[pos] != '"') { result += data[pos]; ++pos; return result; } return parseHexPair(data, pos, false); } // // RFC 2253 // hexpair = hexchar hexchar // static string parseHexPair(const string& data, size_t& pos, bool allowEmpty) { string result; if(pos < data.size() && hexvalid.find(data[pos]) != string::npos) { result += data[pos]; ++pos; } if(pos < data.size() && hexvalid.find(data[pos]) != string::npos) { result += data[pos]; ++pos; } if(result.size() != 2) { if(allowEmpty && result.size() == 0) { return result; } throw ParseException(__FILE__, __LINE__, "invalid hex format"); } return result; } // // RFC 2253: // // Implementations MUST allow for space (' ' ASCII 32) characters to be // present between name-component and ',', between attributeTypeAndValue // and '+', between attributeType and '=', and between '=' and // attributeValue. These space characters are ignored when parsing. // static void eatWhite(const string& data, size_t& pos) { while(pos < data.size() && data[pos] == ' ') { ++pos; } } #ifdef never void print(const list< list > >& r) { if(r.size() > 1) { cout << "result: " << r.size() << " DNs" << endl; } for(list< list > >::const_iterator q = r.begin(); q != r.end(); ++q) { list > l = *q; cout << "result: " << l.size() << " RDNs" << endl; for(list >::const_iterator p = l.begin(); p != l.end(); ++p) { cout << "\t\"" << p->first << "\"=\"" << p->second << "\"" << endl; } } } int main() { string examples[] = { "CN=Steve Kille,O=Isode Limited,C=GB", "OU=Sales+CN=J. Smith,O=Widget Inc.,C=US", "CN=L. Eagle,O=Sue\\, Grabbit and Runn,C=GB", "CN=Before\\0DAfter,O=Test,C=GB", "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB", "SN=Lu\\C4\\8Di\\C4\\87", }; try { for(int i = 0; i < sizeof(examples)/sizeof(examples[0]); ++i) { cout << "string: " << examples[i] << endl; print(RFC2253::parse(examples[i])); } } catch(const RFC2253::ParseException& e) { cout << "error: " << e.reason << endl; } } #endif Ice-3.5.1/cpp/src/IceSSL/RFC2253.h0000644000076400007640000000320512223561476014124 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_RFC_2253_H #define ICE_SSL_RFC_2253_H #include #include // // The methods in the IceSSL::RFC2253 namespace implement a parser // for relative distinguished name (RDN) pairs using the parsing // rules outlined in sections 3 and 4 of RFC 2253. // // Note that this parser does not unescape the elements of the RDNs. // For example, parsing the following RDN // // O=Sue\, Grabit and Runn // // results in the pair ("O","Sue\, Grabit and Runn") and not // ("O","Sue, Grabit and Runn"). // namespace IceSSL { namespace RFC2253 { typedef std::list< std::pair > RDNSeq; struct RDNEntry { RDNSeq rdn; bool negate; }; typedef std::list RDNEntrySeq; // // This function separates DNs with the ';' character. A list of RDN // pairs may optionally be prefixed with '!' to indicate a negation. // The function returns a list of RDNEntry structures. Any failure in // parsing results in a ParseException being thrown. // RDNEntrySeq parse(const std::string&); // // RDNs are separated with ',' and ';'. // // This function returns a list of RDN pairs. Any failure in parsing // results in a ParseException being thrown. // RDNSeq parseStrict(const std::string&); // // Unescape the string. // std::string unescape(const std::string&); } } #endif Ice-3.5.1/cpp/src/IceSSL/AcceptorI.h0000644000076400007640000000310112223561476015042 0ustar mesmes// ********************************************************************** // // 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 ICE_SSL_ACCEPTOR_I_H #define ICE_SSL_ACCEPTOR_I_H #include #include #include #include #include #include #include namespace IceSSL { class EndpointI; class AcceptorI : public IceInternal::Acceptor, public IceInternal::NativeInfo { public: virtual IceInternal::NativeInfoPtr getNativeInfo(); #ifdef ICE_USE_IOCP virtual IceInternal::AsyncInfo* getAsyncInfo(IceInternal::SocketOperation); #endif virtual void close(); virtual void listen(); #ifdef ICE_USE_IOCP virtual void startAccept(); virtual void finishAccept(); #endif virtual IceInternal::TransceiverPtr accept(); virtual std::string toString() const; int effectivePort() const; private: AcceptorI(const InstancePtr&, const std::string&, const std::string&, int); virtual ~AcceptorI(); friend class EndpointI; const InstancePtr _instance; const std::string _adapterName; const Ice::LoggerPtr _logger; const IceInternal::Address _addr; int _backlog; #ifdef ICE_USE_IOCP SOCKET _acceptFd; int _acceptError; std::vector _acceptBuf; IceInternal::AsyncInfo _info; #endif }; } #endif Ice-3.5.1/cpp/src/IceSSL/Instance.cpp0000644000076400007640000011411412223561476015277 0ustar mesmes// ********************************************************************** // // 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 #ifdef _WIN32 # include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceSSL; IceUtil::Shared* IceSSL::upCast(IceSSL::Instance* p) { return p; } namespace { IceUtil::Mutex* staticMutex = 0; int instanceCount = 0; IceUtil::Mutex* locks = 0; class Init { public: Init() { staticMutex = new IceUtil::Mutex; } ~Init() { delete staticMutex; staticMutex = 0; if(locks) { delete[] locks; locks = 0; } } }; Init init; } extern "C" { // // OpenSSL mutex callback. // void IceSSL_opensslLockCallback(int mode, int n, const char* /*file*/, int /*line*/) { assert(locks); if(mode & CRYPTO_LOCK) { locks[n].lock(); } else { locks[n].unlock(); } } // // OpenSSL thread id callback. // unsigned long IceSSL_opensslThreadIdCallback() { #if defined(_WIN32) return static_cast(GetCurrentThreadId()); #elif defined(__FreeBSD__) || defined(__APPLE__) || defined(__osf1__) // // On some platforms, pthread_t is a pointer to a per-thread structure. // return reinterpret_cast(pthread_self()); #elif (defined(__linux) || defined(__sun) || defined(__hpux)) || defined(_AIX) // // On Linux, Solaris, HP-UX and AIX, pthread_t is an integer. // return static_cast(pthread_self()); #else # error "Unknown platform" #endif } int IceSSL_opensslPasswordCallback(char* buf, int size, int flag, void* userData) { IceSSL::Instance* p = reinterpret_cast(userData); string passwd = p->password(flag == 1); int sz = static_cast(passwd.size()); if(sz > size) { sz = size - 1; } strncpy(buf, passwd.c_str(), sz); buf[sz] = '\0'; for(string::iterator i = passwd.begin(); i != passwd.end(); ++i) { *i = '\0'; } return sz; } #ifndef OPENSSL_NO_DH DH* IceSSL_opensslDHCallback(SSL* ssl, int /*isExport*/, int keyLength) { IceSSL::Instance* p = reinterpret_cast(SSL_CTX_get_ex_data(ssl->ctx, 0)); return p->dhParams(keyLength); } #endif int IceSSL_opensslVerifyCallback(int ok, X509_STORE_CTX* ctx) { SSL* ssl = reinterpret_cast(X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx())); IceSSL::Instance* p = reinterpret_cast(SSL_CTX_get_ex_data(ssl->ctx, 0)); return p->verifyCallback(ok, ssl, ctx); } } static bool passwordError() { int reason = ERR_GET_REASON(ERR_peek_error()); return (reason == PEM_R_BAD_BASE64_DECODE || reason == PEM_R_BAD_DECRYPT || reason == PEM_R_BAD_PASSWORD_READ || reason == PEM_R_PROBLEMS_GETTING_PASSWORD); } IceSSL::Instance::Instance(const CommunicatorPtr& communicator) : _logger(communicator->getLogger()), _initialized(false), _ctx(0) { __setNoDelete(true); // // Initialize OpenSSL if necessary. // IceUtilInternal::MutexPtrLock sync(staticMutex); instanceCount++; if(instanceCount == 1) { PropertiesPtr properties = communicator->getProperties(); // // The IceSSL.InitOpenSSL property specifies whether we should perform the global // startup (and shutdown) tasks for the OpenSSL library. // // If an application uses multiple components that each depend on OpenSSL, the // application should disable OpenSSL initialization in those components and // perform the initialization itself. // _initOpenSSL = properties->getPropertyAsIntWithDefault("IceSSL.InitOpenSSL", 1) > 0; if(_initOpenSSL) { // // Create the mutexes and set the callbacks. // if(!locks) { locks = new IceUtil::Mutex[CRYPTO_num_locks()]; CRYPTO_set_locking_callback(IceSSL_opensslLockCallback); CRYPTO_set_id_callback(IceSSL_opensslThreadIdCallback); } // // Load human-readable error messages. // SSL_load_error_strings(); // // Initialize the SSL library. // SSL_library_init(); // // This is necessary to allow programs that use OpenSSL 0.9.x to // load private key files generated by OpenSSL 1.x. // OpenSSL_add_all_algorithms(); // // Initialize the PRNG. // #ifdef WINDOWS RAND_screen(); // Uses data from the screen if possible. #endif char randFile[1024]; if(RAND_file_name(randFile, sizeof(randFile))) // Gets the name of a default seed file. { RAND_load_file(randFile, 1024); } string randFiles = Ice::nativeToUTF8(communicator, properties->getProperty("IceSSL.Random")); if(!randFiles.empty()) { vector files; #ifdef _WIN32 const string sep = ";"; #else const string sep = ":"; #endif string defaultDir = Ice::nativeToUTF8(communicator, properties->getProperty("IceSSL.DefaultDir")); if(!IceUtilInternal::splitString(randFiles, sep, files)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: invalid value for IceSSL.Random:\n" + randFiles; throw ex; } for(vector::iterator p = files.begin(); p != files.end(); ++p) { string file = *p; if(!checkPath(file, defaultDir, false)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: entropy data file not found:\n" + file; throw ex; } if(!RAND_load_file(file.c_str(), 1024)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: unable to load entropy data from " + file; throw ex; } } } #ifndef _WIN32 // // The Entropy Gathering Daemon (EGD) is not available on Windows. // The file should be a Unix domain socket for the daemon. // string entropyDaemon = properties->getProperty("IceSSL.EntropyDaemon"); if(!entropyDaemon.empty()) { if(RAND_egd(entropyDaemon.c_str()) <= 0) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: EGD failure using file " + entropyDaemon; throw ex; } } #endif if(!RAND_status()) { communicator->getLogger()->warning("IceSSL: insufficient data to initialize PRNG"); } } else { if(!properties->getProperty("IceSSL.Random").empty()) { _logger->warning("IceSSL: ignoring IceSSL.Random because OpenSSL initialization is disabled"); } #ifndef _WIN32 else if(!properties->getProperty("IceSSL.EntropyDaemon").empty()) { _logger->warning("IceSSL: ignoring IceSSL.EntropyDaemon because OpenSSL initialization is disabled"); } #endif } } _facade = IceInternal::getProtocolPluginFacade(communicator); _securityTraceLevel = communicator->getProperties()->getPropertyAsInt("IceSSL.Trace.Security"); _securityTraceCategory = "Security"; _trustManager = new TrustManager(communicator); // // Register the endpoint factory. We have to do this now, rather than // in initialize, because the communicator may need to interpret // proxies before the plug-in is fully initialized. // _facade->addEndpointFactory(new EndpointFactoryI(this)); __setNoDelete(false); } IceSSL::Instance::~Instance() { // // Clean up OpenSSL resources. // IceUtilInternal::MutexPtrLock sync(staticMutex); if(--instanceCount == 0 && _initOpenSSL) { // // NOTE: We can't destroy the locks here: threads which might have called openssl methods // might access openssl locks upon termination (from DllMain/THREAD_DETACHED). Instead, // we release the locks in the ~Init() static destructor. See bug #4156. // //CRYPTO_set_locking_callback(0); //CRYPTO_set_id_callback(0); //delete[] locks; //locks = 0; CRYPTO_cleanup_all_ex_data(); RAND_cleanup(); ERR_free_strings(); EVP_cleanup(); } } void IceSSL::Instance::initialize() { if(_initialized) { return; } try { const string propPrefix = "IceSSL."; PropertiesPtr properties = communicator()->getProperties(); // // CheckCertName determines whether we compare the name in a peer's // certificate against its hostname. // _checkCertName = properties->getPropertyAsIntWithDefault(propPrefix + "CheckCertName", 0) > 0; // // VerifyDepthMax establishes the maximum length of a peer's certificate // chain, including the peer's certificate. A value of 0 means there is // no maximum. // _verifyDepthMax = properties->getPropertyAsIntWithDefault(propPrefix + "VerifyDepthMax", 2); // // VerifyPeer determines whether certificate validation failures abort a connection. // _verifyPeer = properties->getPropertyAsIntWithDefault(propPrefix + "VerifyPeer", 2); // // Protocols selects which protocols to enable. // const int protocols = parseProtocols(properties->getPropertyAsList(propPrefix + "Protocols")); // // Create an SSL context if the application hasn't supplied one. // if(!_ctx) { _ctx = SSL_CTX_new(getMethod(protocols)); if(!_ctx) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: unable to create SSL context:\n" + sslErrors(); throw ex; } // // Check for a default directory. We look in this directory for // files mentioned in the configuration. // string defaultDir = properties->getProperty(propPrefix + "DefaultDir"); // // If the configuration defines a password, or the application has supplied // a password prompt object, then register a password callback. Otherwise, // let OpenSSL use its default behavior. // { // TODO: Support quoted value? string password = properties->getProperty(propPrefix + "Password"); if(!password.empty() || _prompt) { SSL_CTX_set_default_passwd_cb(_ctx, IceSSL_opensslPasswordCallback); SSL_CTX_set_default_passwd_cb_userdata(_ctx, this); _password = password; } } int passwordRetryMax = properties->getPropertyAsIntWithDefault(propPrefix + "PasswordRetryMax", 3); // // Establish the location of CA certificates. // { string caFile = properties->getProperty(propPrefix + "CertAuthFile"); string caDir = properties->getPropertyWithDefault(propPrefix + "CertAuthDir", defaultDir); const char* file = 0; const char* dir = 0; if(!caFile.empty()) { if(!checkPath(caFile, defaultDir, false)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: CA certificate file not found:\n" + caFile; throw ex; } file = caFile.c_str(); } if(!caDir.empty()) { if(!checkPath(caDir, defaultDir, true)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: CA certificate directory not found:\n" + caDir; throw ex; } dir = caDir.c_str(); } if(file || dir) { // // The certificate may be stored in an encrypted file, so handle // password retries. // int count = 0; int err = 0; while(count < passwordRetryMax) { ERR_clear_error(); err = SSL_CTX_load_verify_locations(_ctx, file, dir); if(err) { break; } ++count; } if(err == 0) { string msg = "IceSSL: unable to establish CA certificates"; if(passwordError()) { msg += ":\ninvalid password"; } else { string err = sslErrors(); if(!err.empty()) { msg += ":\n" + err; } } PluginInitializationException ex(__FILE__, __LINE__); ex.reason = msg; throw ex; } } } // // Establish the certificate chains and private keys. One RSA certificate and // one DSA certificate are allowed. // { #ifdef _WIN32 const string sep = ";"; #else const string sep = ":"; #endif string certFile = properties->getProperty(propPrefix + "CertFile"); string keyFile = properties->getProperty(propPrefix + "KeyFile"); vector::size_type numCerts = 0; if(!certFile.empty()) { vector files; if(!IceUtilInternal::splitString(certFile, sep, files) || files.size() > 2) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: invalid value for " + propPrefix + "CertFile:\n" + certFile; throw ex; } numCerts = files.size(); for(vector::iterator p = files.begin(); p != files.end(); ++p) { string file = *p; if(!checkPath(file, defaultDir, false)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: certificate file not found:\n" + file; throw ex; } // // The certificate may be stored in an encrypted file, so handle // password retries. // int count = 0; int err = 0; while(count < passwordRetryMax) { ERR_clear_error(); err = SSL_CTX_use_certificate_chain_file(_ctx, file.c_str()); if(err) { break; } ++count; } if(err == 0) { string msg = "IceSSL: unable to load certificate chain from file " + file; if(passwordError()) { msg += ":\ninvalid password"; } else { string err = sslErrors(); if(!err.empty()) { msg += ":\n" + err; } } PluginInitializationException ex(__FILE__, __LINE__); ex.reason = msg; throw ex; } } } if(keyFile.empty()) { keyFile = certFile; // Assume the certificate file also contains the private key. } if(!keyFile.empty()) { vector files; if(!IceUtilInternal::splitString(keyFile, sep, files) || files.size() > 2) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: invalid value for " + propPrefix + "KeyFile:\n" + keyFile; throw ex; } if(files.size() != numCerts) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: " + propPrefix + "KeyFile does not agree with " + propPrefix + "CertFile"; throw ex; } for(vector::iterator p = files.begin(); p != files.end(); ++p) { string file = *p; if(!checkPath(file, defaultDir, false)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: key file not found:\n" + file; throw ex; } // // The private key may be stored in an encrypted file, so handle // password retries. // int count = 0; int err = 0; while(count < passwordRetryMax) { ERR_clear_error(); err = SSL_CTX_use_PrivateKey_file(_ctx, file.c_str(), SSL_FILETYPE_PEM); if(err) { break; } ++count; } if(err == 0) { string msg = "IceSSL: unable to load private key from file " + file; if(passwordError()) { msg += ":\ninvalid password"; } else { string err = sslErrors(); if(!err.empty()) { msg += ":\n" + err; } } PluginInitializationException ex(__FILE__, __LINE__); ex.reason = msg; throw ex; } } if(!SSL_CTX_check_private_key(_ctx)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: unable to validate private key(s):\n" + sslErrors(); throw ex; } } } // // Diffie Hellman configuration. // { #ifndef OPENSSL_NO_DH _dhParams = new DHParams; SSL_CTX_set_options(_ctx, SSL_OP_SINGLE_DH_USE); SSL_CTX_set_tmp_dh_callback(_ctx, IceSSL_opensslDHCallback); #endif // // Properties have the following form: // // ...DH.=file // const string dhPrefix = propPrefix + "DH."; PropertyDict d = properties->getPropertiesForPrefix(dhPrefix); if(!d.empty()) { #ifdef OPENSSL_NO_DH _logger->warning("IceSSL: OpenSSL is not configured for Diffie Hellman"); #else for(PropertyDict::iterator p = d.begin(); p != d.end(); ++p) { string s = p->first.substr(dhPrefix.size()); int keyLength = atoi(s.c_str()); if(keyLength > 0) { string file = p->second; if(!checkPath(file, defaultDir, false)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: DH parameter file not found:\n" + file; throw ex; } if(!_dhParams->add(keyLength, file)) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: unable to read DH parameter file " + file; throw ex; } } } #endif } } } // // Store a pointer to ourself for use in OpenSSL callbacks. // SSL_CTX_set_ex_data(_ctx, 0, this); // // This is necessary for successful interop with Java. Without it, a Java // client would fail to reestablish a connection: the server gets the // error "session id context uninitialized" and the client receives // "SSLHandshakeException: Remote host closed connection during handshake". // SSL_CTX_set_session_cache_mode(_ctx, SSL_SESS_CACHE_OFF); // // Although we disable session caching, we still need to set a session ID // context (ICE-5103). The value can be anything; here we just use the // pointer to this Instance object. // SSL_CTX_set_session_id_context(_ctx, reinterpret_cast(this), static_cast(sizeof(this))); // // Select protocols. // if(protocols != 0) { setOptions(protocols); } // // Establish the cipher list. // string ciphers = properties->getProperty(propPrefix + "Ciphers"); if(!ciphers.empty()) { if(!SSL_CTX_set_cipher_list(_ctx, ciphers.c_str())) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: unable to set ciphers using `" + ciphers + "':\n" + sslErrors(); throw ex; } } // // Determine whether a certificate is required from the peer. // { int sslVerifyMode; switch(_verifyPeer) { case 0: sslVerifyMode = SSL_VERIFY_NONE; break; case 1: sslVerifyMode = SSL_VERIFY_PEER; break; case 2: sslVerifyMode = SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT; break; default: { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: invalid value for " + propPrefix + "VerifyPeer"; throw ex; } } SSL_CTX_set_verify(_ctx, sslVerifyMode, IceSSL_opensslVerifyCallback); } } catch(...) { // // We free the SSL context regardless of whether the plugin created it // or the application supplied it. // SSL_CTX_free(_ctx); _ctx = 0; throw; } _initialized = true; } void IceSSL::Instance::context(SSL_CTX* context) { if(_initialized) { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: plug-in is already initialized"; throw ex; } assert(!_ctx); _ctx = context; } SSL_CTX* IceSSL::Instance::context() const { return _ctx; } void IceSSL::Instance::setCertificateVerifier(const CertificateVerifierPtr& verifier) { _verifier = verifier; } void IceSSL::Instance::setPasswordPrompt(const PasswordPromptPtr& prompt) { _prompt = prompt; } CommunicatorPtr IceSSL::Instance::communicator() const { return _facade->getCommunicator(); } IceInternal::EndpointHostResolverPtr IceSSL::Instance::endpointHostResolver() const { return _facade->getEndpointHostResolver(); } IceInternal::ProtocolSupport IceSSL::Instance::protocolSupport() const { return _facade->getProtocolSupport(); } bool IceSSL::Instance::preferIPv6() const { return _facade->preferIPv6(); } IceInternal::NetworkProxyPtr IceSSL::Instance::networkProxy() const { return _facade->getNetworkProxy(); } string IceSSL::Instance::defaultHost() const { return _facade->getDefaultHost(); } Ice::EncodingVersion IceSSL::Instance::defaultEncoding() const { return _facade->getDefaultEncoding(); } int IceSSL::Instance::networkTraceLevel() const { return _facade->getNetworkTraceLevel(); } string IceSSL::Instance::networkTraceCategory() const { return _facade->getNetworkTraceCategory(); } int IceSSL::Instance::securityTraceLevel() const { return _securityTraceLevel; } string IceSSL::Instance::securityTraceCategory() const { return _securityTraceCategory; } void IceSSL::Instance::verifyPeer(SSL* ssl, SOCKET fd, const string& address, const NativeConnectionInfoPtr& info) { long result = SSL_get_verify_result(ssl); if(result != X509_V_OK) { if(_verifyPeer == 0) { if(_securityTraceLevel >= 1) { ostringstream ostr; ostr << "IceSSL: ignoring certificate verification failure:\n" << X509_verify_cert_error_string(result); _logger->trace(_securityTraceCategory, ostr.str()); } } else { ostringstream ostr; ostr << "IceSSL: certificate verification failed:\n" << X509_verify_cert_error_string(result); string msg = ostr.str(); if(_securityTraceLevel >= 1) { _logger->trace(_securityTraceCategory, msg); } SecurityException ex(__FILE__, __LINE__); ex.reason = msg; throw ex; } } X509* rawCert = SSL_get_peer_certificate(ssl); CertificatePtr cert; if(rawCert != 0) { cert = new Certificate(rawCert); } // // For an outgoing connection, we compare the proxy address (if any) against // fields in the server's certificate (if any). // if(cert && !address.empty()) { // // Extract the IP addresses and the DNS names from the subject // alternative names. // vector > subjectAltNames = cert->getSubjectAlternativeNames(); vector ipAddresses; vector dnsNames; for(vector >::const_iterator p = subjectAltNames.begin(); p != subjectAltNames.end(); ++p) { if(p->first == 7) { ipAddresses.push_back(IceUtilInternal::toLower(p->second)); } else if(p->first == 2) { dnsNames.push_back(IceUtilInternal::toLower(p->second)); } } // // Compare the peer's address against the common name. // bool certNameOK = false; string dn; string addrLower = IceUtilInternal::toLower(address); { DistinguishedName d = cert->getSubjectDN(); dn = IceUtilInternal::toLower(string(d)); string cn = "cn=" + addrLower; string::size_type pos = dn.find(cn); if(pos != string::npos) { // // Ensure we match the entire common name. // certNameOK = (pos + cn.size() == dn.size()) || (dn[pos + cn.size()] == ','); } } // // Compare the peer's address against the dnsName and ipAddress // values in the subject alternative name. // if(!certNameOK) { certNameOK = find(ipAddresses.begin(), ipAddresses.end(), addrLower) != ipAddresses.end(); } if(!certNameOK) { certNameOK = find(dnsNames.begin(), dnsNames.end(), addrLower) != dnsNames.end(); } // // Log a message if the name comparison fails. If CheckCertName is defined, // we also raise an exception to abort the connection. Don't log a message if // CheckCertName is not defined and a verifier is present. // if(!certNameOK && (_checkCertName || (_securityTraceLevel >= 1 && !_verifier))) { ostringstream ostr; ostr << "IceSSL: "; if(!_checkCertName) { ostr << "ignoring "; } ostr << "certificate validation failure:\npeer certificate does not have `" << address << "' as its commonName or in its subjectAltName extension"; if(!dn.empty()) { ostr << "\nSubject DN: " << dn; } if(!dnsNames.empty()) { ostr << "\nDNS names found in certificate: "; for(vector::const_iterator p = dnsNames.begin(); p != dnsNames.end(); ++p) { if(p != dnsNames.begin()) { ostr << ", "; } ostr << *p; } } if(!ipAddresses.empty()) { ostr << "\nIP addresses found in certificate: "; for(vector::const_iterator p = ipAddresses.begin(); p != ipAddresses.end(); ++p) { if(p != ipAddresses.begin()) { ostr << ", "; } ostr << *p; } } string msg = ostr.str(); if(_securityTraceLevel >= 1) { Trace out(_logger, _securityTraceCategory); out << msg; } if(_checkCertName) { SecurityException ex(__FILE__, __LINE__); ex.reason = msg; throw ex; } } } if(_verifyDepthMax > 0 && static_cast(info->certs.size()) > _verifyDepthMax) { ostringstream ostr; ostr << (info->incoming ? "incoming" : "outgoing") << " connection rejected:\n" << "length of peer's certificate chain (" << info->certs.size() << ") exceeds maximum of " << _verifyDepthMax; string msg = ostr.str(); if(_securityTraceLevel >= 1) { _logger->trace(_securityTraceCategory, msg + "\n" + IceInternal::fdToString(fd)); } SecurityException ex(__FILE__, __LINE__); ex.reason = msg; throw ex; } if(!_trustManager->verify(info)) { string msg = string(info->incoming ? "incoming" : "outgoing") + " connection rejected by trust manager"; if(_securityTraceLevel >= 1) { _logger->trace(_securityTraceCategory, msg + "\n" + IceInternal::fdToString(fd)); } SecurityException ex(__FILE__, __LINE__); ex.reason = msg; throw ex; } if(_verifier && !_verifier->verify(info)) { string msg = string(info->incoming ? "incoming" : "outgoing") + " connection rejected by certificate verifier"; if(_securityTraceLevel >= 1) { _logger->trace(_securityTraceCategory, msg + "\n" + IceInternal::fdToString(fd)); } SecurityException ex(__FILE__, __LINE__); ex.reason = msg; throw ex; } } string IceSSL::Instance::sslErrors() const { return getSslErrors(_securityTraceLevel >= 1); } void IceSSL::Instance::destroy() { _facade = 0; if(_ctx) { SSL_CTX_free(_ctx); } } string IceSSL::Instance::password(bool /*encrypting*/) { if(_prompt) { try { return _prompt->getPassword(); } catch(...) { // // Don't allow exceptions to cross an OpenSSL boundary. // return string(); } } else { return _password; } } int IceSSL::Instance::verifyCallback(int ok, SSL* ssl, X509_STORE_CTX* c) { if(!ok && _securityTraceLevel >= 1) { X509* cert = X509_STORE_CTX_get_current_cert(c); int err = X509_STORE_CTX_get_error(c); char buf[256]; Trace out(_logger, _securityTraceCategory); out << "certificate verification failure\n"; X509_NAME_oneline(X509_get_issuer_name(cert), buf, static_cast(sizeof(buf))); out << "issuer = " << buf << '\n'; X509_NAME_oneline(X509_get_subject_name(cert), buf, static_cast(sizeof(buf))); out << "subject = " << buf << '\n'; out << "depth = " << X509_STORE_CTX_get_error_depth(c) << '\n'; out << "error = " << X509_verify_cert_error_string(err) << '\n'; out << IceInternal::fdToString(SSL_get_fd(ssl)); } return ok; } #ifndef OPENSSL_NO_DH DH* IceSSL::Instance::dhParams(int keyLength) { return _dhParams->get(keyLength); } #endif void IceSSL::Instance::traceConnection(SSL* ssl, bool incoming) { Trace out(_logger, _securityTraceCategory); out << "SSL summary for " << (incoming ? "incoming" : "outgoing") << " connection\n"; // // The const_cast is necesary because Solaris still uses OpenSSL 0.9.7. // //const SSL_CIPHER *cipher = SSL_get_current_cipher(ssl); SSL_CIPHER *cipher = const_cast(SSL_get_current_cipher(ssl)); if(!cipher) { out << "unknown cipher\n"; } else { out << "cipher = " << SSL_CIPHER_get_name(cipher) << "\n"; out << "bits = " << SSL_CIPHER_get_bits(cipher, 0) << "\n"; out << "protocol = " << SSL_get_version(ssl) << "\n"; } out << IceInternal::fdToString(SSL_get_fd(ssl)); } int IceSSL::Instance::parseProtocols(const StringSeq& protocols) { int v = 0; for(Ice::StringSeq::const_iterator p = protocols.begin(); p != protocols.end(); ++p) { string prot = *p; if(prot == "ssl3" || prot == "sslv3") { v |= SSLv3; } else if(prot == "tls" || prot == "tls1" || prot == "tlsv1" || prot == "tls1_0" || prot == "tlsv1_0") { v |= TLSv1_0; } else if(prot == "tls1_1" || prot == "tlsv1_1") { v |= TLSv1_1; } else if(prot == "tls1_2" || prot == "tlsv1_2") { v |= TLSv1_2; } else { PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: unrecognized protocol `" + prot + "'"; throw ex; } } return v; } SSL_METHOD* IceSSL::Instance::getMethod(int /*protocols*/) { // // Despite its name, the SSLv23 method can negotiate SSL3, TLS1.0, TLS1.1, and TLS1.2. // We use the const_cast for backward compatibility with older OpenSSL releases. // SSL_METHOD* meth = const_cast(SSLv23_method()); /* * Early versions of OpenSSL 1.0.1 would not negotiate a TLS1.2 connection using * the SSLv23 method. You can enable the code below to override the method. if(protocols & TLSv1_2) { meth = const_cast(TLSv1_2_method()); } */ return meth; } void IceSSL::Instance::setOptions(int protocols) { long opts = SSL_OP_NO_SSLv2; // SSLv2 is not supported. if(!(protocols & SSLv3)) { opts |= SSL_OP_NO_SSLv3; } if(!(protocols & TLSv1_0)) { opts |= SSL_OP_NO_TLSv1; } #ifdef SSL_OP_NO_TLSv1_1 if(!(protocols & TLSv1_1)) { opts |= SSL_OP_NO_TLSv1_1; // // The value of SSL_OP_NO_TLSv1_1 changed between 1.0.1a and 1.0.1b. // if(SSL_OP_NO_TLSv1_1 == 0x00000400L) { opts |= 0x10000000L; // New value of SSL_OP_NO_TLSv1_1. } } #endif #ifdef SSL_OP_NO_TLSv1_2 if(!(protocols & TLSv1_2)) { opts |= SSL_OP_NO_TLSv1_2; } #endif SSL_CTX_set_options(_ctx, opts); } Ice-3.5.1/cpp/src/IceStormLib/0000755000076400007640000000000012223561476014117 5ustar mesmesIce-3.5.1/cpp/src/IceStormLib/.depend0000644000076400007640000001222412223561476015360 0ustar mesmesIceStorm$(OBJEXT): IceStorm.cpp $(includedir)/IceStorm/IceStorm.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/FactoryTableInit.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceStorm/Metrics.h $(includedir)/Ice/Metrics.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SliceChecksums.h $(includedir)/IceUtil/DisableWarnings.h Metrics$(OBJEXT): Metrics.cpp $(includedir)/IceStorm/Metrics.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/FactoryTableInit.h $(includedir)/Ice/Metrics.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceUtil/DisableWarnings.h $(HDIR)/IceStorm.h IceStorm.cpp: $(slicedir)/IceStorm/IceStorm.ice $(slicedir)/Ice/SliceChecksumDict.ice $(slicedir)/IceStorm/Metrics.ice $(slicedir)/Ice/Metrics.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) $(HDIR)/Metrics.h Metrics.cpp: $(slicedir)/IceStorm/Metrics.ice $(slicedir)/Ice/Metrics.ice $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) Ice-3.5.1/cpp/src/IceStormLib/Makefile0000644000076400007640000000262412223561476015563 0ustar mesmes# ********************************************************************** # # 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,IceStorm,$(VERSION)) SONAME = $(call mksoname,IceStorm,$(SOVERSION)) LIBNAME = $(call mklibname,IceStorm) TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME)) OBJS = IceStorm.o \ Metrics.o SRCS = $(OBJS:.o=.cpp) SLICE_SRCS = $(SDIR)/IceStorm.ice \ $(SDIR)/Metrics.ice HDIR = $(headerdir)/IceStorm SDIR = $(slicedir)/IceStorm include $(top_srcdir)/config/Make.rules CPPFLAGS := $(CPPFLAGS) -I.. ICECPPFLAGS := $(ICECPPFLAGS) -I.. SLICE2CPPFLAGS := --ice --include-dir IceStorm --checksum --dll-export ICE_STORM_LIB_API $(SLICE2CPPFLAGS) LINKWITH := $(BZIP2_RPATH_LINK) -lIce -lIceUtil $(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) $@ install:: all $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME)) include .depend Ice-3.5.1/cpp/src/IceUtil/0000755000076400007640000000000012223561476013301 5ustar mesmesIce-3.5.1/cpp/src/IceUtil/Random.cpp0000644000076400007640000001115412223561476015227 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #ifdef _MSC_VER # define _CRT_RAND_S #endif #include #include #include #ifdef _WIN32 # include #else # include # include #endif using namespace std; using namespace IceUtil; #if !defined(_WIN32) || !defined(_MSC_VER) namespace { // // The static mutex is required to lazy initialize the file // descriptor for /dev/urandom (Unix) or the cryptographic // context (Windows). // // Also, unfortunately on Linux (at least up to 2.6.9), concurrent // access to /dev/urandom can return the same value. Search for // "Concurrent access to /dev/urandom" in the linux-kernel mailing // list archive for additional details. Since /dev/urandom on other // platforms is usually a port from Linux, this problem could be // widespread. Therefore, we serialize access to /dev/urandom using a // static mutex. // Mutex* staticMutex = 0; #ifdef _WIN32 HCRYPTPROV context = 0; #else int fd = -1; // // Callback to use with pthread_atfork to reset the "/dev/urandom" // fd state. We don't need to close the fd here as that is done // during static destruction. // extern "C" { void childAtFork() { if(fd != -1) { fd = -1; } } } #endif class Init { public: Init() { staticMutex = new IceUtil::Mutex; #ifndef _WIN32 // // Register a callback to reset the "/dev/urandom" fd // state after fork. // pthread_atfork(0, 0, &childAtFork); #endif } ~Init() { #ifdef _WIN32 if(context != 0) { CryptReleaseContext(context, 0); context = 0; } #else if(fd != -1) { close(fd); fd = -1; } #endif delete staticMutex; staticMutex = 0; } }; Init init; } #endif void IceUtilInternal::generateRandom(char* buffer, int size) { #ifdef _WIN32 # if defined(_MSC_VER) for(int i = 0; i < size; ++i) { buffer[i] = random(256); } # else // // It's not clear from the Microsoft documentation if CryptGenRandom // can be called concurrently from several threads. To be on the safe // side, we also serialize calls to CryptGenRandom with the static // mutex. // IceUtilInternal::MutexPtrLock lock(staticMutex); if(context == 0) { if(!CryptAcquireContext(&context, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { throw SyscallException(__FILE__, __LINE__, GetLastError()); } } if(!CryptGenRandom(context, size, reinterpret_cast(buffer))) { throw SyscallException(__FILE__, __LINE__, GetLastError()); } # endif #else // // Serialize access to /dev/urandom; see comment above. // IceUtilInternal::MutexPtrLock lock(staticMutex); if(fd == -1) { fd = open("/dev/urandom", O_RDONLY); if(fd == -1) { assert(0); throw SyscallException(__FILE__, __LINE__, errno); } } // // Limit the number of attempts to 20 reads to avoid // a potential "for ever" loop // int reads = 0; size_t index = 0; while(reads <= 20 && index != static_cast(size)) { ssize_t bytesRead = read(fd, buffer + index, static_cast(size) - index); if(bytesRead == -1 && errno != EINTR) { SyscallException ex(__FILE__, __LINE__, errno); cerr << "Reading /dev/urandom failed:\n" << ex << endl; assert(0); throw ex; } else { index += bytesRead; reads++; } } if(index != static_cast(size)) { assert(0); throw SyscallException(__FILE__, __LINE__, 0); } #endif } unsigned int IceUtilInternal::random(int limit) { unsigned int r; #if defined(_MSC_VER) errno_t err = rand_s(&r); if(err != 0) { SyscallException ex(__FILE__, __LINE__, errno); cerr << "rand_s failed:\n" << ex << endl; assert(0); throw ex; } #else generateRandom(reinterpret_cast(&r), static_cast(sizeof(unsigned int))); #endif if(limit > 0) { r = r % limit; } return r; } Ice-3.5.1/cpp/src/IceUtil/ConvertUTF.cpp0000644000076400007640000004366412223561476016021 0ustar mesmes/* * Copyright 2001-2004 Unicode, Inc. * * Disclaimer * * This source code is provided as is by Unicode, Inc. No claims are * made as to fitness for any particular purpose. No warranties of any * kind are expressed or implied. The recipient agrees to determine * applicability of information provided. If this file has been * purchased on magnetic or optical media from Unicode, Inc., the * sole remedy for any claim will be exchange of defective media * within 90 days of receipt. * * Limitations on Rights to Redistribute This Code * * Unicode, Inc. hereby grants the right to freely use the information * supplied in this file in the creation of products supporting the * Unicode Standard, and to make copies of this file in any form * for internal or external distribution as long as this notice * remains attached. */ // ********************************************************************** // // 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. // // ********************************************************************** /* --------------------------------------------------------------------- Conversions between UTF32, UTF-16, and UTF-8. Source code file. Author: Mark E. Davis, 1994. Rev History: Rick McGowan, fixes & updates May 2001. Sept 2001: fixed const & error conditions per mods suggested by S. Parent & A. Lillich. June 2002: Tim Dodd added detection and handling of incomplete source sequences, enhanced error detection, added casts to eliminate compiler warnings. July 2003: slight mods to back out aggressive FFFE detection. Jan 2004: updated switches in from-UTF8 conversions. Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions. See the header file "ConvertUTF.h" for complete documentation. ------------------------------------------------------------------------ */ #include #ifdef CVTUTF_DEBUG #include #endif using namespace IceUtil; namespace IceUtilInternal { const int halfShift = 10; /* used for shifting by 10 bits */ const UTF32 halfBase = 0x0010000UL; const UTF32 halfMask = 0x3FFUL; #define UNI_SUR_HIGH_START (UTF32)0xD800 #define UNI_SUR_HIGH_END (UTF32)0xDBFF #define UNI_SUR_LOW_START (UTF32)0xDC00 #define UNI_SUR_LOW_END (UTF32)0xDFFF // #define false 0 // #define true 1 /* --------------------------------------------------------------------- */ /* * Index into the table below with the first byte of a UTF-8 sequence to * get the number of trailing bytes that are supposed to follow it. * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is * left as-is for anyone who may want to do such conversion, which was * allowed in earlier algorithms. */ const char trailingBytesForUTF8[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 }; /* * Magic values subtracted from a buffer value during UTF8 conversion. * This table contains as many values as there might be trailing bytes * in a UTF-8 sequence. */ const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; /* * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed * into the first byte, depending on how many bytes follow. There are * as many entries in this table as there are UTF-8 sequence types. * (I.e., one byte sequence, two byte... etc.). Remember that sequencs * for *legal* UTF-8 will be 4 or fewer bytes total. */ const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; /* --------------------------------------------------------------------- */ /* The interface converts a whole buffer to avoid function-call overhead. * Constants have been gathered. Loops & conditionals have been removed as * much as possible for efficiency, in favor of drop-through switches. * (See "Note A" at the bottom of the file for equivalent code.) * If your compiler supports it, the "isLegalUTF8" call can be turned * into an inline function. */ /* --------------------------------------------------------------------- */ ConversionResult ConvertUTF16toUTF8 ( const UTF16** sourceStart, const UTF16* sourceEnd, UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) { ConversionResult result = conversionOK; const UTF16* source = *sourceStart; UTF8* target = *targetStart; while (source < sourceEnd) { UTF32 ch; unsigned short bytesToWrite = 0; const UTF32 byteMask = 0xBF; const UTF32 byteMark = 0x80; const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */ ch = *source++; /* If we have a surrogate pair, convert to UTF32 first. */ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) { /* If the 16 bits following the high surrogate are in the source buffer... */ if (source < sourceEnd) { UTF32 ch2 = *source; /* If it's a low surrogate, convert to UTF32. */ if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) { ch = ((ch - UNI_SUR_HIGH_START) << halfShift) + (ch2 - UNI_SUR_LOW_START) + halfBase; ++source; } else if (flags == strictConversion) { /* it's an unpaired high surrogate */ --source; /* return to the illegal value itself */ result = sourceIllegal; break; } } else { /* We don't have the 16 bits following the high surrogate. */ --source; /* return to the high surrogate */ result = sourceExhausted; break; } } else if (flags == strictConversion) { /* UTF-16 surrogate values are illegal in UTF-32 */ if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) { --source; /* return to the illegal value itself */ result = sourceIllegal; break; } } /* Figure out how many bytes the result will require */ if (ch < (UTF32)0x80) { bytesToWrite = 1; } else if (ch < (UTF32)0x800) { bytesToWrite = 2; } else if (ch < (UTF32)0x10000) { bytesToWrite = 3; } else if (ch < (UTF32)0x110000) { bytesToWrite = 4; } else { bytesToWrite = 3; ch = UNI_REPLACEMENT_CHAR; } target += bytesToWrite; if (target > targetEnd) { source = oldSource; /* Back up source pointer! */ target -= bytesToWrite; result = targetExhausted; break; } switch (bytesToWrite) { /* note: everything falls through. */ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]); } target += bytesToWrite; } *sourceStart = source; *targetStart = target; return result; } /* --------------------------------------------------------------------- */ /* * Utility routine to tell whether a sequence of bytes is legal UTF-8. * This must be called with the length pre-determined by the first byte. * If not calling this from ConvertUTF8to*, then the length can be set by: * length = trailingBytesForUTF8[*source]+1; * and the sequence is illegal right away if there aren't that many bytes * available. * If presented with a length > 4, this returns false. The Unicode * definition of UTF-8 goes up to 4-byte sequences. */ Boolean isLegalUTF8(const UTF8 *source, int length) { UTF8 a; const UTF8 *srcptr = source+length; switch (length) { default: return false; /* Everything else falls through when "true"... */ case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; case 2: if ((a = (*--srcptr)) > 0xBF) return false; switch (*source) { /* no fall-through in this inner switch */ case 0xE0: if (a < 0xA0) return false; break; case 0xED: if (a > 0x9F) return false; break; case 0xF0: if (a < 0x90) return false; break; case 0xF4: if (a > 0x8F) return false; break; default: if (a < 0x80) return false; } case 1: if (*source >= 0x80 && *source < 0xC2) return false; } if (*source > 0xF4) return false; return true; } /* --------------------------------------------------------------------- */ ConversionResult ConvertUTF8toUTF16 ( const UTF8** sourceStart, const UTF8* sourceEnd, UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) { ConversionResult result = conversionOK; const UTF8* source = *sourceStart; UTF16* target = *targetStart; while (source < sourceEnd) { UTF32 ch = 0; unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; if (source + extraBytesToRead >= sourceEnd) { result = sourceExhausted; break; } /* Do this check whether lenient or strict */ if (! isLegalUTF8(source, extraBytesToRead+1)) { result = sourceIllegal; break; } /* * The cases all fall through. See "Note A" below. */ switch (extraBytesToRead) { case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */ case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */ case 3: ch += *source++; ch <<= 6; case 2: ch += *source++; ch <<= 6; case 1: ch += *source++; ch <<= 6; case 0: ch += *source++; } ch -= offsetsFromUTF8[extraBytesToRead]; if (target >= targetEnd) { source -= (extraBytesToRead+1); /* Back up source pointer! */ result = targetExhausted; break; } if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */ /* UTF-16 surrogate values are illegal in UTF-32 */ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { if (flags == strictConversion) { source -= (extraBytesToRead+1); /* return to the illegal value itself */ result = sourceIllegal; break; } else { *target++ = UNI_REPLACEMENT_CHAR; } } else { *target++ = (UTF16)ch; /* normal case */ } } else if (ch > UNI_MAX_UTF16) { if (flags == strictConversion) { result = sourceIllegal; source -= (extraBytesToRead+1); /* return to the start */ break; /* Bail out; shouldn't continue */ } else { *target++ = UNI_REPLACEMENT_CHAR; } } else { /* target is a character in range 0xFFFF - 0x10FFFF. */ if (target + 1 >= targetEnd) { source -= (extraBytesToRead+1); /* Back up source pointer! */ result = targetExhausted; break; } ch -= halfBase; *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START); *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START); } } *sourceStart = source; *targetStart = target; return result; } /* --------------------------------------------------------------------- */ ConversionResult ConvertUTF32toUTF8 ( const UTF32** sourceStart, const UTF32* sourceEnd, UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) { ConversionResult result = conversionOK; const UTF32* source = *sourceStart; UTF8* target = *targetStart; while (source < sourceEnd) { UTF32 ch; unsigned short bytesToWrite = 0; const UTF32 byteMask = 0xBF; const UTF32 byteMark = 0x80; ch = *source++; if (flags == strictConversion ) { /* UTF-16 surrogate values are illegal in UTF-32 */ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { --source; /* return to the illegal value itself */ result = sourceIllegal; break; } } /* * Figure out how many bytes the result will require. Turn any * illegally large UTF32 things (> Plane 17) into replacement chars. */ if (ch < (UTF32)0x80) { bytesToWrite = 1; } else if (ch < (UTF32)0x800) { bytesToWrite = 2; } else if (ch < (UTF32)0x10000) { bytesToWrite = 3; } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4; } else { bytesToWrite = 3; ch = UNI_REPLACEMENT_CHAR; result = sourceIllegal; } target += bytesToWrite; if (target > targetEnd) { --source; /* Back up source pointer! */ target -= bytesToWrite; result = targetExhausted; break; } switch (bytesToWrite) { /* note: everything falls through. */ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]); } target += bytesToWrite; } *sourceStart = source; *targetStart = target; return result; } /* --------------------------------------------------------------------- */ ConversionResult ConvertUTF8toUTF32 ( const UTF8** sourceStart, const UTF8* sourceEnd, UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) { ConversionResult result = conversionOK; const UTF8* source = *sourceStart; UTF32* target = *targetStart; while (source < sourceEnd) { UTF32 ch = 0; unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; if (source + extraBytesToRead >= sourceEnd) { result = sourceExhausted; break; } /* Do this check whether lenient or strict */ if (! isLegalUTF8(source, extraBytesToRead+1)) { result = sourceIllegal; break; } /* * The cases all fall through. See "Note A" below. */ switch (extraBytesToRead) { case 5: ch += *source++; ch <<= 6; case 4: ch += *source++; ch <<= 6; case 3: ch += *source++; ch <<= 6; case 2: ch += *source++; ch <<= 6; case 1: ch += *source++; ch <<= 6; case 0: ch += *source++; } ch -= offsetsFromUTF8[extraBytesToRead]; if (target >= targetEnd) { source -= (extraBytesToRead+1); /* Back up the source pointer! */ result = targetExhausted; break; } if (ch <= UNI_MAX_LEGAL_UTF32) { /* * UTF-16 surrogate values are illegal in UTF-32, and anything * over Plane 17 (> 0x10FFFF) is illegal. */ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { if (flags == strictConversion) { source -= (extraBytesToRead+1); /* return to the illegal value itself */ result = sourceIllegal; break; } else { *target++ = UNI_REPLACEMENT_CHAR; } } else { *target++ = ch; } } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */ result = sourceIllegal; *target++ = UNI_REPLACEMENT_CHAR; } } *sourceStart = source; *targetStart = target; return result; } /* --------------------------------------------------------------------- Note A. The fall-through switches in UTF-8 reading code save a temp variable, some decrements & conditionals. The switches are equivalent to the following loop: { int tmpBytesToRead = extraBytesToRead+1; do { ch += *source++; --tmpBytesToRead; if (tmpBytesToRead) ch <<= 6; } while (tmpBytesToRead > 0); } In UTF-8 writing code, the switches on "bytesToWrite" are similarly unrolled loops. --------------------------------------------------------------------- */ } namespace IceUtil { using namespace IceUtilInternal; /* --------------------------------------------------------------------- */ /* * Exported function to return whether a UTF-8 sequence is legal or not. * This is not used here; it's just exported. */ Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) { if(source == sourceEnd) { return true; } while(true) { int length = trailingBytesForUTF8[*source]+1; // Is buffer big enough to contain character? if (source+length > sourceEnd) { return false; } // Is character legal UTF8? if(!isLegalUTF8(source, length)) { return false; } // Are we at end of buffer? source += length; if(source == sourceEnd) { return true; } } } } Ice-3.5.1/cpp/src/IceUtil/Shared.cpp0000644000076400007640000001062312223561476015215 0ustar mesmes// ********************************************************************** // // 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 using namespace IceUtil; #ifdef ICE_HAS_ATOMIC_FUNCTIONS namespace IceUtilInternal { // // Linux only. Unfortunately, asm/atomic.h builds non-SMP safe code // with non-SMP kernels. This means that executables compiled with a // non-SMP kernel would fail randomly due to concurrency errors with // reference counting on SMP hosts. Therefore the relevent pieces of // atomic.h are more-or-less duplicated. // /* * atomicInc - increment ice_atomic variable * @v: pointer of type AtomicCounter * * Atomically increments @v by 1. Note that the guaranteed useful * range of an AtomicCounter is only 24 bits. * * Inlined because this operation is performance critical. */ static inline void atomicInc(volatile int* counter) { __asm__ __volatile__( "lock ; incl %0" :"=m" (*counter) :"m" (*counter)); } /** * atomicDecAndTest - decrement and test * @v: pointer of type AtomicCounter * * Atomically decrements @v by 1 and returns true if the result is 0, * or false for all other cases. Note that the guaranteed useful * range of an AtomicCounter is only 24 bits. * * Inlined because this operation is performance critical. */ static inline int atomicDecAndTest(volatile int* counter) { unsigned char c; __asm__ __volatile__( "lock ; decl %0; sete %1" :"=m" (*counter), "=qm" (c) :"m" (*counter) : "memory"); return c != 0; } /** * atomicExchangeAdd - same as InterlockedExchangeAdd. This * didn't come from atomic.h (the code was derived from similar code * in /usr/include/asm/rwsem.h) * * Inlined because this operation is performance critical. */ static inline int atomicExchangeAdd(volatile int* counter, int i) { int tmp = i; __asm__ __volatile__( "lock ; xadd %0,(%2)" :"+r"(tmp), "=m"(*counter) :"r"(counter), "m"(*counter) : "memory"); return tmp + i; } } #endif IceUtil::SimpleShared::SimpleShared() : _ref(0), _noDelete(false) { } IceUtil::SimpleShared::SimpleShared(const SimpleShared&) : _ref(0), _noDelete(false) { } IceUtil::Shared::Shared() : _ref(0), _noDelete(false) { } IceUtil::Shared::Shared(const Shared&) : _ref(0), _noDelete(false) { } void IceUtil::Shared::__incRef() { #if defined(_WIN32) assert(InterlockedExchangeAdd(&_ref, 0) >= 0); InterlockedIncrement(&_ref); #elif defined(ICE_HAS_GCC_BUILTINS) # ifndef NDEBUG int c = # endif __sync_fetch_and_add(&_ref, 1); assert(c >= 0); #elif defined(ICE_HAS_ATOMIC_FUNCTIONS) assert(IceUtilInternal::atomicExchangeAdd(&_ref, 0) >= 0); IceUtilInternal::atomicInc(&_ref); #else _mutex.lock(); assert(_ref >= 0); ++_ref; _mutex.unlock(); #endif } void IceUtil::Shared::__decRef() { #if defined(_WIN32) assert(InterlockedExchangeAdd(&_ref, 0) > 0); if(InterlockedDecrement(&_ref) == 0 && !_noDelete) { _noDelete = true; delete this; } #elif defined(ICE_HAS_GCC_BUILTINS) int c = __sync_fetch_and_sub(&_ref, 1); assert(c > 0); if(c == 1 && !_noDelete) { _noDelete = true; delete this; } #elif defined(ICE_HAS_ATOMIC_FUNCTIONS) assert(IceUtilInternal::atomicExchangeAdd(&_ref, 0) > 0); if(IceUtilInternal::atomicDecAndTest(&_ref) && !_noDelete) { _noDelete = true; delete this; } #else _mutex.lock(); bool doDelete = false; assert(_ref > 0); if(--_ref == 0) { doDelete = !_noDelete; _noDelete = true; } _mutex.unlock(); if(doDelete) { delete this; } #endif } int IceUtil::Shared::__getRef() const { #if defined(_WIN32) return InterlockedExchangeAdd(const_cast(&_ref), 0); #elif defined(ICE_HAS_GCC_BUILTINS) return __sync_fetch_and_sub(const_cast(&_ref), 0); #elif defined(ICE_HAS_ATOMIC_FUNCTIONS) return IceUtilInternal::atomicExchangeAdd(const_cast(&_ref), 0); #else _mutex.lock(); int ref = _ref; _mutex.unlock(); return ref; #endif } void IceUtil::Shared::__setNoDelete(bool b) { _noDelete = b; } Ice-3.5.1/cpp/src/IceUtil/CountDownLatch.cpp0000644000076400007640000000774312223561476016714 0ustar mesmes// ********************************************************************** // // 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 #include IceUtilInternal::CountDownLatch::CountDownLatch(int count) : _count(count) { if(count < 0) { throw IceUtil::Exception(__FILE__, __LINE__); } #ifdef _WIN32 # ifndef ICE_OS_WINRT _event = CreateEvent(0, TRUE, FALSE, 0); # else _event = CreateEventExW(0, 0, CREATE_EVENT_MANUAL_RESET, SEMAPHORE_ALL_ACCESS); # endif if(_event == 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } #else int rc = pthread_mutex_init(&_mutex, 0); if(rc != 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rc); } rc = pthread_cond_init(&_cond, 0); if(rc != 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rc); } #endif } IceUtilInternal::CountDownLatch::~CountDownLatch() { #ifdef _WIN32 CloseHandle(_event); #else # ifndef NDEBUG int rc = pthread_mutex_destroy(&_mutex); assert(rc == 0); rc = pthread_cond_destroy(&_cond); assert(rc == 0); # else pthread_mutex_destroy(&_mutex); pthread_cond_destroy(&_cond); # endif #endif } void IceUtilInternal::CountDownLatch::await() const { #ifdef _WIN32 while(InterlockedExchangeAdd(&_count, 0) > 0) { # ifndef ICE_OS_WINRT DWORD rc = WaitForSingleObject(_event, INFINITE); # else DWORD rc = WaitForSingleObjectEx(_event, INFINITE, false); # endif assert(rc == WAIT_OBJECT_0 || rc == WAIT_FAILED); if(rc == WAIT_FAILED) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } #else lock(); while(_count > 0) { int rc = pthread_cond_wait(&_cond, &_mutex); if(rc != 0) { pthread_mutex_unlock(&_mutex); throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rc); } } unlock(); #endif } void IceUtilInternal::CountDownLatch::countDown() { #ifdef _WIN32 if(InterlockedDecrement(&_count) == 0) { if(SetEvent(_event) == 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } #else bool broadcast = false; lock(); if(_count > 0 && --_count == 0) { broadcast = true; } #if defined(__APPLE__) // // On OS X we do the broadcast with the mutex held. This seems to // be necessary to prevent the broadcast call to hang (spinning in // an infinite loop). // if(broadcast) { int rc = pthread_cond_broadcast(&_cond); if(rc != 0) { pthread_mutex_unlock(&_mutex); throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rc); } } unlock(); #else unlock(); if(broadcast) { int rc = pthread_cond_broadcast(&_cond); if(rc != 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rc); } } #endif #endif } int IceUtilInternal::CountDownLatch::getCount() const { #ifdef _WIN32 int count = InterlockedExchangeAdd(&_count, 0); return count > 0 ? count : 0; #else lock(); int result = _count; unlock(); return result; #endif } #ifndef _WIN32 void IceUtilInternal::CountDownLatch::lock() const { int rc = pthread_mutex_lock(&_mutex); if(rc != 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rc); } } void IceUtilInternal::CountDownLatch::unlock() const { int rc = pthread_mutex_unlock(&_mutex); if(rc != 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rc); } } #endif Ice-3.5.1/cpp/src/IceUtil/.depend0000644000076400007640000001123212223561476014540 0ustar mesmesArgVector$(OBJEXT): ArgVector.cpp $(includedir)/IceUtil/ArgVector.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/DisableWarnings.h Cond$(OBJEXT): Cond.cpp $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h ConvertUTF$(OBJEXT): ConvertUTF.cpp ../IceUtil/ConvertUTF.h $(includedir)/IceUtil/Unicode.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Exception.h CountDownLatch$(OBJEXT): CountDownLatch.cpp $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h CtrlCHandler$(OBJEXT): CtrlCHandler.cpp $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/MutexProtocol.h Exception$(OBJEXT): Exception.cpp $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/StringUtil.h InputUtil$(OBJEXT): InputUtil.cpp $(includedir)/IceUtil/InputUtil.h $(includedir)/IceUtil/Config.h Options$(OBJEXT): Options.cpp $(includedir)/IceUtil/Options.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/StringUtil.h OutputUtil$(OBJEXT): OutputUtil.cpp $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/FileUtil.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h Random$(OBJEXT): Random.cpp $(includedir)/IceUtil/Random.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/MutexPtrLock.h RecMutex$(OBJEXT): RecMutex.cpp $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h Shared$(OBJEXT): Shared.cpp $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h StringUtil$(OBJEXT): StringUtil.cpp $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Unicode.h $(includedir)/IceUtil/Exception.h Thread$(OBJEXT): Thread.cpp $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h ThreadException$(OBJEXT): ThreadException.cpp $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Time.h Time$(OBJEXT): Time.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Time.h Timer$(OBJEXT): Timer.cpp $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h UUID$(OBJEXT): UUID.cpp $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Random.h $(includedir)/IceUtil/Exception.h Unicode$(OBJEXT): Unicode.cpp $(includedir)/IceUtil/Unicode.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Exception.h ../IceUtil/ConvertUTF.h MutexProtocol$(OBJEXT): MutexProtocol.cpp $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Config.h FileUtil$(OBJEXT): FileUtil.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/FileUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Unicode.h Ice-3.5.1/cpp/src/IceUtil/ArgVector.cpp0000644000076400007640000000263212223561476015704 0ustar mesmes// ********************************************************************** // // 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 #include #include IceUtilInternal::ArgVector::ArgVector(int argc, char* const argv[]) { assert(argc >= 0); _args.resize(argc); for(int i = 0; i < argc; ++i) { _args[i] = argv[i]; } setupArgcArgv(); } IceUtilInternal::ArgVector::ArgVector(const ::std::vector< ::std::string>& vec) { _args = vec; setupArgcArgv(); } IceUtilInternal::ArgVector::ArgVector(const ArgVector& rhs) { _args = rhs._args; setupArgcArgv(); } IceUtilInternal::ArgVector& IceUtilInternal::ArgVector::operator=(const ArgVector& rhs) { delete[] argv; argv = 0; _args = rhs._args; setupArgcArgv(); return *this; } IceUtilInternal::ArgVector::~ArgVector() { delete[] argv; } void IceUtilInternal::ArgVector::setupArgcArgv() { argc = static_cast(_args.size()); if((argv = new char*[argc + 1]) == 0) { throw ::std::bad_alloc(); } for(int i = 0; i < argc; i++) { argv[i] = const_cast(_args[i].c_str()); } argv[argc] = 0; } Ice-3.5.1/cpp/src/IceUtil/Options.cpp0000644000076400007640000007622512223561476015454 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace IceUtil; IceUtilInternal::APIException::APIException(const char* file, int line, const string& r) : IceUtil::Exception(file, line), reason(r) { } IceUtilInternal::APIException::~APIException() throw() { } const char* IceUtilInternal::APIException::_name = "IceUtilInternal::APIException"; string IceUtilInternal::APIException::ice_name() const { return _name; } void IceUtilInternal::APIException::ice_print(ostream& out) const { Exception::ice_print(out); if(!reason.empty()) { out << ": " << reason; } } IceUtilInternal::APIException* IceUtilInternal::APIException::ice_clone() const { return new APIException(*this); } void IceUtilInternal::APIException::ice_throw() const { throw *this; } ostream& IceUtilInternal::operator<<(ostream& out, const IceUtilInternal::APIException& ex) { ex.ice_print(out); return out; } IceUtilInternal::BadOptException::BadOptException(const char* file, int line, const string& r) : IceUtil::Exception(file, line), reason(r) { } IceUtilInternal::BadOptException::~BadOptException() throw() { } const char* IceUtilInternal::BadOptException::_name = "IceUtilInternal::BadOptException"; string IceUtilInternal::BadOptException::ice_name() const { return _name; } void IceUtilInternal::BadOptException::ice_print(ostream& out) const { Exception::ice_print(out); if(!reason.empty()) { out << ": " << reason; } } IceUtilInternal::BadOptException* IceUtilInternal::BadOptException::ice_clone() const { return new BadOptException(*this); } void IceUtilInternal::BadOptException::ice_throw() const { throw *this; } ostream& IceUtilInternal::operator<<(ostream& out, const IceUtilInternal::BadOptException& ex) { ex.ice_print(out); return out; } IceUtilInternal::Options::Options() : parseCalled(false) { } void IceUtilInternal::Options::checkArgs(const string& shortOpt, const string& longOpt, bool needArg, const string& dflt) { if(shortOpt.empty() && longOpt.empty()) { throw IllegalArgumentException(__FILE__, __LINE__, "short and long option cannot both be empty"); } if(!shortOpt.empty()) { if(shortOpt.size() != 1) { string err = "`"; err += shortOpt; err += "': a short option cannot specify more than one option"; throw IllegalArgumentException(__FILE__, __LINE__, err); } if(shortOpt.find_first_of(" \t\n\r\f\v") != string::npos) { string err = "`"; err += shortOpt; err += "': a short option cannot be whitespace"; throw IllegalArgumentException(__FILE__, __LINE__, err); } if(shortOpt[0] == '-') { string err = "`"; err += shortOpt; err += "': a short option cannot be `-'"; throw IllegalArgumentException(__FILE__, __LINE__, err); } } if(!longOpt.empty()) { if(longOpt.find_first_of(" \t\n\r\f\v") != string::npos) { string err = "`"; err += longOpt; err += "': a long option cannot contain whitespace"; throw IllegalArgumentException(__FILE__, __LINE__, err); } if(longOpt[0] == '-') { string err = "`"; err += longOpt; err += "': a long option must not contain a leading `-'"; throw IllegalArgumentException(__FILE__, __LINE__, err); } } if(!needArg && !dflt.empty()) { throw IllegalArgumentException(__FILE__, __LINE__, "a default value can be specified only for options requiring an argument"); } } void IceUtilInternal::Options::addOpt(const string& shortOpt, const string& longOpt, ArgType at, string dflt, RepeatType rt) { RecMutex::Lock sync(_m); if(parseCalled) { throw APIException(__FILE__, __LINE__, "cannot add options after parse() was called"); } checkArgs(shortOpt, longOpt, at == NeedArg, dflt); addValidOpt(shortOpt, longOpt, at, dflt, rt); } // // Split a command line into argv-style arguments, applying // bash quoting rules. The return value is the arguments // in the command line, with all shell escapes applied, and // quotes removed. // IceUtilInternal::Options::StringVector IceUtilInternal::Options::split(const string& line) { const string IFS = " \t\n"; // Internal Field Separator. // // Strip leading and trailing whitespace. // string::size_type start = line.find_first_not_of(IFS); if(start == string::npos) { return StringVector(); } string::size_type end = line.find_last_not_of(IFS); assert(end != string::npos); string l(line, start, end - start + 1); StringVector vec; enum ParseState { Normal, DoubleQuote, SingleQuote, ANSIQuote }; ParseState state = Normal; string arg; for(string::size_type i = 0; i < l.size(); ++i) { char c = l[i]; switch(state) { case Normal: { switch(c) { case '\\': { // // Ignore a backslash at the end of the string, // and strip backslash-newline pairs. If a // backslash is followed by a space, single quote, // double quote, or dollar sign, we drop the backslash // and write the space, single quote, double quote, // or dollar sign. This is necessary to allow quotes // to be escaped. Dropping the backslash preceding a // space deviates from bash quoting rules, but is // necessary so we don't drop backslashes from Windows // path names.) // if(i < l.size() - 1 && l[++i] != '\n') { switch(l[i]) { case ' ': case '$': case '\'': case '"': { arg.push_back(l[i]); break; } default: { arg.push_back('\\'); arg.push_back(l[i]); break; } } } break; } case '\'': { state = SingleQuote; break; } case '"': { state = DoubleQuote; break; } case '$': { if(i < l.size() - 1 && l[i + 1] == '\'') { state = ANSIQuote; // Bash uses $'' to allow ANSI escape sequences within . ++i; } else { arg.push_back('$'); } break; } default: { if(IFS.find(l[i]) != string::npos) { vec.push_back(arg); arg.clear(); // // Move to start of next argument. // while(++i < l.size() && IFS.find(l[i]) != string::npos) { ; } --i; } else { arg.push_back(l[i]); } break; } } break; } case DoubleQuote: { // // Within double quotes, only backslash retains its special // meaning, and only if followed by double quote, backslash, // or newline. If not followed by one of these characters, // both the backslash and the character are preserved. // if(c == '\\' && i < l.size() - 1) { switch(c = l[++i]) { case '"': case '\\': case '\n': { arg.push_back(c); break; } default: { arg.push_back('\\'); arg.push_back(c); break; } } } else if(c == '"') // End of double-quote mode. { state = Normal; } else { arg.push_back(c); // Everything else is taken literally. } break; } case SingleQuote: { if(c == '\'') // End of single-quote mode. { state = Normal; } else { arg.push_back(c); // Everything else is taken literally. } break; } case ANSIQuote: { switch(c) { case '\\': { if(i == l.size() - 1) { break; } switch(c = l[++i]) { // // Single-letter escape sequences. // case 'a': { arg.push_back('\a'); break; } case 'b': { arg.push_back('\b'); break; } case 'f': { arg.push_back('\f'); break; } case 'n': { arg.push_back('\n'); break; } case 'r': { arg.push_back('\r'); break; } case 't': { arg.push_back('\t'); break; } case 'v': { arg.push_back('\v'); break; } case '\\': { arg.push_back('\\'); break; } case '\'': { arg.push_back('\''); break; } case 'e': // Not ANSI-C, but used by bash. { arg.push_back('\033'); break; } // // Process up to three octal digits. // case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { static const string octalDigits = "01234567"; unsigned short us = 0; string::size_type j; for(j = i; j < i + 3 && j < l.size() && octalDigits.find_first_of(c = l[j]) != string::npos; ++j) { us = us * 8 + c - '0'; } i = j - 1; arg.push_back(static_cast(us)); break; } // // Process up to two hex digits. // case 'x': { if(i < l.size() - 1 && !isxdigit(static_cast(l[i + 1]))) { arg.push_back('\\'); arg.push_back('x'); break; } Int64 ull = 0; string::size_type j; for(j = i + 1; j < i + 3 && j < l.size() && isxdigit(static_cast(c = l[j])); ++j) { ull *= 16; if(isdigit(static_cast(c))) { ull += c - '0'; } else if(islower(static_cast(c))) { ull += c - 'a' + 10; } else { ull += c - 'A' + 10; } } i = j - 1; arg.push_back(static_cast(ull)); break; } // // Process control-chars. // case 'c': { c = l[++i]; if(IceUtilInternal::isAlpha(c) || c == '@' || (c >= '[' && c <= '_')) { arg.push_back(static_cast(toupper(static_cast(c)) - '@')); } else { // // Bash does not define what should happen if a \c // is not followed by a recognized control character. // We simply treat this case like other unrecognized // escape sequences, that is, we preserve the escape // sequence unchanged. // arg.push_back('\\'); arg.push_back('c'); arg.push_back(c); } break; } // // If inside an ANSI-quoted string, a backslash isn't followed by // one of the recognized characters, both the backslash and the // character are preserved. // default: { arg.push_back('\\'); arg.push_back(c); break; } } break; } case '\'': // End of ANSI-quote mode. { state = Normal; break; } default: { arg.push_back(c); // Everything else is taken literally. break; } } break; } default: { assert(!"Impossible parse state"); break; } } } switch(state) { case Normal: { vec.push_back(arg); break; } case SingleQuote: { throw BadOptException(__FILE__, __LINE__, "missing closing single quote"); break; } case DoubleQuote: { throw BadOptException(__FILE__, __LINE__, "missing closing double quote"); break; } case ANSIQuote: { throw BadOptException(__FILE__, __LINE__, "unterminated $' quote"); break; } default: { assert(!"Impossible parse state"); break; } } return vec; } // // Parse a vector of arguments and return the non-option // arguments as the return value. Throw BadOptException if any of the // options are invalid. // Note that args[0] is ignored because that is the name // of the executable. // IceUtilInternal::Options::StringVector IceUtilInternal::Options::parse(const StringVector& args) { RecMutex::Lock sync(_m); if(parseCalled) { throw APIException(__FILE__, __LINE__, "cannot call parse() more than once on the same Option instance"); } parseCalled = true; set seenNonRepeatableOpts; // To catch repeated non-repeatable options. StringVector result; string::size_type i; for(i = 1; i < args.size(); ++i) { if(args[i] == "-" || args[i] == "--") { ++i; break; // "-" and "--" indicate end of options. } string opt; ValidOpts::iterator pos; bool argDone = false; if(args[i].compare(0, 2, "--") == 0) { // // Long option. If the option has an argument, it can either be separated by '=' // or appear as a separate argument. For example, "--name value" is the same // as "--name=value". // string::size_type p = args[i].find('=', 2); if(p != string::npos) { opt = args[i].substr(2, p - 2); } else { opt = args[i].substr(2); } pos = checkOpt(opt, LongOpt); if(pos->second->repeat == NoRepeat) { set::iterator seenPos = seenNonRepeatableOpts.find(opt); if(seenPos != seenNonRepeatableOpts.end()) { string err = "`--"; err += opt + ":' option cannot be repeated"; throw BadOptException(__FILE__, __LINE__, err); } seenNonRepeatableOpts.insert(seenPos, opt); string synonym = getSynonym(opt); if(!synonym.empty()) { seenNonRepeatableOpts.insert(synonym); } } if(p != string::npos) { if(pos->second->arg == NoArg && p != args[i].size() - 1) { string err = "`"; err += args[i]; err += "': option does not take an argument"; throw BadOptException(__FILE__, __LINE__, err); } setOpt(opt, "", args[i].substr(p + 1), pos->second->repeat); argDone = true; } } else if(!args[i].empty() && args[i][0] == '-') { // // Short option. // for(string::size_type p = 1; p < args[i].size(); ++p) { opt.clear(); opt.push_back(args[i][p]); pos = checkOpt(opt, ShortOpt); if(pos->second->repeat == NoRepeat) { set::iterator seenPos = seenNonRepeatableOpts.find(opt); if(seenPos != seenNonRepeatableOpts.end()) { string err = "`-"; err += opt + ":' option cannot be repeated"; throw BadOptException(__FILE__, __LINE__, err); } seenNonRepeatableOpts.insert(seenPos, opt); string synonym = getSynonym(opt); if(!synonym.empty()) { seenNonRepeatableOpts.insert(synonym); } } if(pos->second->arg == NeedArg && p != args[i].size() - 1) { string optArg = args[i].substr(p + 1); setOpt(opt, "", optArg, pos->second->repeat); argDone = true; break; } } } else { // // Not an option or option argument. // result.push_back(args[i]); argDone = true; } if(!argDone) { if(pos->second->arg == NeedArg) // Need an argument that is separated by whitespace. { if(i == args.size() - 1) { string err = "`-"; if(opt.size() != 1) { err += "-"; } err += opt; err += "' option requires an argument"; throw BadOptException(__FILE__, __LINE__, err); } setOpt(opt, "", args[++i], pos->second->repeat); } else { setOpt(opt, "", "1", pos->second->repeat); } } } _synonyms.clear(); // Don't need the contents anymore. while(i < args.size()) { result.push_back(args[i++]); } return result; } // // Parse a normal argc/argv pair and return the non-option // arguments as the return value. // IceUtilInternal::Options::StringVector IceUtilInternal::Options::parse(int argc, const char* const argv[]) { StringVector vec; for(int i = 0; i < argc; ++i) { vec.push_back(argv[i]); } return parse(vec); } bool IceUtilInternal::Options::isSet(const string& opt) const { RecMutex::Lock sync(_m); if(!parseCalled) { throw APIException(__FILE__, __LINE__, "cannot lookup options before calling parse()"); } ValidOpts::const_iterator pos = checkOptIsValid(opt); return pos->second->repeat == NoRepeat ? _opts.find(opt) != _opts.end() : _ropts.find(opt) != _ropts.end(); } string IceUtilInternal::Options::optArg(const string& opt) const { RecMutex::Lock sync(_m); if(!parseCalled) { throw APIException(__FILE__, __LINE__, "cannot lookup options before calling parse()"); } ValidOpts::const_iterator pos = checkOptHasArg(opt); if(pos->second->repeat == Repeat) { string err = "`-"; if(pos->second->length == LongOpt) { err.push_back('-'); } err += opt; err += "': is a repeating option -- use argVec() to get its arguments"; throw IllegalArgumentException(__FILE__, __LINE__, err); } Opts::const_iterator p = _opts.find(opt); if(p == _opts.end()) { return ""; } return p->second->val; } IceUtilInternal::Options::StringVector IceUtilInternal::Options::argVec(const string& opt) const { RecMutex::Lock sync(_m); if(!parseCalled) { throw APIException(__FILE__, __LINE__, "cannot lookup options before calling parse()"); } ValidOpts::const_iterator pos = checkOptHasArg(opt); if(pos->second->repeat == NoRepeat) { string err = "`-"; if(pos->second->length == LongOpt) { err.push_back('-'); } err += opt + "': is a non-repeating option -- use optArg() to get its argument"; throw IllegalArgumentException(__FILE__, __LINE__, err); } ROpts::const_iterator p = _ropts.find(opt); return p == _ropts.end() ? StringVector() : p->second->vals; } void IceUtilInternal::Options::addValidOpt(const string& shortOpt, const string& longOpt, ArgType at, const string& dflt, RepeatType rt) { if(!shortOpt.empty() && _validOpts.find(shortOpt) != _validOpts.end()) { string err = "`"; err += shortOpt; err += "': duplicate option"; throw IllegalArgumentException(__FILE__, __LINE__, err); } if(!longOpt.empty() && _validOpts.find(longOpt) != _validOpts.end()) { string err = "`"; err += longOpt; err += "': duplicate option"; throw IllegalArgumentException(__FILE__, __LINE__, err); } ODPtr odp = new OptionDetails; odp->arg = at; odp->repeat = rt; odp->hasDefault = !dflt.empty(); if(!shortOpt.empty()) { odp->length = ShortOpt; _validOpts[shortOpt] = odp; } if(!longOpt.empty()) { odp->length = LongOpt; _validOpts[longOpt] = odp; } updateSynonyms(shortOpt, longOpt); if(at == NeedArg && !dflt.empty()) { setOpt(shortOpt, longOpt, dflt, rt); } } IceUtilInternal::Options::ValidOpts::iterator IceUtilInternal::Options::checkOpt(const string& opt, LengthType lt) { ValidOpts::iterator pos = _validOpts.find(opt); if(pos == _validOpts.end()) { string err = "invalid option: `-"; if(lt == LongOpt) { err.push_back('-'); } err += opt; err.push_back('\''); throw BadOptException(__FILE__, __LINE__, err); } return pos; } void IceUtilInternal::Options::setOpt(const string& opt1, const string& opt2, const string& val, RepeatType rt) { // // opt1 and opt2 (short and long opt) can't both be empty. // assert(!(opt1.empty() && opt2.empty())); if(rt == NoRepeat) { setNonRepeatingOpt(opt1, val); setNonRepeatingOpt(opt2, val); } else { setRepeatingOpt(opt1, val); setRepeatingOpt(opt2, val); } } void IceUtilInternal::Options::setNonRepeatingOpt(const string& opt, const string& val) { if(opt.empty()) { return; } // // The option must not have been set before or, if it was set, it must have // been because of a default value. // assert(_opts.find(opt) == _opts.end() || _validOpts.find(opt)->second->hasDefault); OValPtr ovp = new OptionValue; ovp->val = val; _opts[opt] = ovp; const string synonym = getSynonym(opt); if(!synonym.empty()) { _opts[synonym] = ovp; } } void IceUtilInternal::Options::setRepeatingOpt(const string& opt, const string& val) { if(opt.empty()) { return; } ValidOpts::const_iterator vpos = _validOpts.find(opt); assert(vpos != _validOpts.end()); ROpts::iterator pos = _ropts.find(opt); const string synonym = getSynonym(opt); ROpts::iterator spos = _ropts.find(synonym); if(pos != _ropts.end()) { assert(_validOpts.find(opt) != _validOpts.end()); assert(vpos->second->repeat == Repeat); _ropts[opt] = pos->second; if(vpos->second->hasDefault && pos->second->vals.size() == 1) { pos->second->vals[0] = val; vpos->second->hasDefault = false; } else { pos->second->vals.push_back(val); } } else if(spos != _ropts.end()) { assert(_validOpts.find(synonym) != _validOpts.end()); assert(_validOpts.find(synonym)->second->repeat == Repeat); _ropts[synonym] = spos->second; if(vpos->second->hasDefault && spos->second->vals.size() == 1) { spos->second->vals[0] = val; vpos->second->hasDefault = false; } else { spos->second->vals.push_back(val); } } else { OVecPtr ovp = new OptionValueVector; ovp->vals.push_back(val); _ropts[opt] = ovp; if(!synonym.empty()) { _ropts[synonym] = ovp; } } } IceUtilInternal::Options::ValidOpts::const_iterator IceUtilInternal::Options::checkOptIsValid(const string& opt) const { ValidOpts::const_iterator pos = _validOpts.find(opt); if(pos == _validOpts.end()) { string err = "`"; err += opt; err += "': invalid option"; throw IllegalArgumentException(__FILE__, __LINE__, err); } return pos; } IceUtilInternal::Options::ValidOpts::const_iterator IceUtilInternal::Options::checkOptHasArg(const string& opt) const { ValidOpts::const_iterator pos = checkOptIsValid(opt); if(pos->second->arg == NoArg) { string err = "`-"; if(pos->second->length == LongOpt) { err.push_back('-'); } err += opt; err += "': option does not take arguments"; throw IllegalArgumentException(__FILE__, __LINE__, err); } return pos; } void IceUtilInternal::Options::updateSynonyms(const ::std::string& shortOpt, const ::std::string& longOpt) { if(!shortOpt.empty() && !longOpt.empty()) { _synonyms[shortOpt] = longOpt; _synonyms[longOpt] = shortOpt; } } string IceUtilInternal::Options::getSynonym(const ::std::string& optName) const { Synonyms::const_iterator pos = _synonyms.find(optName); return pos != _synonyms.end() ? pos->second : string(""); } Ice-3.5.1/cpp/src/IceUtil/Timer.cpp0000644000076400007640000001507112223561476015071 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; using namespace IceUtil; Timer::Timer() : Thread("IceUtil timer thread"), _destroyed(false) { __setNoDelete(true); start(); __setNoDelete(false); } Timer::Timer(int priority) : Thread("IceUtil timer thread"), _destroyed(false) { __setNoDelete(true); start(0, priority); __setNoDelete(false); } void Timer::destroy() { { IceUtil::Monitor::Lock sync(_monitor); if(_destroyed) { return; } _destroyed = true; _monitor.notify(); _tasks.clear(); _tokens.clear(); } if(getThreadControl() == ThreadControl()) { getThreadControl().detach(); } else { getThreadControl().join(); } } void Timer::schedule(const TimerTaskPtr& task, const IceUtil::Time& delay) { IceUtil::Monitor::Lock sync(_monitor); if(_destroyed) { throw IllegalArgumentException(__FILE__, __LINE__, "timer destroyed"); } IceUtil::Time now = IceUtil::Time::now(IceUtil::Time::Monotonic); IceUtil::Time time = now + delay; if(delay > IceUtil::Time() && time < now) { throw IllegalArgumentException(__FILE__, __LINE__, "invalid delay"); } bool inserted = _tasks.insert(make_pair(task, time)).second; if(!inserted) { throw IllegalArgumentException(__FILE__, __LINE__, "task is already schedulded"); } _tokens.insert(Token(time, IceUtil::Time(), task)); if(_wakeUpTime == IceUtil::Time() || time < _wakeUpTime) { _monitor.notify(); } } void Timer::scheduleRepeated(const TimerTaskPtr& task, const IceUtil::Time& delay) { IceUtil::Monitor::Lock sync(_monitor); if(_destroyed) { throw IllegalArgumentException(__FILE__, __LINE__, "timer destroyed"); } IceUtil::Time now = IceUtil::Time::now(IceUtil::Time::Monotonic); const Token token(now + delay, delay, task); if(delay > IceUtil::Time() && token.scheduledTime < now) { throw IllegalArgumentException(__FILE__, __LINE__, "invalid delay"); } bool inserted = _tasks.insert(make_pair(task, token.scheduledTime)).second; if(!inserted) { throw IllegalArgumentException(__FILE__, __LINE__, "task is already schedulded"); } _tokens.insert(token); if(_wakeUpTime == IceUtil::Time() || token.scheduledTime < _wakeUpTime) { _monitor.notify(); } } bool Timer::cancel(const TimerTaskPtr& task) { IceUtil::Monitor::Lock sync(_monitor); if(_destroyed) { return false; } map::iterator p = _tasks.find(task); if(p == _tasks.end()) { return false; } _tokens.erase(Token(p->second, IceUtil::Time(), p->first)); _tasks.erase(p); return true; } void Timer::run() { Token token(IceUtil::Time(), IceUtil::Time(), 0); while(true) { { IceUtil::Monitor::Lock sync(_monitor); if(!_destroyed) { // // If the task we just ran is a repeated task, schedule it // again for executation if it wasn't canceled. // if(token.delay != IceUtil::Time()) { map::iterator p = _tasks.find(token.task); if(p != _tasks.end()) { token.scheduledTime = IceUtil::Time::now(IceUtil::Time::Monotonic) + token.delay; p->second = token.scheduledTime; _tokens.insert(token); } } token = Token(IceUtil::Time(), IceUtil::Time(), 0); if(_tokens.empty()) { _wakeUpTime = IceUtil::Time(); _monitor.wait(); } } if(_destroyed) { break; } while(!_tokens.empty() && !_destroyed) { const IceUtil::Time now = IceUtil::Time::now(IceUtil::Time::Monotonic); const Token& first = *(_tokens.begin()); if(first.scheduledTime <= now) { token = first; _tokens.erase(_tokens.begin()); if(token.delay == IceUtil::Time()) { _tasks.erase(token.task); } break; } _wakeUpTime = first.scheduledTime; try { _monitor.timedWait(first.scheduledTime - now); } catch(const IceUtil::InvalidTimeoutException&) { IceUtil::Time timeout = (first.scheduledTime - now) / 2; while(timeout > IceUtil::Time()) { try { _monitor.timedWait(timeout); break; } catch(const IceUtil::InvalidTimeoutException&) { timeout = timeout / 2; } } } } if(_destroyed) { break; } } if(token.task) { try { token.task->runTimerTask(); } catch(const IceUtil::Exception& e) { cerr << "IceUtil::Timer::run(): uncaught exception:\n" << e.what(); #ifdef __GNUC__ cerr << "\n" << e.ice_stackTrace(); #endif cerr << endl; } catch(const std::exception& e) { cerr << "IceUtil::Timer::run(): uncaught exception:\n" << e.what() << endl; } catch(...) { cerr << "IceUtil::Timer::run(): uncaught exception" << endl; } } } } Ice-3.5.1/cpp/src/IceUtil/RecMutex.cpp0000644000076400007640000001121112223561476015535 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; IceUtil::RecMutex::RecMutex() : _count(0) { #ifdef _WIN32 init(PrioNone); #else init(getDefaultMutexProtocol()); #endif } IceUtil::RecMutex::RecMutex(const IceUtil::MutexProtocol protocol) : _count(0) { init(protocol); } #ifdef _WIN32 void IceUtil::RecMutex::init(const MutexProtocol) { # ifdef ICE_OS_WINRT InitializeCriticalSectionEx(&_mutex, 0, 0); # else InitializeCriticalSection(&_mutex); # endif } IceUtil::RecMutex::~RecMutex() { assert(_count == 0); DeleteCriticalSection(&_mutex); } void IceUtil::RecMutex::lock() const { EnterCriticalSection(&_mutex); if(++_count > 1) { LeaveCriticalSection(&_mutex); } } bool IceUtil::RecMutex::tryLock() const { if(!TryEnterCriticalSection(&_mutex)) { return false; } if(++_count > 1) { LeaveCriticalSection(&_mutex); } return true; } void IceUtil::RecMutex::unlock() const { if(--_count == 0) { LeaveCriticalSection(&_mutex); } } # ifdef ICE_HAS_WIN32_CONDVAR void IceUtil::RecMutex::unlock(LockState& state) const { state.mutex = &_mutex; state.count = _count; _count = 0; } void IceUtil::RecMutex::lock(LockState& state) const { _count = state.count; } # else void IceUtil::RecMutex::unlock(LockState& state) const { state.count = _count; _count = 0; LeaveCriticalSection(&_mutex); } void IceUtil::RecMutex::lock(LockState& state) const { EnterCriticalSection(&_mutex); _count = state.count; } # endif #else void IceUtil::RecMutex::init(const MutexProtocol protocol) { int rc; pthread_mutexattr_t attr; rc = pthread_mutexattr_init(&attr); assert(rc == 0); if(rc != 0) { pthread_mutexattr_destroy(&attr); throw ThreadSyscallException(__FILE__, __LINE__, rc); } #if defined(__linux) && !defined(__USE_UNIX98) rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); #else rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); #endif assert(rc == 0); if(rc != 0) { pthread_mutexattr_destroy(&attr); throw ThreadSyscallException(__FILE__, __LINE__, rc); } #if defined(_POSIX_THREAD_PRIO_INHERIT) && _POSIX_THREAD_PRIO_INHERIT > 0 if(PrioInherit == protocol) { rc = pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); assert(rc == 0); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } #endif rc = pthread_mutex_init(&_mutex, &attr); assert(rc == 0); if(rc != 0) { pthread_mutexattr_destroy(&attr); throw ThreadSyscallException(__FILE__, __LINE__, rc); } rc = pthread_mutexattr_destroy(&attr); assert(rc == 0); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } IceUtil::RecMutex::~RecMutex() { assert(_count == 0); #ifndef NDEBUG int rc = pthread_mutex_destroy(&_mutex); assert(rc == 0); #else pthread_mutex_destroy(&_mutex); #endif } void IceUtil::RecMutex::lock() const { int rc = pthread_mutex_lock(&_mutex); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } if(++_count > 1) { rc = pthread_mutex_unlock(&_mutex); assert(rc == 0); } } bool IceUtil::RecMutex::tryLock() const { int rc = pthread_mutex_trylock(&_mutex); bool result = (rc == 0); if(!result) { if(rc != EBUSY) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } else if(++_count > 1) { rc = pthread_mutex_unlock(&_mutex); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } return result; } void IceUtil::RecMutex::unlock() const { if(--_count == 0) { #ifndef NDEBUG int rc = pthread_mutex_unlock(&_mutex); assert(rc == 0); #else pthread_mutex_unlock(&_mutex); #endif } } void IceUtil::RecMutex::unlock(LockState& state) const { state.mutex = &_mutex; state.count = _count; _count = 0; } void IceUtil::RecMutex::lock(LockState& state) const { _count = state.count; } #endif bool IceUtil::RecMutex::willUnlock() const { return _count == 1; } Ice-3.5.1/cpp/src/IceUtil/Cond.cpp0000644000076400007640000002213712223561476014675 0ustar mesmes// ********************************************************************** // // 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 #ifndef _WIN32 # include #endif #ifdef _WIN32 # ifdef ICE_HAS_WIN32_CONDVAR IceUtil::Cond::Cond() { InitializeConditionVariable(&_cond); } IceUtil::Cond::~Cond() { } void IceUtil::Cond::signal() { WakeConditionVariable(&_cond); } void IceUtil::Cond::broadcast() { WakeAllConditionVariable(&_cond); } # else IceUtilInternal::Semaphore::Semaphore(long initial) { _sem = CreateSemaphore(0, initial, 0x7fffffff, 0); if(_sem == INVALID_HANDLE_VALUE) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } IceUtilInternal::Semaphore::~Semaphore() { CloseHandle(_sem); } void IceUtilInternal::Semaphore::wait() const { DWORD rc = WaitForSingleObject(_sem, INFINITE); if(rc != WAIT_OBJECT_0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } bool IceUtilInternal::Semaphore::timedWait(const IceUtil::Time& timeout) const { IceUtil::Int64 msTimeout = timeout.toMilliSeconds(); if(msTimeout < 0 || msTimeout > 0x7FFFFFFF) { throw IceUtil::InvalidTimeoutException(__FILE__, __LINE__, timeout); } DWORD rc = WaitForSingleObject(_sem, static_cast(msTimeout)); if(rc != WAIT_TIMEOUT && rc != WAIT_OBJECT_0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } return rc != WAIT_TIMEOUT; } void IceUtilInternal::Semaphore::post(int count) const { int rc = ReleaseSemaphore(_sem, count, 0); if(rc == 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } // // The _queue semaphore is used to wait for the condition variable to // be signaled. When signal is called any further thread signaling or // threads waiting to wait (in preWait) are blocked from proceeding // using an addition _gate semaphore) until the correct number of // threads waiting on the _queue semaphore drain through postWait // // As each thread drains through postWait if there are further threads // to unblock (toUnblock > 0) the _queue is posted again to wake a // further waiting thread, otherwise the _gate is posted which permits // any signaling or preWait threads to continue. Therefore, the _gate // semaphore is used protect further entry into signal or wait until // all signaled threads have woken. // // _blocked is the number of waiting threads. _unblocked is the // number of threads which have unblocked. We use two variables // because _blocked is protected by the _gate, whereas _unblocked is // protected by the _internal mutex. There is an assumption here about // memory visibility since postWait does not itself acquire the _gate // semaphore (note that the _gate must be held if _state != StateIdle). // // Threads timing out present a particular issue because they may have // woken without a corresponding notification and its easy to leave // the _queue in a state where a spurious wakeup will occur -- // consider a notify and a timed wake occuring at the same time. In // this case, if we are not careful the _queue will have been posted, // but the waking thread may not consume the semaphore. // IceUtil::Cond::Cond() : _gate(1), _blocked(0), _unblocked(0), _state(IceUtil::Cond::StateIdle) { } IceUtil::Cond::~Cond() { } void IceUtil::Cond::signal() { wake(false); } void IceUtil::Cond::broadcast() { wake(true); } void IceUtil::Cond::wake(bool broadcast) { // // Lock gate. The gate will be locked if there are threads waiting // to drain from postWait. // _gate.wait(); // // Lock the internal mutex. // IceUtil::Mutex::Lock sync(_internal); // // Adjust the count of the number of waiting/blocked threads. // if(_unblocked != 0) { _blocked -= _unblocked; _unblocked = 0; } // // If there are waiting threads then we enter a signal or // broadcast state. // if(_blocked > 0) { // // Unblock some number of waiters. We use -1 for the signal // case. // assert(_state == StateIdle); _state = (broadcast) ? StateBroadcast : StateSignal; // // Posting the queue wakes a single waiting thread. After this // occurs the waiting thread will wake and then either post on // the _queue to wake the next waiting thread, or post on the // gate to permit more signaling to proceed. // // Release before posting to avoid potential immediate // context switch due to the mutex being locked. // sync.release(); _queue.post(); } else { // // Otherwise no blocked waiters, release the gate. // // Release before posting to avoid potential immediate // context switch due to the mutex being locked. // sync.release(); _gate.post(); } } void IceUtil::Cond::preWait() const { // // _gate is used to protect _blocked. Furthermore, this prevents // further threads from entering the wait state while a // signal/broadcast is being processed. // _gate.wait(); _blocked++; _gate.post(); } void IceUtil::Cond::postWait(bool timedOutOrFailed) const { IceUtil::Mutex::Lock sync(_internal); // // One more thread has unblocked. // _unblocked++; // // If _state is StateIdle then this must be a timeout, otherwise its a // spurious wakeup which is incorrect. // if(_state == StateIdle) { assert(timedOutOrFailed); return; } if(timedOutOrFailed) { // // If the thread was the last blocked thread and there's a // pending signal/broadcast, reset the signal/broadcast to // prevent spurious wakeup. // if(_blocked == _unblocked) { _state = StateIdle; // // Consume the queue post to prevent spurious wakeup. Note // that although the internal mutex could be released // prior to this wait() call, doing so gains nothing since // this wait() MUST return immediately (if it does not // there is a major bug and the entire application will // deadlock). // _queue.wait(); // // Release before posting to avoid potential immediate // context switch due to the mutex being locked. // sync.release(); _gate.post(); } } else { // // At this point, the thread must have been woken up because // of a signal/broadcast. // if(_state == StateSignal || _blocked == _unblocked) // Signal or no more blocked threads { _state = StateIdle; // Release before posting to avoid potential immediate // context switch due to the mutex being locked. sync.release(); _gate.post(); } else // Broadcast and more blocked threads to wake up. { // Release before posting to avoid potential immediate // context switch due to the mutex being locked. sync.release(); _queue.post(); } } } void IceUtil::Cond::dowait() const { try { _queue.wait(); postWait(false); } catch(...) { postWait(true); throw; } } bool IceUtil::Cond::timedDowait(const Time& timeout) const { try { bool rc = _queue.timedWait(timeout); postWait(!rc); return rc; } catch(...) { postWait(true); throw; } } # endif // ICE_HAS_WIN32_CONDVAR #else IceUtil::Cond::Cond() { pthread_condattr_t attr; int rc = pthread_condattr_init(&attr); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } #if !defined(__hpux) && !defined(__APPLE__) rc = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } #endif rc = pthread_cond_init(&_cond, &attr); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } rc = pthread_condattr_destroy(&attr); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } IceUtil::Cond::~Cond() { #ifndef NDEBUG int rc = pthread_cond_destroy(&_cond); assert(rc == 0); #else pthread_cond_destroy(&_cond); #endif } void IceUtil::Cond::signal() { int rc = pthread_cond_signal(&_cond); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } void IceUtil::Cond::broadcast() { int rc = pthread_cond_broadcast(&_cond); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } #endif Ice-3.5.1/cpp/src/IceUtil/Exception.cpp0000644000076400007640000003550212223561476015750 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #if defined(_MSC_VER) && _MSC_VER >= 1700 // // DbgHelp.dll on Windows XP does not contain Unicode functions, so we // "switch on" Unicode only with VS2012 and up // # ifndef UNICODE # define UNICODE # endif # ifndef _UNICODE # define _UNICODE # endif #endif #include #include #include #include #include #include #include #if defined(__GNUC__) && !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__) # include # include # define ICE_STACK_TRACES # define ICE_GCC_STACK_TRACES #endif #ifdef ICE_WIN32_STACK_TRACES # if defined(_MSC_VER) && _MSC_VER >= 1700 # define DBGHELP_TRANSLATE_TCHAR # include # endif # include # include # define ICE_STACK_TRACES #endif using namespace std; namespace IceUtilInternal { bool ICE_DECLSPEC_EXPORT printStackTraces = false; bool ICE_DECLSPEC_EXPORT nullHandleAbort = false; } namespace { IceUtil::Mutex* globalMutex = 0; #ifdef ICE_WIN32_STACK_TRACES HANDLE process = 0; #endif class Init { public: Init() { globalMutex = new IceUtil::Mutex; } ~Init() { delete globalMutex; globalMutex = 0; #ifdef ICE_WIN32_STACK_TRACES if(process != 0) { SymCleanup(process); process = 0; } #endif } }; Init init; #ifdef ICE_STACK_TRACES string getStackTrace() { if(!IceUtilInternal::printStackTraces) { return ""; } string stackTrace; # ifdef ICE_WIN32_STACK_TRACES // // Note: the Sym functions are not thread-safe // IceUtilInternal::MutexPtrLock lock(globalMutex); if(process == 0) { // // Compute Search path (best effort) // consists of the current working directory, this DLL (or exe) directory and %_NT_SYMBOL_PATH% // basic_string searchPath; const TCHAR pathSeparator = _T('\\'); const TCHAR searchPathSeparator = _T(';'); TCHAR cwd[MAX_PATH]; if(GetCurrentDirectory(MAX_PATH, cwd) != 0) { searchPath = cwd; } HMODULE myModule = 0; GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, "startHook", &myModule); // // If GetModuleHandleEx fails, myModule is NULL, i.e. we'll locate the current exe's directory. // TCHAR myFilename[MAX_PATH]; DWORD len = GetModuleFileName(myModule, myFilename, MAX_PATH); if(len != 0 && len < MAX_PATH) { assert(myFilename[len] == 0); basic_string myPath = myFilename; size_t pos = myPath.find_last_of(pathSeparator); if(pos != basic_string::npos) { myPath = myPath.substr(0, pos); if(!searchPath.empty()) { searchPath += searchPathSeparator; } searchPath += myPath; } } const DWORD size = 1024; TCHAR symbolPath[size]; len = GetEnvironmentVariable(_T("_NT_SYMBOL_PATH"), symbolPath, size); if(len > 0 && len < size) { if(!searchPath.empty()) { searchPath += searchPathSeparator; } searchPath += symbolPath; } process = GetCurrentProcess(); SymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS | SYMOPT_EXACT_SYMBOLS | SYMOPT_UNDNAME); if(SymInitialize(process, searchPath.c_str(), TRUE) == 0) { process = 0; return "No stack trace: SymInitialize failed with " + IceUtilInternal::errorToString(GetLastError()); } } lock.release(); const int stackSize = 61; void* stack[stackSize]; // // 1: skip the first frame (the call to getStackTrace) // 1 + stackSize < 63 on XP according to the documentation for CaptureStackBackTrace // USHORT frames = CaptureStackBackTrace(1, stackSize, stack, 0); if(frames > 0) { #if defined(_MSC_VER) && (_MSC_VER >= 1600) # if defined(DBGHELP_TRANSLATE_TCHAR) static_assert(sizeof(TCHAR) == sizeof(wchar_t), "Bad TCHAR - should be wchar_t"); # else static_assert(sizeof(TCHAR) == sizeof(char), "Bad TCHAR - should be char"); # endif #endif char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)]; SYMBOL_INFO* symbol = reinterpret_cast(buffer); symbol->SizeOfStruct = sizeof(SYMBOL_INFO); symbol->MaxNameLen = MAX_SYM_NAME; IMAGEHLP_LINE64 line = {}; line.SizeOfStruct = sizeof(IMAGEHLP_LINE64); DWORD displacement = 0; lock.acquire(); // TODO: call SymRefreshModuleList here? (not available on XP) for(int i = 0; i < frames; i++) { if(!stackTrace.empty()) { stackTrace += "\n"; } stringstream s; s << setw(3) << i << " "; DWORD64 address = reinterpret_cast(stack[i]); BOOL ok = SymFromAddr(process, address, 0, symbol); if(ok) { #ifdef DBGHELP_TRANSLATE_TCHAR s << IceUtil::wstringToString(symbol->Name); #else s << symbol->Name; #endif ok = SymGetLineFromAddr64(process, address, &displacement, &line); if(ok) { s << " at line " << line.LineNumber << " in " #ifdef DBGHELP_TRANSLATE_TCHAR << IceUtil::wstringToString(line.FileName); #else << line.FileName; #endif } } else { s << hex << "0x" << address; } stackTrace += s.str(); } lock.release(); } # elif defined(ICE_GCC_STACK_TRACES) const size_t maxDepth = 100; void *stackAddrs[maxDepth]; size_t stackDepth = backtrace(stackAddrs, maxDepth); char **stackStrings = backtrace_symbols(stackAddrs, stackDepth); // // Start at 1 to skip the top frame (== call to this function) // for (size_t i = 1; i < stackDepth; i++) { string line(stackStrings[i]); if(i > 1) { stackTrace += "\n"; } stringstream s; s << setw(3) << i - 1 << " "; // // For each line attempt to parse the mangled function name as well // as the source library/executable. // string mangled; string source; string::size_type openParen = line.find_first_of('('); if(openParen != string::npos) { // // Format: "/opt/Ice/lib/libIceUtil.so.33(_ZN7IceUtil9ExceptionC2EPKci+0x51) [0x73b267]" // string::size_type closeParen = line.find_first_of(')', openParen); if(closeParen != string::npos) { string tmp = line.substr(openParen + 1, closeParen - openParen - 1); string::size_type plus = tmp.find_last_of('+'); if(plus != string::npos) { mangled = tmp.substr(0 , plus); source = line.substr(0, openParen); } } } else { // // Format: "1 libIce.3.3.1.dylib 0x000933a1 _ZN7IceUtil9ExceptionC2EPKci + 71" // string::size_type plus = line.find_last_of('+'); if(plus != string::npos) { string tmp = line.substr(0, plus - 1); string::size_type space = tmp.find_last_of(" \t"); if(space != string::npos) { tmp = tmp.substr(space + 1, tmp.size() - space); string::size_type start = line.find_first_not_of(" \t", 3); if(start != string::npos) { string::size_type finish = line.find_first_of(" \t", start); if(finish != string::npos) { mangled = tmp; source = line.substr(start, finish - start); } } } } } if(mangled.size() != 0) { // // Unmangle the function name // int status; char* unmangled = abi::__cxa_demangle(mangled.c_str(), 0, 0, &status); if(unmangled) { s << unmangled; free(unmangled); } else { s << mangled << "()"; } if(!source.empty()) { s << " in " << source; } } else { s << line; } stackTrace += s.str(); } free(stackStrings); # endif return stackTrace; } #endif } IceUtil::Exception::Exception() : _file(0), _line(0) #ifdef ICE_STACK_TRACES , _stackTrace(getStackTrace()) #endif { } IceUtil::Exception::Exception(const char* file, int line) : _file(file), _line(line) #ifdef ICE_STACK_TRACES , _stackTrace(getStackTrace()) #endif { } IceUtil::Exception::~Exception() throw() { } const char* IceUtil::Exception::_name = "IceUtil::Exception"; string IceUtil::Exception::ice_name() const { return _name; } void IceUtil::Exception::ice_print(ostream& out) const { if(_file && _line > 0) { out << _file << ':' << _line << ": "; } out << ice_name(); } const char* IceUtil::Exception::what() const throw() { try { IceUtilInternal::MutexPtrLock lock(globalMutex); { if(_str.empty()) { stringstream s; ice_print(s); _str = s.str(); // Lazy initialization. } } return _str.c_str(); } catch(...) { } return ""; } IceUtil::Exception* IceUtil::Exception::ice_clone() const { return new Exception(*this); } void IceUtil::Exception::ice_throw() const { throw *this; } const char* IceUtil::Exception::ice_file() const { return _file; } int IceUtil::Exception::ice_line() const { return _line; } const string& IceUtil::Exception::ice_stackTrace() const { return _stackTrace; } ostream& IceUtil::operator<<(ostream& out, const IceUtil::Exception& ex) { ex.ice_print(out); return out; } IceUtil::NullHandleException::NullHandleException(const char* file, int line) : Exception(file, line) { if(IceUtilInternal::nullHandleAbort) { abort(); } } IceUtil::NullHandleException::~NullHandleException() throw() { } const char* IceUtil::NullHandleException::_name = "IceUtil::NullHandleException"; string IceUtil::NullHandleException::ice_name() const { return _name; } IceUtil::NullHandleException* IceUtil::NullHandleException::ice_clone() const { return new NullHandleException(*this); } void IceUtil::NullHandleException::ice_throw() const { throw *this; } IceUtil::IllegalArgumentException::IllegalArgumentException(const char* file, int line) : Exception(file, line) { } IceUtil::IllegalArgumentException::IllegalArgumentException(const char* file, int line, const string& r) : Exception(file, line), _reason(r) { } IceUtil::IllegalArgumentException::~IllegalArgumentException() throw() { } const char* IceUtil::IllegalArgumentException::_name = "IceUtil::IllegalArgumentException"; string IceUtil::IllegalArgumentException::ice_name() const { return _name; } void IceUtil::IllegalArgumentException::ice_print(ostream& out) const { Exception::ice_print(out); out << ": " << _reason; } IceUtil::IllegalArgumentException* IceUtil::IllegalArgumentException::ice_clone() const { return new IllegalArgumentException(*this); } void IceUtil::IllegalArgumentException::ice_throw() const { throw *this; } string IceUtil::IllegalArgumentException::reason() const { return _reason; } IceUtil::SyscallException::SyscallException(const char* file, int line, int err ): Exception(file, line), _error(err) { } const char* IceUtil::SyscallException::_name = "IceUtil::SyscallException"; string IceUtil::SyscallException::ice_name() const { return _name; } void IceUtil::SyscallException::ice_print(ostream& os) const { Exception::ice_print(os); if(_error != 0) { os << ":\nsyscall exception: " << IceUtilInternal::errorToString(_error); } } IceUtil::SyscallException* IceUtil::SyscallException::ice_clone() const { return new SyscallException(*this); } void IceUtil::SyscallException::ice_throw() const { throw *this; } int IceUtil::SyscallException::error() const { return _error; } IceUtil::FileLockException::FileLockException(const char* file, int line, int err, const string& path): Exception(file, line), _error(err), _path(path) { } IceUtil::FileLockException::~FileLockException() throw() { } const char* IceUtil::FileLockException::_name = "IceUtil::FileLockedException"; string IceUtil::FileLockException::ice_name() const { return _name; } void IceUtil::FileLockException::ice_print(ostream& os) const { Exception::ice_print(os); os << ":\ncould not lock file: `" << _path << "'"; if(_error != 0) { os << "\nsyscall exception: " << IceUtilInternal::errorToString(_error); } } IceUtil::FileLockException* IceUtil::FileLockException::ice_clone() const { return new FileLockException(*this); } void IceUtil::FileLockException::ice_throw() const { throw *this; } int IceUtil::FileLockException::error() const { return _error; } IceUtil::OptionalNotSetException::OptionalNotSetException(const char* file, int line) : Exception(file, line) { if(IceUtilInternal::nullHandleAbort) { abort(); } } IceUtil::OptionalNotSetException::~OptionalNotSetException() throw() { } const char* IceUtil::OptionalNotSetException::_name = "IceUtil::OptionalNotSetException"; string IceUtil::OptionalNotSetException::ice_name() const { return _name; } IceUtil::OptionalNotSetException* IceUtil::OptionalNotSetException::ice_clone() const { return new OptionalNotSetException(*this); } void IceUtil::OptionalNotSetException::ice_throw() const { throw *this; } Ice-3.5.1/cpp/src/IceUtil/FileUtil.cpp0000644000076400007640000002247312223561476015532 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #ifdef _WIN32 # include # include #else # include #endif using namespace std; // // Determine if path is an absolute path // bool IceUtilInternal::isAbsolutePath(const string& path) { size_t i = 0; size_t size = path.size(); // Skip whitespace while(i < size && isspace(static_cast(path[i]))) { ++i; } #ifdef _WIN32 // We need at least 3 non whitespace character to have // and absolute path if(i + 3 > size) { return false; } // Check for X:\ path ('\' may have been converted to '/') if((path[i] >= 'A' && path[i] <= 'Z') || (path[i] >= 'a' && path[i] <= 'z')) { return path[i + 1] == ':' && (path[i + 2] == '\\' || path[i + 2] == '/'); } // Check for UNC path return (path[i] == '\\' && path[i + 1] == '\\') || path[i] == '/'; #else if(i >= size) { return false; } return path[i] == '/'; #endif } // // Determine if a directory exists. // bool IceUtilInternal::directoryExists(const string& path) { IceUtilInternal::structstat st; if(IceUtilInternal::stat(path, &st) != 0 || !S_ISDIR(st.st_mode)) { return false; } return true; } // // Determine if a regular file exists. // bool IceUtilInternal::fileExists(const string& path) { IceUtilInternal::structstat st; if(IceUtilInternal::stat(path, &st) != 0 || !S_ISREG(st.st_mode)) { return false; } return true; } #ifdef _WIN32 // // Stat // int IceUtilInternal::stat(const string& path, structstat* buffer) { return _wstat(IceUtil::stringToWstring(path).c_str(), buffer); } int IceUtilInternal::remove(const string& path) { return ::_wremove(IceUtil::stringToWstring(path).c_str()); } int IceUtilInternal::rename(const string& from, const string& to) { return ::_wrename(IceUtil::stringToWstring(from).c_str(), IceUtil::stringToWstring(to).c_str()); } int IceUtilInternal::rmdir(const string& path) { return ::_wrmdir(IceUtil::stringToWstring(path).c_str()); } int IceUtilInternal::mkdir(const string& path, int) { return ::_wmkdir(IceUtil::stringToWstring(path).c_str()); } FILE* IceUtilInternal::fopen(const string& path, const string& mode) { return ::_wfopen(IceUtil::stringToWstring(path).c_str(), IceUtil::stringToWstring(mode).c_str()); } int IceUtilInternal::open(const string& path, int flags) { if(flags & _O_CREAT) { return ::_wopen(IceUtil::stringToWstring(path).c_str(), flags, _S_IREAD | _S_IWRITE); } else { return ::_wopen(IceUtil::stringToWstring(path).c_str(), flags); } } #ifndef ICE_OS_WINRT int IceUtilInternal::getcwd(string& cwd) { wchar_t cwdbuf[_MAX_PATH]; if(_wgetcwd(cwdbuf, _MAX_PATH) == NULL) { return -1; } cwd = IceUtil::wstringToString(cwdbuf); return 0; } #endif int IceUtilInternal::unlink(const string& path) { return _wunlink(IceUtil::stringToWstring(path).c_str()); } int IceUtilInternal::close(int fd) { #ifdef __MINGW32__ return _close(fd); #else return ::close(fd); #endif } IceUtilInternal::FileLock::FileLock(const std::string& path) : _fd(INVALID_HANDLE_VALUE), _path(path) { #ifndef ICE_OS_WINRT _fd = ::CreateFileW(IceUtil::stringToWstring(path).c_str(), GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #else CREATEFILE2_EXTENDED_PARAMETERS params; params.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; _fd = ::CreateFile2(IceUtil::stringToWstring(path).c_str(), GENERIC_WRITE, 0, OPEN_ALWAYS, ¶ms); #endif _path = path; if(_fd == INVALID_HANDLE_VALUE) { throw IceUtil::FileLockException(__FILE__, __LINE__, GetLastError(), _path); } #ifdef __MINGW32__ if(::LockFile(_fd, 0, 0, 0, 0) == 0) { throw IceUtil::FileLockException(__FILE__, __LINE__, GetLastError(), _path); } #else OVERLAPPED overlaped; overlaped.Internal = 0; overlaped.InternalHigh = 0; overlaped.Offset = 0; overlaped.OffsetHigh = 0; #if defined(_MSC_VER) && (_MSC_VER >= 1600) overlaped.hEvent = nullptr; #else overlaped.hEvent = 0; #endif if(::LockFileEx(_fd, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, 0, 0, &overlaped) == 0) { ::CloseHandle(_fd); throw IceUtil::FileLockException(__FILE__, __LINE__, GetLastError(), _path); } #endif // // In Windows implementation we don't write the process pid to the file, as it is // not possible to read the file from other process while it is locked here. // } IceUtilInternal::FileLock::~FileLock() { assert(_fd != INVALID_HANDLE_VALUE); CloseHandle(_fd); unlink(_path); } IceUtilInternal::ifstream::ifstream() { } IceUtilInternal::ifstream::ifstream(const string& path, ios_base::openmode mode) : #ifdef __MINGW32__ std::ifstream(path.c_str(), mode) #else std::ifstream(IceUtil::stringToWstring(path).c_str(), mode) #endif { } void IceUtilInternal::ifstream::open(const string& path, ios_base::openmode mode) { #ifdef __MINGW32__ std::ifstream::open(path.c_str(), mode); #else std::ifstream::open(IceUtil::stringToWstring(path).c_str(), mode); #endif } IceUtilInternal::ofstream::ofstream() { } IceUtilInternal::ofstream::ofstream(const string& path, ios_base::openmode mode) : #ifdef __MINGW32__ std::ofstream(path.c_str(), mode) #else std::ofstream(IceUtil::stringToWstring(path).c_str(), mode) #endif { } void IceUtilInternal::ofstream::open(const string& path, ios_base::openmode mode) { #ifdef __MINGW32__ std::ofstream::open(path.c_str(), mode); #else std::ofstream::open(IceUtil::stringToWstring(path).c_str(), mode); #endif } #else // // Stat // int IceUtilInternal::stat(const string& path, structstat* buffer) { return ::stat(path.c_str(), buffer); } int IceUtilInternal::remove(const string& path) { return ::remove(path.c_str()); } int IceUtilInternal::rename(const string& from, const string& to) { return ::rename(from.c_str(), to.c_str()); } int IceUtilInternal::rmdir(const string& path) { return ::rmdir(path.c_str()); } int IceUtilInternal::mkdir(const string& path, int perm) { return ::mkdir(path.c_str(), perm); } FILE* IceUtilInternal::fopen(const string& path, const string& mode) { return ::fopen(path.c_str(), mode.c_str()); } int IceUtilInternal::open(const string& path, int flags) { if(flags & O_CREAT) { // By default, create with rw-rw-rw- modified by the user's umask (same as fopen). return ::open(path.c_str(), flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); } else { return ::open(path.c_str(), flags); } } int IceUtilInternal::getcwd(string& cwd) { char cwdbuf[PATH_MAX]; if(::getcwd(cwdbuf, PATH_MAX) == NULL) { return -1; } cwd = cwdbuf; return 0; } int IceUtilInternal::unlink(const string& path) { return ::unlink(path.c_str()); } int IceUtilInternal::close(int fd) { return ::close(fd); } IceUtilInternal::FileLock::FileLock(const std::string& path) : _fd(-1), _path(path) { _fd = ::open(path.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); if(_fd < 0) { throw IceUtil::FileLockException(__FILE__, __LINE__, errno, _path); } struct ::flock lock; lock.l_type = F_WRLCK; // Write lock lock.l_whence = SEEK_SET; // Begining of file lock.l_start = 0; lock.l_len = 0; // // F_SETLK tells fcntl to not block if it cannot // acquire the lock, if the lock cannot be acquired // it returns -1 without wait. // if(::fcntl(_fd, F_SETLK, &lock) == -1) { IceUtil::FileLockException ex(__FILE__, __LINE__, errno, _path); close(_fd); throw ex; } // // If there is an error after here, we close the fd, // to release the lock. // // // Now that we have acquire an excluxive write lock, // write the process pid there. // ostringstream os; os << getpid(); if(write(_fd, os.str().c_str(), os.str().size()) == -1) { IceUtil::FileLockException ex(__FILE__, __LINE__, errno, _path); close(_fd); throw ex; } } IceUtilInternal::FileLock::~FileLock() { assert(_fd > -1); unlink(_path); } IceUtilInternal::ifstream::ifstream() { } IceUtilInternal::ifstream::ifstream(const string& path, ios_base::openmode mode) : std::ifstream(path.c_str(), mode) { } void IceUtilInternal::ifstream::open(const string& path, ios_base::openmode mode) { std::ifstream::open(path.c_str(), mode); } IceUtilInternal::ofstream::ofstream() { } IceUtilInternal::ofstream::ofstream(const string& path, ios_base::openmode mode) : std::ofstream(path.c_str(), mode) { } void IceUtilInternal::ofstream::open(const string& path, ios_base::openmode mode) { std::ofstream::open(path.c_str(), mode); } #endif Ice-3.5.1/cpp/src/IceUtil/ThreadException.cpp0000644000076400007640000000725312223561476017102 0ustar mesmes// ********************************************************************** // // 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 using namespace std; IceUtil::ThreadSyscallException::ThreadSyscallException(const char* file, int line, int err ): SyscallException(file, line, err) { } const char* IceUtil::ThreadSyscallException::_name = "IceUtil::ThreadSyscallException"; string IceUtil::ThreadSyscallException::ice_name() const { return _name; } IceUtil::ThreadSyscallException* IceUtil::ThreadSyscallException::ice_clone() const { return new ThreadSyscallException(*this); } void IceUtil::ThreadSyscallException::ice_throw() const { throw *this; } IceUtil::ThreadLockedException::ThreadLockedException(const char* file, int line) : Exception(file, line) { } const char* IceUtil::ThreadLockedException::_name = "IceUtil::ThreadLockedException"; string IceUtil::ThreadLockedException::ice_name() const { return _name; } IceUtil::ThreadLockedException* IceUtil::ThreadLockedException::ice_clone() const { return new ThreadLockedException(*this); } void IceUtil::ThreadLockedException::ice_throw() const { throw *this; } IceUtil::ThreadStartedException::ThreadStartedException(const char* file, int line) : Exception(file, line) { } const char* IceUtil::ThreadStartedException::_name = "IceUtil::ThreadStartedException"; string IceUtil::ThreadStartedException::ice_name() const { return _name; } IceUtil::ThreadStartedException* IceUtil::ThreadStartedException::ice_clone() const { return new ThreadStartedException(*this); } void IceUtil::ThreadStartedException::ice_throw() const { throw *this; } IceUtil::ThreadNotStartedException::ThreadNotStartedException(const char* file, int line) : Exception(file, line) { } const char* IceUtil::ThreadNotStartedException::_name = "IceUtil::ThreadNotStartedException"; string IceUtil::ThreadNotStartedException::ice_name() const { return _name; } IceUtil::ThreadNotStartedException* IceUtil::ThreadNotStartedException::ice_clone() const { return new ThreadNotStartedException(*this); } void IceUtil::ThreadNotStartedException::ice_throw() const { throw *this; } IceUtil::BadThreadControlException::BadThreadControlException(const char* file, int line) : Exception(file, line) { } const char* IceUtil::BadThreadControlException::_name = "IceUtil::BadThreadControlException"; string IceUtil::BadThreadControlException::ice_name() const { return _name; } IceUtil::BadThreadControlException* IceUtil::BadThreadControlException::ice_clone() const { return new BadThreadControlException(*this); } void IceUtil::BadThreadControlException::ice_throw() const { throw *this; } IceUtil::InvalidTimeoutException::InvalidTimeoutException(const char* file, int line, const IceUtil::Time& timeout) : Exception(file, line), _timeout(timeout) { } const char* IceUtil::InvalidTimeoutException::_name = "IceUtil::InvalidTimeoutException"; string IceUtil::InvalidTimeoutException::ice_name() const { return _name; } void IceUtil::InvalidTimeoutException::ice_print(ostream& os) const { Exception::ice_print(os); os << ":\ninvalid timeout: " << _timeout << " seconds"; } IceUtil::InvalidTimeoutException* IceUtil::InvalidTimeoutException::ice_clone() const { return new InvalidTimeoutException(*this); } void IceUtil::InvalidTimeoutException::ice_throw() const { throw *this; } Ice-3.5.1/cpp/src/IceUtil/ConvertUTF.h0000644000076400007640000001326612223561476015461 0ustar mesmes/* * Copyright 2001-2004 Unicode, Inc. * * Disclaimer * * This source code is provided as is by Unicode, Inc. No claims are * made as to fitness for any particular purpose. No warranties of any * kind are expressed or implied. The recipient agrees to determine * applicability of information provided. If this file has been * purchased on magnetic or optical media from Unicode, Inc., the * sole remedy for any claim will be exchange of defective media * within 90 days of receipt. * * Limitations on Rights to Redistribute This Code * * Unicode, Inc. hereby grants the right to freely use the information * supplied in this file in the creation of products supporting the * Unicode Standard, and to make copies of this file in any form * for internal or external distribution as long as this notice * remains attached. */ // ********************************************************************** // // 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 ICE_UTIL_CONVERT_UTF_H #define ICE_UTIL_CONVERT_UTF_H #include /* --------------------------------------------------------------------- Conversions between UTF32, UTF-16, and UTF-8. Header file. Several funtions are included here, forming a complete set of conversions between the three formats. UTF-7 is not included here, but is handled in a separate source file. Each of these routines takes pointers to input buffers and output buffers. The input buffers are const. Each routine converts the text between *sourceStart and sourceEnd, putting the result into the buffer between *targetStart and targetEnd. Note: the end pointers are *after* the last item: e.g. *(sourceEnd - 1) is the last item. The return result indicates whether the conversion was successful, and if not, whether the problem was in the source or target buffers. (Only the first encountered problem is indicated.) After the conversion, *sourceStart and *targetStart are both updated to point to the end of last text successfully converted in the respective buffers. Input parameters: sourceStart - pointer to a pointer to the source buffer. The contents of this are modified on return so that it points at the next thing to be converted. targetStart - similarly, pointer to pointer to the target buffer. sourceEnd, targetEnd - respectively pointers to the ends of the two buffers, for overflow checking only. These conversion functions take a ConversionFlags argument. When this flag is set to strict, both irregular sequences and isolated surrogates will cause an error. When the flag is set to lenient, both irregular sequences and isolated surrogates are converted. Whether the flag is strict or lenient, all illegal sequences will cause an error return. This includes sequences such as: , , or in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code must check for illegal sequences. When the flag is set to lenient, characters over 0x10FFFF are converted to the replacement character; otherwise (when the flag is set to strict) they constitute an error. Output parameters: The value "sourceIllegal" is returned from some routines if the input sequence is malformed. When "sourceIllegal" is returned, the source value will point to the illegal value that caused the problem. E.g., in UTF-8 when a sequence is malformed, it points to the start of the malformed sequence. Author: Mark E. Davis, 1994. Rev History: Rick McGowan, fixes & updates May 2001. Fixes & updates, Sept 2001. ------------------------------------------------------------------------ */ /* --------------------------------------------------------------------- The following 4 definitions are compiler-specific. The C standard does not guarantee that wchar_t has at least 16 bits, so wchar_t is no less portable than unsigned short! All should be unsigned values to avoid sign extension during bit mask & shift operations. ------------------------------------------------------------------------ */ namespace IceUtilInternal { typedef unsigned int UTF32; /* at least 32 bits */ typedef unsigned short UTF16; /* at least 16 bits */ typedef unsigned char UTF8; /* typically 8 bits */ typedef bool Boolean; /* 0 or 1 */ /* Some fundamental constants */ #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD #define UNI_MAX_BMP (UTF32)0x0000FFFF #define UNI_MAX_UTF16 (UTF32)0x0010FFFF #define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF #define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF ConversionResult ConvertUTF8toUTF16( const UTF8** sourceStart, const UTF8* sourceEnd, UTF16** targetStart, UTF16* targetEnd, IceUtil::ConversionFlags flags); ConversionResult ConvertUTF16toUTF8 ( const UTF16** sourceStart, const UTF16* sourceEnd, UTF8** targetStart, UTF8* targetEnd, IceUtil::ConversionFlags flags); ConversionResult ConvertUTF8toUTF32( const UTF8** sourceStart, const UTF8* sourceEnd, UTF32** targetStart, UTF32* targetEnd, IceUtil::ConversionFlags flags); ConversionResult ConvertUTF32toUTF8( const UTF32** sourceStart, const UTF32* sourceEnd, UTF8** targetStart, UTF8* targetEnd, IceUtil::ConversionFlags flags); // // isLegalUTFSequence is declared in IceUtil/Unicode.h // /* --------------------------------------------------------------------- */ } #endif Ice-3.5.1/cpp/src/IceUtil/StringUtil.cpp0000644000076400007640000004576512223561476016132 0ustar mesmes// ********************************************************************** // // 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 #include #include #ifdef ICE_OS_WINRT #include #endif using namespace std; using namespace IceUtil; namespace { string toOctalString(unsigned int n) { string s; s.resize(32); string::size_type charPos = 32; const int radix = 1 << 3; int mask = radix - 1; do { s[--charPos] = '0' + (n & mask); n >>= 3; } while(n != 0); return string(s, charPos, (32 - charPos)); } // // Write the byte b as an escape sequence if it isn't a printable ASCII // character and append the escape sequence to s. Additional characters // that should be escaped can be passed in special. If b is any of these // characters, b is preceded by a backslash in s. // void encodeChar(string::value_type b, string& s, const string& special) { switch(b) { case '\\': { s.append("\\\\"); break; } case '\'': { s.append("\\'"); break; } case '"': { s.append("\\\""); break; } case '\b': { s.append("\\b"); break; } case '\f': { s.append("\\f"); break; } case '\n': { s.append("\\n"); break; } case '\r': { s.append("\\r"); break; } case '\t': { s.append("\\t"); break; } default: { unsigned char i = static_cast(b); if(!(i >= 32 && i <= 126)) { s.push_back('\\'); string octal = toOctalString(i); // // Add leading zeroes so that we avoid problems during // decoding. For example, consider the escaped string // \0013 (i.e., a character with value 1 followed by the // character '3'). If the leading zeroes were omitted, the // result would be incorrectly interpreted as a single // character with value 11. // for(string::size_type j = octal.size(); j < 3; j++) { s.push_back('0'); } s.append(octal); } else if(special.find(b) != string::npos) { s.push_back('\\'); s.push_back(b); } else { s.push_back(b); } break; } } } } // // Add escape sequences (such as "\n", or "\007") to make a string // readable in ASCII. Any characters that appear in special are // prefixed with a backslash in the returned string. // string IceUtilInternal::escapeString(const string& s, const string& special) { for(string::size_type i = 0; i < special.size(); ++i) { if(static_cast(special[i]) < 32 || static_cast(special[i]) > 126) { throw IllegalArgumentException(__FILE__, __LINE__, "special characters must be in ASCII range 32-126"); } } string result; for(string::size_type i = 0; i < s.size(); ++i) { encodeChar(s[i], result, special); } return result; } namespace { char checkChar(const string& s, string::size_type pos) { unsigned char c = static_cast(s[pos]); if(!(c >= 32 && c <= 126)) { ostringstream ostr; if(pos > 0) { ostr << "character after `" << s.substr(0, pos) << "'"; } else { ostr << "first character"; } ostr << " is not a printable ASCII character (ordinal " << (int)c << ")"; throw IllegalArgumentException(__FILE__, __LINE__, ostr.str()); } return c; } // // Decode the character or escape sequence starting at start and return it. // end marks the one-past-the-end position of the substring to be scanned. // nextStart is set to the index of the first character following the decoded // character or escape sequence. // char decodeChar(const string& s, string::size_type start, string::size_type end, string::size_type& nextStart) { assert(start < end); assert(end <= s.size()); char c; if(s[start] != '\\') { c = checkChar(s, start++); } else { if(start + 1 == end) { throw IllegalArgumentException(__FILE__, __LINE__, "trailing backslash"); } switch(s[++start]) { case '\\': case '\'': case '"': { c = s[start++]; break; } case 'b': { ++start; c = '\b'; break; } case 'f': { ++start; c = '\f'; break; } case 'n': { ++start; c = '\n'; break; } case 'r': { ++start; c = '\r'; break; } case 't': { ++start; c = '\t'; break; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { int val = 0; for(int j = 0; j < 3 && start < end; ++j) { int charVal = s[start++] - '0'; if(charVal < 0 || charVal > 7) { --start; break; } val = val * 8 + charVal; } if(val > 255) { ostringstream ostr; ostr << "octal value \\" << oct << val << dec << " (" << val << ") is out of range"; throw IllegalArgumentException(__FILE__, __LINE__, ostr.str()); } c = (char)val; break; } default: { c = checkChar(s, start++); break; } } } nextStart = start; return c; } // // Remove escape sequences from s and append the result to sb. // Return true if successful, false otherwise. // void decodeString(const string& s, string::size_type start, string::size_type end, string& sb) { while(start < end) { sb.push_back(decodeChar(s, start, end, start)); } } } // // Remove escape sequences added by escapeString. // string IceUtilInternal::unescapeString(const string& s, string::size_type start, string::size_type end) { assert(start <= end && end <= s.size()); string result; result.reserve(end - start); result.clear(); decodeString(s, start, end, result); return result; } bool IceUtilInternal::splitString(const string& str, const string& delim, vector& result) { string::size_type pos = 0; string::size_type length = str.length(); string elt; char quoteChar = '\0'; while(pos < length) { if(quoteChar == '\0' && (str[pos] == '"' || str[pos] == '\'')) { quoteChar = str[pos++]; continue; // Skip the quote } else if(quoteChar == '\0' && str[pos] == '\\' && pos + 1 < length && (str[pos + 1] == '\'' || str[pos + 1] == '"')) { ++pos; } else if(quoteChar != '\0' && str[pos] == '\\' && pos + 1 < length && str[pos + 1] == quoteChar) { ++pos; } else if(quoteChar != '\0' && str[pos] == quoteChar) { ++pos; quoteChar = '\0'; continue; // Skip the end quote } else if(delim.find(str[pos]) != string::npos) { if(quoteChar == '\0') { ++pos; if(elt.length() > 0) { result.push_back(elt); elt = ""; } continue; } } if(pos < length) { elt += str[pos++]; } } if(elt.length() > 0) { result.push_back(elt); } if(quoteChar != '\0') { return false; // Unmatched quote. } return true; } string IceUtilInternal::joinString(const std::vector& values, const std::string& delimiter) { ostringstream out; for(unsigned int i = 0; i < values.size(); i++) { if(i != 0) { out << delimiter; } out << values[i]; } return out.str(); } // // Trim white space (" \t\r\n") // string IceUtilInternal::trim(const string& s) { static const string delim = " \t\r\n"; string::size_type beg = s.find_first_not_of(delim); if(beg == string::npos) { return ""; } else { return s.substr(beg, s.find_last_not_of(delim) - beg + 1); } } // // If a single or double quotation mark is found at the start position, // then the position of the matching closing quote is returned. If no // quotation mark is found at the start position, then 0 is returned. // If no matching closing quote is found, then -1 is returned. // string::size_type IceUtilInternal::checkQuote(const string& s, string::size_type start) { string::value_type quoteChar = s[start]; if(quoteChar == '"' || quoteChar == '\'') { start++; string::size_type pos; while(start < s.size() && (pos = s.find(quoteChar, start)) != string::npos) { if(s[pos - 1] != '\\') { return pos; } start = pos + 1; } return string::npos; // Unmatched quote. } return 0; // Not quoted. } // // Match `s' against the pattern `pat'. A * in the pattern acts // as a wildcard: it matches any non-empty sequence of characters. // We match by hand here because it's portable across platforms // (whereas regex() isn't). Only one * per pattern is supported. // bool IceUtilInternal::match(const string& s, const string& pat, bool emptyMatch) { assert(!s.empty()); assert(!pat.empty()); // // If pattern does not contain a wildcard just compare strings. // string::size_type beginIndex = pat.find('*'); if(beginIndex == string::npos) { return s == pat; } // // Make sure start of the strings match // if(beginIndex > s.length() || s.substr(0, beginIndex) != pat.substr(0, beginIndex)) { return false; } // // Make sure there is something present in the middle to match the // wildcard. If emptyMatch is true, allow a match of "". // string::size_type endLength = pat.length() - beginIndex - 1; if(endLength > s.length()) { return false; } string::size_type endIndex = s.length() - endLength; if(endIndex < beginIndex || (!emptyMatch && endIndex == beginIndex)) { return false; } // // Make sure end of the strings match // if(s.substr(endIndex, s.length()) != pat.substr(beginIndex + 1, pat.length())) { return false; } return true; } #ifdef _WIN32 string IceUtilInternal::errorToString(int error, LPCVOID source) { if(error < WSABASEERR) { #ifdef ICE_OS_WINRT int size = 256; IceUtil::ScopedArray lpMsgBuf(new wchar_t[size]); DWORD stored = 0; while(stored == 0) { stored = FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | (source != NULL ? FORMAT_MESSAGE_FROM_HMODULE : 0), source, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language lpMsgBuf.get(), size, NULL); if(stored == 0) { DWORD err = GetLastError(); if(err == ERROR_INSUFFICIENT_BUFFER) { if(size == 65536) { break; // already at the max size } else { size *= 4; size = max(size, 65536); lpMsgBuf.reset(new wchar_t[size]); } } else { break; } } } LPWSTR msg = lpMsgBuf.get(); #else LPWSTR msg = 0; DWORD stored = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | (source != NULL ? FORMAT_MESSAGE_FROM_HMODULE : 0), source, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language reinterpret_cast(&msg), 0, NULL); #endif if(stored > 0) { assert(msg && wcslen(msg) > 0); wstring result = msg; if(result[result.length() - 1] == L'\n') { result = result.substr(0, result.length() - 2); } #ifndef ICE_OS_WINRT if(msg) { LocalFree(msg); } #endif return IceUtil::wstringToString(result); } else { #ifndef ICE_OS_WINRT if(msg) { LocalFree(msg); } #endif ostringstream os; os << "unknown error: " << error; return os.str(); } } switch(error) { case WSAEINTR: return "WSAEINTR"; case WSAEBADF: return "WSAEBADF"; case WSAEACCES: return "WSAEACCES"; case WSAEFAULT: return "WSAEFAULT"; case WSAEINVAL: return "WSAEINVAL"; case WSAEMFILE: return "WSAEMFILE"; case WSAEWOULDBLOCK: return "WSAEWOULDBLOCK"; case WSAEINPROGRESS: return "WSAEINPROGRESS"; case WSAEALREADY: return "WSAEALREADY"; case WSAENOTSOCK: return "WSAENOTSOCK"; case WSAEDESTADDRREQ: return "WSAEDESTADDRREQ"; case WSAEMSGSIZE: return "WSAEMSGSIZE"; case WSAEPROTOTYPE: return "WSAEPROTOTYPE"; case WSAENOPROTOOPT: return "WSAENOPROTOOPT"; case WSAEPROTONOSUPPORT: return "WSAEPROTONOSUPPORT"; case WSAESOCKTNOSUPPORT: return "WSAESOCKTNOSUPPORT"; case WSAEOPNOTSUPP: return "WSAEOPNOTSUPP"; case WSAEPFNOSUPPORT: return "WSAEPFNOSUPPORT"; case WSAEAFNOSUPPORT: return "WSAEAFNOSUPPORT"; case WSAEADDRINUSE: return "WSAEADDRINUSE"; case WSAEADDRNOTAVAIL: return "WSAEADDRNOTAVAIL"; case WSAENETDOWN: return "WSAENETDOWN"; case WSAENETUNREACH: return "WSAENETUNREACH"; case WSAENETRESET: return "WSAENETRESET"; case WSAECONNABORTED: return "WSAECONNABORTED"; case WSAECONNRESET: return "WSAECONNRESET"; case WSAENOBUFS: return "WSAENOBUFS"; case WSAEISCONN: return "WSAEISCONN"; case WSAENOTCONN: return "WSAENOTCONN"; case WSAESHUTDOWN: return "WSAESHUTDOWN"; case WSAETOOMANYREFS: return "WSAETOOMANYREFS"; case WSAETIMEDOUT: return "WSAETIMEDOUT"; case WSAECONNREFUSED: return "WSAECONNREFUSED"; case WSAELOOP: return "WSAELOOP"; case WSAENAMETOOLONG: return "WSAENAMETOOLONG"; case WSAEHOSTDOWN: return "WSAEHOSTDOWN"; case WSAEHOSTUNREACH: return "WSAEHOSTUNREACH"; case WSAENOTEMPTY: return "WSAENOTEMPTY"; case WSAEPROCLIM: return "WSAEPROCLIM"; case WSAEUSERS: return "WSAEUSERS"; case WSAEDQUOT: return "WSAEDQUOT"; case WSAESTALE: return "WSAESTALE"; case WSAEREMOTE: return "WSAEREMOTE"; case WSAEDISCON: return "WSAEDISCON"; case WSASYSNOTREADY: return "WSASYSNOTREADY"; case WSAVERNOTSUPPORTED: return "WSAVERNOTSUPPORTED"; case WSANOTINITIALISED: return "WSANOTINITIALISED"; case WSAHOST_NOT_FOUND: return "WSAHOST_NOT_FOUND"; case WSATRY_AGAIN: return "WSATRY_AGAIN"; case WSANO_RECOVERY: return "WSANO_RECOVERY"; case WSANO_DATA: return "WSANO_DATA"; default: { ostringstream os; os << "unknown socket error: " << error; return os.str(); } } } string IceUtilInternal::lastErrorToString() { return errorToString(GetLastError()); } #else string IceUtilInternal::errorToString(int error) { return strerror(error); } string IceUtilInternal::lastErrorToString() { return errorToString(errno); } #endif string IceUtilInternal::toLower(const std::string& s) { string result; result.reserve(s.size()); for(unsigned int i = 0; i < s.length(); ++i) { if(isascii(s[i])) { result += tolower(static_cast(s[i])); } else { result += s[i]; } } return result; } string IceUtilInternal::toUpper(const std::string& s) { string result; result.reserve(s.size()); for(unsigned int i = 0; i < s.length(); ++i) { if(isascii(s[i])) { result += toupper(static_cast(s[i])); } else { result += s[i]; } } return result; } bool IceUtilInternal::isAlpha(char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } bool IceUtilInternal::isDigit(char c) { return c >= '0' && c <= '9'; } string IceUtilInternal::removeWhitespace(const std::string& s) { string result; for(unsigned int i = 0; i < s.length(); ++ i) { if(!isspace(static_cast(s[i]))) { result += s[i]; } } return result; } Ice-3.5.1/cpp/src/IceUtil/InputUtil.cpp0000644000076400007640000001025112223561476015741 0ustar mesmes// ********************************************************************** // // 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 #include #include #ifdef __MINGW32__ #include #endif #if defined(__hpux) #include #endif using namespace std; using namespace IceUtil; namespace IceUtilInternal { #ifdef __MINGW32__ // // The MINGW runtime does not include _strtoi64, so we provide our own implementation // static const string allDigits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // // Table to convert ASCII digits/letters into their value (100 for unused slots) // static const char digitVal[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // '0' - '9' 100, 100, 100, 100, 100, 100, 100, // punctuation 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 'A' - 'J' 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 'K' - 'T' 30, 31, 32, 33, 34, 35 // 'U' - 'Z' }; static IceUtil::Int64 strToInt64Impl(const char* s, char** endptr, int base) { // // Assume nothing will be there to convert for now // if(endptr) { *endptr = const_cast(s); } // // Skip leading whitespace // while(*s && isspace(static_cast(*s))) { ++s; } // // Check for sign // int sign = 1; if(*s == '+') { ++s; } else if(*s == '-') { sign = -1; ++s; } // // Check that base is valid // if(base == 0) { if(*s == '0') { base = 8; ++s; // // We have at least this zero // if(endptr) { *endptr = const_cast(s); } if(*s == 'x' || *s == 'X') { base = 16; ++s; } } else { base = 10; } } else if(base < 2 || base > 36) { errno = EINVAL; return 0; } // // Check that we have something left to parse // if(*s == '\0') { // // We did not read any new digit so we don't update endptr // return 0; } Int64 result = 0; bool overflow = false; bool digitFound = false; const string validDigits(allDigits.begin(), allDigits.begin() + base); while(*s && validDigits.find_first_of(toupper(static_cast(*s))) != validDigits.npos) { digitFound = true; if(!overflow) { int digit = digitVal[toupper(static_cast(*s)) - '0']; assert(digit != 100); if(result < _I64_MAX / base) { result *= base; result += digit; } else if((digit <= _I64_MAX % base) || (sign == -1 && digit == _I64_MAX % base + 1)) { result *= base; result += digit; } else { overflow = true; result = sign == -1 ? _I64_MIN : _I64_MAX; } } ++s; } if(overflow) { errno = ERANGE; } else { result *= sign; } if(digitFound && endptr != 0) { *endptr = const_cast(s); } return result; } #endif Int64 strToInt64(const char* s, char** endptr, int base) { #if defined(_WIN32) # ifdef __MINGW32__ return strToInt64Impl(s, endptr, base); # else return _strtoi64(s, endptr, base); # endif #elif defined(ICE_64) return strtol(s, endptr, base); #elif defined(__hpux) return __strtoll(s, endptr, base); #else return strtoll(s, endptr, base); #endif } bool stringToInt64(const string& s, Int64& result) { const char* start = s.c_str(); char* end = 0; errno = 0; result = strToInt64(start, &end, 0); return (errno == 0 && start != end); } } Ice-3.5.1/cpp/src/IceUtil/CtrlCHandler.cpp0000644000076400007640000001243412223561476016316 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #ifdef __sun # define _POSIX_PTHREAD_SEMANTICS #endif #include #include #include #ifndef _WIN32 # include #endif using namespace std; using namespace IceUtil; namespace { CtrlCHandlerCallback _callback = 0; const CtrlCHandler* _handler = 0; IceUtil::Mutex* globalMutex = 0; class Init { public: Init() { globalMutex = new IceUtil::Mutex; } ~Init() { delete globalMutex; globalMutex = 0; } }; Init init; } CtrlCHandlerException::CtrlCHandlerException(const char* file, int line) : Exception(file, line) { } namespace { const char* ctrlCHandlerName = "IceUtil::CtrlCHandlerException"; } string CtrlCHandlerException::ice_name() const { return ctrlCHandlerName; } CtrlCHandlerException* CtrlCHandlerException::ice_clone() const { return new CtrlCHandlerException(*this); } void CtrlCHandlerException::ice_throw() const { throw *this; } void CtrlCHandler::setCallback(CtrlCHandlerCallback callback) { IceUtilInternal::MutexPtrLock lock(globalMutex); _callback = callback; } CtrlCHandlerCallback CtrlCHandler::getCallback() const { IceUtilInternal::MutexPtrLock lock(globalMutex); return _callback; } #ifdef _WIN32 static BOOL WINAPI handlerRoutine(DWORD dwCtrlType) { CtrlCHandlerCallback callback; { IceUtilInternal::MutexPtrLock lock(globalMutex); if(!_handler) // The handler is destroyed. { return FALSE; } callback = _callback; } if(callback != 0) { callback(dwCtrlType); } return TRUE; } CtrlCHandler::CtrlCHandler(CtrlCHandlerCallback callback) { IceUtilInternal::MutexPtrLock lock(globalMutex); bool handler = _handler != 0; if(handler) { throw CtrlCHandlerException(__FILE__, __LINE__); } else { _callback = callback; _handler = this; lock.release(); SetConsoleCtrlHandler(handlerRoutine, TRUE); } } CtrlCHandler::~CtrlCHandler() { SetConsoleCtrlHandler(handlerRoutine, FALSE); { IceUtilInternal::MutexPtrLock lock(globalMutex); _handler = 0; } } #else extern "C" { static void* sigwaitThread(void*) { sigset_t ctrlCLikeSignals; sigemptyset(&ctrlCLikeSignals); sigaddset(&ctrlCLikeSignals, SIGHUP); sigaddset(&ctrlCLikeSignals, SIGINT); sigaddset(&ctrlCLikeSignals, SIGTERM); // // Run until the handler is destroyed (_handler == 0) // for(;;) { int signal = 0; int rc = sigwait(&ctrlCLikeSignals, &signal); if(rc == EINTR) { // // Some sigwait() implementations incorrectly return EINTR // when interrupted by an unblocked caught signal // continue; } assert(rc == 0); CtrlCHandlerCallback callback; { IceUtilInternal::MutexPtrLock lock(globalMutex); if(!_handler) // The handler is destroyed. { return 0; } callback = _callback; } if(callback != 0) { callback(signal); } } return 0; } } namespace { pthread_t _tid; } CtrlCHandler::CtrlCHandler(CtrlCHandlerCallback callback) { IceUtilInternal::MutexPtrLock lock(globalMutex); bool handler = _handler != 0; if(handler) { throw CtrlCHandlerException(__FILE__, __LINE__); } else { _callback = callback; _handler = this; lock.release(); // We block these CTRL+C like signals in the main thread, // and by default all other threads will inherit this signal // mask. sigset_t ctrlCLikeSignals; sigemptyset(&ctrlCLikeSignals); sigaddset(&ctrlCLikeSignals, SIGHUP); sigaddset(&ctrlCLikeSignals, SIGINT); sigaddset(&ctrlCLikeSignals, SIGTERM); #ifndef NDEBUG int rc = pthread_sigmask(SIG_BLOCK, &ctrlCLikeSignals, 0); assert(rc == 0); // Joinable thread rc = pthread_create(&_tid, 0, sigwaitThread, 0); assert(rc == 0); #else pthread_sigmask(SIG_BLOCK, &ctrlCLikeSignals, 0); // Joinable thread pthread_create(&_tid, 0, sigwaitThread, 0); #endif } } CtrlCHandler::~CtrlCHandler() { // // Clear the handler, the sigwaitThread will exit if _handler is // nil. // { IceUtilInternal::MutexPtrLock lock(globalMutex); _handler = 0; } // // Signal the sigwaitThread and join it. // void* status = 0; #ifndef NDEBUG int rc = pthread_kill(_tid, SIGTERM); assert(rc == 0); rc = pthread_join(_tid, &status); assert(rc == 0); #else pthread_kill(_tid, SIGTERM); pthread_join(_tid, &status); #endif } #endif Ice-3.5.1/cpp/src/IceUtil/UUID.cpp0000644000076400007640000001005512223561476014554 0ustar mesmes// ********************************************************************** // // 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 // On Windows, we use Windows's RPC UUID generator. // On other platforms, we use a high quality random number generator // (/dev/random) to generate "version 4" UUIDs, as described in // http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-00.txt #include #ifdef _WIN32 # include #else # include # include #endif using namespace std; #if defined(ICE_OS_WINRT) || !defined(_WIN32) namespace { char myPid[2]; } namespace IceUtilInternal { // // Initialize the pid. // class PidInitializer { public: PidInitializer() { #ifndef _WIN32 pid_t p = getpid(); #else int p = GetCurrentProcessId(); #endif myPid[0] = (p >> 8) & 0x7F; myPid[1] = p & 0xFF; } }; PidInitializer pidInitializer; }; #endif namespace { // Helper char to hex functions // inline void halfByteToHex(unsigned char hb, char*& hexBuffer) { if(hb < 10) { *hexBuffer++ = '0' + hb; } else { *hexBuffer++ = 'A' + (hb - 10); } } inline void bytesToHex(unsigned char* bytes, size_t len, char*& hexBuffer) { for(size_t i = 0; i < len; i++) { halfByteToHex((bytes[i] & 0xF0) >> 4, hexBuffer); halfByteToHex((bytes[i] & 0x0F), hexBuffer); } } } string IceUtil::generateUUID() { #if defined(_WIN32) && !defined(ICE_OS_WINRT) UUID uuid; RPC_STATUS ret = UuidCreate(&uuid); if(ret != RPC_S_OK && ret != RPC_S_UUID_LOCAL_ONLY && ret != RPC_S_UUID_NO_ADDRESS) { throw new SyscallException(__FILE__, __LINE__, GetLastError()); } unsigned char* str; ret = UuidToString(&uuid, &str); if(ret != RPC_S_OK) { throw new SyscallException(__FILE__, __LINE__, GetLastError()); } string result = reinterpret_cast(str); RpcStringFree(&str); return result; #else struct UUID { unsigned char timeLow[4]; unsigned char timeMid[2]; unsigned char timeHighAndVersion[2]; unsigned char clockSeqHiAndReserved; unsigned char clockSeqLow; unsigned char node[6]; }; UUID uuid; assert(sizeof(UUID) == 16); // // Get a random sequence of bytes. Instead of using 122 random // bits that could be duplicated (because of a bug with some Linux // kernels and potentially other Unix platforms -- see comment in // Random.cpp), we replace the last 15 bits of all "random" // Randoms by the last 15 bits of the process id. // char* buffer = reinterpret_cast(&uuid); IceUtilInternal::generateRandom(buffer, static_cast(sizeof(UUID))); // // Adjust the bits that say "version 4" UUID // uuid.timeHighAndVersion[0] &= 0x0F; uuid.timeHighAndVersion[0] |= (4 << 4); uuid.clockSeqHiAndReserved &= 0x3F; uuid.clockSeqHiAndReserved |= 0x80; // // Replace the end of the node by myPid (15 bits) // uuid.node[4] = (uuid.node[4] & 0x80) | myPid[0]; uuid.node[5] = myPid[1]; // // Convert to a UUID string // char uuidString[16 * 2 + 4 + 1]; // 16 bytes, 4 '-' and a final '\0' char* uuidIndex = uuidString; bytesToHex(uuid.timeLow, sizeof(uuid.timeLow), uuidIndex); *uuidIndex++ = '-'; bytesToHex(uuid.timeMid, sizeof(uuid.timeMid), uuidIndex); *uuidIndex++ = '-'; bytesToHex(uuid.timeHighAndVersion, sizeof(uuid.timeHighAndVersion), uuidIndex); *uuidIndex++ = '-'; bytesToHex(&uuid.clockSeqHiAndReserved, sizeof(uuid.clockSeqHiAndReserved), uuidIndex); bytesToHex(&uuid.clockSeqLow, sizeof(uuid.clockSeqLow), uuidIndex); *uuidIndex++ = '-'; bytesToHex(uuid.node, sizeof(uuid.node), uuidIndex); *uuidIndex = '\0'; return uuidString; #endif } Ice-3.5.1/cpp/src/IceUtil/Thread.cpp0000644000076400007640000003747112223561476015230 0ustar mesmes// ********************************************************************** // // 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. // // ********************************************************************** #ifdef __sun // // Solaris 10 bug: it's supposed to be defined in pthread.h // #ifndef __EXTENSIONS__ #define __EXTENSIONS__ #endif #endif #include #include #include #include #include #ifdef ICE_OS_WINRT # include #endif #ifndef _WIN32 #include #include #endif using namespace std; #ifdef ICE_OS_WINRT IceUtil::ThreadControl::ThreadControl() : _id(this_thread::get_id()) { } IceUtil::ThreadControl::ThreadControl(const shared_ptr& thread) : _thread(thread), _id(_thread->get_id()) { } bool IceUtil::ThreadControl::operator==(const ThreadControl& rhs) const { return id() == rhs.id(); } bool IceUtil::ThreadControl::operator!=(const ThreadControl& rhs) const { return id() != rhs.id(); } void IceUtil::ThreadControl::join() { if(!_thread) { throw BadThreadControlException(__FILE__, __LINE__); } try { _thread->join(); } catch(const system_error& ex) { throw ThreadSyscallException(__FILE__, __LINE__, ex.code().value()); } } void IceUtil::ThreadControl::detach() { if(!_thread) { throw BadThreadControlException(__FILE__, __LINE__); } try { _thread->detach(); } catch(const system_error& ex) { throw ThreadSyscallException(__FILE__, __LINE__, ex.code().value()); } } IceUtil::ThreadControl::ID IceUtil::ThreadControl::id() const { return _id; } void IceUtil::ThreadControl::sleep(const Time& timeout) { this_thread::sleep_for(chrono::microseconds(timeout.toMicroSeconds())); } void IceUtil::ThreadControl::yield() { this_thread::yield(); } IceUtil::Thread::Thread() : _started(false), _running(false) { } IceUtil::Thread::Thread(const string& name) : _name(name), _started(false), _running(false) { } IceUtil::Thread::~Thread() { } static unsigned int WINAPI startHook(void* arg) { // Ensure that the thread doesn't go away until run() has // completed. // IceUtil::ThreadPtr thread; try { IceUtil::Thread* rawThread = static_cast(arg); // // Ensure that the thread doesn't go away until run() has // completed. // thread = rawThread; // // Initialize the random number generator in each thread on // Windows (the rand() seed is thread specific). // unsigned int seed = static_cast(IceUtil::Time::now().toMicroSeconds()); srand(seed ^ static_cast(hash()(thread->getThreadControl().id()))); // // See the comment in IceUtil::Thread::start() for details. // rawThread->__decRef(); thread->run(); } catch(...) { if(!thread->name().empty()) { cerr << thread->name() << " terminating" << endl; } std::terminate(); } thread->_done(); return 0; } #include IceUtil::ThreadControl IceUtil::Thread::start(size_t) { return start(0, 0); } IceUtil::ThreadControl IceUtil::Thread::start(size_t, int) { // // Keep this alive for the duration of start // IceUtil::ThreadPtr keepMe = this; IceUtil::Mutex::Lock lock(_stateMutex); if(_started) { throw ThreadStartedException(__FILE__, __LINE__); } // // It's necessary to increment the reference count since // pthread_create won't necessarily call the thread function until // later. If the user does (new MyThread)->start() then the thread // object could be deleted before the thread object takes // ownership. It's also necessary to increment the reference count // prior to calling pthread_create since the thread itself calls // __decRef(). // __incRef(); _thread.reset(new thread(startHook, this)); _started = true; _running = true; return ThreadControl(_thread); } IceUtil::ThreadControl IceUtil::Thread::getThreadControl() const { IceUtil::Mutex::Lock lock(_stateMutex); if(!_started) { throw ThreadNotStartedException(__FILE__, __LINE__); } return ThreadControl(_thread); } bool IceUtil::Thread::operator==(const Thread& rhs) const { return this == &rhs; } bool IceUtil::Thread::operator!=(const Thread& rhs) const { return this != &rhs; } bool IceUtil::Thread::operator<(const Thread& rhs) const { return this < &rhs; } bool IceUtil::Thread::isAlive() const { IceUtil::Mutex::Lock lock(_stateMutex); return _running; } void IceUtil::Thread::_done() { IceUtil::Mutex::Lock lock(_stateMutex); _running = false; } const string& IceUtil::Thread::name() const { return _name; } #elif defined(_WIN32) IceUtil::ThreadControl::ThreadControl() : _handle(0), _id(GetCurrentThreadId()) { } IceUtil::ThreadControl::ThreadControl(HANDLE handle, IceUtil::ThreadControl::ID id) : _handle(handle), _id(id) { } bool IceUtil::ThreadControl::operator==(const ThreadControl& rhs) const { return _id == rhs._id; } bool IceUtil::ThreadControl::operator!=(const ThreadControl& rhs) const { return _id != rhs._id; } void IceUtil::ThreadControl::join() { if(_handle == 0) { throw BadThreadControlException(__FILE__, __LINE__); } DWORD rc = WaitForSingleObjectEx(_handle, INFINITE, true); if(rc != WAIT_OBJECT_0) { throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } detach(); } void IceUtil::ThreadControl::detach() { if(_handle == 0) { throw BadThreadControlException(__FILE__, __LINE__); } if(CloseHandle(_handle) == 0) { throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } IceUtil::ThreadControl::ID IceUtil::ThreadControl::id() const { return _id; } void IceUtil::ThreadControl::sleep(const Time& timeout) { Sleep(static_cast(timeout.toMilliSeconds())); } void IceUtil::ThreadControl::yield() { // // A value of zero causes the thread to relinquish the remainder // of its time slice to any other thread of equal priority that is // ready to run. // Sleep(0); } IceUtil::Thread::Thread() : _started(false), _running(false), _handle(0), _id(0) { } IceUtil::Thread::Thread(const string& name) : _name(name), _started(false), _running(false), _handle(0), _id(0) { } IceUtil::Thread::~Thread() { } static unsigned int WINAPI startHook(void* arg) { // Ensure that the thread doesn't go away until run() has // completed. // IceUtil::ThreadPtr thread; try { IceUtil::Thread* rawThread = static_cast(arg); // // Ensure that the thread doesn't go away until run() has // completed. // thread = rawThread; // // Initialize the random number generator in each thread on // Windows (the rand() seed is thread specific). // unsigned int seed = static_cast(IceUtil::Time::now().toMicroSeconds()); srand(seed ^ thread->getThreadControl().id()); // // See the comment in IceUtil::Thread::start() for details. // rawThread->__decRef(); thread->run(); } catch(...) { if(!thread->name().empty()) { cerr << thread->name() << " terminating" << endl; } std::terminate(); } thread->_done(); return 0; } #include IceUtil::ThreadControl IceUtil::Thread::start(size_t stackSize) { return start(stackSize, THREAD_PRIORITY_NORMAL); } IceUtil::ThreadControl IceUtil::Thread::start(size_t stackSize, int priority) { // // Keep this alive for the duration of start // IceUtil::ThreadPtr keepMe = this; IceUtil::Mutex::Lock lock(_stateMutex); if(_started) { throw ThreadStartedException(__FILE__, __LINE__); } // // It's necessary to increment the reference count since // pthread_create won't necessarily call the thread function until // later. If the user does (new MyThread)->start() then the thread // object could be deleted before the thread object takes // ownership. It's also necessary to increment the reference count // prior to calling pthread_create since the thread itself calls // __decRef(). // __incRef(); unsigned int id; _handle = reinterpret_cast( _beginthreadex(0, static_cast(stackSize), startHook, this, CREATE_SUSPENDED, &id)); _id = id; assert(_handle != (HANDLE)-1L); if(_handle == 0) { __decRef(); throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } if(SetThreadPriority(_handle, priority) == 0) { throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } if(static_cast(ResumeThread(_handle)) == -1) { __decRef(); throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } _started = true; _running = true; return ThreadControl(_handle, _id); } IceUtil::ThreadControl IceUtil::Thread::getThreadControl() const { IceUtil::Mutex::Lock lock(_stateMutex); if(!_started) { throw ThreadNotStartedException(__FILE__, __LINE__); } return ThreadControl(_handle, _id); } bool IceUtil::Thread::operator==(const Thread& rhs) const { return this == &rhs; } bool IceUtil::Thread::operator!=(const Thread& rhs) const { return this != &rhs; } bool IceUtil::Thread::operator<(const Thread& rhs) const { return this < &rhs; } bool IceUtil::Thread::isAlive() const { IceUtil::Mutex::Lock lock(_stateMutex); return _running; } void IceUtil::Thread::_done() { IceUtil::Mutex::Lock lock(_stateMutex); _running = false; } const string& IceUtil::Thread::name() const { return _name; } #else IceUtil::ThreadControl::ThreadControl(pthread_t thread) : _thread(thread), _detachable(true) { } IceUtil::ThreadControl::ThreadControl() : _thread(pthread_self()), _detachable(false) { } bool IceUtil::ThreadControl::operator==(const ThreadControl& rhs) const { return pthread_equal(_thread, rhs._thread) != 0; } bool IceUtil::ThreadControl::operator!=(const ThreadControl& rhs) const { return !operator==(rhs); } void IceUtil::ThreadControl::join() { if(!_detachable) { throw BadThreadControlException(__FILE__, __LINE__); } void* ignore = 0; int rc = pthread_join(_thread, &ignore); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } void IceUtil::ThreadControl::detach() { if(!_detachable) { throw BadThreadControlException(__FILE__, __LINE__); } int rc = pthread_detach(_thread); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); } } IceUtil::ThreadControl::ID IceUtil::ThreadControl::id() const { return _thread; } void IceUtil::ThreadControl::sleep(const Time& timeout) { struct timeval tv = timeout; struct timespec ts; ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000L; nanosleep(&ts, 0); } void IceUtil::ThreadControl::yield() { sched_yield(); } IceUtil::Thread::Thread() : _started(false), _running(false) { } IceUtil::Thread::Thread(const string& name) : _name(name), _started(false), _running(false) { } IceUtil::Thread::~Thread() { } extern "C" { static void* startHook(void* arg) { // // Ensure that the thread doesn't go away until run() has // completed. // IceUtil::ThreadPtr thread; try { IceUtil::Thread* rawThread = static_cast(arg); thread = rawThread; // // See the comment in IceUtil::Thread::start() for details. // rawThread->__decRef(); thread->run(); } catch(...) { if(!thread->name().empty()) { cerr << thread->name() << " terminating" << endl; } std::terminate(); } thread->_done(); return 0; } } IceUtil::ThreadControl IceUtil::Thread::start(size_t stackSize) { return start(stackSize, false, 0); } IceUtil::ThreadControl IceUtil::Thread::start(size_t stackSize, int priority) { return start(stackSize, true, priority); } IceUtil::ThreadControl IceUtil::Thread::start(size_t stackSize, bool realtimeScheduling, int priority) { // // Keep this alive for the duration of start // IceUtil::ThreadPtr keepMe = this; IceUtil::Mutex::Lock lock(_stateMutex); if(_started) { throw ThreadStartedException(__FILE__, __LINE__); } // // It's necessary to increment the reference count since // pthread_create won't necessarily call the thread function until // later. If the user does (new MyThread)->start() then the thread // object could be deleted before the thread object takes // ownership. It's also necessary to increment the reference count // prior to calling pthread_create since the thread itself calls // __decRef(). // __incRef(); pthread_attr_t attr; int rc = pthread_attr_init(&attr); if(rc != 0) { __decRef(); pthread_attr_destroy(&attr); throw ThreadSyscallException(__FILE__, __LINE__, rc); } if(stackSize > 0) { if(stackSize < PTHREAD_STACK_MIN) { stackSize = PTHREAD_STACK_MIN; } #ifdef __APPLE__ if(stackSize % 4096 > 0) { stackSize = stackSize / 4096 * 4096 + 4096; } #endif rc = pthread_attr_setstacksize(&attr, stackSize); if(rc != 0) { __decRef(); pthread_attr_destroy(&attr); throw ThreadSyscallException(__FILE__, __LINE__, rc); } } if(realtimeScheduling) { rc = pthread_attr_setschedpolicy(&attr, SCHED_RR); if(rc != 0) { __decRef(); throw ThreadSyscallException(__FILE__, __LINE__, rc); } sched_param param; param.sched_priority = priority; rc = pthread_attr_setschedparam(&attr, ¶m); if(rc != 0) { __decRef(); pthread_attr_destroy(&attr); throw ThreadSyscallException(__FILE__, __LINE__, rc); } pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); } rc = pthread_create(&_thread, &attr, startHook, this); pthread_attr_destroy(&attr); if(rc != 0) { __decRef(); throw ThreadSyscallException(__FILE__, __LINE__, rc); } _started = true; _running = true; return ThreadControl(_thread); } IceUtil::ThreadControl IceUtil::Thread::getThreadControl() const { IceUtil::Mutex::Lock lock(_stateMutex); if(!_started) { throw ThreadNotStartedException(__FILE__, __LINE__); } return ThreadControl(_thread); } bool IceUtil::Thread::operator==(const Thread& rhs) const { return this == &rhs; } bool IceUtil::Thread::operator!=(const Thread& rhs) const { return this != &rhs; } bool IceUtil::Thread::operator<(const Thread& rhs) const { return this < &rhs; } bool IceUtil::Thread::isAlive() const { IceUtil::Mutex::Lock lock(_stateMutex); return _running; } void IceUtil::Thread::_done() { IceUtil::Mutex::Lock lock(_stateMutex); _running = false; } const string& IceUtil::Thread::name() const { return _name; } #endif Ice-3.5.1/cpp/src/IceUtil/Time.cpp0000644000076400007640000001414012223561476014703 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #ifdef _WIN32 # include # include #else # include #endif #ifdef __APPLE__ # include # include #endif using namespace IceUtil; #ifdef _WIN32 namespace { double frequency = -1.0; // // Initialize the frequency // class InitializeFrequency { public: InitializeFrequency() { // // Get the frequency of performance counters. We also make a call to // QueryPerformanceCounter to ensure it works. If it fails or if the // call to QueryPerformanceFrequency fails, the frequency will remain // set to -1.0 and ftime will be used instead. // Int64 v; if(QueryPerformanceCounter(reinterpret_cast(&v))) { if(QueryPerformanceFrequency(reinterpret_cast(&v))) { frequency = static_cast(v); } } } }; InitializeFrequency frequencyInitializer; } #endif #ifdef __APPLE__ namespace { double machMultiplier = 1.0; class InitializeTime { public: InitializeTime() { mach_timebase_info_data_t initTimeBase = { 0, 0 }; mach_timebase_info(&initTimeBase); machMultiplier = static_cast(initTimeBase.numer) / initTimeBase.denom / ICE_INT64(1000); } }; InitializeTime initializeTime; } #endif Time::Time() : _usec(0) { } Time IceUtil::Time::now(Clock clock) { if(clock == Realtime) { #ifdef _WIN32 # if defined(_MSC_VER) struct _timeb tb; _ftime(&tb); # elif defined(__MINGW32__) struct timeb tb; ftime(&tb); # endif return Time(static_cast(tb.time) * ICE_INT64(1000000) + tb.millitm * 1000); #else struct timeval tv; if(gettimeofday(&tv, 0) < 0) { assert(0); throw SyscallException(__FILE__, __LINE__, errno); } return Time(tv.tv_sec * ICE_INT64(1000000) + tv.tv_usec); #endif } else // Monotonic { #if defined(_WIN32) if(frequency > 0.0) { Int64 count; if(!QueryPerformanceCounter(reinterpret_cast(&count))) { assert(0); throw SyscallException(__FILE__, __LINE__, GetLastError()); } return Time(static_cast(count / frequency * 1000000.0)); } else { # if defined(_MSC_VER) struct _timeb tb; _ftime(&tb); # elif defined(__MINGW32__) struct timeb tb; ftime(&tb); # endif return Time(static_cast(tb.time) * ICE_INT64(1000000) + tb.millitm * 1000); } #elif defined(__hpux) // // HP does not support CLOCK_MONOTONIC // struct timeval tv; if(gettimeofday(&tv, 0) < 0) { assert(0); throw SyscallException(__FILE__, __LINE__, errno); } return Time(tv.tv_sec * ICE_INT64(1000000) + tv.tv_usec); #elif defined(__APPLE__) return Time(mach_absolute_time() * machMultiplier); #else struct timespec ts; if(clock_gettime(CLOCK_MONOTONIC, &ts) < 0) { assert(0); throw SyscallException(__FILE__, __LINE__, errno); } return Time(ts.tv_sec * ICE_INT64(1000000) + ts.tv_nsec / ICE_INT64(1000)); #endif } } Time IceUtil::Time::seconds(Int64 t) { return Time(t * ICE_INT64(1000000)); } Time IceUtil::Time::milliSeconds(Int64 t) { return Time(t * ICE_INT64(1000)); } Time IceUtil::Time::microSeconds(Int64 t) { return Time(t); } Time IceUtil::Time::secondsDouble(double t) { return Time(Int64(t * 1000000)); } Time IceUtil::Time::milliSecondsDouble(double t) { return Time(Int64(t * 1000)); } Time IceUtil::Time::microSecondsDouble(double t) { return Time(Int64(t)); } #ifndef _WIN32 IceUtil::Time::operator timeval() const { timeval tv; tv.tv_sec = static_cast(_usec / 1000000); tv.tv_usec = static_cast(_usec % 1000000); return tv; } #endif Int64 IceUtil::Time::toSeconds() const { return _usec / 1000000; } Int64 IceUtil::Time::toMilliSeconds() const { return _usec / 1000; } Int64 IceUtil::Time::toMicroSeconds() const { return _usec; } double IceUtil::Time::toSecondsDouble() const { return _usec / 1000000.0; } double IceUtil::Time::toMilliSecondsDouble() const { return _usec / 1000.0; } double IceUtil::Time::toMicroSecondsDouble() const { return static_cast(_usec); } std::string IceUtil::Time::toDateTime() const { time_t time = static_cast(_usec / 1000000); struct tm* t; #ifdef _WIN32 t = localtime(&time); #else struct tm tr; localtime_r(&time, &tr); t = &tr; #endif char buf[32]; strftime(buf, sizeof(buf), "%x %H:%M:%S", t); std::ostringstream os; os << buf << "."; os.fill('0'); os.width(3); os << static_cast(_usec % 1000000 / 1000); return os.str(); } std::string IceUtil::Time::toDuration() const { Int64 usecs = _usec % 1000000; Int64 secs = _usec / 1000000 % 60; Int64 mins = _usec / 1000000 / 60 % 60; Int64 hours = _usec / 1000000 / 60 / 60 % 24; Int64 days = _usec / 1000000 / 60 / 60 / 24; using namespace std; ostringstream os; if(days != 0) { os << days << "d "; } os << setfill('0') << setw(2) << hours << ":" << setw(2) << mins << ":" << setw(2) << secs; if(usecs != 0) { os << "." << setw(3) << (usecs / 1000); } return os.str(); } Time::Time(Int64 usec) : _usec(usec) { } std::ostream& IceUtil::operator<<(std::ostream& out, const Time& tm) { return out << tm.toMicroSeconds() / 1000000.0; } Ice-3.5.1/cpp/src/IceUtil/MutexProtocol.cpp0000644000076400007640000000121512223561476016630 0ustar mesmes// ********************************************************************** // // 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 IceUtil::MutexProtocol IceUtil::getDefaultMutexProtocol() { #ifdef _WIN32 return PrioNone; #else # if defined(ICE_PRIO_INHERIT) && defined(_POSIX_THREAD_PRIO_INHERIT) && _POSIX_THREAD_PRIO_INHERIT > 0 return PrioInherit; # else return PrioNone; # endif #endif } Ice-3.5.1/cpp/src/IceUtil/OutputUtil.cpp0000644000076400007640000002366212223561476016154 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace IceUtil; using namespace IceUtilInternal; namespace IceUtilInternal { NextLine nl; StartBlock sb; EndBlock eb; StartPar spar; EndPar epar; Separator sp; EndElement ee; StartEscapes startEscapes; EndEscapes endEscapes; } string IceUtilInternal::int64ToString(Int64 val) { char buf[64]; #ifdef _WIN32 # if defined(_MSC_VER) sprintf_s(buf, sizeof(buf), "%I64d", val); # else sprintf(buf, "%I64d", val); # endif #elif defined(ICE_64) sprintf(buf, "%ld", val); // Avoids a format warning from GCC. #else sprintf(buf, "%lld", val); #endif return string(buf); } // ---------------------------------------------------------------------- // OutputBase // ---------------------------------------------------------------------- IceUtilInternal::OutputBase::OutputBase() : _out(_fout), _pos(0), _indent(0), _indentSize(4), _useTab(false), _separator(true) { } IceUtilInternal::OutputBase::OutputBase(ostream& os) : _out(os), _pos(0), _indent(0), _indentSize(4), _useTab(false), _separator(true) { } IceUtilInternal::OutputBase::OutputBase(const char* s) : _out(_fout), _pos(0), _indent(0), _indentSize(4), _useTab(false), _separator(true) { open(s); } IceUtilInternal::OutputBase::~OutputBase() { } void IceUtilInternal::OutputBase::open(const char* s) { // // Remove any existing file first. This prevents file name // mismatches on case-insensitive OSs. // IceUtilInternal::unlink(s); _fout.open(s); } void IceUtilInternal::OutputBase::close() { if(_fout.is_open()) { _fout.close(); } } bool IceUtilInternal::OutputBase::isOpen() { return _fout.is_open(); } void IceUtilInternal::OutputBase::print(const char* s) { for(unsigned int i = 0; i < strlen(s); ++i) { if(s[i] == '\n') { _pos = 0; } else { ++_pos; } } _out << s; } void IceUtilInternal::OutputBase::inc() { _indent += _indentSize; } void IceUtilInternal::OutputBase::dec() { assert(_indent >= _indentSize); _indent -= _indentSize; } void IceUtilInternal::OutputBase::useCurrentPosAsIndent() { _indentSave.push(_indent); _indent = _pos; } void IceUtilInternal::OutputBase::zeroIndent() { _indentSave.push(_indent); _indent = 0; } void IceUtilInternal::OutputBase::restoreIndent() { assert(!_indentSave.empty()); _indent = _indentSave.top(); _indentSave.pop(); } int IceUtilInternal::OutputBase::currIndent() { return _indent; } void IceUtilInternal::OutputBase::setIndent(int indentSize) { _indentSize = indentSize; } void IceUtilInternal::OutputBase::setUseTab(bool useTab) { _useTab = useTab; } void IceUtilInternal::OutputBase::newline() { _out << '\n'; _pos = 0; _separator = true; int indent = _indent; if(_useTab) { while(indent >= 8) { indent -= 8; _out << '\t'; _pos += 8; } } else { while(indent >= _indentSize) { indent -= _indentSize; _out << " "; _pos += _indentSize; } } while(indent > 0) { --indent; _out << ' '; ++_pos; } _out.flush(); } void IceUtilInternal::OutputBase::separator() { if(_separator) { _out << '\n'; } } bool IceUtilInternal::OutputBase::operator!() const { return !_out; } // ---------------------------------------------------------------------- // Output // ---------------------------------------------------------------------- IceUtilInternal::Output::Output() : OutputBase(), _blockStart("{"), _blockEnd("}"), _par(-1) { } IceUtilInternal::Output::Output(ostream& os) : OutputBase(os), _blockStart("{"), _blockEnd("}"), _par(-1) { } IceUtilInternal::Output::Output(const char* s) : OutputBase(s), _blockStart("{"), _blockEnd("}"), _par(-1) { } void IceUtilInternal::Output::print(const char* s) { if(_par >= 0) { if(++_par > 1) // No comma for the first parameter. { _out << ", "; } } OutputBase::print(s); } void IceUtilInternal::Output::setBeginBlock(const char *bb) { _blockStart = bb; } void IceUtilInternal::Output::setEndBlock(const char *eb) { _blockEnd = eb; } void IceUtilInternal::Output::sb() { if(_blockStart.length()) { newline(); _out << _blockStart; } ++_pos; inc(); _separator = false; } void IceUtilInternal::Output::eb() { dec(); if(_blockEnd.length()) { newline(); _out << _blockEnd; } --_pos; } void IceUtilInternal::Output::spar() { _out << '('; _par = 0; } void IceUtilInternal::Output::epar() { _par = -1; _out << ')'; } Output& IceUtilInternal::operator<<(Output& out, ios_base& (*val)(ios_base&)) { ostringstream s; s << val; out.print(s.str().c_str()); return out; } // ---------------------------------------------------------------------- // XMLOutput // ---------------------------------------------------------------------- IceUtilInternal::XMLOutput::XMLOutput() : OutputBase(), _se(false), _text(false), _escape(false) { } IceUtilInternal::XMLOutput::XMLOutput(ostream& os) : OutputBase(os), _se(false), _text(false), _escape(false) { } IceUtilInternal::XMLOutput::XMLOutput(const char* s) : OutputBase(s), _se(false), _text(false), _escape(false) { } void IceUtilInternal::XMLOutput::print(const char* s) { if(_se) { _out << '>'; _se = false; } _text = true; if(_escape) { string escaped = escape(s); OutputBase::print(escaped.c_str()); } else { OutputBase::print(s); } } void IceUtilInternal::XMLOutput::newline() { if(_se) { _se = false; _out << '>'; } OutputBase::newline(); } void IceUtilInternal::XMLOutput::startElement(const string& element) { newline(); // // If we're not in SGML mode the output of the '>' character is // deferred until either the //end-element (in which case a /> is // emitted) or until something //is displayed. // if(_escape) { _out << '<' << escape(element); } else { _out << '<' << element; } _se = true; _text = false; string::size_type pos = element.find_first_of(" \t"); if(pos == string::npos) { _elementStack.push(element); } else { _elementStack.push(element.substr(0, pos)); } ++_pos; // TODO: ??? inc(); _separator = false; } void IceUtilInternal::XMLOutput::endElement() { string element = _elementStack.top(); _elementStack.pop(); dec(); if(_se) { _out << ">'; } else { if(!_text) { newline(); } _out << "'; } --_pos; // TODO: ??? _se = false; _text = false; } void IceUtilInternal::XMLOutput::attr(const string& name, const string& value) { // // Precondition: Attributes can only be attached to elements. // assert(_se); _out << " " << name << "=\"" << escape(value) << '"'; } void IceUtilInternal::XMLOutput::startEscapes() { _escape = true; } void IceUtilInternal::XMLOutput::endEscapes() { _escape = false; } string IceUtilInternal::XMLOutput::currentElement() const { if(_elementStack.size() > 0) { return _elementStack.top(); } else { return string(); } } string IceUtilInternal::XMLOutput::escape(const string& input) const { string v = input; // // Find out whether there is a reserved character to avoid // conversion if not necessary. // const string allReserved = "<>'\"&"; if(v.find_first_of(allReserved) != string::npos) { // // First convert all & to & // size_t pos = 0; while((pos = v.find_first_of('&', pos)) != string::npos) { v.insert(pos+1, "amp;"); pos += 4; } // // Next convert remaining reserved characters. // const string reserved = "<>'\""; pos = 0; while((pos = v.find_first_of(reserved, pos)) != string::npos) { string replace; switch(v[pos]) { case '>': replace = ">"; break; case '<': replace = "<"; break; case '\'': replace = "'"; break; case '"': replace = """; break; default: assert(false); } v.erase(pos, 1); v.insert(pos, replace); pos += replace.size(); } } return v; } XMLOutput& IceUtilInternal::operator<<(XMLOutput& out, ios_base& (*val)(ios_base&)) { ostringstream s; s << val; out.print(s.str().c_str()); return out; } IceUtilInternal::StartElement::StartElement(const string& name) : _name(name) { } const string& IceUtilInternal::StartElement::getName() const { return _name; } IceUtilInternal::Attribute::Attribute(const string& name, const string& value) : _name(name), _value(value) { } const string& IceUtilInternal::Attribute::getName() const { return _name; } const string& IceUtilInternal::Attribute::getValue() const { return _value; } Ice-3.5.1/cpp/src/IceUtil/Makefile0000644000076400007640000000312412223561476014741 0ustar mesmes# ********************************************************************** # # 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,IceUtil,$(VERSION)) SONAME = $(call mksoname,IceUtil,$(SOVERSION)) LIBNAME = $(call mklibname,IceUtil) TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME)) OBJS = ArgVector.o \ Cond.o \ ConvertUTF.o \ CountDownLatch.o \ CtrlCHandler.o \ Exception.o \ InputUtil.o \ Options.o \ OutputUtil.o \ Random.o \ RecMutex.o \ Shared.o \ StringUtil.o \ Thread.o \ ThreadException.o \ Time.o \ Timer.o \ UUID.o \ Unicode.o \ MutexProtocol.o \ FileUtil.o SRCS = $(OBJS:.o=.cpp) include $(top_srcdir)/config/Make.rules CPPFLAGS := $(CPPFLAGS) $(ICEUTIL_FLAGS) -DICE_UTIL_API_EXPORTS -I.. LINKWITH := $(ICEUTIL_OS_LIBS) 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 install:: all $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME)) include .depend Ice-3.5.1/cpp/src/IceUtil/Unicode.cpp0000644000076400007640000001502012223561476015371 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; using namespace IceUtil; using namespace IceUtilInternal; namespace { // // Helper class, base never defined // Usage: WstringHelper::toUTF8 and fromUTF8. // template struct WstringHelper { static ConversionResult toUTF8( const wchar_t*& sourceStart, const wchar_t* sourceEnd, Byte*& targetStart, Byte* targetEnd, ConversionFlags flags); static ConversionResult fromUTF8( const Byte*& sourceStart, const Byte* sourceEnd, wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags); }; template<> struct WstringHelper<2> { static ConversionResult toUTF8( const wchar_t*& sourceStart, const wchar_t* sourceEnd, Byte*& targetStart, Byte* targetEnd, ConversionFlags flags) { return ConvertUTF16toUTF8( reinterpret_cast(&sourceStart), reinterpret_cast(sourceEnd), &targetStart, targetEnd, flags); } static ConversionResult fromUTF8( const Byte*& sourceStart, const Byte* sourceEnd, wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags) { return ConvertUTF8toUTF16( &sourceStart, sourceEnd, reinterpret_cast(&targetStart), reinterpret_cast(targetEnd), flags); } }; template<> struct WstringHelper<4> { static ConversionResult toUTF8( const wchar_t*& sourceStart, const wchar_t* sourceEnd, Byte*& targetStart, Byte* targetEnd, ConversionFlags flags) { return ConvertUTF32toUTF8( reinterpret_cast(&sourceStart), reinterpret_cast(sourceEnd), &targetStart, targetEnd, flags); } static ConversionResult fromUTF8( const Byte*& sourceStart, const Byte* sourceEnd, wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags) { return ConvertUTF8toUTF32( &sourceStart, sourceEnd, reinterpret_cast(&targetStart), reinterpret_cast(targetEnd), flags); } }; } // // convertXXX functions // ConversionResult IceUtilInternal::convertUTFWstringToUTF8( const wchar_t*& sourceStart, const wchar_t* sourceEnd, Byte*& targetStart, Byte* targetEnd, ConversionFlags flags) { return WstringHelper::toUTF8( sourceStart, sourceEnd, targetStart, targetEnd, flags); } ConversionResult IceUtilInternal::convertUTF8ToUTFWstring( const Byte*& sourceStart, const Byte* sourceEnd, wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags) { return WstringHelper::fromUTF8( sourceStart, sourceEnd, targetStart, targetEnd, flags); } ConversionResult IceUtilInternal::convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd, std::wstring& target, ConversionFlags flags) { // // Could be reimplemented without this temporary wchar_t buffer // size_t size = static_cast(sourceEnd - sourceStart); wchar_t* outBuf = new wchar_t[size]; wchar_t* targetStart = outBuf; wchar_t* targetEnd = targetStart + size; ConversionResult result = convertUTF8ToUTFWstring(sourceStart, sourceEnd, targetStart, targetEnd, flags); if(result == conversionOK) { std::wstring s(outBuf, static_cast(targetStart - outBuf)); s.swap(target); } delete[] outBuf; return result; } // // wstringToString and stringToWstring // const char* IceUtil::UTFConversionException::_name = "IceUtil::UTFConversionException"; IceUtil::UTFConversionException::UTFConversionException(const char* file, int line, ConversionError ce): Exception(file, line), _conversionError(ce) {} string IceUtil::UTFConversionException::ice_name() const { return _name; } void IceUtil::UTFConversionException::ice_print(ostream& os) const { Exception::ice_print(os); switch(_conversionError) { case partialCharacter: os << ": partial character"; break; case badEncoding: os << ": bad encoding"; break; default: assert(0); break; }; } IceUtil::UTFConversionException* IceUtil::UTFConversionException::ice_clone() const { return new UTFConversionException(*this); } void IceUtil::UTFConversionException::ice_throw() const { throw *this; } IceUtil::ConversionError IceUtil::UTFConversionException::conversionError() const { return _conversionError; } string IceUtil::wstringToString(const wstring& wstr, ConversionFlags flags) { string target; size_t size = wstr.size() * 3 * (sizeof(wchar_t) / 2); Byte* outBuf = new Byte[size]; Byte* targetStart = outBuf; Byte* targetEnd = outBuf + size; const wchar_t* sourceStart = wstr.data(); ConversionResult cr = convertUTFWstringToUTF8( sourceStart, sourceStart + wstr.size(), targetStart, targetEnd, flags); if(cr != conversionOK) { delete[] outBuf; assert(cr == sourceExhausted || cr == sourceIllegal); throw UTFConversionException(__FILE__, __LINE__, cr == sourceExhausted ? partialCharacter : badEncoding); } string s(reinterpret_cast(outBuf), static_cast(targetStart - outBuf)); s.swap(target); delete[] outBuf; return target; } wstring IceUtil::stringToWstring(const string& str, ConversionFlags flags) { wstring result; const Byte* sourceStart = reinterpret_cast(str.data()); ConversionResult cr = convertUTF8ToUTFWstring(sourceStart, sourceStart + str.size(), result, flags); if(cr != conversionOK) { assert(cr == sourceExhausted || cr == sourceIllegal); throw UTFConversionException(__FILE__, __LINE__, cr == sourceExhausted ? partialCharacter : badEncoding); } return result; } Ice-3.5.1/cpp/src/IceGrid/0000755000076400007640000000000012223561477013252 5ustar mesmesIce-3.5.1/cpp/src/IceGrid/ServerAdapterI.cpp0000644000076400007640000001566512223561476016652 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace IceGrid; ServerAdapterI::ServerAdapterI(const NodeIPtr& node, ServerI* server, const string& serverName, const AdapterPrx& proxy, const string& id, bool enabled) : _node(node), _this(proxy), _serverId(serverName), _id(id), _server(server), _enabled(enabled) { } ServerAdapterI::~ServerAdapterI() { assert(_activateCB.empty()); } void ServerAdapterI::activate_async(const AMD_Adapter_activatePtr& cb, const Ice::Current&) { { Lock sync(*this); if(_enabled && _proxy) { // // Return the adapter direct proxy. // cb->ice_response(_proxy); return; } else if(_activateCB.empty()) { // // Nothing else waits for this adapter so we must make sure that this // adapter if still activatable. // if(!_enabled || !_server->isAdapterActivatable(_id)) { cb->ice_response(0); return; } } if(_node->getTraceLevels()->adapter > 2) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat); out << "waiting for activation of server `" + _serverId + "' adapter `" << _id << "'"; } _activateCB.push_back(cb); if(_activateCB.size() > 1) { return; } _activateAfterDeactivating = _server->getState() >= Deactivating && _server->getState() < Destroying; } // // Try to start the server. Note that we start the server outside // the synchronization block since start() can block and callback // on this adapter (when the server is deactivating for example). // try { _server->start(ServerI::OnDemand); return; } catch(const ServerStartException& ex) { activationFailed(ex.reason); } catch(const Ice::ObjectNotExistException&) { // // The server associated to this adapter doesn't exist anymore. Somehow the database is // inconsistent if this happens. The best thing to do is to destroy the adapter. // destroy(); } catch(const Ice::Exception& ex) { ostringstream os; os << "unexpected exception: " << ex; activationFailed(os.str()); } } Ice::ObjectPrx ServerAdapterI::getDirectProxy(const Ice::Current&) const { Lock sync(*this); // // Return the adapter direct proxy if it's set. Otherwise, throw. The caller can eventually // activate the adapter if it's activatable. // if(_proxy && _enabled) { return _proxy; } else { AdapterNotActiveException ex; ex.activatable = _enabled && _server->isAdapterActivatable(_id); throw ex; } } void ServerAdapterI::setDirectProxy(const Ice::ObjectPrx& prx, const Ice::Current&) { Lock sync(*this); // // We don't allow to override an existing proxy by another non // null proxy if the server is not inactive. // if(!_node->allowEndpointsOverride()) { if(prx && _proxy) { if(_server->getState() == Active) { throw AdapterActiveException(); } } } bool updated = _proxy != prx; _proxy = prx; // // If the server is being deactivated and the activation callback // was added during the deactivation, we don't send the response // now. The server is going to be activated again and the adapter // activated. // if(_server->getState() < Deactivating || _server->getState() >= Destroying || !_activateAfterDeactivating) { for(vector::const_iterator p = _activateCB.begin(); p != _activateCB.end(); ++p) { (*p)->ice_response(_proxy); } _activateCB.clear(); } if(updated) { AdapterDynamicInfo info; info.id = _id; info.proxy = _proxy; _node->observerUpdateAdapter(info); } if(_proxy) { _server->adapterActivated(_id); } else { _server->adapterDeactivated(_id); } if(_node->getTraceLevels()->adapter > 1) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat); out << "server `" + _serverId + "' adapter `" << _id << "' " << (_proxy ? "activated" : "deactivated"); if(_proxy) { out << ": " << _node->getCommunicator()->proxyToString(_proxy); } } } void ServerAdapterI::destroy() { activationFailed("adapter destroyed"); try { _node->getAdapter()->remove(_this->ice_getIdentity()); } catch(const Ice::LocalException&) { // Ignore. } } void ServerAdapterI::updateEnabled() { Lock sync(*this); _enabled = _server->isEnabled(); } void ServerAdapterI::clear() { Lock sync(*this); _proxy = 0; _activateAfterDeactivating = false; } void ServerAdapterI::activationFailed(const std::string& reason) { // // The server couldn't be activated, trace and return the current adapter proxy. // if(_node->getTraceLevels()->adapter > 1) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat); out << "server `" + _serverId + "' adapter `" << _id << "' activation failed: " << reason; } Lock sync(*this); for(vector::const_iterator p = _activateCB.begin(); p != _activateCB.end(); ++p) { (*p)->ice_response(0); } _activateCB.clear(); } void ServerAdapterI::activationCompleted() { Lock sync(*this); if(!_proxy) { // // The server activation completed, but the adapter hasn't been activated. // if(_node->getTraceLevels()->adapter > 1) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat); out << "server `" + _serverId + "' adapter `" << _id << "' activation failed: server activation completed"; } } for(vector::const_iterator p = _activateCB.begin(); p != _activateCB.end(); ++p) { (*p)->ice_response(_proxy); } _activateCB.clear(); } AdapterPrx ServerAdapterI::getProxy() const { return _this; } Ice-3.5.1/cpp/src/IceGrid/DB.h0000644000076400007640000000423412223561476013712 0ustar mesmes// ********************************************************************** // // 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 DATABASE_CACHE_H #define DATABASE_CACHE_H #include #include #include namespace IceGrid { class ApplicationsWrapper : public virtual IceDB::Wrapper { public: virtual Ice::Long updateSerial(Ice::Long = 0) = 0; virtual Ice::Long getSerial() const = 0; }; typedef IceUtil::Handle ApplicationsWrapperPtr; class AdaptersWrapper : public virtual IceDB::Wrapper { public: virtual std::vector findByReplicaGroupId(const std::string&) = 0; virtual Ice::Long updateSerial(Ice::Long = 0) = 0; virtual Ice::Long getSerial() const = 0; }; typedef IceUtil::Handle AdaptersWrapperPtr; class ObjectsWrapper : public virtual IceDB::Wrapper { public: virtual std::vector findByType(const std::string&) = 0; virtual Ice::Long updateSerial(Ice::Long = 0) = 0; virtual Ice::Long getSerial() const = 0; }; typedef IceUtil::Handle ObjectsWrapperPtr; class ConnectionPool : public virtual IceDB::ConnectionPool { public: virtual ApplicationsWrapperPtr getApplications(const IceDB::DatabaseConnectionPtr&) = 0; virtual AdaptersWrapperPtr getAdapters(const IceDB::DatabaseConnectionPtr&) = 0; virtual ObjectsWrapperPtr getObjects(const IceDB::DatabaseConnectionPtr&) = 0; virtual ObjectsWrapperPtr getInternalObjects(const IceDB::DatabaseConnectionPtr&) = 0; virtual std::map getSerials() const = 0; }; typedef IceUtil::Handle ConnectionPoolPtr; class DatabasePlugin : virtual public Ice::Plugin { public: virtual bool initDB() = 0; virtual ConnectionPoolPtr getConnectionPool() = 0; }; typedef IceUtil::Handle DatabasePluginPtr; } #endif Ice-3.5.1/cpp/src/IceGrid/DescriptorParser.h0000644000076400007640000000172212223561476016717 0ustar mesmes// ********************************************************************** // // 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 ICEGRID_DESCRIPTOR_PARSER_H #define ICEGRID_DESCRIPTOR_PARSER_H namespace IceGrid { class DescriptorParser { public: static ApplicationDescriptor parseDescriptor(const std::string&, const Ice::StringSeq&, const std::map&, const Ice::CommunicatorPtr&, const IceGrid::AdminPrx&); static ApplicationDescriptor parseDescriptor(const std::string&, const Ice::CommunicatorPtr&); }; } #endif Ice-3.5.1/cpp/src/IceGrid/NodeServerAdminRouter.h0000644000076400007640000000153312223561476017652 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_NODE_SERVER_ADMIN_ROUTER_H #define ICE_GRID_NODE_SERVER_ADMIN_ROUTER_H #include namespace IceGrid { class NodeServerAdminRouter : public Ice::BlobjectArrayAsync { public: NodeServerAdminRouter(const NodeIPtr&); virtual void ice_invoke_async(const Ice::AMD_Object_ice_invokePtr&, const std::pair&, const Ice::Current&); private: NodeIPtr _node; }; } #endif Ice-3.5.1/cpp/src/IceGrid/AllocatableObjectCache.cpp0000644000076400007640000002466212223561476020245 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace IceGrid; namespace IceGrid { struct AllocatableObjectEntryCI : binary_function { bool operator()(const AllocatableObjectEntryPtr& lhs, const AllocatableObjectEntryPtr& rhs) { return ::Ice::proxyIdentityLess(lhs->getProxy(), rhs->getProxy()); } }; }; AllocatableObjectCache::TypeEntry::TypeEntry() { } void AllocatableObjectCache::TypeEntry::add(const AllocatableObjectEntryPtr& obj) { // // No mutex protection here, this is called with the cache locked. // _objects.insert(lower_bound(_objects.begin(), _objects.end(), obj, AllocatableObjectEntryCI()), obj); if(!_requests.empty()) { canTryAllocate(obj, false); } } bool AllocatableObjectCache::TypeEntry::remove(const AllocatableObjectEntryPtr& obj) { // // No mutex protection here, this is called with the cache locked. // vector::iterator q; q = lower_bound(_objects.begin(), _objects.end(), obj, AllocatableObjectEntryCI()); assert(q->get() == obj.get()); _objects.erase(q); if(!_requests.empty() && _objects.empty()) { for(list::const_iterator p = _requests.begin(); p != _requests.end(); ++p) { (*p)->cancel(AllocationException("no allocatable objects with type `" + obj->getType() + "' registered")); } } return _objects.empty(); } void AllocatableObjectCache::TypeEntry::addAllocationRequest(const ObjectAllocationRequestPtr& request) { // // No mutex protection here, this is called with the cache locked. // if(request->pending()) { _requests.push_back(request); } } bool AllocatableObjectCache::TypeEntry::canTryAllocate(const AllocatableObjectEntryPtr& entry, bool fromRelease) { // // No mutex protection here, this is called with the cache locked. // list::iterator p = _requests.begin(); while(p != _requests.end()) { AllocationRequestPtr request = *p; try { if(request->isCanceled()) // If the request has been canceled, we just remove it. { p = _requests.erase(p); } else if(entry->tryAllocate(request, fromRelease)) { p = _requests.erase(p); return true; // The request successfully allocated the entry! } else if(entry->getSession()) // If entry is allocated, we're done { return false; } else { ++p; } } catch(const SessionDestroyedException&) { p = _requests.erase(p); } } return false; } AllocatableObjectCache::AllocatableObjectCache(const Ice::CommunicatorPtr& communicator) : _communicator(communicator) { } void AllocatableObjectCache::add(const ObjectInfo& info, const AllocatablePtr& parent) { const Ice::Identity& id = info.proxy->ice_getIdentity(); Lock sync(*this); if(getImpl(id)) { Ice::Error out(_communicator->getLogger()); out << "can't add duplicate allocatable object `" << _communicator->identityToString(id) << "'"; return; } AllocatableObjectEntryPtr entry = new AllocatableObjectEntry(*this, info, parent); addImpl(id, entry); map::iterator p = _types.find(entry->getType()); if(p == _types.end()) { p = _types.insert(p, map::value_type(entry->getType(), TypeEntry())); } p->second.add(entry); if(_traceLevels && _traceLevels->object > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat); out << "added allocatable object `" << _communicator->identityToString(id) << "'"; } } AllocatableObjectEntryPtr AllocatableObjectCache::get(const Ice::Identity& id) const { Lock sync(*this); AllocatableObjectEntryPtr entry = getImpl(id); if(!entry) { throw ObjectNotRegisteredException(id); } return entry; } void AllocatableObjectCache::remove(const Ice::Identity& id) { AllocatableObjectEntryPtr entry; { Lock sync(*this); entry = getImpl(id); if(!entry) { Ice::Error out(_communicator->getLogger()); out << "can't remove unknown object `" << _communicator->identityToString(id) << "'"; } removeImpl(id); map::iterator p = _types.find(entry->getType()); assert(p != _types.end()); if(p->second.remove(entry)) { _types.erase(p); } if(_traceLevels && _traceLevels->object > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat); out << "removed allocatable object `" << _communicator->identityToString(id) << "'"; } } // // This must be done outside the synchronization because destroy // might release the object and release might try to callback on // the cache. // assert(entry); entry->destroy(); } void AllocatableObjectCache::allocateByType(const string& type, const ObjectAllocationRequestPtr& request) { Lock sync(*this); map::iterator p = _types.find(type); if(p == _types.end()) { throw AllocationException("no allocatable objects with type `" + type + "' registered"); } vector objects = p->second.getObjects(); RandomNumberGenerator rng; random_shuffle(objects.begin(), objects.end(), rng); // TODO: OPTIMIZE try { for(vector::const_iterator q = objects.begin(); q != objects.end(); ++q) { if((*q)->tryAllocate(request)) { return; } } } catch(const SessionDestroyedException&) { return; // The request has been answered already, no need to throw here. } p->second.addAllocationRequest(request); } bool AllocatableObjectCache::canTryAllocate(const AllocatableObjectEntryPtr& entry) { // // Notify the type entry that an object was released. // Lock sync(*this); map::iterator p = _types.find(entry->getType()); if(p == _types.end()) { return false; } return p->second.canTryAllocate(entry, true); } AllocatableObjectEntry::AllocatableObjectEntry(AllocatableObjectCache& cache, const ObjectInfo& info, const AllocatablePtr& parent) : Allocatable(true, parent), _cache(cache), _info(info), _destroyed(false) { } Ice::ObjectPrx AllocatableObjectEntry::getProxy() const { return _info.proxy; } string AllocatableObjectEntry::getType() const { return _info.type; } bool AllocatableObjectEntry::canRemove() { return true; } void AllocatableObjectEntry::allocated(const SessionIPtr& session) { // // Add the object allocation to the session. The object will be // released once the session is destroyed. // session->addAllocation(this); TraceLevelsPtr traceLevels = _cache.getTraceLevels(); if(traceLevels && traceLevels->object > 1) { Ice::Trace out(traceLevels->logger, traceLevels->objectCat); out << "object `" << _info.proxy->ice_toString() << "' allocated by `" << session->getId() << "' (" << _count << ")"; } Glacier2::IdentitySetPrx identities = session->getGlacier2IdentitySet(); if(identities) { try { Ice::IdentitySeq seq(1); seq.push_back(_info.proxy->ice_getIdentity()); identities->add(seq); } catch(const Ice::LocalException& ex) { if(traceLevels && traceLevels->object > 0) { Ice::Trace out(traceLevels->logger, traceLevels->objectCat); out << "couldn't add Glacier2 filter for object `" << _info.proxy->ice_toString(); out << "' allocated by `" << session->getId() << "':\n" << ex; } } } } void AllocatableObjectEntry::released(const SessionIPtr& session) { // // Remove the object allocation from the session. // session->removeAllocation(this); TraceLevelsPtr traceLevels = _cache.getTraceLevels(); Glacier2::IdentitySetPrx identities = session->getGlacier2IdentitySet(); if(identities) { try { Ice::IdentitySeq seq(1); seq.push_back(_info.proxy->ice_getIdentity()); identities->remove(seq); } catch(const Ice::LocalException& ex) { if(traceLevels && traceLevels->object > 0) { Ice::Trace out(traceLevels->logger, traceLevels->objectCat); out << "couldn't remove Glacier2 filter for object `" << _info.proxy->ice_toString(); out << "' allocated by `" << session->getId() << "':\n" << ex; } } } if(traceLevels && traceLevels->object > 1) { Ice::Trace out(traceLevels->logger, traceLevels->objectCat); out << "object `" << _info.proxy->ice_toString() << "' released by `" << session->getId() << "' (" << _count << ")"; } } void AllocatableObjectEntry::destroy() { SessionIPtr session; { Lock sync(*this); _destroyed = true; session = _session; } if(session) { try { release(session); } catch(const AllocationException&) { } } } void AllocatableObjectEntry::checkAllocatable() { if(_destroyed) { throw ObjectNotRegisteredException(_info.proxy->ice_getIdentity()); } Allocatable::checkAllocatable(); } bool AllocatableObjectEntry::canTryAllocate() { return _cache.canTryAllocate(this); } Ice-3.5.1/cpp/src/IceGrid/DescriptorHelper.cpp0000644000076400007640000031317012223561476017240 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace IceUtil; using namespace IceUtilInternal; using namespace IceGrid; #ifdef __SUNPRO_CC // // Disable warning about unassigned function objects // # pragma error_messages(off,unassigned) #endif namespace IceGrid { struct GetReplicaGroupId : unary_function { const string& operator()(const ReplicaGroupDescriptor& desc) { return desc.id; } }; struct TemplateDescriptorEqual : std::binary_function { bool operator()(const TemplateDescriptor& lhs, const TemplateDescriptor& rhs) { if(lhs.parameters != rhs.parameters) { return false; } if(lhs.parameterDefaults != rhs.parameterDefaults) { return false; } { IceBoxDescriptorPtr slhs = IceBoxDescriptorPtr::dynamicCast(lhs.descriptor); IceBoxDescriptorPtr srhs = IceBoxDescriptorPtr::dynamicCast(rhs.descriptor); if(slhs && srhs) { return IceBoxHelper(slhs) == IceBoxHelper(srhs); } } { ServerDescriptorPtr slhs = ServerDescriptorPtr::dynamicCast(lhs.descriptor); ServerDescriptorPtr srhs = ServerDescriptorPtr::dynamicCast(rhs.descriptor); if(slhs && srhs) { return ServerHelper(slhs) == ServerHelper(srhs); } } { ServiceDescriptorPtr slhs = ServiceDescriptorPtr::dynamicCast(lhs.descriptor); ServiceDescriptorPtr srhs = ServiceDescriptorPtr::dynamicCast(rhs.descriptor); if(slhs && srhs) { return ServiceHelper(slhs) == ServiceHelper(srhs); } } return false; } }; struct ReplicaGroupEq : std::binary_function { bool operator()(const ReplicaGroupDescriptor& lhs, const ReplicaGroupDescriptor& rhs) { if(lhs.id != rhs.id) { return false; } if(lhs.proxyOptions != rhs.proxyOptions) { return false; } if(set(lhs.objects.begin(), lhs.objects.end()) != set(rhs.objects.begin(), rhs.objects.end())) { return false; } if(lhs.loadBalancing && rhs.loadBalancing) { if(lhs.loadBalancing->ice_id() != rhs.loadBalancing->ice_id()) { return false; } if(lhs.loadBalancing->nReplicas != rhs.loadBalancing->nReplicas) { return false; } AdaptiveLoadBalancingPolicyPtr alhs = AdaptiveLoadBalancingPolicyPtr::dynamicCast(lhs.loadBalancing); AdaptiveLoadBalancingPolicyPtr arhs = AdaptiveLoadBalancingPolicyPtr::dynamicCast(rhs.loadBalancing); if(alhs && arhs && alhs->loadSample != arhs->loadSample) { return false; } } else if(lhs.loadBalancing || rhs.loadBalancing) { return false; } return true; } }; template Seq getSeqUpdatedElts(const Seq& lseq, const Seq& rseq, GetKeyFunc func) { return getSeqUpdatedEltsWithEq(lseq, rseq, func, equal_to()); } template Seq getSeqUpdatedEltsWithEq(const Seq& lseq, const Seq& rseq, GetKeyFunc func, EqFunc eq) { Seq result; for(typename Seq::const_iterator p = rseq.begin(); p != rseq.end(); ++p) { typename Seq::const_iterator q = lseq.begin(); for(; q != lseq.end(); ++q) { if(func(*p) == func(*q)) { break; } } if(q == lseq.end() || !eq(*p, *q)) { result.push_back(*p); } } return result; } template Ice::StringSeq getSeqRemovedElts(const Seq& lseq, const Seq& rseq, GetKeyFunc func) { Ice::StringSeq removed; for(typename Seq::const_iterator p = lseq.begin(); p != lseq.end(); ++p) { typename Seq::const_iterator q; for(q = rseq.begin(); q != rseq.end(); ++q) { if(func(*p) == func(*q)) { break; } } if(q == rseq.end()) { removed.push_back(func(*p)); } } return removed; } template Seq updateSeqElts(const Seq& seq, const Seq& update, const Ice::StringSeq& remove, GetKeyFunc func) { Seq result = update; set removed(remove.begin(), remove.end()); for(typename Seq::const_iterator p = seq.begin(); p != seq.end(); ++p) { if(removed.find(func(*p)) == removed.end()) { typename Seq::const_iterator q = update.begin(); for(; q != update.end(); ++q) { if(func(*p) == func(*q)) { break; } } if(q == update.end()) { result.push_back(*p); } } } return result; } template Dict getDictUpdatedEltsWithEq(const Dict& ldict, const Dict& rdict, EqFunc eq) { Dict result; for(typename Dict::const_iterator p = rdict.begin(); p != rdict.end(); ++p) { typename Dict::const_iterator q = ldict.find(p->first); if(q == ldict.end() || !eq(p->second, q->second)) { result.insert(*p); } } return result; } template Dict getDictUpdatedElts(const Dict& ldict, const Dict& rdict) { return getDictUpdatedEltsWithEq(ldict, rdict, equal_to()); } template Ice::StringSeq getDictRemovedElts(const Dict& ldict, const Dict& rdict) { Ice::StringSeq removed; for(typename Dict::const_iterator p = ldict.begin(); p != ldict.end(); ++p) { if(rdict.find(p->first) == rdict.end()) { removed.push_back(p->first); } } return removed; } template Dict updateDictElts(const Dict& dict, const Dict& update, const Ice::StringSeq& remove) { Dict result = dict; for(Ice::StringSeq::const_iterator p = remove.begin(); p != remove.end(); ++p) { result.erase(*p); } for(typename Dict::const_iterator q = update.begin(); q != update.end(); ++q) { result[q->first] = q->second; } return result; } void validateProxyOptions(const Resolver& resolver, const string& proxyOptions) { if(!proxyOptions.empty()) { try { resolver.getCommunicator()->stringToProxy("dummy " + proxyOptions); } catch(const Ice::ProxyParseException& ex) { string reason = ex.str; size_t pos = ex.str.find("dummy "); if(pos != string::npos) { reason = reason.replace(pos, 6, ""); } resolver.exception("invalid proxy options: " + reason); } } } } Resolver::Resolver(const ApplicationDescriptor& app, const Ice::CommunicatorPtr& communicator, bool enableWarning) : _application(&app), _communicator(communicator), _escape(false), _enableWarning(enableWarning), _context("application `" + app.name + "'"), _variables(app.variables), _reserved(getReserved()), _version(0) { // // Make sure the variables don't override reserved variables. // checkReserved("variable", _variables); setReserved("application", app.name); // // Some reserved variables which are ignored for now and will be // substituted later. // _ignore.insert("node.os"); _ignore.insert("node.hostname"); _ignore.insert("node.release"); _ignore.insert("node.version"); _ignore.insert("node.machine"); _ignore.insert("node.datadir"); for(StringStringDict::const_iterator v = _variables.begin(); v != _variables.end(); ++v) { if(v->first == "") { exception("empty variable name"); } } for(TemplateDescriptorDict::const_iterator t = _application->serverTemplates.begin(); t != _application->serverTemplates.end(); ++t) { if(t->first == "") { exception("empty server template id"); } if(!t->second.descriptor) { exception("invalid server template `" + t->first + "': server definition is empty"); } Ice::StringSeq params = t->second.parameters; sort(params.begin(), params.end()); Ice::StringSeq wdups = params; Ice::StringSeq dups; set_difference(wdups.begin(), wdups.end(), params.begin(), unique(params.begin(), params.end()), back_inserter(dups)); if(!dups.empty()) { dups.erase(unique(dups.begin(), dups.end()), dups.end()); exception("invalid server template `" + t->first + "': duplicate parameters " + toString(dups)); } } for(TemplateDescriptorDict::const_iterator t = _application->serviceTemplates.begin(); t != _application->serviceTemplates.end(); ++t) { if(t->first == "") { exception("empty service template id"); } if(!t->second.descriptor) { exception("invalid service template `" + t->first + "': service definition is empty"); } Ice::StringSeq params = t->second.parameters; sort(params.begin(), params.end()); Ice::StringSeq wdups = params; Ice::StringSeq dups; set_difference(wdups.begin(), wdups.end(), params.begin(), unique(params.begin(), params.end()), back_inserter(dups)); if(!dups.empty()) { dups.erase(unique(dups.begin(), dups.end()), dups.end()); exception("invalid server template `" + t->first + "': duplicate parameters " + toString(dups)); } } } Resolver::Resolver(const Resolver& resolve, const map& values, bool params) : _application(resolve._application), _communicator(resolve._communicator), _escape(resolve._escape), _enableWarning(resolve._enableWarning), _context(resolve._context), _variables(params ? resolve._variables : values), _parameters(!params ? resolve._parameters : values), _propertySets(resolve._propertySets), _reserved(resolve._reserved), _ignore(resolve._ignore), _version(resolve._version) { if(params) { checkReserved("parameter", values); } else { _variables.insert(resolve._variables.begin(), resolve._variables.end()); checkReserved("variable", values); } for(StringStringDict::const_iterator v = _variables.begin(); v != _variables.end(); ++v) { if(v->first == "") { exception("empty variable name"); } } } Resolver::Resolver(const InternalNodeInfoPtr& info, const Ice::CommunicatorPtr& com) : _application(0), _communicator(com), _escape(true), _enableWarning(false), _context("node `" + info->name + "'"), _reserved(getReserved()), _version(0) { setReserved("node", info->name); setReserved("node.os", info->os); setReserved("node.hostname", info->hostname); setReserved("node.release", info->release); setReserved("node.version", info->version); setReserved("node.machine", info->machine); setReserved("node.datadir", info->dataDir); } string Resolver::operator()(const string& value, const string& name, bool allowEmpty) const { try { string val; try { val = substitute(value, true, true); } catch(const string& reason) { throw "invalid variable `" + value + "':\n " + reason; } catch(const char* reason) { throw "invalid variable `" + value + "':\n " + reason; } if(!allowEmpty) { if(value.empty()) { throw "empty string"; } else if(val.empty()) { throw "the value of `" + value + "' is an empty string"; } } return val; } catch(const string& reason) { exception("invalid value for attribute `" + name + "':\n" + reason); } catch(const char* reason) { exception("invalid value for attribute `" + name + "':\n" + reason); } return ""; // To prevent compiler warning. } Ice::StringSeq Resolver::operator()(const Ice::StringSeq& values, const string& name) const { Ice::StringSeq result; for(Ice::StringSeq::const_iterator p = values.begin(); p != values.end(); ++p) { result.push_back(operator()(*p, name)); } return result; } DistributionDescriptor Resolver::operator()(const DistributionDescriptor& desc) const { DistributionDescriptor result; result.icepatch = operator()(desc.icepatch, "IcePatch2 server proxy"); result.directories = operator()(desc.directories, "distribution source directory"); return result; } PropertyDescriptorSeq Resolver::operator()(const PropertyDescriptorSeq& properties, const string& name) const { PropertyDescriptorSeq result; for(PropertyDescriptorSeq::const_iterator q = properties.begin(); q != properties.end(); ++q) { PropertyDescriptor prop; prop.name = operator()(q->name, name + " name"); prop.value = operator()(q->value, name + " value"); result.push_back(prop); } return result; } PropertySetDescriptorDict Resolver::operator()(const PropertySetDescriptorDict& propertySets) const { PropertySetDescriptorDict result; for(PropertySetDescriptorDict::const_iterator ps = propertySets.begin(); ps != propertySets.end(); ++ps) { PropertySetDescriptor desc; desc.references = operator()(ps->second.references, "property set `" + ps->first + "' reference"); desc.properties = operator()(ps->second.properties, "property set `" + ps->first + "' property"); result.insert(make_pair(ps->first, desc)); } return result; } ObjectDescriptorSeq Resolver::operator()(const ObjectDescriptorSeq& objects, const string& proxyOptions, const string& type) const { ObjectDescriptorSeq result; for(ObjectDescriptorSeq::const_iterator q = objects.begin(); q != objects.end(); ++q) { ObjectDescriptor obj; obj.type = operator()(q->type, type + " object type"); obj.id = operator()(q->id, type + " object identity"); if(!q->proxyOptions.empty()) { obj.proxyOptions = IceUtilInternal::trim(operator()(q->proxyOptions, type + " object proxy options")); } else if(!proxyOptions.empty()) { obj.proxyOptions = IceUtilInternal::trim(operator()(proxyOptions, type + " object proxy options")); } validateProxyOptions(*this, obj.proxyOptions); result.push_back(obj); } return result; } Ice::Identity Resolver::operator()(const Ice::Identity& value, const string& name) const { assert(_communicator); string str = asId(_communicator->identityToString(value), name, false); Ice::Identity id = _communicator->stringToIdentity(str); if(id.name.empty()) { exception("invalid object identity `" + _communicator->identityToString(value) + "': name empty"); } return id; } PropertySetDescriptor Resolver::operator()(const PropertySetDescriptor& desc) const { PropertySetDescriptor result; result.properties = getProperties(desc.references); PropertyDescriptorSeq props = operator()(desc.properties); result.properties.insert(result.properties.end(), props.begin(), props.end()); return result; } string Resolver::asInt(const string& value, const string& name) const { string v = operator()(value, name); if(!v.empty()) { string::size_type beg = v.find_first_not_of(' '); string::size_type end = v.find_last_not_of(' '); v = v.substr(beg == string::npos ? 0 : beg, end == string::npos ? v.length() - 1 : end - beg + 1); int val; istringstream is(v); if(!(is >> val) || !is.eof()) { exception("invalid value `" + value + "' for `" + name + "':\nnot an integer"); } ostringstream os; os << val; v = os.str(); } return v; } string Resolver::asFloat(const string& value, const string& name) const { string v = operator()(value, name); if(!v.empty()) { string::size_type beg = v.find_first_not_of(' '); string::size_type end = v.find_last_not_of(' '); v = v.substr(beg == string::npos ? 0 : beg, end == string::npos ? v.length() - 1 : end - beg + 1); float val; istringstream is(v); if(!(is >> val) || !is.eof()) { exception("invalid value `" + value + "' for `" + name + "':\nnot a float"); } } return v; } string Resolver::asId(const string& value, const string& name, bool allowEmpty) const { try { if(!allowEmpty && value.empty()) { throw "empty string"; } string val; try { val = substitute(value, true, false); } catch(const string& reason) { throw "invalid variable `" + value + "':\n" + reason; } catch(const char* reason) { throw "invalid variable `" + value + "':\n" + reason; } if(!allowEmpty && val.empty()) { throw "the value of `" + value + "' is an empty string"; } return val; } catch(const string& reason) { exception("invalid value for attribute `" + name + "':\n" + reason); } catch(const char* reason) { exception("invalid value for attribute `" + name + "':\n" + reason); } return ""; // To prevent compiler warning. } void Resolver::setReserved(const string& name, const string& value) { assert(_reserved.find(name) != _reserved.end()); _reserved[name] = value; } void Resolver::setContext(const string& context) { try { _context = substitute(context, true, true); } catch(const string& reason) { exception(reason); } catch(const char* reason) { exception(reason); } } void Resolver::addPropertySets(const PropertySetDescriptorDict& propertySets) { PropertySetDescriptorDict oldPropertySets; oldPropertySets.swap(_propertySets); for(PropertySetDescriptorDict::const_iterator p = propertySets.begin(); p != propertySets.end(); ++p) { if(!_propertySets.insert(*p).second) { exception("property set with id `" + p->first + "' is already defined at this scope"); } } _propertySets.insert(oldPropertySets.begin(), oldPropertySets.end()); // // Validate the new property set references. // for(PropertySetDescriptorDict::const_iterator p = propertySets.begin(); p != propertySets.end(); ++p) { getProperties(p->second.references); } } const PropertySetDescriptor& Resolver::getPropertySet(const string& id) const { PropertySetDescriptorDict::const_iterator p = _propertySets.find(id); if(p == _propertySets.end()) { exception("invalid reference to property set, property set `" + id + "' doesn't exist"); } return p->second; } PropertyDescriptorSeq Resolver::getProperties(const Ice::StringSeq& references) const { set resolved; return getProperties(references, resolved); } void Resolver::addIgnored(const string& name) { _ignore.insert(name); } void Resolver::setVersion(const string& version) { string v = operator()(version, "ice version"); if(!v.empty()) { _version = getMMVersion(v); if(_version < 0) { exception("invalid ice version: " + v); } else if(_version > ICE_INT_VERSION && warningEnabled()) { Ice::Warning out(_communicator->getLogger()); out << "invalid ice version: " << _version << " is superior to the IceGrid "; out << "registry version (" << ICE_STRING_VERSION << ")"; } } } int Resolver::getVersion() const { return _version; } void Resolver::exception(const string& reason) const { throw DeploymentException(_context + ":\n" + reason); } TemplateDescriptor Resolver::getServerTemplate(const string& tmpl) const { assert(_application); TemplateDescriptorDict::const_iterator p = _application->serverTemplates.find(tmpl); if(p == _application->serverTemplates.end()) { throw DeploymentException("unknown server template `" + tmpl + "'"); } return p->second; } TemplateDescriptor Resolver::getServiceTemplate(const string& tmpl) const { assert(_application); TemplateDescriptorDict::const_iterator p = _application->serviceTemplates.find(tmpl); if(p == _application->serviceTemplates.end()) { throw DeploymentException("unknown service template `" + tmpl + "'"); } return p->second; } bool Resolver::hasReplicaGroup(const string& id) const { if(!_application) { // // If we don't know the application descriptor we assume that // the replica group exists (this is possible if the resolver // wasn't built from an application helper, that's the case if // it's built from NodeCache just to resolve ${node.*} and // ${session.*} variables. // return true; } for(ReplicaGroupDescriptorSeq::const_iterator p = _application->replicaGroups.begin(); p != _application->replicaGroups.end(); ++p) { if(p->id == id) { return true; } } return false; } string Resolver::substitute(const string& v, bool useParams, bool useIgnored) const { string value(v); string::size_type beg = 0; string::size_type end = 0; while((beg = value.find("${", beg)) != string::npos) { if(beg > 0 && value[beg - 1] == '$') { string::size_type escape = beg - 1; while(escape > 0 && value[escape - 1] == '$') { --escape; } if((beg - escape) % 2) { if(_escape) { value.replace(escape, beg - escape, (beg - escape) / 2, '$'); } ++beg; continue; } else { value.replace(escape, beg - escape, (beg - escape) / 2, '$'); beg -= (beg - escape) / 2; } } end = value.find("}", beg); if(end == string::npos) { throw "malformed variable name `" + value + "'"; } // // Get the name of the variable and get its value if the // variable is not currently ignored (in which case we do // nothing, the variable will be substituted later). If the // name refered to a parameter we don't do any recursive // substitution: the parameter value is computed at the point // of definition. // string name = value.substr(beg + 2, end - beg - 2); if(_ignore.find(name) != _ignore.end()) { if(useIgnored) { ++beg; continue; } else { throw "use of the `" + name + "' variable is now allowed here"; } } bool param; string val = getVariable(name, useParams, param); if(!param) { val = substitute(val, false, useIgnored); // Recursive resolution } value.replace(beg, end - beg + 1, val); beg += val.length(); } return value; } string Resolver::getVariable(const string& name, bool checkParams, bool& param) const { // // We first check the reserved variables, then the parameters if // necessary and finally the variables. // param = false; map::const_iterator p = _reserved.find(name); if(p != _reserved.end()) { if(p->second.empty()) { throw "undefined variable `" + name + "'"; } return p->second; } if(checkParams) { p = _parameters.find(name); if(p != _parameters.end()) { param = true; return p->second; } } p = _variables.find(name); if(p != _variables.end()) { return p->second; } throw "undefined variable `" + name + "'"; return ""; // To keep the compiler happy. } PropertyDescriptorSeq Resolver::getProperties(const Ice::StringSeq& references, set& resolved) const { PropertyDescriptorSeq properties; for(Ice::StringSeq::const_iterator p = references.begin(); p != references.end(); ++p) { if(resolved.find(*p) != resolved.end()) { exception("detected circular dependency with property reference `" + *p + "'"); } PropertySetDescriptor desc = getPropertySet(*p); if(!desc.references.empty()) { resolved.insert(*p); PropertyDescriptorSeq p = getProperties(desc.references, resolved); properties.insert(properties.end(), p.begin(), p.end()); } PropertyDescriptorSeq pds = operator()(desc.properties); properties.insert(properties.end(), pds.begin(), pds.end()); } return properties; } map Resolver::getReserved() { // // Allowed reserved variables (reserved variables can't be // overrided, in this implementation an empty reserved variable is // considered to be undefined (see getVariable)) // map reserved; reserved["application"] = ""; reserved["node"] = ""; reserved["node.os"] = ""; reserved["node.hostname"] = ""; reserved["node.release"] = ""; reserved["node.version"] = ""; reserved["node.machine"] = ""; reserved["node.datadir"] = ""; reserved["session.id"] = ""; reserved["application.distrib"] = "${node.datadir}/distrib/${application}"; reserved["server.distrib"] = "${node.datadir}/servers/${server}/distrib"; reserved["server"] = ""; reserved["service"] = ""; return reserved; } void Resolver::checkReserved(const string& type, const map& values) const { for(map::const_iterator p = values.begin(); p != values.end(); ++p) { if(_reserved.find(p->first) != _reserved.end()) { exception("invalid " + type + " `" + p->first + "': reserved variable name"); } } } CommunicatorHelper::CommunicatorHelper(const CommunicatorDescriptorPtr& desc, bool ignoreProps) : _desc(desc), _ignoreProps(ignoreProps) { } bool CommunicatorHelper::operator==(const CommunicatorHelper& helper) const { if(_desc->ice_id() != helper._desc->ice_id()) { return false; } if(_desc->description != helper._desc->description) { return false; } if(set(_desc->adapters.begin(), _desc->adapters.end()) != set(helper._desc->adapters.begin(), helper._desc->adapters.end())) { return false; } if(!_ignoreProps) { if(_desc->propertySet != helper._desc->propertySet) { return false; } } if(set(_desc->dbEnvs.begin(), _desc->dbEnvs.end()) != set(helper._desc->dbEnvs.begin(), helper._desc->dbEnvs.end())) { return false; } if(_desc->logs != helper._desc->logs) { return false; } return true; } bool CommunicatorHelper::operator!=(const CommunicatorHelper& helper) const { return !operator==(helper); } void CommunicatorHelper::getIds(multiset& adapterIds, multiset& objectIds) const { for(AdapterDescriptorSeq::const_iterator p = _desc->adapters.begin(); p != _desc->adapters.end(); ++p) { if(!p->id.empty()) { adapterIds.insert(p->id); } set ids; for(ObjectDescriptorSeq::const_iterator q = p->objects.begin(); q != p->objects.end(); ++q) { ids.insert(q->id); objectIds.insert(q->id); } for(ObjectDescriptorSeq::const_iterator q = p->allocatables.begin(); q != p->allocatables.end(); ++q) { if(ids.find(q->id) == ids.end()) { objectIds.insert(q->id); } else { ids.erase(q->id); } } } } void CommunicatorHelper::getReplicaGroups(set& replicaGroups) const { for(AdapterDescriptorSeq::const_iterator p = _desc->adapters.begin(); p != _desc->adapters.end(); ++p) { if(!p->replicaGroupId.empty()) { replicaGroups.insert(p->replicaGroupId); } } } void CommunicatorHelper::instantiateImpl(const CommunicatorDescriptorPtr& instance, const Resolver& resolve) const { instance->description = resolve(_desc->description, "description"); instance->propertySet = resolve(_desc->propertySet); for(AdapterDescriptorSeq::const_iterator p = _desc->adapters.begin(); p != _desc->adapters.end(); ++p) { AdapterDescriptor adapter; adapter.name = resolve(p->name, "object adapter name", false); adapter.description = resolve(p->description, "object adapter description"); adapter.id = resolve.asId(p->id, "object adapter id"); adapter.registerProcess = p->registerProcess; adapter.serverLifetime = p->serverLifetime; adapter.replicaGroupId = resolve.asId(p->replicaGroupId, "object adapter replica group id", true); // // Don't check for unknown replica groups here. This check is // instead done by the database before the application is // added. It's legal for an OA to refer to a replica group // from another application. // //if(!adapter.replicaGroupId.empty() && !resolve.hasReplicaGroup(adapter.replicaGroupId)) //{ //resolve.exception("unknown replica group `" + adapter.replicaGroupId + "'"); //} // Default proxy options to set on object descriptors if none is set. string proxyOptions = IceGrid::getProperty(instance->propertySet.properties, adapter.name + ".ProxyOptions"); if(proxyOptions.empty()) { string encoding; if(resolve.getVersion() > 0 && resolve.getVersion() < 30500) { encoding = "1.0"; } else { encoding = "1.1"; } encoding = IceGrid::getProperty(instance->propertySet.properties, "Ice.Default.EncodingVersion", encoding); proxyOptions = "-e " + encoding; } adapter.priority = resolve.asInt(p->priority, "object adapter priority"); adapter.objects = resolve(p->objects, proxyOptions, "well-known"); adapter.allocatables = resolve(p->allocatables, proxyOptions, "allocatable"); instance->adapters.push_back(adapter); // // Make sure the endpoints are defined. // if(IceGrid::getProperty(instance->propertySet.properties, adapter.name + ".Endpoints").empty()) { resolve.exception("invalid endpoints for adapter `" + adapter.name + "': empty string"); } } for(DbEnvDescriptorSeq::const_iterator s = _desc->dbEnvs.begin(); s != _desc->dbEnvs.end(); ++s) { DbEnvDescriptor dbEnv; dbEnv.name = resolve(s->name, "database environment name", false); dbEnv.description = resolve(s->description, "database environment description"); dbEnv.dbHome = resolve(s->dbHome, "database environment home directory"); dbEnv.properties = resolve(s->properties, "database environment property"); instance->dbEnvs.push_back(dbEnv); } for(Ice::StringSeq::const_iterator l = _desc->logs.begin(); l != _desc->logs.end(); ++l) { instance->logs.push_back(resolve(*l, "log path", false)); } } void CommunicatorHelper::print(const Ice::CommunicatorPtr& communicator, Output& out) const { if(!_desc->description.empty()) { out << nl << "description"; out << sb; out << nl << _desc->description; out << eb; } set hiddenProperties; { for(DbEnvDescriptorSeq::const_iterator p = _desc->dbEnvs.begin(); p != _desc->dbEnvs.end(); ++p) { printDbEnv(out, *p); } } { for(AdapterDescriptorSeq::const_iterator p = _desc->adapters.begin(); p != _desc->adapters.end(); ++p) { hiddenProperties.insert(p->name + ".Endpoints"); hiddenProperties.insert(p->name + ".ProxyOptions"); printObjectAdapter(communicator, out, *p); } } { for(Ice::StringSeq::const_iterator p = _desc->logs.begin(); p != _desc->logs.end(); ++p) { out << nl << "log `" << *p << "'"; } } if(!_desc->propertySet.properties.empty() || !_desc->propertySet.references.empty()) { out << nl << "properties"; out << sb; if(!_desc->propertySet.references.empty()) { out << nl << "references = " << toString(_desc->propertySet.references); } for(PropertyDescriptorSeq::const_iterator q = _desc->propertySet.properties.begin(); q != _desc->propertySet.properties.end(); ++q) { if(hiddenProperties.find(q->name) == hiddenProperties.end()) { out << nl << q->name << " = `" << q->value << "'"; } } out << eb; } } void CommunicatorHelper::printDbEnv(Output& out, const DbEnvDescriptor& dbEnv) const { out << nl << "database environment `" << dbEnv.name << "'"; if(!dbEnv.dbHome.empty() || !dbEnv.properties.empty() || !dbEnv.description.empty()) { out << sb; if(!dbEnv.dbHome.empty()) { out << nl << "home = `" << dbEnv.dbHome << "'"; } if(!dbEnv.description.empty()) { out << nl << "description = `" << dbEnv.description << "'"; } if(!dbEnv.properties.empty()) { out << nl << "properties"; out << sb; for(PropertyDescriptorSeq::const_iterator p = dbEnv.properties.begin(); p != dbEnv.properties.end(); ++p) { out << nl << p->name << " = `" << p->value << "'"; } out << eb; } out << eb; } } void CommunicatorHelper::printObjectAdapter(const Ice::CommunicatorPtr& communicator, Output& out, const AdapterDescriptor& adapter) const { out << nl << "adapter `" << adapter.name << "'"; out << sb; if(!adapter.id.empty()) { out << nl << "id = `" << adapter.id << "'"; } if(!adapter.replicaGroupId.empty()) { out << nl << "replica group id = `" << adapter.replicaGroupId << "'"; } if(!adapter.priority.empty()) { out << nl << "priority = `" << adapter.priority << "'"; } string endpoints = getProperty(adapter.name + ".Endpoints"); if(!endpoints.empty()) { out << nl << "endpoints = `" << endpoints << "'"; } string proxyOptions = getProperty(adapter.name + ".ProxyOptions"); if(!proxyOptions.empty()) { out << nl << "proxy options = `" << proxyOptions << "'"; } out << nl << "register process = `" << (adapter.registerProcess ? "true" : "false") << "'"; out << nl << "server lifetime = `" << (adapter.serverLifetime ? "true" : "false") << "'"; for(ObjectDescriptorSeq::const_iterator p = adapter.objects.begin(); p != adapter.objects.end(); ++p) { out << nl << "well-known object"; out << sb; out << nl << "identity = `" << communicator->identityToString(p->id) << "' "; if(!p->type.empty()) { out << nl << "type = `" << p->type << "'"; } if(!p->proxyOptions.empty()) { out << nl << "proxy options = `" << p->proxyOptions << "'"; } out << eb; } for(ObjectDescriptorSeq::const_iterator p = adapter.allocatables.begin(); p != adapter.allocatables.end(); ++p) { out << nl << "allocatable"; out << sb; out << nl << "identity = `" << communicator->identityToString(p->id) << "' "; if(!p->type.empty()) { out << nl << "type = `" << p->type << "'"; } if(!p->proxyOptions.empty()) { out << nl << "proxy options = `" << p->proxyOptions << "'"; } out << eb; } if(!adapter.description.empty()) { out << nl << "description = `" << adapter.description << "'"; } out << eb; } string CommunicatorHelper::getProperty(const string& name) const { return IceGrid::getProperty(_desc->propertySet.properties, name); } ServiceHelper::ServiceHelper(const ServiceDescriptorPtr& descriptor, bool ignoreProps) : CommunicatorHelper(descriptor, ignoreProps), _desc(descriptor) { } bool ServiceHelper::operator==(const CommunicatorHelper& h) const { const ServiceHelper* helper = dynamic_cast(&h); if(!helper || !CommunicatorHelper::operator==(h)) { return false; } if(_desc->name != helper->_desc->name) { return false; } if(_desc->entry != helper->_desc->entry) { return false; } return true; } bool ServiceHelper::operator!=(const CommunicatorHelper& helper) const { return !operator==(helper); } ServiceDescriptorPtr ServiceHelper::getDescriptor() const { return _desc; } ServiceDescriptorPtr ServiceHelper::instantiate(const Resolver& resolver, const PropertyDescriptorSeq& props, const PropertySetDescriptorDict& serviceProps) const { ServiceDescriptorPtr service = new ServiceDescriptor(); instantiateImpl(service, resolver, props, serviceProps); return service; } void ServiceHelper::instantiateImpl(const ServiceDescriptorPtr& instance, const Resolver& resolve, const PropertyDescriptorSeq& props, const PropertySetDescriptorDict& serviceProps) const { CommunicatorHelper::instantiateImpl(instance, resolve); instance->name = resolve(_desc->name, "name", false); instance->entry = resolve(_desc->entry, "entry", false); instance->propertySet.properties.insert(instance->propertySet.properties.end(), props.begin(), props.end()); PropertySetDescriptorDict::const_iterator p = serviceProps.find(instance->name); if(p != serviceProps.end()) { instance->propertySet.properties.insert(instance->propertySet.properties.end(), p->second.properties.begin(), p->second.properties.end()); } } void ServiceHelper::print(const Ice::CommunicatorPtr& communicator, Output& out) const { out << "service `" + _desc->name + "'"; out << sb; out << nl << "entry = `" << _desc->entry << "'"; CommunicatorHelper::print(communicator, out); out << eb; } ServerHelper::ServerHelper(const ServerDescriptorPtr& descriptor, bool ignoreProps) : CommunicatorHelper(descriptor, ignoreProps), _desc(descriptor) { } bool ServerHelper::operator==(const CommunicatorHelper& h) const { const ServerHelper* helper = dynamic_cast(&h); if(!helper || !CommunicatorHelper::operator==(h)) { return false; } if(_desc->id != helper->_desc->id) { return false; } if(_desc->exe != helper->_desc->exe) { return false; } if(_desc->iceVersion != helper->_desc->iceVersion) { return false; } if(_desc->pwd != helper->_desc->pwd) { return false; } if(set(_desc->options.begin(), _desc->options.end()) != set(helper->_desc->options.begin(), helper->_desc->options.end())) { return false; } if(set(_desc->envs.begin(), _desc->envs.end()) != set(helper->_desc->envs.begin(), helper->_desc->envs.end())) { return false; } if(_desc->activation != helper->_desc->activation) { return false; } if(_desc->activationTimeout != helper->_desc->activationTimeout) { return false; } if(_desc->deactivationTimeout != helper->_desc->deactivationTimeout) { return false; } if(_desc->distrib != helper->_desc->distrib) { return false; } if(_desc->allocatable != helper->_desc->allocatable) { return false; } if(_desc->user != helper->_desc->user) { return false; } return true; } bool ServerHelper::operator!=(const CommunicatorHelper& helper) const { return !operator==(helper); } ServerDescriptorPtr ServerHelper::getDescriptor() const { return _desc; } ServerDescriptorPtr ServerHelper::instantiate(const Resolver& resolver, const PropertyDescriptorSeq& props, const PropertySetDescriptorDict& serviceProps) const { if(!serviceProps.empty()) { resolver.exception("service property sets are only allowed in IceBox server instances"); } ServerDescriptorPtr server = new ServerDescriptor(); instantiateImpl(server, resolver, props); return server; } void ServerHelper::print(const Ice::CommunicatorPtr& communicator, Output& out) const { print(communicator, out, ServerInfo()); } void ServerHelper::print(const Ice::CommunicatorPtr& communicator, Output& out, const ServerInfo& info) const { out << "server `" + _desc->id + "'"; out << sb; printImpl(communicator, out, info); out << eb; } void ServerHelper::printImpl(const Ice::CommunicatorPtr& communicator, Output& out, const ServerInfo& info) const { if(!info.application.empty()) { out << nl << "application = `" << info.application << "'"; out << nl << "application uuid = `" << info.uuid << "'"; out << nl << "application revision = `" << info.revision << "'"; } if(!info.node.empty()) { out << nl << "node = `" << info.node << "'"; } if(!info.sessionId.empty()) { out << nl << "session id = `" << info.sessionId << "'"; } out << nl << "exe = `" << _desc->exe << "'"; if(!_desc->iceVersion.empty()) { out << nl << "ice version = `" << _desc->iceVersion << "'"; } if(!_desc->pwd.empty()) { out << nl << "pwd = `" << _desc->pwd << "'"; } out << nl << "activation = `" << _desc->activation << "'"; if(!_desc->activationTimeout.empty() && _desc->activationTimeout != "0") { out << nl << "activationTimeout = `" << _desc->activationTimeout << "'"; } if(!_desc->deactivationTimeout.empty() && _desc->deactivationTimeout != "0") { out << nl << "deactivationTimeout = `" << _desc->deactivationTimeout << "'"; } if(!_desc->user.empty()) { out << nl << "user = `" << _desc->user << "'"; } if(!_desc->applicationDistrib) { out << nl << "application distribution = `false'"; } if(!_desc->options.empty()) { out << nl << "options = `" << toString(_desc->options) << "'"; } if(!_desc->envs.empty()) { out << nl << "envs = `" << toString(_desc->envs) << "'"; } if(!_desc->distrib.icepatch.empty()) { out << nl << "distribution"; out << sb; out << nl << "proxy = `" << _desc->distrib.icepatch << "'"; if(!_desc->distrib.directories.empty()) { out << nl << "directories = `" << toString(_desc->distrib.directories) << "'"; } out << eb; } CommunicatorHelper::print(communicator, out); } void ServerHelper::instantiateImpl(const ServerDescriptorPtr& instance, const Resolver& resolve, const PropertyDescriptorSeq& props) const { CommunicatorHelper::instantiateImpl(instance, resolve); instance->id = resolve.asId(_desc->id, "id", false); instance->exe = resolve(_desc->exe, "executable", false); instance->iceVersion = resolve(_desc->iceVersion, "ice version"); instance->pwd = resolve(_desc->pwd, "working directory path"); instance->activation = resolve(_desc->activation, "activation"); instance->applicationDistrib = _desc->applicationDistrib; instance->allocatable = _desc->allocatable; instance->user = resolve(_desc->user, "user"); if(!instance->activation.empty() && instance->activation != "manual" && instance->activation != "on-demand" && instance->activation != "always" && instance->activation != "session") { resolve.exception("unknown activation `" + instance->activation + "'"); } instance->activationTimeout = resolve.asInt(_desc->activationTimeout, "activation timeout"); instance->deactivationTimeout = resolve.asInt(_desc->deactivationTimeout, "deactivation timeout"); instance->options = resolve(_desc->options, "option"); instance->envs = resolve(_desc->envs, "environment variable"); instance->distrib = resolve(_desc->distrib); instance->propertySet.properties.insert(instance->propertySet.properties.end(), props.begin(), props.end()); } IceBoxHelper::IceBoxHelper(const IceBoxDescriptorPtr& descriptor, bool ignoreProps) : ServerHelper(descriptor, ignoreProps), _desc(descriptor) { for(ServiceInstanceDescriptorSeq::const_iterator p = _desc->services.begin(); p != _desc->services.end(); ++p) { _services.push_back(ServiceInstanceHelper(*p, ignoreProps)); } } bool IceBoxHelper::operator==(const CommunicatorHelper& h) const { const IceBoxHelper* helper = dynamic_cast(&h); if(!helper || !ServerHelper::operator==(h)) { return false; } if(_services != helper->_services) { return false; } return true; } bool IceBoxHelper::operator!=(const CommunicatorHelper& helper) const { return !operator==(helper); } ServerDescriptorPtr IceBoxHelper::instantiate(const Resolver& resolver, const PropertyDescriptorSeq& props, const PropertySetDescriptorDict& serviceProps) const { IceBoxDescriptorPtr iceBox = new IceBoxDescriptor(); instantiateImpl(iceBox, resolver, props, serviceProps); return iceBox; } void IceBoxHelper::getIds(multiset& adapterIds, multiset& objectIds) const { CommunicatorHelper::getIds(adapterIds, objectIds); for(vector::const_iterator p = _services.begin(); p != _services.end(); ++p) { p->getIds(adapterIds, objectIds); } } void IceBoxHelper::getReplicaGroups(set& replicaGroups) const { CommunicatorHelper::getReplicaGroups(replicaGroups); for(vector::const_iterator p = _services.begin(); p != _services.end(); ++p) { p->getReplicaGroups(replicaGroups); } } void IceBoxHelper::print(const Ice::CommunicatorPtr& communicator, Output& out) const { print(communicator, out, ServerInfo()); } void IceBoxHelper::print(const Ice::CommunicatorPtr& communicator, Output& out, const ServerInfo& info) const { out << "icebox `" + _desc->id + "'"; out << sb; string endpoints = getProperty("IceBox.ServiceManager.Endpoints"); out << nl << "service manager endpoints = `" << endpoints << "'"; printImpl(communicator, out, info); out << nl << "services"; out << sb; for(ServiceInstanceDescriptorSeq::const_iterator p = _desc->services.begin(); p != _desc->services.end(); ++p) { assert(p->descriptor); out << nl << p->descriptor->name; } out << eb; out << eb; } void IceBoxHelper::instantiateImpl(const IceBoxDescriptorPtr& instance, const Resolver& resolver, const PropertyDescriptorSeq& props, const PropertySetDescriptorDict& serviceProps) const { ServerHelper::instantiateImpl(instance, resolver, props); set serviceNames; for(vector::const_iterator p = _services.begin(); p != _services.end(); ++p) { ServiceInstanceDescriptor desc = p->instantiate(resolver, serviceProps); assert(desc.descriptor); serviceNames.insert(desc.descriptor->name); instance->services.push_back(desc); } for(PropertySetDescriptorDict::const_iterator q = serviceProps.begin(); q != serviceProps.end(); ++q) { if(serviceNames.find(q->first) == serviceNames.end()) { resolver.exception("invalid service property set: service `" + q->first + "' doesn't exist"); } } } map InstanceHelper::instantiateParams(const Resolver& resolve, const string& tmpl, const map& parameters, const vector& requiredParameters, const map& defaults) const { map params; set required(requiredParameters.begin(), requiredParameters.end()); set unknown; for(map::const_iterator p = parameters.begin(); p != parameters.end(); ++p) { if(required.find(p->first) == required.end()) { unknown.insert(p->first); } params.insert(make_pair(p->first, resolve(p->second, "parameter `" + p->first + "'"))); } if(!unknown.empty()) { ostringstream os; os << "unknown parameters when instantiating `" + tmpl + "' template: "; copy(unknown.begin(), unknown.end(), ostream_iterator(os, " ")); resolve.exception(os.str()); } set missingParams; for(set::const_iterator q = required.begin(); q != required.end(); ++q) { if(params.find(*q) == params.end()) { map::const_iterator r = defaults.find(*q); if(r == defaults.end()) { missingParams.insert(*q); } else { params.insert(make_pair(r->first, resolve(r->second, "default parameter `" + r->first + "'"))); } } } if(!missingParams.empty()) { ostringstream os; os << "undefined parameters when instantiating `" + tmpl + "' template: "; copy(missingParams.begin(), missingParams.end(), ostream_iterator(os, " ")); resolve.exception(os.str()); } return params; } ServiceInstanceHelper::ServiceInstanceHelper(const ServiceInstanceDescriptor& desc, bool ignoreProps) : _def(desc) { // // If the service instance is not a template instance, its // descriptor must be set and contain the definition of the // service. // if(_def._cpp_template.empty() && !_def.descriptor) { throw DeploymentException("invalid service instance: no template defined"); } if(_def.descriptor) { _service = ServiceHelper(_def.descriptor, ignoreProps); } } bool ServiceInstanceHelper::operator==(const ServiceInstanceHelper& helper) const { if(_def._cpp_template.empty()) { return _service == helper._service; } else { return _def._cpp_template == helper._def._cpp_template && _def.parameterValues == helper._def.parameterValues && _def.propertySet == helper._def.propertySet; } } bool ServiceInstanceHelper::operator!=(const ServiceInstanceHelper& helper) const { return !operator==(helper); } ServiceInstanceDescriptor ServiceInstanceHelper::instantiate(const Resolver& resolve, const PropertySetDescriptorDict& serviceProps) const { ServiceHelper def = _service; std::map parameterValues; if(!def.getDescriptor()) { assert(!_def._cpp_template.empty()); TemplateDescriptor tmpl = resolve.getServiceTemplate(_def._cpp_template); def = ServiceHelper(ServiceDescriptorPtr::dynamicCast(tmpl.descriptor)); parameterValues = instantiateParams(resolve, _def._cpp_template, _def.parameterValues, tmpl.parameters, tmpl.parameterDefaults); } // // Setup the resolver. // Resolver svcResolve(resolve, parameterValues, !_service.getDescriptor()); svcResolve.setReserved("service", svcResolve(def.getDescriptor()->name, "service name", false)); svcResolve.setContext("service `${service}' from server `${server}'"); // // Instantiate the service instance. // ServiceInstanceDescriptor desc; desc.descriptor = def.instantiate(svcResolve, svcResolve(_def.propertySet).properties, serviceProps); // // NOTE: We can't keep the following attributes in the service // instance otherwise the instance comparison would be based on // the template + parameters which would be wrong (if the template // changed the instance also changed.) // //desc._cpp_template = _template; //desc.parameterValues = _parameters; return desc; } void ServiceInstanceHelper::getIds(multiset& adapterIds, multiset& objectIds) const { assert(_service.getDescriptor()); _service.getIds(adapterIds, objectIds); } void ServiceInstanceHelper::getReplicaGroups(set& replicaGroups) const { assert(_service.getDescriptor()); _service.getReplicaGroups(replicaGroups); } void ServiceInstanceHelper::print(const Ice::CommunicatorPtr& communicator, Output& out) const { if(_service.getDescriptor()) { _service.print(communicator, out); } else { assert(!_def._cpp_template.empty()); out << "service instance"; out << sb; out << nl << "template = `" << _def._cpp_template << "'"; out << nl << "parameters"; out << sb; for(StringStringDict::const_iterator p = _def.parameterValues.begin(); p != _def.parameterValues.end(); ++p) { out << nl << p->first << " = `" << p->second << "'"; } out << eb; out << eb; } } ServerInstanceHelper::ServerInstanceHelper(const ServerInstanceDescriptor& desc, const Resolver& resolve, bool instantiate) : _def(desc) { init(0, resolve, instantiate); } ServerInstanceHelper::ServerInstanceHelper(const ServerDescriptorPtr& definition, const Resolver& resolve, bool instantiate) : _def(ServerInstanceDescriptor()) { init(definition, resolve, instantiate); } void ServerInstanceHelper::init(const ServerDescriptorPtr& definition, const Resolver& resolve, bool instantiate) { // // Get the server definition if it's not provided. // ServerDescriptorPtr def = definition; std::map parameterValues; if(!def) { if(_def._cpp_template.empty()) { resolve.exception("invalid server instance: template is not defined"); } // // Get the server definition and the template property sets. // TemplateDescriptor tmpl = resolve.getServerTemplate(_def._cpp_template); def = ServerDescriptorPtr::dynamicCast(tmpl.descriptor); parameterValues = instantiateParams(resolve, _def._cpp_template, _def.parameterValues, tmpl.parameters, tmpl.parameterDefaults); } assert(def); // // Setup the resolver. // Resolver svrResolve(resolve, parameterValues, true); svrResolve.setReserved("server", svrResolve.asId(def->id, "server id", false)); svrResolve.setContext("server `${server}'"); svrResolve.setVersion(def->iceVersion); _id = svrResolve("${server}"); // // Set the server definition. // _serverDefinition = createHelper(def); if(!instantiate) { return; // We're done. } // // Ignore undefined session.id variable if the activation mode is // 'session', it will get defined when the server is allocated. // if(svrResolve(def->activation, "server activation", true) == "session") { svrResolve.addIgnored("session.id"); } // // Instantiate the server instance definition (we use the server // resolver above, so using parameters in properties is possible). // if(!_def._cpp_template.empty()) { _instance._cpp_template = _def._cpp_template; _instance.parameterValues = parameterValues; _instance.propertySet = svrResolve(_def.propertySet); for(PropertySetDescriptorDict::const_iterator p = _def.servicePropertySets.begin(); p != _def.servicePropertySets.end(); ++p) { _instance.servicePropertySets.insert(make_pair(svrResolve(p->first), svrResolve(p->second))); } } // // Instantiate the server definition. // ServerDescriptorPtr inst = _serverDefinition->instantiate(svrResolve, _instance.propertySet.properties, _instance.servicePropertySets); _serverInstance = createHelper(inst); } bool ServerInstanceHelper::operator==(const ServerInstanceHelper& helper) const { if(_def._cpp_template.empty()) { return *_serverDefinition == *helper._serverDefinition; } else { return _def._cpp_template == helper._def._cpp_template && _def.parameterValues == helper._def.parameterValues && _def.propertySet == helper._def.propertySet && _def.servicePropertySets == helper._def.servicePropertySets; } } bool ServerInstanceHelper::operator!=(const ServerInstanceHelper& helper) const { return !operator==(helper); } string ServerInstanceHelper::getId() const { return _id; } ServerInstanceDescriptor ServerInstanceHelper::getDefinition() const { assert(!_def._cpp_template.empty()); return _def; } ServerInstanceDescriptor ServerInstanceHelper::getInstance() const { assert(!_def._cpp_template.empty() && !_instance._cpp_template.empty()); return _instance; } ServerDescriptorPtr ServerInstanceHelper::getServerDefinition() const { assert(_def._cpp_template.empty()); return _serverDefinition->getDescriptor(); } ServerDescriptorPtr ServerInstanceHelper::getServerInstance() const { assert(_serverInstance); return _serverInstance->getDescriptor(); } void ServerInstanceHelper::getIds(multiset& adapterIds, multiset& objectIds) const { assert(_serverInstance); _serverInstance->getIds(adapterIds, objectIds); } void ServerInstanceHelper::getReplicaGroups(set& replicaGroups) const { assert(_serverInstance); _serverInstance->getReplicaGroups(replicaGroups); } NodeHelper::NodeHelper(const string& name, const NodeDescriptor& descriptor, const Resolver& appResolve, bool instantiate) : _name(name), _def(descriptor), _instantiated(instantiate) { if(_name.empty()) { appResolve.exception("invalid node: empty name"); } Resolver resolve(appResolve, _def.variables, false); resolve.setReserved("node", _name); resolve.setContext("node `" + _name + "'"); if(instantiate) { // // Instantiate the node definition. // _instance.variables = _def.variables; _instance.loadFactor = resolve.asFloat(_def.loadFactor, "load factor"); _instance.description = resolve(_def.description, "description"); _instance.propertySets = resolve(_def.propertySets); // // Set the named property sets on the resolver. We use the // instantiated named property sets here -- named property sets // must be fully definied at the node level. // resolve.addPropertySets(_instance.propertySets); } for(ServerInstanceDescriptorSeq::const_iterator p = _def.serverInstances.begin(); p != _def.serverInstances.end(); ++p) { ServerInstanceHelper helper(*p, resolve, instantiate); if(!_serverInstances.insert(make_pair(helper.getId(), helper)).second) { resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'"); } if(instantiate) { _instance.serverInstances.push_back(helper.getInstance()); } } for(ServerDescriptorSeq::const_iterator q = _def.servers.begin(); q != _def.servers.end(); ++q) { ServerInstanceHelper helper(*q, resolve, instantiate); if(!_servers.insert(make_pair(helper.getId(), helper)).second) { resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'"); } if(instantiate) { _instance.servers.push_back(helper.getServerInstance()); } } } bool NodeHelper::operator==(const NodeHelper& helper) const { if(_def.variables != helper._def.variables) { return false; } if(_serverInstances != helper._serverInstances) { return false; } if(_servers != helper._servers) { return false; } if(_def.loadFactor != helper._def.loadFactor) { return false; } if(_def.description != helper._def.description) { return false; } if(_def.propertySets != helper._def.propertySets) { return false; } return true; } bool NodeHelper::operator!=(const NodeHelper& helper) const { return !operator==(helper); } NodeUpdateDescriptor NodeHelper::diff(const NodeHelper& helper) const { assert(_name == helper._name); NodeUpdateDescriptor update; update.name = _name; if(_def.loadFactor != helper._def.loadFactor) { update.loadFactor = new BoxedString(_def.loadFactor); } if(_def.description != helper._def.description) { update.description = new BoxedString(_def.description); } update.variables = getDictUpdatedElts(helper._def.variables, _def.variables); update.removeVariables = getDictRemovedElts(helper._def.variables, _def.variables); update.propertySets = getDictUpdatedElts(helper._def.propertySets, _def.propertySets); update.removePropertySets = getDictRemovedElts(helper._def.propertySets, _def.propertySets); ServerInstanceHelperDict updated = getDictUpdatedElts(helper._serverInstances, _serverInstances); for(ServerInstanceHelperDict::const_iterator p = updated.begin(); p != updated.end(); ++p) { update.serverInstances.push_back(p->second.getDefinition()); } update.removeServers = getDictRemovedElts(helper._serverInstances, _serverInstances); updated = getDictUpdatedElts(helper._servers, _servers); for(ServerInstanceHelperDict::const_iterator q = updated.begin(); q != updated.end(); ++q) { update.servers.push_back(q->second.getServerDefinition()); } Ice::StringSeq removed = getDictRemovedElts(helper._servers, _servers); update.removeServers.insert(update.removeServers.end(), removed.begin(), removed.end()); return update; } NodeDescriptor NodeHelper::update(const NodeUpdateDescriptor& update, const Resolver& appResolve) const { NodeDescriptor def; assert(update.name == _name); // // Update the variables, property sets, load factor, description. // def.variables = updateDictElts(_def.variables, update.variables, update.removeVariables); def.propertySets = updateDictElts(_def.propertySets, update.propertySets, update.removePropertySets); def.loadFactor = update.loadFactor ? update.loadFactor->value : _def.loadFactor; def.description = update.description ? update.description->value : _def.description; // // NOTE: It's important to create the resolver *after* updating // the node variables! // Resolver resolve(appResolve, def.variables, false); resolve.setReserved("node", _name); resolve.setContext("node `" + _name + "'"); // // Update the node servers and server instances. The update is in 2 steps: // // * first we instantiate the servers from the update descriptor. // * then we add the servers from the node which were not updated or removed. // set added; set removed(update.removeServers.begin(), update.removeServers.end()); for(ServerInstanceDescriptorSeq::const_iterator q = update.serverInstances.begin(); q != update.serverInstances.end(); ++q) { ServerInstanceHelper helper(*q, resolve, false); if(!added.insert(helper.getId()).second) { resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'"); } def.serverInstances.push_back(helper.getDefinition()); } for(ServerInstanceHelperDict::const_iterator r = _serverInstances.begin(); r != _serverInstances.end(); ++r) { if(removed.find(r->first) != removed.end() || added.find(r->first) != added.end()) { continue; } // // Re-instantiate the server. Make sure the server ID didn't // change, if the ID of a server changes the update descriptor // has to remove the server and add an update entry for it. // ServerInstanceHelper helper(r->second.getDefinition(), resolve, false); if(helper.getId() != r->first) { resolve.exception("invalid update in node `" + _name + "':\n" + "server instance id `" + r->first + "' changed to `" + helper.getId() + "'"); } def.serverInstances.push_back(helper.getDefinition()); } added.clear(); for(ServerDescriptorSeq::const_iterator s = update.servers.begin(); s != update.servers.end(); ++s) { ServerInstanceHelper helper(*s, resolve, false); if(!added.insert(helper.getId()).second) { resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'"); } def.servers.push_back(helper.getServerDefinition()); } for(ServerInstanceHelperDict::const_iterator r = _servers.begin(); r != _servers.end(); ++r) { if(removed.find(r->first) != removed.end() || added.find(r->first) != added.end()) { continue; } // // Re-instantiate the server. Make sure the server ID didn't // change, if the ID of a server changes the update descriptor // has to remove the server and add an update entry for it. // ServerInstanceHelper helper(r->second.getServerDefinition(), resolve, false); if(helper.getId() != r->first) { resolve.exception("invalid update in node `" + _name + "':\nserver instance id `" + r->first + "' changed to `" + helper.getId() + "'"); } def.servers.push_back(helper.getServerDefinition()); } return def; } void NodeHelper::getIds(multiset& serverIds, multiset& adapterIds, multiset& objectIds) const { assert(_instantiated); for(ServerInstanceHelperDict::const_iterator p = _serverInstances.begin(); p != _serverInstances.end(); ++p) { serverIds.insert(p->first); p->second.getIds(adapterIds, objectIds); } for(ServerInstanceHelperDict::const_iterator p = _servers.begin(); p != _servers.end(); ++p) { serverIds.insert(p->first); p->second.getIds(adapterIds, objectIds); } } void NodeHelper::getReplicaGroups(set& replicaGroups) const { assert(_instantiated); for(ServerInstanceHelperDict::const_iterator p = _serverInstances.begin(); p != _serverInstances.end(); ++p) { p->second.getReplicaGroups(replicaGroups); } for(ServerInstanceHelperDict::const_iterator p = _servers.begin(); p != _servers.end(); ++p) { p->second.getReplicaGroups(replicaGroups); } } const NodeDescriptor& NodeHelper::getDefinition() const { return _def; } const NodeDescriptor& NodeHelper::getInstance() const { assert(_instantiated); return _instance; } void NodeHelper::getServerInfos(const string& app, const string& uuid, int revision, map& servers) const { assert(_instantiated); for(ServerInstanceHelperDict::const_iterator p = _serverInstances.begin(); p != _serverInstances.end(); ++p) { ServerInfo info; info.node = _name; info.application = app; info.uuid = uuid; info.revision = revision; info.descriptor = p->second.getServerInstance(); servers.insert(make_pair(p->second.getId(), info)); } for(ServerInstanceHelperDict::const_iterator p = _servers.begin(); p != _servers.end(); ++p) { ServerInfo info; info.node = _name; info.application = app; info.uuid = uuid; info.revision = revision; info.descriptor = p->second.getServerInstance(); servers.insert(make_pair(p->second.getId(), info)); } } bool NodeHelper::hasDistributions(const string& server) const { assert(_instantiated); // // Get the server distributions to patch. // if(server.empty()) { for(ServerInstanceHelperDict::const_iterator p = _serverInstances.begin(); p != _serverInstances.end(); ++p) { if(!p->second.getServerInstance()->distrib.icepatch.empty()) { return true; } } for(ServerInstanceHelperDict::const_iterator p = _servers.begin(); p != _servers.end(); ++p) { if(!p->second.getServerInstance()->distrib.icepatch.empty()) { return true; } } } else { ServerInstanceHelperDict::const_iterator p = _serverInstances.find(server); if(p == _serverInstances.end()) { p = _servers.find(server); if(p == _servers.end()) { return false; } } if(!p->second.getServerInstance()->distrib.icepatch.empty()) { return true; } } return false; } bool NodeHelper::hasServers() const { return !_serverInstances.empty() || !_servers.empty(); } bool NodeHelper::hasServer(const string& name) const { return _serverInstances.find(name) != _serverInstances.end() || _servers.find(name) != _servers.end(); } void NodeHelper::print(Output& out) const { assert(_instantiated); out << nl << "node `" << _name << "'"; out << sb; if(!_instance.loadFactor.empty()) { out << nl << "load factor = `" << _instance.loadFactor << "'"; } if(!_instance.description.empty()) { out << nl << "description = `" << _instance.description << "'"; } if(!_instance.variables.empty()) { out << nl << "variables"; out << sb; for(StringStringDict::const_iterator q = _instance.variables.begin(); q != _instance.variables.end(); ++q) { out << nl << q->first << " = `" << q->second << "'"; } out << eb; } if(!_instance.propertySets.empty()) { for(PropertySetDescriptorDict::const_iterator q = _instance.propertySets.begin(); q != _instance.propertySets.end(); ++q) { out << nl << "properties `" << q->first << "'"; out << sb; if(!q->second.references.empty()) { out << nl << "references = " << toString(q->second.references); } PropertyDescriptorSeq::const_iterator r; for(r = q->second.properties.begin(); r != q->second.properties.end(); ++r) { out << nl << r->name << " = `" << r->value << "'"; } out << eb; } } if(_serverInstances.empty() && _servers.empty()) { out << eb; return; } out << nl << "servers"; out << sb; for(ServerInstanceHelperDict::const_iterator p = _serverInstances.begin(); p != _serverInstances.end(); ++p) { out << nl << p->first; } for(ServerInstanceHelperDict::const_iterator p = _servers.begin(); p != _servers.end(); ++p) { out << nl << p->first; } out << eb; out << eb; } void NodeHelper::printDiff(Output& out, const NodeHelper& helper) const { assert(_instantiated); ServerInstanceHelperDict updated1 = getDictUpdatedElts(helper._serverInstances, _serverInstances); Ice::StringSeq removed1 = getDictRemovedElts(helper._serverInstances, _serverInstances); ServerInstanceHelperDict updated2 = getDictUpdatedElts(helper._servers, _servers); Ice::StringSeq removed2 = getDictRemovedElts(helper._servers, _servers); ServerInstanceHelperDict updated; Ice::StringSeq removed; updated.insert(updated1.begin(), updated1.end()); removed.insert(removed.end(), removed1.begin(), removed1.end()); updated.insert(updated2.begin(), updated2.end()); removed.insert(removed.end(), removed2.begin(), removed2.end()); map variables = getDictUpdatedElts(helper._def.variables, _def.variables); Ice::StringSeq removeVariables = getDictRemovedElts(helper._def.variables, _def.variables); PropertySetDescriptorDict updatedPs = getDictUpdatedElts(helper._def.propertySets, _def.propertySets); Ice::StringSeq removedPs = getDictRemovedElts(helper._def.propertySets, _def.propertySets); if(updated.empty() && removed.empty() && variables.empty() && removeVariables.empty() && updatedPs.empty() && removedPs.empty() && _def.loadFactor == helper._def.loadFactor && _def.description == helper._def.description) { return; } // // TODO: Show updated variables? // out << nl << "node `" + _name + "' updated"; out << sb; if(_def.loadFactor != helper._def.loadFactor) { out << nl << "load factor udpated"; } if(_def.description != helper._def.description) { out << nl << "description udpated"; } if(!updatedPs.empty() || !removedPs.empty()) { out << nl << "property sets udpated"; } if(!variables.empty() || !removeVariables.empty()) { out << nl << "variables udpated"; } if(!updated.empty() || !removed.empty()) { out << nl << "servers"; out << sb; for(ServerInstanceHelperDict::const_iterator p = updated.begin(); p != updated.end(); ++p) { if(helper._serverInstances.find(p->first) == helper._serverInstances.end() && helper._servers.find(p->first) == helper._servers.end()) { out << nl << "server `" << p->first << "' added"; } } for(ServerInstanceHelperDict::const_iterator p = updated.begin(); p != updated.end(); ++p) { if(helper._serverInstances.find(p->first) != helper._serverInstances.end() || helper._servers.find(p->first) != helper._servers.end()) { out << nl << "server `" << p->first << "' updated"; } } for(Ice::StringSeq::const_iterator q = removed.begin(); q != removed.end(); ++q) { out << nl << "server `" << *q << "' removed"; } out << eb; } out << eb; } ApplicationHelper::ApplicationHelper(const Ice::CommunicatorPtr& communicator, const ApplicationDescriptor& desc, bool enableWarning, bool instantiate) : _communicator(communicator), _def(desc) { if(_def.name.empty()) { throw DeploymentException("invalid application: empty name"); } Resolver resolve(_def, communicator, enableWarning); if(instantiate) { // // Instantiate the application definition. // _instance.name = _def.name; _instance.variables = _def.variables; _instance.serverTemplates = _def.serverTemplates; _instance.serviceTemplates = _def.serviceTemplates; _instance.description = resolve(_def.description, "description"); _instance.distrib = resolve(_def.distrib); _instance.propertySets = resolve(_def.propertySets); for(ReplicaGroupDescriptorSeq::iterator r = _def.replicaGroups.begin(); r != _def.replicaGroups.end(); ++r) { ReplicaGroupDescriptor desc; desc.id = resolve.asId(r->id, "replica group id", false); desc.description = resolve(r->description, "replica group description"); desc.proxyOptions = resolve(r->proxyOptions, "replica group proxy options"); validateProxyOptions(resolve, desc.proxyOptions); desc.objects = resolve(r->objects, r->proxyOptions, "replica group well-known"); if(!r->loadBalancing) { resolve.exception("replica group load balancing is not set"); } desc.loadBalancing = LoadBalancingPolicyPtr::dynamicCast(r->loadBalancing->ice_clone()); desc.loadBalancing->nReplicas = resolve.asInt(r->loadBalancing->nReplicas, "replica group number of replicas"); if(desc.loadBalancing->nReplicas.empty()) { resolve.exception("invalid replica group load balancing number of replicas value: empty value"); } else if(desc.loadBalancing->nReplicas[0] == '-') { resolve.exception("invalid replica group load balancing number of replicas value: inferior to 0"); } AdaptiveLoadBalancingPolicyPtr al = AdaptiveLoadBalancingPolicyPtr::dynamicCast(desc.loadBalancing); if(al) { al->loadSample = resolve(al->loadSample, "replica group load sample"); if(al->loadSample != "" && al->loadSample != "1" && al->loadSample != "5" && al->loadSample != "15") { resolve.exception("invalid load sample value (allowed values are 1, 5 or 15)"); } } _instance.replicaGroups.push_back(desc); } // // Set the named property sets on the resolver. We use the // instantiated named property sets here -- named property sets // must be fully definied at the application level. // resolve.addPropertySets(_instance.propertySets); } // // Create the node helpers. // NodeHelperDict::const_iterator n; for(NodeDescriptorDict::const_iterator p = _def.nodes.begin(); p != _def.nodes.end(); ++p) { n = _nodes.insert(make_pair(p->first, NodeHelper(p->first, p->second, resolve, instantiate))).first; if(instantiate) { _instance.nodes.insert(make_pair(n->first, n->second.getInstance())); } } // // If the application is instantiated, ensure the unicity of // object ids, adapter ids and server ids. // if(instantiate) { multiset serverIds; multiset adapterIds; multiset objectIds; for(n = _nodes.begin(); n != _nodes.end(); ++n) { n->second.getIds(serverIds, adapterIds, objectIds); } for(ReplicaGroupDescriptorSeq::iterator r = _def.replicaGroups.begin(); r != _def.replicaGroups.end(); ++r) { if(r->id.empty()) { throw DeploymentException("replica group id is empty"); } if(adapterIds.find(r->id) != adapterIds.end()) { throw DeploymentException("duplicate replica group `" + r->id + "'"); } adapterIds.insert(r->id); for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o) { objectIds.insert(o->id); } } for(multiset::const_iterator s = serverIds.begin(); s != serverIds.end(); ++s) { if(serverIds.count(*s) > 1) { resolve.exception("duplicate server `" + *s + "'"); } } for(multiset::const_iterator a = adapterIds.begin(); a != adapterIds.end(); ++a) { if(adapterIds.count(*a) > 1) { resolve.exception("duplicate adapter `" + *a + "'"); } } for(multiset::const_iterator o = objectIds.begin(); o != objectIds.end(); ++o) { if(objectIds.count(*o) > 1) { resolve.exception("duplicate object `" + _communicator->identityToString(*o) + "'"); } } } } ApplicationUpdateDescriptor ApplicationHelper::diff(const ApplicationHelper& helper) const { ApplicationUpdateDescriptor updt; assert(helper._def.name == _def.name); updt.name = _def.name; if(_def.description != helper._def.description) { updt.description = new BoxedString(_def.description); } updt.variables = getDictUpdatedElts(helper._def.variables, _def.variables); updt.removeVariables = getDictRemovedElts(helper._def.variables, _def.variables); updt.propertySets = getDictUpdatedElts(helper._def.propertySets, _def.propertySets); updt.removePropertySets = getDictRemovedElts(helper._def.propertySets, _def.propertySets); if(_def.distrib != helper._def.distrib) { updt.distrib = new BoxedDistributionDescriptor(_def.distrib); } GetReplicaGroupId rk; ReplicaGroupEq req; updt.replicaGroups = getSeqUpdatedEltsWithEq(helper._def.replicaGroups, _def.replicaGroups, rk, req); updt.removeReplicaGroups = getSeqRemovedElts(helper._def.replicaGroups, _def.replicaGroups, rk); TemplateDescriptorEqual eq; updt.serverTemplates = getDictUpdatedEltsWithEq(helper._def.serverTemplates, _def.serverTemplates, eq); updt.removeServerTemplates = getDictRemovedElts(helper._def.serverTemplates, _def.serverTemplates); updt.serviceTemplates = getDictUpdatedEltsWithEq(helper._def.serviceTemplates, _def.serviceTemplates, eq); updt.removeServiceTemplates = getDictRemovedElts(helper._def.serviceTemplates, _def.serviceTemplates); NodeHelperDict updated = getDictUpdatedElts(helper._nodes, _nodes); for(NodeHelperDict::const_iterator p = updated.begin(); p != updated.end(); ++p) { NodeHelperDict::const_iterator q = helper._nodes.find(p->first); if(q == helper._nodes.end()) { NodeUpdateDescriptor nodeUpdate; const NodeDescriptor& node = p->second.getDefinition(); nodeUpdate.name = p->first; nodeUpdate.variables = node.variables; nodeUpdate.servers = node.servers; nodeUpdate.serverInstances = node.serverInstances; nodeUpdate.loadFactor = new BoxedString(node.loadFactor); nodeUpdate.description = new BoxedString(node.description); updt.nodes.push_back(nodeUpdate); } else { updt.nodes.push_back(p->second.diff(q->second)); } } updt.removeNodes = getDictRemovedElts(helper._nodes, _nodes); return updt; } ApplicationDescriptor ApplicationHelper::update(const ApplicationUpdateDescriptor& updt) const { ApplicationDescriptor def; GetReplicaGroupId rg; def.name = _def.name; def.description = updt.description ? updt.description->value : _def.description; def.distrib = updt.distrib ? updt.distrib->value : _def.distrib; def.replicaGroups = updateSeqElts(_def.replicaGroups, updt.replicaGroups, updt.removeReplicaGroups, rg); def.variables = updateDictElts(_def.variables, updt.variables, updt.removeVariables); def.propertySets = updateDictElts(_def.propertySets, updt.propertySets, updt.removePropertySets); def.serverTemplates = updateDictElts(_def.serverTemplates, updt.serverTemplates, updt.removeServerTemplates); def.serviceTemplates = updateDictElts(_def.serviceTemplates, updt.serviceTemplates, updt.removeServiceTemplates); Resolver resolve(def, _communicator, false); // A resolver based on the *updated* application descriptor. for(NodeUpdateDescriptorSeq::const_iterator p = updt.nodes.begin(); p != updt.nodes.end(); ++p) { NodeHelperDict::const_iterator q = _nodes.find(p->name); if(q != _nodes.end()) // Updated node { NodeDescriptor desc = q->second.update(*p, resolve); def.nodes.insert(make_pair(p->name, q->second.update(*p, resolve))); } else // New node { NodeDescriptor desc; desc.variables = p->variables; if(!p->removeVariables.empty()) { resolve.exception("can't remove variables for node `" + p->name + "': node doesn't exist"); } desc.propertySets = p->propertySets; if(!p->removePropertySets.empty()) { resolve.exception("can't remove property sets for node `" + p->name + "': node doesn't exist"); } desc.servers = p->servers; desc.serverInstances = p->serverInstances; if(!p->removeServers.empty()) { resolve.exception("can't remove servers for node `" + p->name + "': node doesn't exist"); } desc.loadFactor = p->loadFactor ? p->loadFactor->value : string(""); desc.description = p->description ? p->description->value : string(""); def.nodes.insert(make_pair(p->name, desc)); } } set removedNodes(updt.removeNodes.begin(), updt.removeNodes.end()); for(NodeHelperDict::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) { if(removedNodes.find(n->first) != removedNodes.end() || def.nodes.find(n->first) != def.nodes.end()) { continue; // Node was removed or updated. } def.nodes.insert(make_pair(n->first, n->second.getDefinition())); } return def; } ApplicationDescriptor ApplicationHelper::instantiateServer(const string& node, const ServerInstanceDescriptor& instance) const { // // Copy this application descriptor definition and add a server // instance to the given node. The caller should then construct // an application helper with the new application definition to // ensure it's valid. // ApplicationDescriptor def = _def; NodeDescriptorDict::iterator q = def.nodes.find(node); if(q == def.nodes.end()) { NodeDescriptor desc; desc.serverInstances.push_back(instance); def.nodes.insert(make_pair(node, desc)); } else { q->second.serverInstances.push_back(instance); } return def; } void ApplicationHelper::getIds(set& serverIds, set& adapterIds, set& objectIds) const { multiset sIds; multiset aIds; multiset oIds; for(NodeHelperDict::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p) { p->second.getIds(sIds, aIds, oIds); } for(ReplicaGroupDescriptorSeq::const_iterator r = _def.replicaGroups.begin(); r != _def.replicaGroups.end(); ++r) { aIds.insert(r->id); for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o) { oIds.insert(o->id); } } copy(sIds.begin(), sIds.end(), inserter(serverIds, serverIds.begin())); copy(aIds.begin(), aIds.end(), inserter(adapterIds, adapterIds.begin())); copy(oIds.begin(), oIds.end(), inserter(objectIds, objectIds.begin())); } void ApplicationHelper::getReplicaGroups(set& replicaGroups, set& adapterReplicaGroups) const { for(ReplicaGroupDescriptorSeq::const_iterator r = _def.replicaGroups.begin(); r != _def.replicaGroups.end(); ++r) { replicaGroups.insert(r->id); } set allAdapterReplicaGroups; for(NodeHelperDict::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p) { p->second.getReplicaGroups(allAdapterReplicaGroups); } // // Only return references to replica groups which don't belong to // this application. // set_difference(allAdapterReplicaGroups.begin(), allAdapterReplicaGroups.end(), replicaGroups.begin(), replicaGroups.end(), set_inserter(adapterReplicaGroups)); } const ApplicationDescriptor& ApplicationHelper::getDefinition() const { return _def; } const ApplicationDescriptor& ApplicationHelper::getInstance() const { assert(!_instance.name.empty()); return _instance; } map ApplicationHelper::getServerInfos(const string& uuid, int revision) const { assert(!_instance.name.empty()); map servers; for(NodeHelperDict::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) { n->second.getServerInfos(_def.name, uuid, revision, servers); } return servers; } void ApplicationHelper::getDistributions(DistributionDescriptor& distribution, vector& nodes, const string& server) const { assert(!_instance.name.empty()); distribution = _instance.distrib; for(NodeHelperDict::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) { if(n->second.hasDistributions(server)) { nodes.push_back(n->first); if(!server.empty()) { break; } } else if(!_instance.distrib.icepatch.empty() && ((server.empty() && n->second.hasServers()) || n->second.hasServer(server))) { nodes.push_back(n->first); } } } void ApplicationHelper::print(Output& out, const ApplicationInfo& info) const { assert(!_instance.name.empty()); out << "application `" << _instance.name << "'"; out << sb; out << nl << "uuid = `" << info.uuid << "'"; out << nl << "revision = `" << info.revision << "'"; out << nl << "creation time = `" << IceUtil::Time::milliSeconds(info.createTime).toDateTime() << "'"; out << nl << "created by = `" << info.createUser << "'"; out << nl << "update time = `" << IceUtil::Time::milliSeconds(info.updateTime).toDateTime() << "'"; out << nl << "updated by = `" << info.updateUser << "'"; if(!_instance.description.empty()) { out << nl << "description = `" << _instance.description << "'"; } if(!_instance.variables.empty()) { out << nl << "variables"; out << sb; for(StringStringDict::const_iterator p = _instance.variables.begin(); p != _instance.variables.end(); ++p) { out << nl << p->first << " = `" << p->second << "'"; } out << eb; } if(!_instance.propertySets.empty()) { for(PropertySetDescriptorDict::const_iterator q = _instance.propertySets.begin(); q != _instance.propertySets.end(); ++q) { out << nl << "properties `" << q->first << "'"; out << sb; if(!q->second.references.empty()) { out << nl << "references = " << toString(q->second.references); } for(PropertyDescriptorSeq::const_iterator r = q->second.properties.begin(); r != q->second.properties.end(); ++r) { out << nl << r->name << " = `" << r->value << "'"; } out << eb; } } if(!_instance.distrib.icepatch.empty()) { out << nl << "distribution"; out << sb; out << nl << "proxy = `" << _instance.distrib.icepatch << "'"; if(!_instance.distrib.directories.empty()) { out << nl << "directories = `" << toString(_instance.distrib.directories) << "'"; } out << eb; } if(!_instance.replicaGroups.empty()) { out << nl << "replica groups"; out << sb; for(ReplicaGroupDescriptorSeq::const_iterator p = _instance.replicaGroups.begin(); p != _instance.replicaGroups.end(); ++p) { out << nl << "id = `" << p->id << "' load balancing = `"; if(!p->loadBalancing) { out << "default (return all endpoints)"; } else if(RandomLoadBalancingPolicyPtr::dynamicCast(p->loadBalancing)) { out << "random"; } else if(RoundRobinLoadBalancingPolicyPtr::dynamicCast(p->loadBalancing)) { out << "round-robin"; } else if(AdaptiveLoadBalancingPolicyPtr::dynamicCast(p->loadBalancing)) { out << "adaptive" ; } else { out << ""; } if(!p->proxyOptions.empty()) { out << nl << "proxy options = `" << p->proxyOptions << "'"; } out << "'"; } out << eb; } if(!_instance.serverTemplates.empty()) { out << nl << "server templates"; out << sb; for(TemplateDescriptorDict::const_iterator p = _instance.serverTemplates.begin(); p != _instance.serverTemplates.end(); ++p) { out << nl << p->first; } out << eb; } if(!_instance.serviceTemplates.empty()) { out << nl << "service templates"; out << sb; for(TemplateDescriptorDict::const_iterator p = _instance.serviceTemplates.begin(); p != _instance.serviceTemplates.end(); ++p) { out << nl << p->first; } out << eb; } if(!_nodes.empty()) { for(NodeHelperDict::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p) { p->second.print(out); } } out << eb; } void ApplicationHelper::printDiff(Output& out, const ApplicationHelper& helper) const { assert(!_instance.name.empty()); out << "application `" << _def.name << "'"; out << sb; { map variables = getDictUpdatedElts(helper._def.variables, _def.variables); Ice::StringSeq removeVariables = getDictRemovedElts(helper._def.variables, _def.variables); if(!variables.empty() || !removeVariables.empty()) { out << nl << "variables udpated"; } } { if(_def.distrib != helper._def.distrib) { out << nl << "distribution updated"; } } { PropertySetDescriptorDict updt = getDictUpdatedElts(helper._def.propertySets, _def.propertySets); Ice::StringSeq removed = getDictRemovedElts(helper._def.propertySets, _def.propertySets); if(!updt.empty() || !removed.empty()) { out << nl << "property sets udpated"; } } { GetReplicaGroupId rk; ReplicaGroupEq req; ReplicaGroupDescriptorSeq updated = getSeqUpdatedEltsWithEq(helper._def.replicaGroups, _def.replicaGroups, rk, req); Ice::StringSeq removed = getSeqRemovedElts(helper._def.replicaGroups, _def.replicaGroups, rk); if(!updated.empty() || !removed.empty()) { out << nl << "replica groups"; out << sb; for(ReplicaGroupDescriptorSeq::iterator p = updated.begin(); p != updated.end();) { ReplicaGroupDescriptorSeq::const_iterator r; for(r = helper._def.replicaGroups.begin(); r != helper._def.replicaGroups.end(); ++r) { if(p->id == r->id) { out << nl << "replica group `" << r->id << "' updated"; p = updated.erase(p); break; } } if(r == helper._def.replicaGroups.end()) { ++p; } } for(ReplicaGroupDescriptorSeq::iterator p = updated.begin(); p != updated.end(); ++p) { out << nl << "replica group `" << p->id << "' added"; } for(Ice::StringSeq::const_iterator q = removed.begin(); q != removed.end(); ++q) { out << nl << "replica group `" << *q << "' removed"; } out << eb; } } { TemplateDescriptorEqual eq; TemplateDescriptorDict updated; updated = getDictUpdatedEltsWithEq(helper._def.serverTemplates, _def.serverTemplates, eq); Ice::StringSeq removed = getDictRemovedElts(helper._def.serverTemplates, _def.serverTemplates); if(!updated.empty() || !removed.empty()) { out << nl << "server templates"; out << sb; for(TemplateDescriptorDict::const_iterator p = updated.begin(); p != updated.end(); ++p) { if(helper._def.serverTemplates.find(p->first) == helper._def.serverTemplates.end()) { out << nl << "server template `" << p->first << "' added"; } } for(TemplateDescriptorDict::const_iterator q = updated.begin(); q != updated.end(); ++q) { if(helper._def.serverTemplates.find(q->first) != helper._def.serverTemplates.end()) { out << nl << "server template `" << q->first << "' updated"; } } for(Ice::StringSeq::const_iterator r = removed.begin(); r != removed.end(); ++r) { out << nl << "server template `" << *r << "' removed"; } out << eb; } } { TemplateDescriptorEqual eq; TemplateDescriptorDict updated; updated = getDictUpdatedEltsWithEq(helper._def.serviceTemplates, _def.serviceTemplates, eq); Ice::StringSeq removed = getDictRemovedElts(helper._def.serviceTemplates, _def.serviceTemplates); if(!updated.empty() || !removed.empty()) { out << nl << "service templates"; out << sb; for(TemplateDescriptorDict::const_iterator p = updated.begin(); p != updated.end(); ++p) { if(helper._def.serviceTemplates.find(p->first) == helper._def.serviceTemplates.end()) { out << nl << "service template `" << p->first << "' added"; } } for(TemplateDescriptorDict::const_iterator q = updated.begin(); q != updated.end(); ++q) { if(helper._def.serviceTemplates.find(q->first) != helper._def.serviceTemplates.end()) { out << nl << "service template `" << q->first << "' updated"; } } for(Ice::StringSeq::const_iterator r = removed.begin(); r != removed.end(); ++r) { out << nl << "service template `" << *r << "' removed"; } out << eb; } } { NodeHelperDict updated = getDictUpdatedElts(helper._nodes, _nodes); Ice::StringSeq removed = getDictRemovedElts(helper._nodes, _nodes); if(!updated.empty() || !removed.empty()) { out << nl << "nodes"; out << sb; for(NodeHelperDict::const_iterator p = updated.begin(); p != updated.end(); ++p) { NodeHelperDict::const_iterator q = helper._nodes.find(p->first); if(q == helper._nodes.end()) { p->second.print(out); } } for(NodeHelperDict::const_iterator r = updated.begin(); r != updated.end(); ++r) { NodeHelperDict::const_iterator q = helper._nodes.find(r->first); if(q != helper._nodes.end()) { r->second.printDiff(out, q->second); } } for(Ice::StringSeq::const_iterator s = removed.begin(); s != removed.end(); ++s) { out << nl << "node `" << *s << "' removed"; } out << eb; } } out << eb; } bool IceGrid::descriptorEqual(const ServerDescriptorPtr& lhs, const ServerDescriptorPtr& rhs, bool ignoreProps) { IceBoxDescriptorPtr lhsIceBox = IceBoxDescriptorPtr::dynamicCast(lhs); IceBoxDescriptorPtr rhsIceBox = IceBoxDescriptorPtr::dynamicCast(rhs); if(lhsIceBox && rhsIceBox) { return IceBoxHelper(lhsIceBox, ignoreProps) == IceBoxHelper(rhsIceBox, ignoreProps); } else if(!lhsIceBox && !rhsIceBox) { return ServerHelper(lhs, ignoreProps) == ServerHelper(rhs, ignoreProps); } else { return false; } } ServerHelperPtr IceGrid::createHelper(const ServerDescriptorPtr& desc) { IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(desc); if(iceBox) { return new IceBoxHelper(iceBox); } else { return new ServerHelper(desc); } } bool IceGrid::isServerUpdated(const ServerInfo& lhs, const ServerInfo& rhs, bool ignoreProps) { if(lhs.node != rhs.node) { return true; } return !descriptorEqual(lhs.descriptor, rhs.descriptor, ignoreProps); } Ice-3.5.1/cpp/src/IceGrid/WaitQueue.h0000644000076400007640000000230712223561476015335 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_WAIT_QUEUE_H #define ICE_GRID_WAIT_QUEUE_H #include #include #include namespace IceGrid { class WaitItem : virtual public IceUtil::Shared { public: WaitItem(); virtual ~WaitItem(); virtual void expired(bool) = 0; const IceUtil::Time& getExpirationTime(); void setExpirationTime(const IceUtil::Time&); private: IceUtil::Time _expiration; }; typedef IceUtil::Handle WaitItemPtr; class WaitQueue : public IceUtil::Thread, public IceUtil::Monitor< IceUtil::Mutex> { public: WaitQueue(); virtual void run(); void destroy(); void add(const WaitItemPtr&, const IceUtil::Time&); bool remove(const WaitItemPtr&); private: std::list _waitQueue; bool _destroyed; }; typedef IceUtil::Handle WaitQueuePtr; } #endif Ice-3.5.1/cpp/src/IceGrid/Scanner.cpp0000644000076400007640000014314212223561476015353 0ustar mesmes#include #line 3 "lex.yy.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart (FILE *input_file ); void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); void yy_delete_buffer (YY_BUFFER_STATE b ); void yy_flush_buffer (YY_BUFFER_STATE b ); void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); void yypop_buffer_state (void ); static void yyensure_buffer_stack (void ); static void yy_load_buffer_state (void ); static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define yywrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 8 #define YY_END_OF_BUFFER 9 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[19] = { 0, 3, 3, 9, 7, 3, 4, 5, 6, 7, 4, 7, 3, 0, 2, 1, 0, 3, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 4, 1, 1, 1, 1, 5, 1, 1, 6, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[10] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int16_t yy_base[19] = { 0, 0, 0, 11, 22, 8, 22, 22, 22, 12, 22, 18, 0, 0, 22, 22, 0, 22, 22 } ; static yyconst flex_int16_t yy_def[19] = { 0, 18, 1, 18, 18, 18, 18, 18, 18, 18, 18, 18, 5, 11, 18, 18, 11, 18, 0 } ; static yyconst flex_int16_t yy_nxt[32] = { 0, 4, 5, 6, 7, 8, 4, 9, 10, 11, 12, 18, 18, 18, 18, 18, 18, 13, 14, 15, 16, 17, 3, 18, 18, 18, 18, 18, 18, 18, 18, 18 } ; static yyconst flex_int16_t yy_chk[32] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 3, 0, 0, 0, 0, 0, 5, 9, 9, 11, 11, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "Scanner.l" #line 2 "Scanner.l" // ********************************************************************** // // 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 #include #include #if defined(_MSC_VER) && defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // # pragma warning( 4 : 4267 ) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // # pragma warning( 4 : 4244 ) #endif using namespace std; using namespace Ice; using namespace IceGrid; #ifdef _MSC_VER # ifdef yywrap # undef yywrap # define yywrap() 1 # endif # define YY_NO_UNISTD_H #endif #ifdef __SUNPRO_CC # ifdef yywrap # undef yywrap # define yywrap() 1 # endif # ifdef ICE_64 # pragma error_messages(off,truncwarn) # endif #endif #define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) namespace IceGrid { typedef std::map StringTokenMap; static StringTokenMap keywordMap; void initScanner(); std::string parseDoubleQuotedString(); std::string parseSingleQuotedString(); } #define YY_USER_INIT initScanner(); #line 526 "lex.yy.c" #define INITIAL 0 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy (void ); int yyget_debug (void ); void yyset_debug (int debug_flag ); YY_EXTRA_TYPE yyget_extra (void ); void yyset_extra (YY_EXTRA_TYPE user_defined ); FILE *yyget_in (void ); void yyset_in (FILE * in_str ); FILE *yyget_out (void ); void yyset_out (FILE * out_str ); int yyget_leng (void ); char *yyget_text (void ); int yyget_lineno (void ); void yyset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap (void ); #else extern int yywrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 75 "Scanner.l" #line 711 "lex.yy.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 19 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 22 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 77 "Scanner.l" { // C++-style comment int c; do { c = yyinput(); } while(c != '\n' && c != EOF); } YY_BREAK case 2: YY_RULE_SETUP #line 87 "Scanner.l" { // C-style comment while(true) { int c = yyinput(); if(c == '*') { int next = yyinput(); if(next == '/') { break; } else { unput(next); } } else if(c == EOF) { parser->warning("EOF in comment"); break; } } } YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP #line 112 "Scanner.l" { size_t len = strlen(yytext); for(size_t i = 0; i < len; ++i) { if(yytext[i] == '\\') { parser->continueLine(); } } } YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP #line 123 "Scanner.l" { return ';'; } YY_BREAK case 5: YY_RULE_SETUP #line 127 "Scanner.l" { // "..."-type strings string s = parseDoubleQuotedString(); yylvalp->clear(); yylvalp->push_back(s); return ICE_GRID_STRING; } YY_BREAK case 6: YY_RULE_SETUP #line 135 "Scanner.l" { // '...'-type strings string s; while(true) { char c = static_cast(yyinput()); if(c == '\'') { break; } else if(c == EOF) { parser->warning("EOF in string"); break; } else { s += c; } } yylvalp->clear(); yylvalp->push_back(s); return ICE_GRID_STRING; } YY_BREAK case 7: YY_RULE_SETUP #line 160 "Scanner.l" { // Simple strings string s; s += yytext[0]; while(true) { char c = static_cast(yyinput()); if(c == EOF) { break; } else if(c == '"') { s += parseDoubleQuotedString(); continue; } else if(c == '\'') { s += parseSingleQuotedString(); continue; } else if(isspace(static_cast(c)) || c == ';') { unput(c); break; } s += c; } yylvalp->clear(); yylvalp->push_back(s); StringTokenMap::const_iterator pos = keywordMap.find(s); return pos != keywordMap.end() ? pos->second : ICE_GRID_STRING; } YY_BREAK case 8: YY_RULE_SETUP #line 196 "Scanner.l" ECHO; YY_BREAK #line 941 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 19 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 19 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 18); return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree((void *) b->yy_ch_buf ); yyfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 1; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { return yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param line_number * */ void yyset_lineno (int line_number ) { yylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * in_str ) { yyin = in_str ; } void yyset_out (FILE * out_str ) { yyout = out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int bdebug ) { yy_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = (FILE *) 0; yyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return (void *) malloc( size ); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 196 "Scanner.l" namespace IceGrid { // // initScanner() fills the keyword map with all keyword-token pairs. // void initScanner() { keywordMap["help"] = ICE_GRID_HELP; keywordMap["quit"] = ICE_GRID_EXIT; keywordMap["exit"] = ICE_GRID_EXIT; keywordMap["application"] = ICE_GRID_APPLICATION; keywordMap["server"] = ICE_GRID_SERVER; keywordMap["adapter"] = ICE_GRID_ADAPTER; keywordMap["add"] = ICE_GRID_ADD; keywordMap["remove"] = ICE_GRID_REMOVE; keywordMap["list"] = ICE_GRID_LIST; keywordMap["shutdown"] = ICE_GRID_SHUTDOWN; keywordMap["describe"] = ICE_GRID_DESCRIBE; keywordMap["properties"] = ICE_GRID_PROPERTIES; keywordMap["property"] = ICE_GRID_PROPERTY; keywordMap["state"] = ICE_GRID_STATE; keywordMap["pid"] = ICE_GRID_PID; keywordMap["endpoints"] = ICE_GRID_ENDPOINTS; keywordMap["start"] = ICE_GRID_START; keywordMap["patch"] = ICE_GRID_PATCH; keywordMap["stop"] = ICE_GRID_STOP; keywordMap["signal"] = ICE_GRID_SIGNAL; keywordMap["stdout"] = ICE_GRID_STDOUT; keywordMap["stderr"] = ICE_GRID_STDERR; keywordMap["node"] = ICE_GRID_NODE; keywordMap["registry"] = ICE_GRID_REGISTRY; keywordMap["ping"] = ICE_GRID_PING; keywordMap["load"] = ICE_GRID_LOAD; keywordMap["processors"] = ICE_GRID_SOCKETS; keywordMap["sockets"] = ICE_GRID_SOCKETS; keywordMap["activation"] = ICE_GRID_ACTIVATION; keywordMap["object"] = ICE_GRID_OBJECT; keywordMap["find"] = ICE_GRID_FIND; keywordMap["show"] = ICE_GRID_SHOW; keywordMap["copying"] = ICE_GRID_COPYING; keywordMap["warranty"] = ICE_GRID_WARRANTY; keywordMap["diff"] = ICE_GRID_DIFF; keywordMap["update"] = ICE_GRID_UPDATE; keywordMap["instantiate"] = ICE_GRID_INSTANTIATE; keywordMap["template"] = ICE_GRID_TEMPLATE; keywordMap["service"] = ICE_GRID_SERVICE; keywordMap["enable"] = ICE_GRID_ENABLE; keywordMap["disable"] = ICE_GRID_DISABLE; } std::string parseDoubleQuotedString() { string s; while(true) { char c = static_cast(yyinput()); if(c == '"') { break; } else if(c == EOF) { parser->warning("EOF in string"); break; } else if(c == '\\') { char next = static_cast(yyinput()); switch(next) { case '\\': case '"': { s += next; break; } case 'n': { s += '\n'; break; } case 'r': { s += '\r'; break; } case 't': { s += '\t'; break; } case 'v': { s += '\v'; break; } case 'f': { s += '\f'; break; } default: { s += c; unput(next); } } } else { s += c; } } return s; } std::string parseSingleQuotedString() { string s; while(true) { char c = static_cast(yyinput()); if(c == '\'') { break; } else if(c == EOF) { parser->warning("EOF in string"); break; } else { s += c; } } return s; } } Ice-3.5.1/cpp/src/IceGrid/Database.h0000644000076400007640000002215612223561476015134 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_DATABASE_H #define ICE_GRID_DATABASE_H #include #include #include #include #include #include #include #include #include #include #include #include #include namespace IceGrid { class TraceLevels; typedef IceUtil::Handle TraceLevelsPtr; class NodeSessionI; typedef IceUtil::Handle NodeSessionIPtr; class ReplicaSessionI; typedef IceUtil::Handle ReplicaSessionIPtr; class AdminSessionI; class ServerEntry; typedef IceUtil::Handle ServerEntryPtr; class ApplicationHelper; class Database : public IceUtil::Shared, public IceUtil::Monitor { public: #ifdef __SUNPRO_CC using IceUtil::Monitor::lock; using IceUtil::Monitor::unlock; #endif Database(const Ice::ObjectAdapterPtr&, const IceStorm::TopicManagerPrx&, const std::string&, const TraceLevelsPtr&, const RegistryInfo&, const DatabasePluginPtr&, bool); virtual ~Database(); std::string getInstanceName() const; bool isReadOnly() const { return _readonly; } const TraceLevelsPtr& getTraceLevels() const { return _traceLevels; } const Ice::CommunicatorPtr& getCommunicator() const { return _communicator; } const Ice::ObjectAdapterPtr& getInternalAdapter() { return _internalAdapter; } void destroyTopics(); ObserverTopicPtr getObserverTopic(TopicName) const; int lock(AdminSessionI*, const std::string&); void unlock(AdminSessionI*); void syncApplications(const ApplicationInfoSeq&, Ice::Long); void syncAdapters(const AdapterInfoSeq&, Ice::Long); void syncObjects(const ObjectInfoSeq&, Ice::Long); ApplicationInfoSeq getApplications(Ice::Long&) const; AdapterInfoSeq getAdapters(Ice::Long&) const; ObjectInfoSeq getObjects(Ice::Long&) const; StringLongDict getSerials() const; void addApplication(const ApplicationInfo&, AdminSessionI*, Ice::Long = 0); void updateApplication(const ApplicationUpdateInfo&, bool, AdminSessionI*, Ice::Long = 0); void syncApplicationDescriptor(const ApplicationDescriptor&, bool, AdminSessionI*); void instantiateServer(const std::string&, const std::string&, const ServerInstanceDescriptor&, AdminSessionI*); void removeApplication(const std::string&, AdminSessionI*, Ice::Long = 0); ApplicationInfo getApplicationInfo(const std::string&); Ice::StringSeq getAllApplications(const std::string& = std::string()); void waitForApplicationUpdate(const AMD_NodeSession_waitForApplicationUpdatePtr&, const std::string&, int); NodeCache& getNodeCache(); NodeEntryPtr getNode(const std::string&, bool = false) const; ReplicaCache& getReplicaCache(); ReplicaEntryPtr getReplica(const std::string&) const; ServerCache& getServerCache(); ServerEntryPtr getServer(const std::string&) const; AllocatableObjectCache& getAllocatableObjectCache(); AllocatableObjectEntryPtr getAllocatableObject(const Ice::Identity&) const; void setAdapterDirectProxy(const std::string&, const std::string&, const Ice::ObjectPrx&, Ice::Long = 0); Ice::ObjectPrx getAdapterDirectProxy(const std::string&, const Ice::EncodingVersion&); void removeAdapter(const std::string&); AdapterPrx getAdapterProxy(const std::string&, const std::string&, bool); void getLocatorAdapterInfo(const std::string&, LocatorAdapterInfoSeq&, int&, bool&, bool&, const std::set& = std::set()); bool addAdapterSyncCallback(const std::string&, const SynchronizationCallbackPtr&, const std::set& = std::set()); std::vector > getAdapters(const std::string&, int&, bool&); AdapterInfoSeq getAdapterInfo(const std::string&); Ice::StringSeq getAllAdapters(const std::string& = std::string()); void addObject(const ObjectInfo&); void addOrUpdateObject(const ObjectInfo&, Ice::Long = 0); void removeObject(const Ice::Identity&, Ice::Long = 0); void updateObject(const Ice::ObjectPrx&); int addOrUpdateRegistryWellKnownObjects(const ObjectInfoSeq&); int removeRegistryWellKnownObjects(const ObjectInfoSeq&); Ice::ObjectPrx getObjectProxy(const Ice::Identity&); Ice::ObjectPrx getObjectByType(const std::string&); Ice::ObjectPrx getObjectByTypeOnLeastLoadedNode(const std::string&, LoadSample); Ice::ObjectProxySeq getObjectsByType(const std::string&); ObjectInfo getObjectInfo(const Ice::Identity&); ObjectInfoSeq getObjectInfosByType(const std::string&); ObjectInfoSeq getAllObjectInfos(const std::string& = std::string()); void addInternalObject(const ObjectInfo&, bool = false); void removeInternalObject(const Ice::Identity&); Ice::ObjectProxySeq getInternalObjectsByType(const std::string&); private: void checkForAddition(const ApplicationHelper&, const IceDB::DatabaseConnectionPtr&); void checkForUpdate(const ApplicationHelper&, const ApplicationHelper&, const IceDB::DatabaseConnectionPtr&); void checkForRemove(const ApplicationHelper&); void checkServerForAddition(const std::string&); void checkAdapterForAddition(const std::string&, const AdaptersWrapperPtr&); void checkObjectForAddition(const Ice::Identity&, const ObjectsWrapperPtr&); void checkReplicaGroupExists(const std::string&); void checkReplicaGroupForRemove(const std::string&); void load(const ApplicationHelper&, ServerEntrySeq&, const std::string&, int); void unload(const ApplicationHelper&, ServerEntrySeq&); void reload(const ApplicationHelper&, const ApplicationHelper&, ServerEntrySeq&, const std::string&, int, bool); void checkUpdate(const ApplicationHelper&, const ApplicationHelper&, const std::string&, int, bool); Ice::Long saveApplication(const ApplicationInfo&, const IceDB::DatabaseConnectionPtr&, Ice::Long = 0); Ice::Long removeApplication(const std::string&, const IceDB::DatabaseConnectionPtr&, Ice::Long = 0); void finishApplicationUpdate(const ApplicationUpdateInfo&, const ApplicationInfo&, const ApplicationHelper&, const ApplicationHelper&, AdminSessionI*, bool, Ice::Long = 0); void checkSessionLock(AdminSessionI*); void waitForUpdate(const std::string&); void startUpdating(const std::string&, const std::string&, int); void finishUpdating(const std::string&); friend struct AddComponent; static const std::string _applicationDbName; static const std::string _objectDbName; static const std::string _internalObjectDbName; static const std::string _adapterDbName; static const std::string _replicaGroupDbName; const Ice::CommunicatorPtr _communicator; const Ice::ObjectAdapterPtr _internalAdapter; const IceStorm::TopicManagerPrx _topicManager; const std::string _instanceName; const TraceLevelsPtr _traceLevels; const bool _master; const bool _readonly; ReplicaCache _replicaCache; NodeCache _nodeCache; AdapterCache _adapterCache; ObjectCache _objectCache; AllocatableObjectCache _allocatableObjectCache; ServerCache _serverCache; RegistryObserverTopicPtr _registryObserverTopic; NodeObserverTopicPtr _nodeObserverTopic; ApplicationObserverTopicPtr _applicationObserverTopic; AdapterObserverTopicPtr _adapterObserverTopic; ObjectObserverTopicPtr _objectObserverTopic; ConnectionPoolPtr _connectionPool; DatabasePluginPtr _databasePlugin; AdminSessionI* _lock; std::string _lockUserId; struct UpdateInfo { std::string name; std::string uuid; int revision; std::vector cbs; bool updated; UpdateInfo(const std::string& n, const std::string& u, int r) : name(n), uuid(u), revision(r), updated(false) { } bool operator==(const std::string& n) { return name == n; } bool operator==(const std::pair& p) { return uuid == p.first && revision == p.second; } void markUpdated() { updated = true; std::vector::const_iterator q; for(q = cbs.begin(); q != cbs.end(); ++q) { (*q)->ice_response(); } cbs.clear(); } void unmarkUpdated() { updated = false; } }; std::vector _updating; }; typedef IceUtil::Handle DatabasePtr; }; #endif Ice-3.5.1/cpp/src/IceGrid/NodeI.h0000644000076400007640000001567412223561476014435 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_NODE_I_H #define ICE_GRID_NODE_I_H #include #include #include #include #include #include #include namespace IceGrid { class TraceLevels; typedef IceUtil::Handle TraceLevelsPtr; class Activator; typedef IceUtil::Handle ActivatorPtr; class ServerI; typedef IceUtil::Handle ServerIPtr; class ServerCommand; typedef IceUtil::Handle ServerCommandPtr; class NodeSessionManager; class NodeI; typedef IceUtil::Handle NodeIPtr; class NodeI : public Node, public IceUtil::Monitor { public: class Update : virtual public IceUtil::Shared { public: Update(const NodeIPtr&, const NodeObserverPrx&); virtual ~Update(); virtual bool send() = 0; void finished(bool); void completed(const Ice::AsyncResultPtr&); protected: const NodeIPtr _node; const NodeObserverPrx _observer; }; typedef IceUtil::Handle UpdatePtr; NodeI(const Ice::ObjectAdapterPtr&, NodeSessionManager&, const ActivatorPtr&, const IceUtil::TimerPtr&, const TraceLevelsPtr&, const NodePrx&, const std::string&, const UserAccountMapperPrx&); virtual ~NodeI(); virtual void loadServer_async(const AMD_Node_loadServerPtr&, const InternalServerDescriptorPtr&, const std::string&, bool, const Ice::Current&); virtual void loadServer_async(const AMD_Node_loadServerPtr&, const InternalServerDescriptorPtr&, const std::string&, const Ice::Current&); virtual void loadServerWithoutRestart_async(const AMD_Node_loadServerWithoutRestartPtr&, const InternalServerDescriptorPtr&, const std::string&, const Ice::Current&); virtual void destroyServer_async(const AMD_Node_destroyServerPtr&, const std::string&, const std::string&, int, const std::string&, const Ice::Current&); virtual void patch_async(const AMD_Node_patchPtr&, const PatcherFeedbackPrx&, const std::string&, const std::string&, const InternalDistributionDescriptorPtr&, bool, const Ice::Current&); virtual void registerWithReplica(const InternalRegistryPrx&, const Ice::Current&); virtual void replicaInit(const InternalRegistryPrxSeq&, const Ice::Current&); virtual void replicaAdded(const InternalRegistryPrx&, const Ice::Current&); virtual void replicaRemoved(const InternalRegistryPrx&, const Ice::Current&); virtual std::string getName(const Ice::Current& = Ice::Current()) const; virtual std::string getHostname(const Ice::Current& = Ice::Current()) const; virtual LoadInfo getLoad(const Ice::Current& = Ice::Current()) const; virtual int getProcessorSocketCount(const Ice::Current&) const; virtual void shutdown(const Ice::Current&) const; virtual Ice::Long getOffsetFromEnd(const std::string&, int, const Ice::Current&) const; virtual bool read(const std::string&, Ice::Long, int, Ice::Long&, Ice::StringSeq&, const Ice::Current&) const; void shutdown(); IceUtil::TimerPtr getTimer() const; Ice::CommunicatorPtr getCommunicator() const; Ice::ObjectAdapterPtr getAdapter() const; ActivatorPtr getActivator() const; TraceLevelsPtr getTraceLevels() const; UserAccountMapperPrx getUserAccountMapper() const; PlatformInfo& getPlatformInfo() const; FileCachePtr getFileCache() const; NodePrx getProxy() const; const PropertyDescriptorSeq& getPropertiesOverride() const; std::string getOutputDir() const; bool getRedirectErrToOut() const; bool allowEndpointsOverride() const; NodeSessionPrx registerWithRegistry(const InternalRegistryPrx&); void checkConsistency(const NodeSessionPrx&); NodeSessionPrx getMasterNodeSession() const; void addObserver(const NodeSessionPrx&, const NodeObserverPrx&); void removeObserver(const NodeSessionPrx&); void observerUpdateServer(const ServerDynamicInfo&); void observerUpdateAdapter(const AdapterDynamicInfo&); void queueUpdate(const NodeObserverPrx&, const UpdatePtr&); void dequeueUpdate(const NodeObserverPrx&, const UpdatePtr&, bool); void addServer(const ServerIPtr&, const std::string&); void removeServer(const ServerIPtr&, const std::string&); Ice::Identity createServerIdentity(const std::string&) const; std::string getServerAdminCategory() const; bool canRemoveServerDirectory(const std::string&); private: std::vector checkConsistencyNoSync(const Ice::StringSeq&); void patch(const IcePatch2::FileServerPrx&, const std::string&, const std::vector&); std::set getApplicationServers(const std::string&) const; std::string getFilePath(const std::string&) const; const Ice::CommunicatorPtr _communicator; const Ice::ObjectAdapterPtr _adapter; NodeSessionManager& _sessions; const ActivatorPtr _activator; const IceUtil::TimerPtr _timer; const TraceLevelsPtr _traceLevels; const std::string _name; const NodePrx _proxy; const std::string _outputDir; const bool _redirectErrToOut; const bool _allowEndpointsOverride; const Ice::Int _waitTime; const std::string _instanceName; const UserAccountMapperPrx _userAccountMapper; mutable PlatformInfo _platform; const std::string _dataDir; const std::string _serversDir; const std::string _tmpDir; const FileCachePtr _fileCache; PropertyDescriptorSeq _propertiesOverride; unsigned long _serial; bool _consistencyCheckDone; IceUtil::Mutex _observerMutex; std::map _observers; std::map _serversDynamicInfo; std::map _adaptersDynamicInfo; std::map > _observerUpdates; IceUtil::Mutex _serversLock; std::map > _serversByApplication; std::set _patchInProgress; }; typedef IceUtil::Handle NodeIPtr; } #endif Ice-3.5.1/cpp/src/IceGrid/NodeI.cpp0000644000076400007640000011220412223561476014753 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace IcePatch2; using namespace IceGrid; namespace { class LogPatcherFeedback : public IcePatch2::PatcherFeedback { public: LogPatcherFeedback(const TraceLevelsPtr& traceLevels, const string& dest) : _traceLevels(traceLevels), _startedPatch(false), _lastProgress(0), _dest(dest) { } void setPatchingPath(const string& path) { _path = path; _startedPatch = false; _lastProgress = 0; } virtual bool noFileSummary(const string& reason) { if(_traceLevels->patch > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat); out << _dest << ": can't load summary file (will perform a thorough patch):\n" << reason; } return true; } virtual bool checksumStart() { if(_traceLevels->patch > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat); out << _dest << ": started checksum calculation"; } return true; } virtual bool checksumProgress(const string& path) { if(_traceLevels->patch > 2) { Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat); out << _dest << ": calculating checksum for " << getBasename(path); } return true; } virtual bool checksumEnd() { if(_traceLevels->patch > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat); out << _dest << ": finished checksum calculation"; } return true; } virtual bool fileListStart() { if(_traceLevels->patch > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat); out << _dest << ": getting list of file to patch"; } return true; } virtual bool fileListProgress(Ice::Int /*percent*/) { return true; } virtual bool fileListEnd() { if(_traceLevels->patch > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat); out << _dest << ": getting list of file to patch completed"; } return true; } virtual bool patchStart(const string& /*path*/, Ice::Long /*size*/, Ice::Long totalProgress, Ice::Long totalSize) { if(_traceLevels->patch > 1 && totalSize > (1024 * 1024)) { int progress = static_cast(static_cast(totalProgress) / totalSize * 100.0); progress /= 5; progress *= 5; if(progress != _lastProgress) { _lastProgress = progress; Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat); out << _dest << ": downloaded " << progress << "% (" << totalProgress << '/' << totalSize << ')'; if(!_path.empty()) { out << " of " << _path; } } } else if(_traceLevels->patch > 0) { if(!_startedPatch) { Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat); int roundedSize = static_cast(static_cast(totalSize) / 1024); if(roundedSize == 0 && totalSize > 0) { roundedSize = 1; } out << _dest << ": downloading " << (_path.empty() ? string("") : (_path + " ")) << roundedSize << "KB "; _startedPatch = true; } } return true; } virtual bool patchProgress(Ice::Long /*progress*/, Ice::Long /*size*/, Ice::Long /*totalProgress*/, Ice::Long /*totalSize*/) { return true; } virtual bool patchEnd() { return true; } void finishPatch() { if(_traceLevels->patch > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat); out << _dest << ": downloading completed"; } } private: const TraceLevelsPtr _traceLevels; bool _startedPatch; int _lastProgress; string _path; string _dest; }; class NodeUp : public NodeI::Update { public: NodeUp(const NodeIPtr& node, const NodeObserverPrx& observer, NodeDynamicInfo info) : NodeI::Update(node, observer), _info(info) { } virtual bool send() { try { _observer->begin_nodeUp(_info, newCallback(static_cast(this), &NodeI::Update::completed)); } catch(const Ice::LocalException&) { return false; } return true; } private: NodeDynamicInfo _info; }; class UpdateServer : public NodeI::Update { public: UpdateServer(const NodeIPtr& node, const NodeObserverPrx& observer, ServerDynamicInfo info) : NodeI::Update(node, observer), _info(info) { } virtual bool send() { try { _observer->begin_updateServer(_node->getName(), _info, newCallback(static_cast(this), &NodeI::Update::completed)); } catch(const Ice::LocalException&) { return false; } return true; } private: ServerDynamicInfo _info; }; class UpdateAdapter : public NodeI::Update { public: UpdateAdapter(const NodeIPtr& node, const NodeObserverPrx& observer, AdapterDynamicInfo info) : NodeI::Update(node, observer), _info(info) { } virtual bool send() { try { _observer->begin_updateAdapter(_node->getName(), _info, newCallback(static_cast(this), &NodeI::Update::completed)); } catch(const Ice::LocalException&) { return false; } return true; } private: AdapterDynamicInfo _info; }; } NodeI::Update::Update(const NodeIPtr& node, const NodeObserverPrx& observer) : _node(node), _observer(observer) { } NodeI::Update::~Update() { } void NodeI::Update::finished(bool success) { _node->dequeueUpdate(_observer, this, !success); } NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, NodeSessionManager& sessions, const ActivatorPtr& activator, const IceUtil::TimerPtr& timer, const TraceLevelsPtr& traceLevels, const NodePrx& proxy, const string& name, const UserAccountMapperPrx& mapper) : _communicator(adapter->getCommunicator()), _adapter(adapter), _sessions(sessions), _activator(activator), _timer(timer), _traceLevels(traceLevels), _name(name), _proxy(proxy), _redirectErrToOut(false), _allowEndpointsOverride(false), _waitTime(0), _userAccountMapper(mapper), _platform("IceGrid.Node", _communicator, _traceLevels), _fileCache(new FileCache(_communicator)), _serial(1), _consistencyCheckDone(false) { Ice::PropertiesPtr props = _communicator->getProperties(); const_cast(_dataDir) = _platform.getDataDir(); const_cast(_serversDir) = _dataDir + "/servers"; const_cast(_tmpDir) = _dataDir + "/tmp"; const_cast(_instanceName) = _communicator->getDefaultLocator()->ice_getIdentity().category; const_cast(_waitTime) = props->getPropertyAsIntWithDefault("IceGrid.Node.WaitTime", 60); const_cast(_outputDir) = props->getProperty("IceGrid.Node.Output"); const_cast(_redirectErrToOut) = props->getPropertyAsInt("IceGrid.Node.RedirectErrToOut") > 0; const_cast(_allowEndpointsOverride) = props->getPropertyAsInt("IceGrid.Node.AllowEndpointsOverride") > 0; // // Parse the properties override property. // vector overrides = props->getPropertyAsList("IceGrid.Node.PropertiesOverride"); if(!overrides.empty()) { for(vector::iterator p = overrides.begin(); p != overrides.end(); ++p) { if(p->find("--") != 0) { *p = "--" + *p; } } Ice::PropertiesPtr p = Ice::createProperties(); p->parseCommandLineOptions("", overrides); Ice::PropertyDict propDict = p->getPropertiesForPrefix(""); for(Ice::PropertyDict::const_iterator q = propDict.begin(); q != propDict.end(); ++q) { _propertiesOverride.push_back(createProperty(q->first, q->second)); } } } void NodeI::Update::completed(const Ice::AsyncResultPtr& result) { try { result->throwLocalException(); finished(true); } catch(const Ice::LocalException&) { finished(false); } } NodeI::~NodeI() { } void NodeI::loadServer_async(const AMD_Node_loadServerPtr& amdCB, const InternalServerDescriptorPtr& descriptor, const string& replicaName, bool noRestart, const Ice::Current& current) { ServerCommandPtr command; { Lock sync(*this); ++_serial; Ice::Identity id = createServerIdentity(descriptor->id); // // Check if we already have a servant for this server. If that's // the case, the server is already loaded and we just need to // update it. // while(true) { bool added = false; ServerIPtr server; try { server = ServerIPtr::dynamicCast(_adapter->find(id)); if(!server) { ServerPrx proxy = ServerPrx::uncheckedCast(_adapter->createProxy(id)); server = new ServerI(this, proxy, _serversDir, descriptor->id, _waitTime); _adapter->add(server, id); added = true; } } catch(const Ice::ObjectAdapterDeactivatedException&) { // // We throw an object not exist exception to avoid // dispatch warnings. The registry will consider the // node has being unreachable upon receival of this // exception (like any other Ice::LocalException). We // could also have disabled dispatch warnings but they // can still useful to catch other issues. // throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); } try { command = server->load(amdCB, descriptor, replicaName, noRestart); } catch(const Ice::ObjectNotExistException&) { assert(!added); continue; } catch(const Ice::Exception&) { if(added) { try { _adapter->remove(id); } catch(const Ice::ObjectAdapterDeactivatedException&) { // IGNORE } } throw; } break; } } if(command) { command->execute(); } } void NodeI::loadServer_async(const AMD_Node_loadServerPtr& amdCB, const InternalServerDescriptorPtr& descriptor, const string& replicaName, const Ice::Current& current) { loadServer_async(amdCB, descriptor, replicaName, false, current); } void NodeI::loadServerWithoutRestart_async(const AMD_Node_loadServerWithoutRestartPtr& amdCB, const InternalServerDescriptorPtr& descriptor, const string& replicaName, const Ice::Current& current) { class LoadServerCB : public AMD_Node_loadServer { public: LoadServerCB(const AMD_Node_loadServerWithoutRestartPtr& cb) : _cb(cb) { } virtual void ice_response(const ServerPrx& server, const AdapterPrxDict& adapters, Ice::Int actTimeout, Ice::Int deacTimeout) { _cb->ice_response(server, adapters, actTimeout, deacTimeout); }; virtual void ice_exception(const ::std::exception& ex) { _cb->ice_exception(ex); } virtual void ice_exception() { _cb->ice_exception(); } private: const AMD_Node_loadServerWithoutRestartPtr _cb; }; loadServer_async(new LoadServerCB(amdCB), descriptor, replicaName, true, current); } void NodeI::destroyServer_async(const AMD_Node_destroyServerPtr& amdCB, const string& serverId, const string& uuid, int revision, const string& replicaName, const Ice::Current& current) { ServerCommandPtr command; { Lock sync(*this); ++_serial; ServerIPtr server; try { server = ServerIPtr::dynamicCast(_adapter->find(createServerIdentity(serverId))); } catch(const Ice::ObjectAdapterDeactivatedException&) { // // We throw an object not exist exception to avoid // dispatch warnings. The registry will consider the node // has being unreachable upon receival of this exception // (like any other Ice::LocalException). We could also // have disabled dispatch warnings but they can still // useful to catch other issues. // throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); } if(!server) { server = new ServerI(this, 0, _serversDir, serverId, _waitTime); } // // Destroy the server object if it's loaded. // try { command = server->destroy(amdCB, uuid, revision, replicaName); } catch(const Ice::ObjectNotExistException&) { amdCB->ice_response(); return; } } if(command) { command->execute(); } } void NodeI::patch_async(const AMD_Node_patchPtr& amdCB, const PatcherFeedbackPrx& feedback, const string& application, const string& server, const InternalDistributionDescriptorPtr& appDistrib, bool shutdown, const Ice::Current&) { amdCB->ice_response(); { Lock sync(*this); while(_patchInProgress.find(application) != _patchInProgress.end()) { wait(); } _patchInProgress.insert(application); } set servers; bool patchApplication = !appDistrib->icepatch.empty(); if(server.empty()) { // // Patch all the servers from the application. // servers = getApplicationServers(application); } else { ServerIPtr svr; try { svr = ServerIPtr::dynamicCast(_adapter->find(createServerIdentity(server))); } catch(const Ice::ObjectAdapterDeactivatedException&) { } if(svr) { if(appDistrib->icepatch.empty() || !svr->dependsOnApplicationDistrib()) { // // Don't patch the application if the server doesn't // depend on it. // patchApplication = false; servers.insert(svr); } else { // // If the server to patch depends on the application, // we need to shutdown all the application servers // that depend on the application. // servers = getApplicationServers(application); } } } set::iterator s = servers.begin(); while(s != servers.end()) { if(!appDistrib->icepatch.empty() && (*s)->dependsOnApplicationDistrib()) { ++s; } else if((*s)->getDistribution() && (server.empty() || server == (*s)->getId())) { ++s; } else { // // Exclude servers which don't depend on the application distribution // or don't have a distribution. // servers.erase(s++); } } string failure; if(!servers.empty()) { try { vector running; for(set::iterator s = servers.begin(); s != servers.end();) { try { if(!(*s)->startPatch(shutdown)) { running.push_back((*s)->getId()); servers.erase(s++); } else { ++s; } } catch(const Ice::ObjectNotExistException&) { servers.erase(s++); } } if(!running.empty()) { if(running.size() == 1) { throw "server `" + toString(running) + "' is active"; } else { throw "servers `" + toString(running, ", ") + "' are active"; } } for(set::iterator s = servers.begin(); s != servers.end(); ++s) { (*s)->waitForPatch(); } // // Patch the application. // FileServerPrx icepatch; if(patchApplication) { assert(!appDistrib->icepatch.empty()); icepatch = FileServerPrx::checkedCast(_communicator->stringToProxy(appDistrib->icepatch)); if(!icepatch) { throw "proxy `" + appDistrib->icepatch + "' is not a file server."; } patch(icepatch, "distrib/" + application, appDistrib->directories); } // // Patch the server(s). // for(set::iterator s = servers.begin(); s != servers.end(); ++s) { InternalDistributionDescriptorPtr dist = (*s)->getDistribution(); if(dist && (server.empty() || (*s)->getId() == server)) { icepatch = FileServerPrx::checkedCast(_communicator->stringToProxy(dist->icepatch)); if(!icepatch) { throw "proxy `" + dist->icepatch + "' is not a file server."; } patch(icepatch, "servers/" + (*s)->getId() + "/distrib", dist->directories); if(!server.empty()) { break; // No need to continue. } } } } catch(const Ice::LocalException& e) { ostringstream os; os << e; failure = os.str(); } catch(const string& e) { failure = e; } catch(const char* e) { failure = e; } for(set::const_iterator s = servers.begin(); s != servers.end(); ++s) { (*s)->finishPatch(); } } { Lock sync(*this); _patchInProgress.erase(application); notifyAll(); } try { if(failure.empty()) { feedback->finished(); } else { feedback->failed(failure); } } catch(const Ice::LocalException&) { } } void NodeI::registerWithReplica(const InternalRegistryPrx& replica, const Ice::Current&) { _sessions.create(replica); } void NodeI::replicaInit(const InternalRegistryPrxSeq& replicas, const Ice::Current&) { _sessions.replicaInit(replicas); } void NodeI::replicaAdded(const InternalRegistryPrx& replica, const Ice::Current&) { _sessions.replicaAdded(replica); } void NodeI::replicaRemoved(const InternalRegistryPrx& replica, const Ice::Current&) { _sessions.replicaRemoved(replica); } std::string NodeI::getName(const Ice::Current&) const { return _name; } std::string NodeI::getHostname(const Ice::Current&) const { return _platform.getHostname(); } LoadInfo NodeI::getLoad(const Ice::Current&) const { return _platform.getLoadInfo(); } int NodeI::getProcessorSocketCount(const Ice::Current&) const { return _platform.getProcessorSocketCount(); } void NodeI::shutdown(const Ice::Current&) const { _activator->shutdown(); } Ice::Long NodeI::getOffsetFromEnd(const string& filename, int count, const Ice::Current&) const { return _fileCache->getOffsetFromEnd(getFilePath(filename), count); } bool NodeI::read(const string& filename, Ice::Long pos, int size, Ice::Long& newPos, Ice::StringSeq& lines, const Ice::Current&) const { return _fileCache->read(getFilePath(filename), pos, size, newPos, lines); } void NodeI::shutdown() { IceUtil::Mutex::Lock sync(_serversLock); for(map >::const_iterator p = _serversByApplication.begin(); p != _serversByApplication.end(); ++p) { for(set::const_iterator q = p->second.begin(); q != p->second.end(); ++q) { (*q)->shutdown(); } } _serversByApplication.clear(); } Ice::CommunicatorPtr NodeI::getCommunicator() const { return _communicator; } Ice::ObjectAdapterPtr NodeI::getAdapter() const { return _adapter; } ActivatorPtr NodeI::getActivator() const { return _activator; } IceUtil::TimerPtr NodeI::getTimer() const { return _timer; } TraceLevelsPtr NodeI::getTraceLevels() const { return _traceLevels; } UserAccountMapperPrx NodeI::getUserAccountMapper() const { return _userAccountMapper; } PlatformInfo& NodeI::getPlatformInfo() const { return _platform; } FileCachePtr NodeI::getFileCache() const { return _fileCache; } NodePrx NodeI::getProxy() const { return _proxy; } const PropertyDescriptorSeq& NodeI::getPropertiesOverride() const { return _propertiesOverride; } string NodeI::getOutputDir() const { return _outputDir; } bool NodeI::getRedirectErrToOut() const { return _redirectErrToOut; } bool NodeI::allowEndpointsOverride() const { return _allowEndpointsOverride; } NodeSessionPrx NodeI::registerWithRegistry(const InternalRegistryPrx& registry) { return registry->registerNode(_platform.getInternalNodeInfo(), _proxy, _platform.getLoadInfo()); } void NodeI::checkConsistency(const NodeSessionPrx& session) { // // Only do the consistency check on the startup. This ensures that servers can't // be removed by a bogus master when the master session is re-established. // if(_consistencyCheckDone) { return; } _consistencyCheckDone = true; // // We use a serial number to keep track of the concurrent changes // on the node. When a server is loaded/destroyed the serial is // incremented. This allows to ensure that the list of servers // returned by the registry is consistent with the servers // currently deployed on the node: if the serial didn't change // after getting the list of servers from the registry, we have // the accurate list of servers that should be deployed on the // node. // unsigned long serial = 0; Ice::StringSeq servers; vector commands; while(true) { { Lock sync(*this); if(serial == _serial) { _serial = 1; // We can reset the serial number. commands = checkConsistencyNoSync(servers); break; } serial = _serial; } assert(session); try { servers = session->getServers(); } catch(const Ice::LocalException&) { return; // The connection with the session was lost. } sort(servers.begin(), servers.end()); } for_each(commands.begin(), commands.end(), IceUtil::voidMemFun(&ServerCommand::execute)); } void NodeI::addObserver(const NodeSessionPrx& session, const NodeObserverPrx& observer) { IceUtil::Mutex::Lock sync(_observerMutex); assert(_observers.find(session) == _observers.end()); _observers.insert(make_pair(session, observer)); _observerUpdates.erase(observer); // Remove any updates from the previous session. ServerDynamicInfoSeq serverInfos; AdapterDynamicInfoSeq adapterInfos; for(map::const_iterator p = _serversDynamicInfo.begin(); p != _serversDynamicInfo.end(); ++p) { assert(p->second.state != Destroyed && (p->second.state != Inactive || !p->second.enabled)); serverInfos.push_back(p->second); } for(map::const_iterator q = _adaptersDynamicInfo.begin(); q != _adaptersDynamicInfo.end(); ++q) { assert(q->second.proxy); adapterInfos.push_back(q->second); } NodeDynamicInfo info; info.info = _platform.getNodeInfo(); info.servers = serverInfos; info.adapters = adapterInfos; queueUpdate(observer, new NodeUp(this, observer, info)); } void NodeI::removeObserver(const NodeSessionPrx& session) { IceUtil::Mutex::Lock sync(_observerMutex); _observers.erase(session); } void NodeI::observerUpdateServer(const ServerDynamicInfo& info) { IceUtil::Mutex::Lock sync(_observerMutex); if(info.state == Destroyed || (info.state == Inactive && info.enabled)) { _serversDynamicInfo.erase(info.id); } else { _serversDynamicInfo[info.id] = info; } // // Send the update and make sure we don't send the update twice to // the same observer (it's possible for the observer to be // registered twice if a replica is removed and added right away // after). // set sent; for(map::const_iterator p = _observers.begin(); p != _observers.end(); ++p) { if(sent.find(p->second) == sent.end()) { queueUpdate(p->second, new UpdateServer(this, p->second, info)); } } } void NodeI::observerUpdateAdapter(const AdapterDynamicInfo& info) { IceUtil::Mutex::Lock sync(_observerMutex); if(info.proxy) { _adaptersDynamicInfo[info.id] = info; } else { _adaptersDynamicInfo.erase(info.id); } // // Send the update and make sure we don't send the update twice to // the same observer (it's possible for the observer to be // registered twice if a replica is removed and added right away // after). // set sent; for(map::const_iterator p = _observers.begin(); p != _observers.end(); ++p) { if(sent.find(p->second) == sent.end()) { queueUpdate(p->second, new UpdateAdapter(this, p->second, info)); } } } void NodeI::queueUpdate(const NodeObserverPrx& proxy, const UpdatePtr& update) { //Lock sync(*this); Called within the synchronization map >::iterator p = _observerUpdates.find(proxy); if(p == _observerUpdates.end()) { if(update->send()) { _observerUpdates[proxy].push_back(update); } } else { p->second.push_back(update); } } void NodeI::dequeueUpdate(const NodeObserverPrx& proxy, const UpdatePtr& update, bool all) { IceUtil::Mutex::Lock sync(_observerMutex); map >::iterator p = _observerUpdates.find(proxy); if(p == _observerUpdates.end() || p->second.front().get() != update.get()) { return; } p->second.pop_front(); if(all || (!p->second.empty() && !p->second.front()->send())) { p->second.clear(); } if(p->second.empty()) { _observerUpdates.erase(p); } } void NodeI::addServer(const ServerIPtr& server, const string& application) { IceUtil::Mutex::Lock sync(_serversLock); map >::iterator p = _serversByApplication.find(application); if(p == _serversByApplication.end()) { map >::value_type v(application, set()); p = _serversByApplication.insert(p, v); } p->second.insert(server); } void NodeI::removeServer(const ServerIPtr& server, const std::string& application) { IceUtil::Mutex::Lock sync(_serversLock); map >::iterator p = _serversByApplication.find(application); if(p != _serversByApplication.end()) { p->second.erase(server); if(p->second.empty()) { _serversByApplication.erase(p); string appDir = _dataDir + "/distrib/" + application; if(IceUtilInternal::directoryExists(appDir)) { try { IcePatch2::removeRecursive(appDir); } catch(const string& msg) { Ice::Warning out(_traceLevels->logger); out << "removing application directory `" << appDir << "' failed:\n" << msg; } } } } } Ice::Identity NodeI::createServerIdentity(const string& name) const { Ice::Identity id; id.category = _instanceName + "-Server"; id.name = name; return id; } string NodeI::getServerAdminCategory() const { return _instanceName + "-NodeRouter"; } vector NodeI::checkConsistencyNoSync(const Ice::StringSeq& servers) { vector commands; // // Check if the servers directory doesn't contain more servers // than the registry really knows. // Ice::StringSeq contents; try { contents = readDirectory(_serversDir); } catch(const string& msg) { Ice::Error out(_traceLevels->logger); out << "couldn't read directory `" << _serversDir << "':\n" << msg; return commands; } vector remove; set_difference(contents.begin(), contents.end(), servers.begin(), servers.end(), back_inserter(remove)); // // Remove the extra servers if possible. // try { vector::iterator p = remove.begin(); while(p != remove.end()) { ServerIPtr server = ServerIPtr::dynamicCast(_adapter->find(createServerIdentity(*p))); if(server) { // // If the server is loaded, we invoke on it to destroy it. // try { ServerCommandPtr command = server->destroy(0, "", 0, "Master"); if(command) { commands.push_back(command); } p = remove.erase(p); continue; } catch(const Ice::LocalException& ex) { Ice::Error out(_traceLevels->logger); out << "server `" << *p << "' destroy failed:\n" << ex; } catch(const string&) { assert(false); } } try { if(canRemoveServerDirectory(*p)) { // // If the server directory can be removed and we // either remove it or back it up before to remove it. // removeRecursive(_serversDir + "/" + *p); p = remove.erase(p); continue; } } catch(const string& msg) { Ice::Warning out(_traceLevels->logger); out << "removing server directory `" << _serversDir << "/" << *p << "' failed:\n" << msg; } *p = _serversDir + "/" + *p; ++p; } } catch(const Ice::ObjectAdapterDeactivatedException&) { // // Just return the server commands, we'll finish the // consistency check next time the node is started. // return commands; } if(!remove.empty()) { Ice::Warning out(_traceLevels->logger); out << "server directories containing data not created or written by IceGrid were not removed:\n"; out << toString(remove); } return commands; } NodeSessionPrx NodeI::getMasterNodeSession() const { return _sessions.getMasterNodeSession(); } bool NodeI::canRemoveServerDirectory(const string& name) { // // Check if there's files which we didn't create. // Ice::StringSeq c = readDirectory(_serversDir + "/" + name); set contents(c.begin(), c.end()); contents.erase("dbs"); contents.erase("config"); contents.erase("distrib"); contents.erase("revision"); if(!contents.empty()) { return false; } c = readDirectory(_serversDir + "/" + name + "/config"); for(Ice::StringSeq::const_iterator p = c.begin() ; p != c.end(); ++p) { if(p->find("config") != 0) { return false; } } c = readDirectory(_serversDir + "/" + name + "/dbs"); for(Ice::StringSeq::const_iterator p = c.begin() ; p != c.end(); ++p) { try { Ice::StringSeq files = readDirectory(_serversDir + "/" + name + "/dbs/" + *p); files.erase(remove(files.begin(), files.end(), "DB_CONFIG"), files.end()); files.erase(remove(files.begin(), files.end(), "__Freeze"), files.end()); if(!files.empty()) { return false; } } catch(const string&) { return false; } } return true; } void NodeI::patch(const FileServerPrx& icepatch, const string& dest, const vector& directories) { IcePatch2::PatcherFeedbackPtr feedback = new LogPatcherFeedback(_traceLevels, dest); IcePatch2::createDirectory(_dataDir + "/" + dest); PatcherPtr patcher = new Patcher(icepatch, feedback, _dataDir + "/" + dest, false, 100, 1); bool aborted = !patcher->prepare(); if(!aborted) { if(directories.empty()) { aborted = !patcher->patch(""); dynamic_cast(feedback.get())->finishPatch(); } else { for(vector::const_iterator p = directories.begin(); p != directories.end(); ++p) { dynamic_cast(feedback.get())->setPatchingPath(*p); if(!patcher->patch(*p)) { aborted = true; break; } dynamic_cast(feedback.get())->finishPatch(); } } } if(!aborted) { patcher->finish(); } // // Update the files owner/group // } set NodeI::getApplicationServers(const string& application) const { IceUtil::Mutex::Lock sync(_serversLock); set servers; map >::const_iterator p = _serversByApplication.find(application); if(p != _serversByApplication.end()) { servers = p->second; } return servers; } string NodeI::getFilePath(const string& filename) const { string file; if(filename == "stderr") { file = _communicator->getProperties()->getProperty("Ice.StdErr"); if(file.empty()) { throw FileNotAvailableException("Ice.StdErr configuration property is not set"); } } else if(filename == "stdout") { file = _communicator->getProperties()->getProperty("Ice.StdOut"); if(file.empty()) { throw FileNotAvailableException("Ice.StdOut configuration property is not set"); } } else { throw FileNotAvailableException("unknown file"); } return file; } Ice-3.5.1/cpp/src/IceGrid/DescriptorBuilder.h0000644000076400007640000002420012223561476017045 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_DESCRIPTOR_BUILDER_H #define ICE_GRID_DESCRIPTOR_BUILDER_H #include #include #include #include #ifdef __SUNPRO_CC // // We hide some init functions on purpose in classes below // # pragma error_messages(off,hidef) #endif namespace IceGrid { class XmlAttributesHelper { public: XmlAttributesHelper(const IceXML::Attributes&, const Ice::LoggerPtr&, const std::string&, int); void checkUnknownAttributes(); bool contains(const std::string&) const; std::map asMap() const; bool asBool(const std::string&) const; bool asBool(const std::string&, bool) const; std::string operator()(const std::string&) const; std::string operator()(const std::string&, const std::string&) const; private: const IceXML::Attributes& _attributes; const Ice::LoggerPtr _logger; const std::string _filename; const int _line; mutable std::set _used; }; class PropertySetDescriptorBuilder; class DescriptorBuilder { public: virtual ~DescriptorBuilder() { } virtual void addVariable(const XmlAttributesHelper&); }; class PropertySetDescriptorBuilder : DescriptorBuilder { public: PropertySetDescriptorBuilder(); void setId(const std::string&); void setService(const std::string&); const std::string& getId() const; const std::string& getService() const; const PropertySetDescriptor& getDescriptor() const; void addProperty(const XmlAttributesHelper&); void addPropertySet(const XmlAttributesHelper&); bool finish(); private: std::string _id; std::string _service; PropertySetDescriptor _descriptor; bool _inPropertySetRef; }; class NodeDescriptorBuilder; class TemplateDescriptorBuilder; class ApplicationDescriptorBuilder : public DescriptorBuilder { public: ApplicationDescriptorBuilder(const Ice::CommunicatorPtr&, const XmlAttributesHelper&, const std::map&); ApplicationDescriptorBuilder(const Ice::CommunicatorPtr&, const ApplicationDescriptor&, const XmlAttributesHelper&, const std::map&); const ApplicationDescriptor& getDescriptor() const; void setVariableOverrides(const std::map&); void setDescription(const std::string&); void addReplicaGroup(const XmlAttributesHelper&); void finishReplicaGroup(); void setLoadBalancing(const XmlAttributesHelper&); void setReplicaGroupDescription(const std::string&); void addObject(const XmlAttributesHelper&); virtual void addVariable(const XmlAttributesHelper&); virtual NodeDescriptorBuilder* createNode(const XmlAttributesHelper&); virtual TemplateDescriptorBuilder* createServerTemplate(const XmlAttributesHelper&); virtual TemplateDescriptorBuilder* createServiceTemplate(const XmlAttributesHelper&); virtual PropertySetDescriptorBuilder* createPropertySet(const XmlAttributesHelper&) const; void addNode(const std::string&, const NodeDescriptor&); void addServerTemplate(const std::string&, const TemplateDescriptor&); void addServiceTemplate(const std::string&, const TemplateDescriptor&); void addPropertySet(const std::string&, const PropertySetDescriptor&); void addDistribution(const XmlAttributesHelper&); void addDistributionDirectory(const std::string&); bool isOverride(const std::string&); const Ice::CommunicatorPtr& getCommunicator() const { return _communicator; } private: Ice::CommunicatorPtr _communicator; ApplicationDescriptor _descriptor; std::map _overrides; }; class ServerDescriptorBuilder; class IceBoxDescriptorBuilder; class ServerInstanceDescriptorBuilder : public DescriptorBuilder { public: ServerInstanceDescriptorBuilder(const XmlAttributesHelper&); const ServerInstanceDescriptor& getDescriptor() const { return _descriptor; } virtual PropertySetDescriptorBuilder* createPropertySet(const XmlAttributesHelper& attrs) const; virtual void addPropertySet(const std::string&, const PropertySetDescriptor&); private: ServerInstanceDescriptor _descriptor; }; class NodeDescriptorBuilder : public DescriptorBuilder { public: NodeDescriptorBuilder(ApplicationDescriptorBuilder&, const XmlAttributesHelper&); NodeDescriptorBuilder(ApplicationDescriptorBuilder&, const NodeDescriptor&, const XmlAttributesHelper&); virtual ServerDescriptorBuilder* createServer(const XmlAttributesHelper&); virtual ServerDescriptorBuilder* createIceBox(const XmlAttributesHelper&); virtual ServerInstanceDescriptorBuilder* createServerInstance(const XmlAttributesHelper&); virtual PropertySetDescriptorBuilder* createPropertySet(const XmlAttributesHelper&) const; void addVariable(const XmlAttributesHelper&); void addServer(const ServerDescriptorPtr&); void addServerInstance(const ServerInstanceDescriptor&); void addPropertySet(const std::string&, const PropertySetDescriptor&); void setDescription(const std::string&); const std::string& getName() const { return _name; } const NodeDescriptor& getDescriptor() const { return _descriptor; } private: ApplicationDescriptorBuilder& _application; std::string _name; NodeDescriptor _descriptor; }; class ServiceDescriptorBuilder; class TemplateDescriptorBuilder : public DescriptorBuilder { public: TemplateDescriptorBuilder(ApplicationDescriptorBuilder&, const XmlAttributesHelper&, bool); virtual ServerDescriptorBuilder* createServer(const XmlAttributesHelper&); virtual ServerDescriptorBuilder* createIceBox(const XmlAttributesHelper&); virtual ServiceDescriptorBuilder* createService(const XmlAttributesHelper&); void addParameter(const XmlAttributesHelper&); void setDescriptor(const CommunicatorDescriptorPtr&); const std::string& getId() const { return _id; } const TemplateDescriptor& getDescriptor() const { return _descriptor; } protected: ApplicationDescriptorBuilder& _application; const bool _serviceTemplate; const std::string _id; TemplateDescriptor _descriptor; }; class CommunicatorDescriptorBuilder : public DescriptorBuilder { public: CommunicatorDescriptorBuilder(const Ice::CommunicatorPtr&); void init(const CommunicatorDescriptorPtr&, const XmlAttributesHelper&); virtual void finish(); virtual void setDescription(const std::string&); virtual void addProperty(const XmlAttributesHelper&); virtual void addPropertySet(const PropertySetDescriptor&); virtual void addAdapter(const XmlAttributesHelper&); virtual void setAdapterDescription(const std::string&); virtual void addObject(const XmlAttributesHelper&); virtual void addAllocatable(const XmlAttributesHelper&); virtual void addDbEnv(const XmlAttributesHelper&); virtual void addDbEnvProperty(const XmlAttributesHelper&); virtual void setDbEnvDescription(const std::string&); virtual void addLog(const XmlAttributesHelper&); virtual PropertySetDescriptorBuilder* createPropertySet() const; protected: void addProperty(PropertyDescriptorSeq&, const std::string&, const std::string&); PropertyDescriptorSeq _hiddenProperties; Ice::CommunicatorPtr _communicator; private: CommunicatorDescriptorPtr _descriptor; }; class ServiceInstanceDescriptorBuilder : public DescriptorBuilder { public: ServiceInstanceDescriptorBuilder(const XmlAttributesHelper&); const ServiceInstanceDescriptor& getDescriptor() const { return _descriptor; } virtual PropertySetDescriptorBuilder* createPropertySet() const; virtual void addPropertySet(const PropertySetDescriptor&); private: ServiceInstanceDescriptor _descriptor; }; class ServerDescriptorBuilder : public CommunicatorDescriptorBuilder { public: ServerDescriptorBuilder(const Ice::CommunicatorPtr&, const XmlAttributesHelper&); ServerDescriptorBuilder(const Ice::CommunicatorPtr&); void init(const ServerDescriptorPtr&, const XmlAttributesHelper&); virtual ServiceDescriptorBuilder* createService(const XmlAttributesHelper&); virtual ServiceInstanceDescriptorBuilder* createServiceInstance(const XmlAttributesHelper&); virtual void addOption(const std::string&); virtual void addEnv(const std::string&); virtual void addService(const ServiceDescriptorPtr&); virtual void addServiceInstance(const ServiceInstanceDescriptor&); virtual void addDistribution(const XmlAttributesHelper&); virtual void addDistributionDirectory(const std::string&); const ServerDescriptorPtr& getDescriptor() const { return _descriptor; } private: ServerDescriptorPtr _descriptor; }; class IceBoxDescriptorBuilder : public ServerDescriptorBuilder { public: IceBoxDescriptorBuilder(const Ice::CommunicatorPtr&, const XmlAttributesHelper&); void init(const IceBoxDescriptorPtr&, const XmlAttributesHelper&); virtual ServiceDescriptorBuilder* createService(const XmlAttributesHelper&); virtual ServiceInstanceDescriptorBuilder* createServiceInstance(const XmlAttributesHelper&); virtual void addAdapter(const XmlAttributesHelper&); virtual void addDbEnv(const XmlAttributesHelper&); virtual void addServiceInstance(const ServiceInstanceDescriptor&); virtual void addService(const ServiceDescriptorPtr&); private: IceBoxDescriptorPtr _descriptor; }; class ServiceDescriptorBuilder : public CommunicatorDescriptorBuilder { public: ServiceDescriptorBuilder(const Ice::CommunicatorPtr&, const XmlAttributesHelper&); void init(const ServiceDescriptorPtr&, const XmlAttributesHelper&); const ServiceDescriptorPtr& getDescriptor() const { return _descriptor; } private: ServiceDescriptorPtr _descriptor; }; } #ifdef __SUNPRO_CC # pragma error_messages(default,hidef) #endif #endif Ice-3.5.1/cpp/src/IceGrid/FileCache.h0000644000076400007640000000153112223561476015225 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_FILE_CACHE_H #define ICE_GRID_FILE_CACHE_H #include #include #include namespace IceGrid { class FileCache : public IceUtil::Shared { public: FileCache(const Ice::CommunicatorPtr&); Ice::Long getOffsetFromEnd(const std::string&, int); bool read(const std::string&, Ice::Long, int, Ice::Long&, Ice::StringSeq&); private: const int _messageSizeMax; }; typedef IceUtil::Handle FileCachePtr; }; #endif Ice-3.5.1/cpp/src/IceGrid/LocatorRegistryI.h0000644000076400007640000000425312223561476016673 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_LOCATOR_REGISTRY_I_H #define ICE_GRID_LOCATOR_REGISTRY_I_H #include #include #include namespace IceGrid { class Database; typedef IceUtil::Handle DatabasePtr; class TraceLevels; typedef IceUtil::Handle TraceLevelsPtr; class ReplicaSessionManager; class LocatorRegistryI : public Ice::LocatorRegistry { public: class AdapterSetDirectProxyCB : virtual public IceUtil::Shared { public: virtual void response() = 0; virtual void exception(const ::Ice::Exception&) = 0; }; typedef IceUtil::Handle AdapterSetDirectProxyCBPtr; LocatorRegistryI(const DatabasePtr&, bool, bool, ReplicaSessionManager&); 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&); void setAdapterDirectProxy(const AdapterSetDirectProxyCBPtr&, const std::string&, const std::string&, const Ice::ObjectPrx&); const TraceLevelsPtr& getTraceLevels() const; private: const DatabasePtr _database; const bool _dynamicRegistration; const bool _master; ReplicaSessionManager& _session; }; typedef IceUtil::Handle LocatorRegistryIPtr; } #endif Ice-3.5.1/cpp/src/IceGrid/SessionManager.h0000644000076400007640000002103412223561476016340 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_SESSION_MANAGER_H #define ICE_GRID_SESSION_MANAGER_H #include #include #include #include #include #include namespace IceGrid { template class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor { enum State { Disconnected, Connected, InProgress, Destroyed }; enum Action { Connect, Disconnect, KeepAlive, None }; public: SessionKeepAliveThread(const InternalRegistryPrx& registry, const Ice::LoggerPtr& logger) : IceUtil::Thread("IceGrid session keepalive thread"), _registry(registry), _logger(logger), _state(InProgress), _nextAction(None) { } virtual void run() { TPrx session; InternalRegistryPrx registry; IceUtil::Time timeout = IceUtil::Time::seconds(10); Action action = Connect; try { while(true) { { Lock sync(*this); if(_state == Destroyed) { break; } // // Update the current state. // assert(_state == InProgress); _state = session ? Connected : Disconnected; _session = session; if(_session) { _registry = registry; } if(_nextAction == Connect && _state == Connected) { _nextAction = KeepAlive; } else if(_nextAction == Disconnect && _state == Disconnected) { _nextAction = None; } else if(_nextAction == KeepAlive && _state == Disconnected) { _nextAction = Connect; } notifyAll(); // // Wait if there's nothing to do and if we are // connected or if we've just tried to connect. // if(_nextAction == None) { if(_state == Connected || action == Connect || action == KeepAlive) { IceUtil::Time now = IceUtil::Time::now(IceUtil::Time::Monotonic); IceUtil::Time wakeTime = now + timeout; while(_state != Destroyed && _nextAction == None && wakeTime > now) { timedWait(wakeTime - now); now = IceUtil::Time::now(IceUtil::Time::Monotonic); } } if(_nextAction == None) { _nextAction = session ? KeepAlive : Connect; } } if(_state == Destroyed) { break; } assert(_nextAction != None); action = _nextAction; registry = InternalRegistryPrx::uncheckedCast( _registry->ice_timeout(static_cast(timeout.toMilliSeconds()))); _nextAction = None; _state = InProgress; notifyAll(); } switch(action) { case Connect: assert(!session); session = createSession(registry, timeout); break; case Disconnect: assert(session); destroySession(session); session = 0; break; case KeepAlive: assert(session); if(!keepAlive(session)) { session = createSession(registry, timeout); } break; case None: default: assert(false); } } // // Destroy the session. // if(_nextAction == Disconnect && session) { destroySession(session); } } catch(const std::exception& ex) { Ice::Error out(_logger); out << "unknown exception in session manager keep alive thread:\n" << ex.what(); throw; } catch(...) { Ice::Error out(_logger); out << "unknown exception in session manager keep alive thread"; throw; } } virtual bool waitForCreate() { Lock sync(*this); while(_state != Destroyed && _state != Connected) { wait(); } return _state != Destroyed; } virtual void tryCreateSession(bool waitForTry = true, const IceUtil::Time& timeout = IceUtil::Time()) { { Lock sync(*this); if(_state == Destroyed) { return; } if(_state == Connected) { _nextAction = KeepAlive; } else { _nextAction = Connect; } notifyAll(); } if(waitForTry) { Lock sync(*this); // Wait until the action is executed and the state changes. while(_nextAction == Connect || _nextAction == KeepAlive || _state == InProgress) { if(timeout == IceUtil::Time()) { wait(); } else { if(!timedWait(timeout)) { break; } } } } } void destroyActiveSession() { Lock sync(*this); if(_state == Destroyed || _state == Disconnected) { return; } _nextAction = Disconnect; notifyAll(); } bool terminateIfDisconnected() { Lock sync(*this); if(_state != Disconnected) { return false; // Nothing we can do for now. } assert(_state != Destroyed); _state = Destroyed; _nextAction = None; notifyAll(); return true; } void terminate(bool destroySession = true) { Lock sync(*this); if(_state == Destroyed) { return; } assert(_state != Destroyed); _state = Destroyed; _nextAction = destroySession ? Disconnect : None; notifyAll(); } bool isDestroyed() { Lock sync(*this); return _state == Destroyed; } TPrx getSession() { Lock sync(*this); return _session; } void setRegistry(const InternalRegistryPrx& registry) { Lock sync(*this); _registry = registry; } InternalRegistryPrx getRegistry() const { Lock sync(*this); return _registry; } virtual TPrx createSession(InternalRegistryPrx&, IceUtil::Time&) = 0; virtual void destroySession(const TPrx&) = 0; virtual bool keepAlive(const TPrx&) = 0; protected: InternalRegistryPrx _registry; Ice::LoggerPtr _logger; TPrx _session; State _state; Action _nextAction; }; class SessionManager : public IceUtil::Monitor { public: SessionManager(const Ice::CommunicatorPtr&); virtual ~SessionManager(); virtual bool isDestroyed() = 0; protected: std::vector findAllQueryObjects(); Ice::CommunicatorPtr _communicator; InternalRegistryPrx _master; std::vector _queryObjects; }; }; #endif Ice-3.5.1/cpp/src/IceGrid/NodeServerAdminRouter.cpp0000644000076400007640000000451012223561476020203 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace IceGrid; using namespace Ice; using namespace std; namespace { class InvokeAMICallback : public AMI_Array_Object_ice_invoke { public: InvokeAMICallback(const AMD_Object_ice_invokePtr& cb) : _cb(cb) { } virtual void ice_response(bool ok, const pair& outParams) { _cb->ice_response(ok, outParams); } virtual void ice_exception(const Ice::Exception&) { _cb->ice_exception(ObjectNotExistException(__FILE__, __LINE__)); // Server admin object is unreachable } private: AMD_Object_ice_invokePtr _cb; }; } IceGrid::NodeServerAdminRouter::NodeServerAdminRouter(const NodeIPtr& node) : _node(node) { } void IceGrid::NodeServerAdminRouter::ice_invoke_async(const AMD_Object_ice_invokePtr& cb, const pair& inParams, const Current& current) { // // First, get the ServerI servant // Identity serverId = _node->createServerIdentity(current.id.name); ServerIPtr server = ServerIPtr::dynamicCast(_node->getAdapter()->find(serverId)); if(server == 0) { throw ObjectNotExistException(__FILE__, __LINE__); } // // Then get a proxy to the Process facet of the real admin object // ObjectPrx target = server->getProcess(); if(target == 0) { throw ObjectNotExistException(__FILE__, __LINE__); } // // If this is a legacy Process proxy with no facet, we keep target as is // if(current.facet != "Process") { // // Set the facet // target = target->ice_facet(current.facet); } // // Call with AMI // target->ice_invoke_async(new InvokeAMICallback(cb), current.operation, current.mode, inParams, current.ctx); } Ice-3.5.1/cpp/src/IceGrid/SessionManager.cpp0000644000076400007640000000662312223561476016702 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; using namespace IceGrid; SessionManager::SessionManager(const Ice::CommunicatorPtr& communicator) : _communicator(communicator) { if(communicator->getDefaultLocator()) { Ice::ObjectPrx prx = communicator->getDefaultLocator(); // // Derive the query objects from the locator proxy endpoints. // Ice::EndpointSeq endpoints = prx->ice_getEndpoints(); Ice::Identity id = prx->ice_getIdentity(); id.name = "Query"; QueryPrx query = QueryPrx::uncheckedCast(prx->ice_identity(id)); for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { Ice::EndpointSeq singleEndpoint; singleEndpoint.push_back(*p); _queryObjects.push_back(QueryPrx::uncheckedCast(query->ice_endpoints(singleEndpoint))); } id.name = "InternalRegistry-Master"; _master = InternalRegistryPrx::uncheckedCast(prx->ice_identity(id)->ice_endpoints(Ice::EndpointSeq())); } } SessionManager::~SessionManager() { } vector SessionManager::findAllQueryObjects() { vector queryObjects = _queryObjects; for(vector::const_iterator q = _queryObjects.begin(); q != _queryObjects.end(); ++q) { Ice::ConnectionPtr connection = (*q)->ice_getCachedConnection(); if(connection) { try { connection->close(false); } catch(const Ice::LocalException&) { } } } map proxies; vector results; size_t previousSize = 0; do { for(vector::const_iterator q = queryObjects.begin(); q != queryObjects.end(); ++q) { results.push_back((*q)->begin_findAllObjectsByType(Registry::ice_staticId())); } map proxies; for(vector::const_iterator p = results.begin(); p != results.end(); ++p) { QueryPrx query = QueryPrx::uncheckedCast((*p)->getProxy()); if(isDestroyed()) { break; } try { Ice::ObjectProxySeq prxs = query->end_findAllObjectsByType(*p); for(Ice::ObjectProxySeq::iterator q = prxs.begin(); q != prxs.end(); ++q) { Ice::Identity id = (*q)->ice_getIdentity(); id.name = "Query"; proxies[(*q)->ice_getIdentity()] = QueryPrx::uncheckedCast((*q)->ice_identity(id)); } } catch(const Ice::Exception&) { // Ignore. } } queryObjects.clear(); for(map::const_iterator p = proxies.begin(); p != proxies.end(); ++p) { queryObjects.push_back(p->second); } } while(proxies.size() != previousSize); return queryObjects; } Ice-3.5.1/cpp/src/IceGrid/InternalRegistryI.h0000644000076400007640000000517212223561476017045 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_INTERNALREGISTRYI_H #define ICE_GRID_INTERNALREGISTRYI_H #include #include namespace IceGrid { class Database; typedef IceUtil::Handle DatabasePtr; class FileCache; typedef IceUtil::Handle FileCachePtr; class WellKnownObjectsManager; typedef IceUtil::Handle WellKnownObjectsManagerPtr; class ReapThread; typedef IceUtil::Handle ReapThreadPtr; class RegistryI; typedef IceUtil::Handle RegistryIPtr; class ReplicaSessionManager; class InternalRegistryI : public InternalRegistry { public: InternalRegistryI(const RegistryIPtr&, const DatabasePtr&, const ReapThreadPtr&, const WellKnownObjectsManagerPtr&, ReplicaSessionManager&); virtual ~InternalRegistryI(); virtual NodeSessionPrx registerNode(const InternalNodeInfoPtr&, const NodePrx&, const LoadInfo&, const Ice::Current&); virtual ReplicaSessionPrx registerReplica(const InternalReplicaInfoPtr&, const InternalRegistryPrx&, const Ice::Current&); virtual void registerWithReplica(const InternalRegistryPrx&, const Ice::Current&); virtual NodePrxSeq getNodes(const Ice::Current&) const; virtual InternalRegistryPrxSeq getReplicas(const Ice::Current&) const; virtual ApplicationInfoSeq getApplications(Ice::Long&, const Ice::Current&) const; virtual AdapterInfoSeq getAdapters(Ice::Long&, const Ice::Current&) const; virtual ObjectInfoSeq getObjects(Ice::Long&, const Ice::Current&) const; virtual void shutdown(const Ice::Current&) const; virtual Ice::Long getOffsetFromEnd(const std::string&, int, const Ice::Current&) const; virtual bool read(const std::string&, Ice::Long, int, Ice::Long&, Ice::StringSeq&, const Ice::Current&) const; private: std::string getFilePath(const std::string&) const; const RegistryIPtr _registry; const DatabasePtr _database; const ReapThreadPtr _reaper; const WellKnownObjectsManagerPtr _wellKnownObjects; const FileCachePtr _fileCache; ReplicaSessionManager& _session; int _nodeSessionTimeout; int _replicaSessionTimeout; bool _requireNodeCertCN; bool _requireReplicaCertCN; }; }; #endif Ice-3.5.1/cpp/src/IceGrid/InternalRegistryI.cpp0000644000076400007640000002310112223561476017370 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace IceGrid; InternalRegistryI::InternalRegistryI(const RegistryIPtr& registry, const DatabasePtr& database, const ReapThreadPtr& reaper, const WellKnownObjectsManagerPtr& wellKnownObjects, ReplicaSessionManager& session) : _registry(registry), _database(database), _reaper(reaper), _wellKnownObjects(wellKnownObjects), _fileCache(new FileCache(database->getCommunicator())), _session(session) { Ice::PropertiesPtr properties = database->getCommunicator()->getProperties(); _nodeSessionTimeout = properties->getPropertyAsIntWithDefault("IceGrid.Registry.NodeSessionTimeout", 30); _replicaSessionTimeout = properties->getPropertyAsIntWithDefault("IceGrid.Registry.ReplicaSessionTimeout", 30); _requireNodeCertCN = properties->getPropertyAsIntWithDefault("IceGrid.Registry.RequireNodeCertCN", 0); _requireReplicaCertCN = properties->getPropertyAsIntWithDefault("IceGrid.Registry.RequireReplicaCertCN", 0); } InternalRegistryI::~InternalRegistryI() { } NodeSessionPrx InternalRegistryI::registerNode(const InternalNodeInfoPtr& info, const NodePrx& node, const LoadInfo& load, const Ice::Current& current) { const TraceLevelsPtr traceLevels = _database->getTraceLevels(); const Ice::LoggerPtr logger = traceLevels->logger; if(!info || !node) { return 0; } if(_requireNodeCertCN) { try { IceSSL::ConnectionInfoPtr sslConnInfo = IceSSL::ConnectionInfoPtr::dynamicCast(current.con->getInfo()); if(sslConnInfo) { if (sslConnInfo->certs.empty() || !IceSSL::Certificate::decode(sslConnInfo->certs[0])->getSubjectDN().match("CN=" + info->name)) { if(traceLevels->node > 0) { Ice::Trace out(logger, traceLevels->nodeCat); out << "certificate CN doesn't match node name `" << info->name << "'"; } throw PermissionDeniedException("certificate CN doesn't match node name `" + info->name + "'"); } } else { if(traceLevels->node > 0) { Ice::Trace out(logger, traceLevels->nodeCat); out << "node certificate for `" << info->name << "' is required to connect to this registry"; } throw PermissionDeniedException("node certificate is required to connect to this registry"); } } catch(const PermissionDeniedException& ex) { throw ex; } catch(const IceUtil::Exception&) { if(traceLevels->node > 0) { Ice::Trace out(logger, traceLevels->nodeCat); out << "unexpected exception while verifying certificate for node `" << info->name << "'"; } throw PermissionDeniedException("unable to verify certificate for node `" + info->name + "'"); } } try { NodeSessionIPtr session = new NodeSessionI(_database, node, info, _nodeSessionTimeout, load); _reaper->add(new SessionReapable(logger, session), _nodeSessionTimeout); return session->getProxy(); } catch(const Ice::ObjectAdapterDeactivatedException&) { throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); } } ReplicaSessionPrx InternalRegistryI::registerReplica(const InternalReplicaInfoPtr& info, const InternalRegistryPrx& prx, const Ice::Current& current) { const TraceLevelsPtr traceLevels = _database->getTraceLevels(); const Ice::LoggerPtr logger = traceLevels->logger; if(!info || !prx) { return 0; } if(_requireReplicaCertCN) { try { IceSSL::ConnectionInfoPtr sslConnInfo = IceSSL::ConnectionInfoPtr::dynamicCast(current.con->getInfo()); if(sslConnInfo) { if (sslConnInfo->certs.empty() || !IceSSL::Certificate::decode(sslConnInfo->certs[0])->getSubjectDN().match("CN=" + info->name)) { if(traceLevels->replica > 0) { Ice::Trace out(logger, traceLevels->replicaCat); out << "certificate CN doesn't match replica name `" << info->name << "'"; } throw PermissionDeniedException("certificate CN doesn't match replica name `" + info->name + "'"); } } else { if(traceLevels->replica > 0) { Ice::Trace out(logger, traceLevels->replicaCat); out << "replica certificate for `" << info->name << "' is required to connect to this registry"; } throw PermissionDeniedException("replica certificate is required to connect to this registry"); } } catch(const PermissionDeniedException& ex) { throw ex; } catch(const IceUtil::Exception&) { if(traceLevels->replica > 0) { Ice::Trace out(logger, traceLevels->replicaCat); out << "unexpected exception while verifying certificate for replica `" << info->name << "'"; } throw PermissionDeniedException("unable to verify certificate for replica `" + info->name + "'"); } } try { ReplicaSessionIPtr s = new ReplicaSessionI(_database, _wellKnownObjects, info, prx, _replicaSessionTimeout); _reaper->add(new SessionReapable(logger, s), _replicaSessionTimeout); return s->getProxy(); } catch(const Ice::ObjectAdapterDeactivatedException&) { throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); } } void InternalRegistryI::registerWithReplica(const InternalRegistryPrx& replica, const Ice::Current&) { _session.create(replica); } NodePrxSeq InternalRegistryI::getNodes(const Ice::Current&) const { NodePrxSeq nodes; Ice::ObjectProxySeq proxies = _database->getInternalObjectsByType(Node::ice_staticId()); for(Ice::ObjectProxySeq::const_iterator p = proxies.begin(); p != proxies.end(); ++p) { nodes.push_back(NodePrx::uncheckedCast(*p)); } return nodes; } InternalRegistryPrxSeq InternalRegistryI::getReplicas(const Ice::Current&) const { InternalRegistryPrxSeq replicas; Ice::ObjectProxySeq proxies = _database->getObjectsByType(InternalRegistry::ice_staticId()); for(Ice::ObjectProxySeq::const_iterator p = proxies.begin(); p != proxies.end(); ++p) { replicas.push_back(InternalRegistryPrx::uncheckedCast(*p)); } return replicas; } ApplicationInfoSeq InternalRegistryI::getApplications(Ice::Long& serial, const Ice::Current&) const { return _database->getApplications(serial); } AdapterInfoSeq InternalRegistryI::getAdapters(Ice::Long& serial, const Ice::Current&) const { return _database->getAdapters(serial); } ObjectInfoSeq InternalRegistryI::getObjects(Ice::Long& serial, const Ice::Current&) const { return _database->getObjects(serial); } void InternalRegistryI::shutdown(const Ice::Current& /*current*/) const { _registry->shutdown(); } Ice::Long InternalRegistryI::getOffsetFromEnd(const string& filename, int count, const Ice::Current&) const { return _fileCache->getOffsetFromEnd(getFilePath(filename), count); } bool InternalRegistryI::read(const string& filename, Ice::Long pos, int size, Ice::Long& newPos, Ice::StringSeq& lines, const Ice::Current&) const { return _fileCache->read(getFilePath(filename), pos, size, newPos, lines); } string InternalRegistryI::getFilePath(const string& filename) const { string file; if(filename == "stderr") { file = _database->getCommunicator()->getProperties()->getProperty("Ice.StdErr"); if(file.empty()) { throw FileNotAvailableException("Ice.StdErr configuration property is not set"); } } else if(filename == "stdout") { file = _database->getCommunicator()->getProperties()->getProperty("Ice.StdOut"); if(file.empty()) { throw FileNotAvailableException("Ice.StdOut configuration property is not set"); } } else { throw FileNotAvailableException("unknown file"); } return file; } Ice-3.5.1/cpp/src/IceGrid/Allocatable.cpp0000644000076400007640000003161712223561476016170 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; using namespace IceGrid; AllocationRequest::~AllocationRequest() { } bool AllocationRequest::pending() { Lock sync(*this); assert(_state == Initial); if(_timeout == 0) { _state = Canceled; canceled(AllocationTimeoutException()); return false; } else if(!_session->addAllocationRequest(this)) { _state = Canceled; canceled(AllocationException("session destroyed")); return false; } if(_timeout > 0) { try { _session->getTimer()->schedule(this, IceUtil::Time::milliSeconds(_timeout)); } catch(const IceUtil::Exception&) { // Ignore, timer is destroyed because of shutdown } } _state = Pending; return true; } bool AllocationRequest::allocate(const AllocatablePtr& /*allocatable*/, const SessionIPtr& session) { Lock sync(*this); switch(_state) { case Initial: break; case Canceled: return false; case Pending: if(_timeout > 0) { _session->getTimer()->cancel(this); } _session->removeAllocationRequest(this); break; case Allocated: assert(false); break; } // // Check if the allocatable is already allocated by the session. // if(_session == session) { _state = Canceled; canceled(AllocationException("already allocated by the session")); return false; } else { _state = Allocated; return true; } } void AllocationRequest::cancel(const AllocationException& ex) { Lock sync(*this); switch(_state) { case Initial: break; case Canceled: case Allocated: return; case Pending: if(_timeout > 0) { _session->getTimer()->cancel(this); } _session->removeAllocationRequest(this); break; } _state = Canceled; canceled(ex); } void AllocationRequest::runTimerTask() // TimerTask::runTimerTask() method implementation { Lock sync(*this); switch(_state) { case Initial: assert(false); case Canceled: case Allocated: return; case Pending: _session->removeAllocationRequest(this); break; } _state = Canceled; canceled(AllocationTimeoutException()); } bool AllocationRequest::isCanceled() const { Lock sync(*this); return _state == Canceled; } bool AllocationRequest::operator<(const AllocationRequest& r) const { return this < &r; } AllocationRequest::AllocationRequest(const SessionIPtr& session) : _session(session), _timeout(_session->getAllocationTimeout()), // The session timeout can be updated so we need to cache it here. _state(Initial) { } Allocatable::Allocatable(bool allocatable, const AllocatablePtr& parent) : _allocatable(allocatable || (parent && parent->isAllocatable())), _count(0), _releasing(false) { // // COMPILERFIX: the constructor initializaton: // // _parent((parent && parent->isAllocatable()) ? parent : AllocatablePtr()) // // doesn't work on HP-UX (aCC: HP ANSI C++ B3910B A.03.56). It // results in a SEGFAULT at runtime. // if(parent && parent->isAllocatable()) { const_cast(_parent) = parent; } assert(!_parent || _parent->isAllocatable()); // Parent is only set if it's allocatable. } Allocatable::~Allocatable() { } void Allocatable::checkAllocatable() { if(!isAllocatable()) { throw AllocationException("not allocatable"); } } bool Allocatable::allocate(const AllocationRequestPtr& request, bool fromRelease) { try { return allocate(request, false, fromRelease); } catch(const SessionDestroyedException&) { return false; // The session was destroyed } } bool Allocatable::tryAllocate(const AllocationRequestPtr& request, bool fromRelease) { try { return allocate(request, true, fromRelease); } catch(const AllocationException&) { return false; // Not allocatable } } void Allocatable::release(const SessionIPtr& session, bool fromRelease) { bool isReleased = false; bool hasRequests = false; { Lock sync(*this); if(!fromRelease) { while(_releasing) { wait(); } assert(!_releasing); } if(!_session || _session != session) { throw AllocationException("can't release object which is not allocated"); } if(--_count == 0) { _session = 0; released(session); isReleased = true; if(!fromRelease && !_requests.empty()) { assert(!_parent); _releasing = true; // Prevent new allocations. hasRequests = true; } } } if(isReleased) { releasedNoSync(session); } if(_parent) { _parent->release(session, fromRelease); } else if(!fromRelease) { if(hasRequests) { while(true) { AllocationRequestPtr request; AllocatablePtr allocatable; { Lock sync(*this); allocatable = dequeueAllocationAttempt(request); if(!allocatable) { assert(_count == 0 && _requests.empty()); _releasing = false; notifyAll(); return; } } // // Try to allocate the allocatable with the request or if // there's no request, just notify the allocatable that it can // be allocated again. // if((request && allocatable->allocate(request, true)) || (!request && allocatable->canTryAllocate())) { while(true) { { Lock sync(*this); assert(_count); allocatable = 0; request = 0; // // Check if there's other requests from the session // waiting to allocate this allocatable. // list >::iterator p = _requests.begin(); while(p != _requests.end()) { if(p->second && p->second->getSession() == _session) { allocatable = p->first; request = p->second; _requests.erase(p); break; } ++p; } if(!allocatable) { _releasing = false; notifyAll(); return; // We're done, the allocatable was released (but is allocated again)! } } assert(allocatable && request); allocatable->allocate(request, true); } } } } else if(isReleased) { canTryAllocate(); // Notify that this allocatable can be allocated. } } } SessionIPtr Allocatable::getSession() const { Lock sync(*this); return _session; } bool Allocatable::operator<(const Allocatable& r) const { return this < &r; } void Allocatable::queueAllocationAttempt(const AllocatablePtr& allocatable, const AllocationRequestPtr& request, bool tryAllocate) { assert(!_parent); if(!tryAllocate) { if(request->pending()) { _requests.push_back(make_pair(allocatable, request)); } } else { _requests.push_back(make_pair(allocatable, AllocationRequestPtr())); } } void Allocatable::queueAllocationAttemptFromChild(const AllocatablePtr& allocatable) { if(_parent) { _parent->queueAllocationAttemptFromChild(allocatable); return; } Lock sync(*this); _requests.push_back(make_pair(allocatable, AllocationRequestPtr())); } AllocatablePtr Allocatable::dequeueAllocationAttempt(AllocationRequestPtr& request) { if(_requests.empty()) { return 0; } pair alloc = _requests.front(); _requests.pop_front(); if(alloc.second) { request = alloc.second; } return alloc.first; } bool Allocatable::allocate(const AllocationRequestPtr& request, bool tryAllocate, bool fromRelease) { if(_parent && !_parent->allocateFromChild(request, this, tryAllocate, fromRelease)) { return false; } bool queueWithParent = false; int allocationCount = 0; try { Lock sync(*this); checkAllocatable(); if(!_session && (fromRelease || !_releasing)) { if(request->allocate(this, _session)) { try { allocated(request->getSession()); // This might throw SessionDestroyedException } catch(const SessionDestroyedException&) { request->canceled(AllocationException("session destroyed")); throw; } assert(_count == 0); _session = request->getSession(); request->allocated(this, request->getSession()); ++_count; allocationCount = _count; } } else if(_session == request->getSession()) { if(!tryAllocate) { if(request->allocate(this, _session)) { assert(_count > 0); ++_count; request->allocated(this, _session); allocationCount = _count; } } else { queueWithParent = true; } } else { queueAllocationAttempt(this, request, tryAllocate); } } catch(const SessionDestroyedException& ex) { if(_parent) { _parent->release(request->getSession(), fromRelease); } throw ex; } catch(const AllocationException& ex) { if(_parent) { _parent->release(request->getSession(), fromRelease); } throw ex; } if(allocationCount == 1) { allocatedNoSync(request->getSession()); } else if(allocationCount == 0 && _parent) { if(queueWithParent) { _parent->queueAllocationAttemptFromChild(this); } _parent->release(request->getSession(), fromRelease); } return allocationCount > 0; } bool Allocatable::allocateFromChild(const AllocationRequestPtr& request, const AllocatablePtr& child, bool tryAllocate, bool fromRelease) { if(_parent && !_parent->allocateFromChild(request, child, tryAllocate, fromRelease)) { return false; } int allocationCount = 0; { Lock sync(*this); if((!_session || _session == request->getSession()) && (fromRelease || !_releasing)) { if(!_session) { try { allocated(request->getSession()); } catch(const SessionDestroyedException&) { // Ignore } } _session = request->getSession(); ++_count; allocationCount = _count; } else { queueAllocationAttempt(child, request, tryAllocate); } } if(allocationCount == 1) { allocatedNoSync(request->getSession()); } return allocationCount > 0; } Ice-3.5.1/cpp/src/IceGrid/ReplicaCache.cpp0000644000076400007640000001607512223561476016271 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace IceGrid; ReplicaCache::ReplicaCache(const Ice::CommunicatorPtr& communicator, const IceStorm::TopicManagerPrx& topicManager) : _communicator(communicator) { IceStorm::TopicPrx t; try { t = topicManager->create("ReplicaObserverTopic"); } catch(const IceStorm::TopicExists&) { t = topicManager->retrieve("ReplicaObserverTopic"); } const_cast(_topic) = IceStorm::TopicPrx::uncheckedCast(t->ice_collocationOptimized(true)); const_cast(_observers) = ReplicaObserverPrx::uncheckedCast(_topic->getPublisher()); } ReplicaEntryPtr ReplicaCache::add(const string& name, const ReplicaSessionIPtr& session) { Lock sync(*this); ReplicaEntryPtr entry; while((entry = getImpl(name))) { ReplicaSessionIPtr session = entry->getSession(); if(session->isDestroyed()) { wait(); // Wait for the session to be removed. } else { // // Check if the replica is still reachable, if not, we // destroy its session. // sync.release(); try { session->getInternalRegistry()->ice_ping(); throw ReplicaActiveException(); } catch(const Ice::LocalException&) { try { session->destroy(); } catch(const Ice::LocalException&) { } } sync.acquire(); } } if(_traceLevels && _traceLevels->replica > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat); out << "replica `" << name << "' up"; } try { _observers->replicaAdded(session->getInternalRegistry()); } catch(const Ice::ConnectFailedException&) { // Expected if the replica is being shutdown. } catch(const Ice::LocalException& ex) { TraceLevelsPtr traceLevels = getTraceLevels(); if(traceLevels) { Ice::Warning out(traceLevels->logger); out << "unexpected exception while publishing `replicaAdded' update:\n" << ex; } } return addImpl(name, new ReplicaEntry(name, session)); } ReplicaEntryPtr ReplicaCache::remove(const string& name, bool shutdown) { Lock sync(*this); ReplicaEntryPtr entry = getImpl(name); assert(entry); removeImpl(name); notifyAll(); if(_traceLevels && _traceLevels->replica > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat); out << "replica `" << name << "' down"; } if(!shutdown) { try { _observers->replicaRemoved(entry->getProxy()); } catch(const Ice::ConnectFailedException&) { // Expected if the replica is being shutdown. } catch(const Ice::LocalException& ex) { TraceLevelsPtr traceLevels = getTraceLevels(); if(traceLevels) { Ice::Warning out(traceLevels->logger); out << "unexpected exception while publishing `replicaRemoved' update:\n" << ex; } } } return entry; } ReplicaEntryPtr ReplicaCache::get(const string& name) const { Lock sync(*this); ReplicaEntryPtr entry = getImpl(name); if(!entry) { RegistryNotExistException ex; ex.name = name; throw ex; } return entry; } void ReplicaCache::subscribe(const ReplicaObserverPrx& observer) { try { Lock sync(*this); InternalRegistryPrxSeq replicas; for(map::const_iterator p = _entries.begin(); p != _entries.end(); ++p) { replicas.push_back(p->second->getProxy()); } IceStorm::QoS qos; qos["reliability"] = "ordered"; Ice::ObjectPrx publisher = _topic->subscribeAndGetPublisher(qos, observer->ice_twoway()); ReplicaObserverPrx::uncheckedCast(publisher)->replicaInit(replicas); } catch(const Ice::ConnectFailedException&) { // The replica is being shutdown. } catch(const Ice::LocalException& ex) { TraceLevelsPtr traceLevels = getTraceLevels(); if(traceLevels) { Ice::Warning out(traceLevels->logger); out << "unexpected exception while subscribing observer from replica observer topic:\n" << ex; } } } void ReplicaCache::unsubscribe(const ReplicaObserverPrx& observer) { try { _topic->unsubscribe(observer); } catch(const Ice::ConnectFailedException&) { // The replica is being shutdown. } catch(const Ice::LocalException& ex) { TraceLevelsPtr traceLevels = getTraceLevels(); if(traceLevels) { Ice::Warning out(traceLevels->logger); out << "unexpected exception while unsubscribing observer from replica observer topic:\n" << ex; } } } Ice::ObjectPrx ReplicaCache::getEndpoints(const string& name, const Ice::ObjectPrx& proxy) const { Ice::EndpointSeq endpoints; if(proxy) { Ice::EndpointSeq endpts = proxy->ice_getEndpoints(); endpoints.insert(endpoints.end(), endpts.begin(), endpts.end()); } Lock sync(*this); for(map::const_iterator p = _entries.begin(); p != _entries.end(); ++p) { Ice::ObjectPrx prx = p->second->getSession()->getEndpoint(name); if(prx) { Ice::EndpointSeq endpts = prx->ice_getEndpoints(); endpoints.insert(endpoints.end(), endpts.begin(), endpts.end()); } } return _communicator->stringToProxy("dummy")->ice_endpoints(endpoints); } void ReplicaCache::setInternalRegistry(const InternalRegistryPrx& proxy) { // // Setup this replica internal registry proxy. // _self = proxy; } InternalRegistryPrx ReplicaCache::getInternalRegistry() const { // // This replica internal registry proxy. // return _self; } ReplicaEntry::ReplicaEntry(const std::string& name, const ReplicaSessionIPtr& session) : _name(name), _session(session) { } ReplicaEntry::~ReplicaEntry() { } const ReplicaSessionIPtr& ReplicaEntry::getSession() const { return _session; } InternalReplicaInfoPtr ReplicaEntry::getInfo() const { return _session->getInfo(); } InternalRegistryPrx ReplicaEntry::getProxy() const { return _session->getInternalRegistry(); } Ice-3.5.1/cpp/src/IceGrid/.depend0000644000076400007640000065234112223561476014524 0ustar mesmesGrammar$(OBJEXT): Grammar.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 ../IceGrid/Parser.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Query.h Scanner$(OBJEXT): Scanner.cpp $(includedir)/IceUtil/ScannerConfig.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Ice.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 ../IceGrid/Parser.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Query.h ../IceGrid/Grammar.h Parser$(OBJEXT): Parser.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Options.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/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 $(includedir)/IceXML/Parser.h ../IceGrid/Parser.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Query.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/DescriptorParser.h ../IceGrid/DescriptorHelper.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h $(includedir)/IceBox/IceBox.h DescriptorParser$(OBJEXT): DescriptorParser.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 $(includedir)/IceXML/Parser.h $(includedir)/IcePatch2/Util.h $(includedir)/IcePatch2/FileInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h ../IceGrid/DescriptorParser.h ../IceGrid/DescriptorBuilder.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h DescriptorBuilder$(OBJEXT): DescriptorBuilder.cpp $(includedir)/Ice/Communicator.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LocalException.h ../IceGrid/DescriptorBuilder.h $(includedir)/IceXML/Parser.h $(includedir)/IceGrid/Descriptor.h $(includedir)/Ice/FactoryTableInit.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceUtil/Random.h DescriptorHelper$(OBJEXT): DescriptorHelper.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 ../IceGrid/DescriptorHelper.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceXML/Parser.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h FileParserI$(OBJEXT): FileParserI.cpp ../IceGrid/FileParserI.h $(includedir)/IceGrid/FileParser.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)/IceGrid/Admin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h ../IceGrid/DescriptorParser.h $(includedir)/IceXML/Parser.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h Util$(OBJEXT): Util.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 $(includedir)/IcePatch2/Util.h $(includedir)/IcePatch2/FileInfo.h ../IceGrid/Util.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceUtil/Random.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h Internal$(OBJEXT): Internal.cpp ../IceGrid/Internal.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/BuiltinSequences.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SlicedData.h $(includedir)/Ice/SliceChecksums.h $(includedir)/IceUtil/DisableWarnings.h Client$(OBJEXT): Client.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/Options.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/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/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 $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h ../IceGrid/Parser.h $(includedir)/IceGrid/Admin.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Query.h ../IceGrid/FileParserI.h $(includedir)/IceGrid/FileParser.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h $(includedir)/IceGrid/Locator.h $(includedir)/Glacier2/Router.h $(includedir)/Glacier2/PermissionsVerifier.h Internal$(OBJEXT): Internal.cpp ../IceGrid/Internal.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/BuiltinSequences.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SlicedData.h $(includedir)/Ice/SliceChecksums.h $(includedir)/IceUtil/DisableWarnings.h DescriptorParser$(OBJEXT): DescriptorParser.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 $(includedir)/IceXML/Parser.h $(includedir)/IcePatch2/Util.h $(includedir)/IcePatch2/FileInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h ../IceGrid/DescriptorParser.h ../IceGrid/DescriptorBuilder.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h DescriptorBuilder$(OBJEXT): DescriptorBuilder.cpp $(includedir)/Ice/Communicator.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LocalException.h ../IceGrid/DescriptorBuilder.h $(includedir)/IceXML/Parser.h $(includedir)/IceGrid/Descriptor.h $(includedir)/Ice/FactoryTableInit.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceUtil/Random.h TraceLevels$(OBJEXT): TraceLevels.cpp $(includedir)/Ice/Communicator.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h ../IceGrid/TraceLevels.h FileCache$(OBJEXT): FileCache.cpp $(includedir)/Ice/Communicator.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/FileUtil.h ../IceGrid/FileCache.h $(includedir)/IceGrid/Exception.h $(includedir)/Ice/FactoryTableInit.h PlatformInfo$(OBJEXT): PlatformInfo.cpp $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/FileUtil.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Plugin.h ../IceGrid/PlatformInfo.h ../IceGrid/Internal.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/TraceLevels.h $(includedir)/IcePatch2/Util.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Stats.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/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/Metrics.h $(includedir)/Ice/Service.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/IcePatch2/FileInfo.h SessionManager$(OBJEXT): SessionManager.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 ../IceGrid/SessionManager.h $(includedir)/IceGrid/Query.h $(includedir)/IceGrid/Exception.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h NodeI$(OBJEXT): NodeI.cpp $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/FileUtil.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/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/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 $(includedir)/IcePatch2/Util.h $(includedir)/IcePatch2/FileInfo.h $(includedir)/IcePatch2/ClientUtil.h $(includedir)/IcePatch2/FileServer.h ../IceGrid/NodeI.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/PlatformInfo.h $(includedir)/IceGrid/UserAccountMapper.h ../IceGrid/FileCache.h ../IceGrid/Activator.h ../IceGrid/ServerI.h $(includedir)/Freeze/EvictorF.h ../IceGrid/ServerAdapterI.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeSessionManager.h ../IceGrid/SessionManager.h $(includedir)/IceGrid/Query.h NodeServerAdminRouter$(OBJEXT): NodeServerAdminRouter.cpp ../IceGrid/NodeServerAdminRouter.h ../IceGrid/NodeI.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IcePatch2/FileServer.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/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/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)/IcePatch2/FileInfo.h $(includedir)/Ice/BuiltinSequences.h ../IceGrid/Internal.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/PlatformInfo.h $(includedir)/IceGrid/UserAccountMapper.h ../IceGrid/FileCache.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.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)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.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/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/Metrics.h $(includedir)/Ice/Service.h $(includedir)/Ice/IconvStringConverter.h ../IceGrid/ServerI.h $(includedir)/Freeze/EvictorF.h ../IceGrid/Activator.h ../IceGrid/ServerAdapterI.h ServerI$(OBJEXT): ServerI.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/FileUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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 ../Ice/Instance.h $(includedir)/IceUtil/RecMutex.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../Ice/ThreadPoolF.h $(includedir)/Ice/ConnectionFactoryF.h $(includedir)/Ice/ConnectionMonitorF.h $(includedir)/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../Ice/RetryQueueF.h $(includedir)/Ice/DynamicLibraryF.h $(includedir)/Ice/NetworkF.h ../Ice/ImplicitContextI.h ../IceGrid/ServerI.h $(includedir)/Freeze/EvictorF.h ../IceGrid/Activator.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/TraceLevels.h ../IceGrid/NodeI.h $(includedir)/IcePatch2/FileServer.h $(includedir)/IcePatch2/FileInfo.h ../IceGrid/PlatformInfo.h $(includedir)/IceGrid/UserAccountMapper.h ../IceGrid/FileCache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/ServerAdapterI.h ../IceGrid/DescriptorHelper.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceXML/Parser.h $(includedir)/IcePatch2/Util.h ServerAdapterI$(OBJEXT): ServerAdapterI.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 ../IceGrid/ServerAdapterI.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/ServerI.h $(includedir)/Freeze/EvictorF.h ../IceGrid/Activator.h ../IceGrid/TraceLevels.h ../IceGrid/NodeI.h $(includedir)/IcePatch2/FileServer.h $(includedir)/IcePatch2/FileInfo.h ../IceGrid/PlatformInfo.h $(includedir)/IceGrid/UserAccountMapper.h ../IceGrid/FileCache.h Activator$(OBJEXT): Activator.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/ArgVector.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/FileUtil.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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 ../IceGrid/Activator.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/TraceLevels.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/ServerI.h $(includedir)/Freeze/EvictorF.h $(includedir)/IcePatch2/Util.h $(includedir)/IcePatch2/FileInfo.h NodeSessionManager$(OBJEXT): NodeSessionManager.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 ../IceGrid/NodeSessionManager.h ../IceGrid/SessionManager.h $(includedir)/IceGrid/Query.h $(includedir)/IceGrid/Exception.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/TraceLevels.h ../IceGrid/NodeI.h $(includedir)/IcePatch2/FileServer.h $(includedir)/IcePatch2/FileInfo.h ../IceGrid/PlatformInfo.h $(includedir)/IceGrid/UserAccountMapper.h ../IceGrid/FileCache.h AdminCallbackRouter$(OBJEXT): AdminCallbackRouter.cpp ../IceGrid/AdminCallbackRouter.h $(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 $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h RegistryI$(OBJEXT): RegistryI.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/FileUtil.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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 ../Ice/Network.h $(includedir)/Ice/NetworkF.h $(includedir)/Ice/ProtocolPluginFacade.h $(includedir)/Ice/ProtocolPluginFacadeF.h $(includedir)/Ice/EndpointFactoryF.h ../IceStorm/Service.h $(includedir)/IceBox/IceBox.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h $(includedir)/IceSSL/IceSSL.h $(includedir)/IceSSL/Plugin.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/IceSSL/EndpointInfo.h $(includedir)/Glacier2/PermissionsVerifier.h $(includedir)/Glacier2/SSLInfo.h ../IceGrid/TraceLevels.h ../IceGrid/Database.h $(includedir)/IceGrid/Admin.h $(includedir)/Glacier2/Session.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/ServerCache.h $(includedir)/IceGrid/Query.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h ../IceGrid/ReapThread.h ../IceGrid/RegistryI.h $(includedir)/IceGrid/Locator.h ../IceGrid/PlatformInfo.h ../IceGrid/ReplicaSessionManager.h ../IceGrid/SessionManager.h $(includedir)/Glacier2/PermissionsVerifierF.h ../IceGrid/LocatorI.h ../IceGrid/LocatorRegistryI.h ../IceGrid/AdminI.h ../IceGrid/QueryI.h ../IceGrid/SessionI.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h ../IceGrid/AdminSessionI.h ../IceGrid/InternalRegistryI.h ../IceGrid/FileUserAccountMapperI.h $(includedir)/IceGrid/UserAccountMapper.h ../IceGrid/WellKnownObjectsManager.h ../IceGrid/FileCache.h ../IceGrid/RegistryServerAdminRouter.h RegistryServerAdminRouter$(OBJEXT): RegistryServerAdminRouter.cpp ../IceGrid/RegistryServerAdminRouter.h ../IceGrid/Database.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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)/IceGrid/Admin.h $(includedir)/Ice/Proxy.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/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/BuiltinSequences.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h ../IceGrid/Internal.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/ServerCache.h $(includedir)/IceGrid/Query.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h $(includedir)/Ice/LoggerF.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h $(includedir)/Ice/Metrics.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h $(includedir)/Ice/Plugin.h ../IceDB/IceDB.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.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/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/Service.h $(includedir)/Ice/IconvStringConverter.h InternalRegistryI$(OBJEXT): InternalRegistryI.cpp $(includedir)/IceUtil/DisableWarnings.h $(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 ../IceGrid/RegistryI.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Session.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Query.h $(includedir)/IceGrid/Locator.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h ../IceGrid/PlatformInfo.h ../IceGrid/ReplicaSessionManager.h ../IceGrid/SessionManager.h $(includedir)/Glacier2/PermissionsVerifierF.h ../IceStorm/Service.h $(includedir)/IceBox/IceBox.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/InternalRegistryI.h ../IceGrid/Database.h ../IceGrid/ServerCache.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h ../IceGrid/WellKnownObjectsManager.h ../IceGrid/ReapThread.h ../IceGrid/NodeSessionI.h ../IceGrid/ReplicaSessionI.h ../IceGrid/FileCache.h $(includedir)/IceSSL/IceSSL.h $(includedir)/IceSSL/Plugin.h $(includedir)/IceSSL/ConnectionInfo.h $(includedir)/IceSSL/EndpointInfo.h ../IceSSL/RFC2253.h Allocatable$(OBJEXT): Allocatable.cpp ../IceGrid/Allocatable.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceGrid/Session.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/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/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)/Glacier2/Session.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h ../IceGrid/SessionI.h ../IceGrid/ReapThread.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/Properties.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/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 $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h AdapterCache$(OBJEXT): AdapterCache.cpp $(includedir)/IceUtil/Random.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/ProcessF.h ../IceGrid/AdapterCache.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h ../IceGrid/TraceLevels.h $(includedir)/IceGrid/Query.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/NodeSessionI.h ../IceGrid/ServerCache.h ../IceGrid/Allocatable.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/SessionI.h ../IceGrid/ReapThread.h $(includedir)/Ice/LocalException.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Stats.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/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/Metrics.h $(includedir)/Ice/Service.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/UUID.h ObjectCache$(OBJEXT): ObjectCache.cpp $(includedir)/IceUtil/Random.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LocalException.h ../IceGrid/ObjectCache.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceGrid/Descriptor.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h ../IceGrid/TraceLevels.h ../IceGrid/Internal.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/NodeSessionI.h ../IceGrid/ServerCache.h $(includedir)/IceGrid/Query.h ../IceGrid/Allocatable.h ../IceGrid/SessionI.h ../IceGrid/ReapThread.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Stats.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/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/Metrics.h $(includedir)/Ice/Service.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h AllocatableObjectCache$(OBJEXT): AllocatableObjectCache.cpp $(includedir)/IceUtil/Random.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LocalException.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceGrid/Descriptor.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h ../IceGrid/TraceLevels.h ../IceGrid/Allocatable.h $(includedir)/IceGrid/Session.h ../IceGrid/SessionI.h ../IceGrid/ReapThread.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Stats.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/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 $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h ServerCache$(OBJEXT): ServerCache.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.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)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Communicator.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/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Direct.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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LocalException.h ../IceGrid/ServerCache.h $(includedir)/IceGrid/Descriptor.h $(includedir)/Ice/FactoryTableInit.h ../IceGrid/Internal.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h $(includedir)/IceGrid/Query.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/AdapterCache.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/SessionI.h ../IceGrid/ReapThread.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Stats.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/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/Metrics.h $(includedir)/Ice/Service.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/UUID.h ../IceGrid/DescriptorHelper.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceXML/Parser.h NodeCache$(OBJEXT): NodeCache.cpp $(includedir)/IceUtil/Functional.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Plugin.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceGrid/Descriptor.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/Internal.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/SessionI.h ../IceGrid/ReapThread.h $(includedir)/Ice/LocalException.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Stats.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)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.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 $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/UUID.h ../IceGrid/NodeSessionI.h ../IceGrid/ServerCache.h $(includedir)/IceGrid/Query.h ../IceGrid/Allocatable.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/DescriptorHelper.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceXML/Parser.h $(includedir)/IcePatch2/Util.h $(includedir)/IcePatch2/FileInfo.h ReplicaCache$(OBJEXT): ReplicaCache.cpp $(includedir)/Ice/Communicator.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/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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/Plugin.h ../IceGrid/ReplicaCache.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceGrid/Descriptor.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/Internal.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h $(includedir)/Ice/Metrics.h ../IceGrid/ReplicaSessionI.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h Database$(OBJEXT): Database.cpp $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Random.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Functional.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Logger.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/CommunicatorF.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Communicator.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/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Direct.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/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h ../IceGrid/Database.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h ../IceGrid/Internal.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/ServerCache.h $(includedir)/IceGrid/Query.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h $(includedir)/Ice/Metrics.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h ../IceGrid/DescriptorHelper.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceXML/Parser.h ../IceGrid/NodeSessionI.h ../IceGrid/ReplicaSessionI.h LocatorI$(OBJEXT): LocatorI.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 ../IceGrid/LocatorI.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h $(includedir)/IceGrid/Locator.h ../IceGrid/Database.h ../IceGrid/ServerCache.h $(includedir)/IceGrid/Query.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h ../IceGrid/SessionI.h ../IceGrid/ReapThread.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/UUID.h LocatorRegistryI$(OBJEXT): LocatorRegistryI.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 ../IceGrid/LocatorRegistryI.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/ReplicaSessionManager.h ../IceGrid/SessionManager.h $(includedir)/IceGrid/Query.h ../IceGrid/Database.h ../IceGrid/ServerCache.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h AdminI$(OBJEXT): AdminI.cpp $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Ice.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 ../Ice/TraceUtil.h ../Ice/TraceLevelsF.h $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceUtil/DisableWarnings.h ../IceGrid/AdminI.h $(includedir)/IceGrid/Admin.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h ../IceGrid/RegistryI.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h $(includedir)/IceGrid/Query.h $(includedir)/IceGrid/Locator.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h ../IceGrid/PlatformInfo.h ../IceGrid/ReplicaSessionManager.h ../IceGrid/SessionManager.h $(includedir)/Glacier2/PermissionsVerifierF.h ../IceStorm/Service.h $(includedir)/IceBox/IceBox.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/Database.h ../IceGrid/ServerCache.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h ../IceGrid/DescriptorParser.h ../IceGrid/DescriptorHelper.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceXML/Parser.h ../IceGrid/AdminSessionI.h ../IceGrid/SessionI.h ../IceGrid/ReapThread.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h ../IceGrid/NodeSessionI.h Util$(OBJEXT): Util.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 $(includedir)/IcePatch2/Util.h $(includedir)/IcePatch2/FileInfo.h ../IceGrid/Util.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceUtil/Random.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h DescriptorHelper$(OBJEXT): DescriptorHelper.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 ../IceGrid/DescriptorHelper.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceXML/Parser.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h NodeSessionI$(OBJEXT): NodeSessionI.cpp $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Ice.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 ../IceGrid/NodeSessionI.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/Database.h ../IceGrid/ServerCache.h $(includedir)/IceGrid/Query.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h ReplicaSessionI$(OBJEXT): ReplicaSessionI.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 ../IceGrid/ReplicaSessionI.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Session.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Descriptor.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h ../IceGrid/Database.h ../IceGrid/ServerCache.h $(includedir)/IceGrid/Query.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h ../IceGrid/WellKnownObjectsManager.h ../IceGrid/PlatformInfo.h ReapThread$(OBJEXT): ReapThread.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 ../IceGrid/ReapThread.h SessionI$(OBJEXT): SessionI.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 $(includedir)/IceUtil/UUID.h ../IceGrid/SessionI.h ../IceGrid/ReapThread.h $(includedir)/IceGrid/Session.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Exception.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/QueryI.h $(includedir)/IceGrid/Query.h ../IceGrid/LocatorI.h ../IceGrid/Internal.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Locator.h ../IceGrid/Database.h ../IceGrid/ServerCache.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h $(includedir)/IceSSL/Plugin.h $(includedir)/IceSSL/ConnectionInfo.h AdminSessionI$(OBJEXT): AdminSessionI.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 $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/DisableWarnings.h ../IceGrid/RegistryI.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Session.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Query.h $(includedir)/IceGrid/Locator.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h ../IceGrid/PlatformInfo.h ../IceGrid/ReplicaSessionManager.h ../IceGrid/SessionManager.h $(includedir)/Glacier2/PermissionsVerifierF.h ../IceStorm/Service.h $(includedir)/IceBox/IceBox.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/AdminSessionI.h ../IceGrid/SessionI.h ../IceGrid/ReapThread.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h ../IceGrid/AdminI.h ../IceGrid/Database.h ../IceGrid/ServerCache.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h ../IceGrid/ReplicaCache.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h $(includedir)/IceSSL/Plugin.h $(includedir)/IceSSL/ConnectionInfo.h SessionServantManager$(OBJEXT): SessionServantManager.cpp $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/LocalException.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/Identity.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Version.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectAdapter.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/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.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/ServantLocatorF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h ../IceGrid/SessionServantManager.h ../IceGrid/AdminCallbackRouter.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.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)/IceUtil/Unicode.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.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/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.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 $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h Topics$(OBJEXT): Topics.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 ../IceGrid/Topics.h $(includedir)/IceStorm/IceStorm.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceStorm/Metrics.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/DB.h ../IceDB/IceDB.h ../IceGrid/DescriptorHelper.h $(includedir)/IceUtil/OutputUtil.h $(includedir)/IceXML/Parser.h QueryI$(OBJEXT): QueryI.cpp ../IceGrid/Internal.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/BuiltinSequences.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/QueryI.h $(includedir)/IceGrid/Query.h ../IceGrid/Database.h ../IceGrid/ServerCache.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h $(includedir)/Ice/LoggerF.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h $(includedir)/Ice/Metrics.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h $(includedir)/Ice/Plugin.h ../IceDB/IceDB.h FileUserAccountMapperI$(OBJEXT): FileUserAccountMapperI.cpp $(includedir)/IceUtil/DisableWarnings.h $(includedir)/IceUtil/FileUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h ../IceGrid/FileUserAccountMapperI.h $(includedir)/IceGrid/UserAccountMapper.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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/FactoryTableInit.h ReplicaSessionManager$(OBJEXT): ReplicaSessionManager.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 ../IceGrid/ReplicaSessionManager.h ../IceGrid/SessionManager.h $(includedir)/IceGrid/Query.h $(includedir)/IceGrid/Exception.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/TraceLevels.h ../IceGrid/Database.h ../IceGrid/ServerCache.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h ../IceDB/IceDB.h ../IceGrid/WellKnownObjectsManager.h WellKnownObjectsManager$(OBJEXT): WellKnownObjectsManager.cpp $(includedir)/Glacier2/PermissionsVerifier.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/FactoryTableInit.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/Ice/BuiltinSequences.h ../IceGrid/WellKnownObjectsManager.h ../IceGrid/Internal.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Locator.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Glacier2/Session.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/Database.h ../IceGrid/ServerCache.h $(includedir)/IceGrid/Query.h ../IceGrid/Allocatable.h ../IceGrid/Cache.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h ../IceGrid/TraceLevels.h $(includedir)/Ice/LoggerF.h ../IceGrid/NodeCache.h $(includedir)/IceUtil/RecMutex.h ../IceGrid/ReplicaCache.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h $(includedir)/Ice/Metrics.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h ../IceGrid/DB.h $(includedir)/Ice/Plugin.h ../IceDB/IceDB.h IceGridNode$(OBJEXT): IceGridNode.cpp $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/FileUtil.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/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/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 ../IceGrid/Activator.h ../IceGrid/Internal.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Observer.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Session.h ../IceGrid/NodeServerAdminRouter.h ../IceGrid/NodeI.h $(includedir)/IcePatch2/FileServer.h $(includedir)/IcePatch2/FileInfo.h ../IceGrid/PlatformInfo.h $(includedir)/IceGrid/UserAccountMapper.h ../IceGrid/FileCache.h ../IceGrid/RegistryI.h $(includedir)/IceGrid/Query.h $(includedir)/IceGrid/Locator.h ../IceGrid/ReplicaSessionManager.h ../IceGrid/SessionManager.h $(includedir)/Glacier2/PermissionsVerifierF.h ../IceStorm/Service.h $(includedir)/IceBox/IceBox.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/FileUserAccountMapperI.h ../IceGrid/NodeSessionManager.h ../IceGrid/TraceLevels.h ../IceGrid/DescriptorParser.h ../IceGrid/Util.h $(includedir)/IceUtil/Random.h $(includedir)/IcePatch2/Util.h IceGridRegistry$(OBJEXT): IceGridRegistry.cpp $(includedir)/IceUtil/Options.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.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)/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 ../IceGrid/RegistryI.h $(includedir)/IceGrid/Registry.h $(includedir)/IceGrid/Exception.h $(includedir)/IceGrid/Session.h $(includedir)/Glacier2/Session.h $(includedir)/Glacier2/SSLInfo.h $(includedir)/IceGrid/Admin.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceGrid/Descriptor.h $(includedir)/IceGrid/Query.h $(includedir)/IceGrid/Locator.h ../IceGrid/Internal.h $(includedir)/IceGrid/Observer.h ../IceGrid/PlatformInfo.h ../IceGrid/ReplicaSessionManager.h ../IceGrid/SessionManager.h $(includedir)/Glacier2/PermissionsVerifierF.h ../IceStorm/Service.h $(includedir)/IceBox/IceBox.h $(includedir)/IceStorm/IceStorm.h $(includedir)/IceStorm/Metrics.h ../IceGrid/TraceLevels.h ../IceGrid/Util.h $(includedir)/IceUtil/StringUtil.h $(includedir)/IceUtil/Random.h $(HDIR)/Internal.h Internal.cpp: ../IceGrid/Internal.ice $(slicedir)/Ice/Identity.ice $(slicedir)/Ice/BuiltinSequences.ice $(slicedir)/Ice/ProcessF.ice $(slicedir)/Ice/Locator.ice $(slicedir)/Ice/Properties.ice $(slicedir)/Ice/PropertiesAdmin.ice $(slicedir)/Glacier2/Session.ice $(slicedir)/Glacier2/SSLInfo.ice $(slicedir)/IceGrid/Admin.ice $(slicedir)/Ice/SliceChecksumDict.ice $(slicedir)/IceGrid/Exception.ice $(slicedir)/IceGrid/Descriptor.ice $(slicedir)/IceGrid/Observer.ice $(slicedir)/IceGrid/Registry.ice $(slicedir)/IceGrid/Session.ice $(SLICE2CPP) $(SLICEPARSERLIB) Ice-3.5.1/cpp/src/IceGrid/PlatformInfo.h0000644000076400007640000000401512223561476016022 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_PLATFORM_INFO_H #define ICE_GRID_PLATFORM_INFO_H #include #include #ifdef _WIN32 # include // Performance data helper API # include #endif namespace IceGrid { class TraceLevels; typedef IceUtil::Handle TraceLevelsPtr; NodeInfo toNodeInfo(const InternalNodeInfoPtr&); RegistryInfo toRegistryInfo(const InternalReplicaInfoPtr&); class PlatformInfo { public: PlatformInfo(const std::string&, const Ice::CommunicatorPtr&, const TraceLevelsPtr&); ~PlatformInfo(); void start(); void stop(); InternalNodeInfoPtr getInternalNodeInfo() const; InternalReplicaInfoPtr getInternalReplicaInfo() const; NodeInfo getNodeInfo() const; RegistryInfo getRegistryInfo() const; LoadInfo getLoadInfo(); int getProcessorSocketCount() const; std::string getHostname() const; std::string getDataDir() const; std::string getCwd() const; #if defined(_WIN32) void runUpdateLoadInfo(); #endif private: const TraceLevelsPtr _traceLevels; std::string _name; std::string _os; std::string _hostname; std::string _release; std::string _version; std::string _machine; int _nProcessorThreads; std::string _dataDir; std::string _cwd; std::string _endpoints; int _nProcessorSockets; #if defined(_WIN32) IceUtil::ThreadPtr _updateUtilizationThread; IceUtil::Monitor _utilizationMonitor; bool _terminated; std::deque _usages1; std::deque _usages5; std::deque _usages15; int _last1Total; int _last5Total; int _last15Total; #elif defined(_AIX) int _kmem; #endif }; }; #endif Ice-3.5.1/cpp/src/IceGrid/AdapterCache.cpp0000644000076400007640000005021612223561476016265 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include using namespace std; using namespace IceGrid; namespace IceGrid { struct ReplicaLoadComp : binary_function { bool operator()(const pair& lhs, const pair& rhs) { return lhs.first < rhs.first; } }; struct ReplicaPriorityComp : binary_function { bool operator()(const ServerAdapterEntryPtr& lhs, const ServerAdapterEntryPtr& rhs) { return lhs->getPriority() < rhs->getPriority(); } }; struct TransformToReplicaLoad : public unary_function > { public: TransformToReplicaLoad(LoadSample loadSample) : _loadSample(loadSample) { } pair operator()(const ServerAdapterEntryPtr& value) { return make_pair(value->getLeastLoadedNodeLoad(_loadSample), value); } LoadSample _loadSample; }; struct TransformToReplica : public unary_function&, ServerAdapterEntryPtr> { ServerAdapterEntryPtr operator()(const pair& value) { return value.second; } }; class ReplicaGroupSyncCallback : public SynchronizationCallback, public IceUtil::Mutex { public: ReplicaGroupSyncCallback(const SynchronizationCallbackPtr& callback, int count, int nReplicas) : _callback(callback), _responseCalled(false), _synchronizeCount(count), _synchronizedCount(0), _nReplicas(nReplicas > count ? count : nReplicas) { } bool response() { Lock sync(*this); _responseCalled = true; if(_synchronizedCount >= _nReplicas) { _callback = 0; return false; } else if(_synchronizeCount == 0) { if(_synchronizedCount == 0 && _exception.get()) { _exception->ice_throw(); } _callback = 0; return false; } return true; } void synchronized() { SynchronizationCallbackPtr callback; { Lock sync(*this); ++_synchronizedCount; --_synchronizeCount; if(!_responseCalled) { return; } if(_synchronizedCount < _nReplicas && _synchronizeCount > 0) { return; } callback = _callback; _callback = 0; } if(callback) { callback->synchronized(); } } void synchronized(const Ice::Exception& ex) { SynchronizationCallbackPtr callback; { Lock sync(*this); if(!_exception.get()) { _exception.reset(ex.ice_clone()); } --_synchronizeCount; if(!_responseCalled) { return; } if(_synchronizeCount > 0) { return; } callback = _callback; _callback = 0; } if(callback) { callback->synchronized(ex); } } private: SynchronizationCallbackPtr _callback; bool _responseCalled; int _synchronizeCount; int _synchronizedCount; int _nReplicas; IceUtil::UniquePtr _exception; }; typedef IceUtil::Handle ReplicaGroupSyncCallbackPtr; } AdapterCache::AdapterCache(const Ice::CommunicatorPtr& communicator) : _communicator(communicator) { } void AdapterCache::addServerAdapter(const AdapterDescriptor& desc, const ServerEntryPtr& server, const string& app) { Lock sync(*this); if(getImpl(desc.id)) { Ice::Error out(_communicator->getLogger()); out << "can't add duplicate adapter `" << desc.id << "'"; return; } istringstream is(desc.priority); int priority = 0; is >> priority; ServerAdapterEntryPtr entry = new ServerAdapterEntry(*this, desc.id, app, desc.replicaGroupId, priority, server); addImpl(desc.id, entry); if(!desc.replicaGroupId.empty()) { ReplicaGroupEntryPtr repEntry = ReplicaGroupEntryPtr::dynamicCast(getImpl(desc.replicaGroupId)); if(!repEntry) { Ice::Error out(_communicator->getLogger()); out << "can't add adapter `" << desc.id << "' to unknown replica group `" << desc.replicaGroupId << "'"; } repEntry->addReplica(desc.id, entry); } } void AdapterCache::addReplicaGroup(const ReplicaGroupDescriptor& desc, const string& app) { Lock sync(*this); if(getImpl(desc.id)) { Ice::Error out(_communicator->getLogger()); out << "can't add duplicate replica group `" << desc.id << "'"; return; } addImpl(desc.id, new ReplicaGroupEntry(*this, desc.id, app, desc.loadBalancing)); } AdapterEntryPtr AdapterCache::get(const string& id) const { Lock sync(*this); AdapterEntryPtr entry = getImpl(id); if(!entry) { throw AdapterNotExistException(id); } return entry; } void AdapterCache::removeServerAdapter(const string& id) { Lock sync(*this); ServerAdapterEntryPtr entry = ServerAdapterEntryPtr::dynamicCast(getImpl(id)); if(!entry) { Ice::Error out(_communicator->getLogger()); out << "can't remove unknown adapter `" << id << "'"; return; } removeImpl(id); string replicaGroupId = entry->getReplicaGroupId(); if(!replicaGroupId.empty()) { ReplicaGroupEntryPtr repEntry = ReplicaGroupEntryPtr::dynamicCast(getImpl(replicaGroupId)); if(!repEntry) { Ice::Error out(_communicator->getLogger()); out << "can't remove adapter `" << id << "' from unknown replica group `" << replicaGroupId << "'"; } repEntry->removeReplica(id); } } void AdapterCache::removeReplicaGroup(const string& id) { Lock sync(*this); ReplicaGroupEntryPtr entry = ReplicaGroupEntryPtr::dynamicCast(getImpl(id)); if(!entry) { Ice::Error out(_communicator->getLogger()); out << "can't remove unknown replica group `" << id << "'"; return; } removeImpl(id); } AdapterEntryPtr AdapterCache::addImpl(const string& id, const AdapterEntryPtr& entry) { if(_traceLevels && _traceLevels->adapter > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat); out << "added adapter `" << id << "'"; } return Cache::addImpl(id, entry); } void AdapterCache::removeImpl(const string& id) { if(_traceLevels && _traceLevels->adapter > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat); out << "removed adapter `" << id << "'"; } Cache::removeImpl(id); } AdapterEntry::AdapterEntry(AdapterCache& cache, const string& id, const string& application) : _cache(cache), _id(id), _application(application) { } bool AdapterEntry::canRemove() { return true; } string AdapterEntry::getId() const { return _id; } string AdapterEntry::getApplication() const { return _application; } ServerAdapterEntry::ServerAdapterEntry(AdapterCache& cache, const string& id, const string& application, const string& replicaGroupId, int priority, const ServerEntryPtr& server) : AdapterEntry(cache, id, application), _replicaGroupId(replicaGroupId), _priority(priority), _server(server) { } bool ServerAdapterEntry::addSyncCallback(const SynchronizationCallbackPtr& callback, const set&) { try { return _server->addSyncCallback(callback); } catch(const ServerNotExistException&) { throw AdapterNotExistException(_id); } } void ServerAdapterEntry::getLocatorAdapterInfo(LocatorAdapterInfoSeq& adapters, int& nReplicas, bool& replicaGroup, bool& roundRobin, const set&) { nReplicas = 1; replicaGroup = false; roundRobin = false; LocatorAdapterInfo info; info.id = _id; info.proxy = _server->getAdapter(info.activationTimeout, info.deactivationTimeout, _id, true); adapters.push_back(info); } float ServerAdapterEntry::getLeastLoadedNodeLoad(LoadSample loadSample) const { try { return _server->getLoad(loadSample); } catch(const ServerNotExistException&) { // This might happen if the application is updated concurrently. } catch(const NodeNotExistException&) { // This might happen if the application is updated concurrently. } catch(const NodeUnreachableException&) { } catch(const Ice::Exception& ex) { Ice::Error error(_cache.getTraceLevels()->logger); error << "unexpected exception while getting node load:\n" << ex; } return 999.9f; } AdapterInfoSeq ServerAdapterEntry::getAdapterInfo() const { AdapterInfo info; info.id = _id; info.replicaGroupId = _replicaGroupId; try { info.proxy = _server->getAdapter(_id, true)->getDirectProxy(); } catch(const SynchronizationException&) { } catch(const Ice::Exception&) { } AdapterInfoSeq infos; infos.push_back(info); return infos; } AdapterPrx ServerAdapterEntry::getProxy(const string& replicaGroupId, bool upToDate) const { if(replicaGroupId.empty()) { return _server->getAdapter(_id, upToDate); } else { if(_replicaGroupId != replicaGroupId) // Validate the replica group. { throw Ice::InvalidReplicaGroupIdException(); } return _server->getAdapter(_id, upToDate); } } int ServerAdapterEntry::getPriority() const { return _priority; } ReplicaGroupEntry::ReplicaGroupEntry(AdapterCache& cache, const string& id, const string& application, const LoadBalancingPolicyPtr& policy) : AdapterEntry(cache, id, application), _lastReplica(0), _requestInProgress(false) { update(policy); } bool ReplicaGroupEntry::addSyncCallback(const SynchronizationCallbackPtr& callback, const set& excludes) { vector replicas; int nReplicas; int roundRobin = false; { Lock sync(*this); nReplicas = _loadBalancingNReplicas > 0 ? _loadBalancingNReplicas : static_cast(_replicas.size()); roundRobin = RoundRobinLoadBalancingPolicyPtr::dynamicCast(_loadBalancing); if(!roundRobin) { replicas = _replicas; } else { for(vector::const_iterator p = _replicas.begin(); p != _replicas.end(); ++p) { if(excludes.find((*p)->getId()) == excludes.end()) { replicas.push_back(*p); } } } if(replicas.empty()) { return false; } } ReplicaGroupSyncCallbackPtr cb = new ReplicaGroupSyncCallback(callback, static_cast(replicas.size()), nReplicas); set emptyExcludes; for(vector::const_iterator p = replicas.begin(); p != replicas.end(); ++p) { try { if(!(*p)->addSyncCallback(cb, emptyExcludes)) { cb->synchronized(); } } catch(const Ice::Exception& ex) { cb->synchronized(ex); } } return cb->response(); } void ReplicaGroupEntry::addReplica(const string& /*replicaId*/, const ServerAdapterEntryPtr& adapter) { Lock sync(*this); _replicas.push_back(adapter); } void ReplicaGroupEntry::removeReplica(const string& replicaId) { Lock sync(*this); for(vector::iterator p = _replicas.begin(); p != _replicas.end(); ++p) { if(replicaId == (*p)->getId()) { _replicas.erase(p); // Make sure _lastReplica is still within the bounds. _lastReplica = _replicas.empty() ? 0 : _lastReplica % static_cast(_replicas.size()); break; } } } void ReplicaGroupEntry::update(const LoadBalancingPolicyPtr& policy) { Lock sync(*this); assert(policy); _loadBalancing = policy; istringstream is(_loadBalancing->nReplicas); int nReplicas = 0; is >> nReplicas; _loadBalancingNReplicas = nReplicas < 0 ? 1 : nReplicas; AdaptiveLoadBalancingPolicyPtr alb = AdaptiveLoadBalancingPolicyPtr::dynamicCast(_loadBalancing); if(alb) { if(alb->loadSample == "1") { _loadSample = LoadSample1; } else if(alb->loadSample == "5") { _loadSample = LoadSample5; } else if(alb->loadSample == "15") { _loadSample = LoadSample15; } else { _loadSample = LoadSample1; } } } void ReplicaGroupEntry::getLocatorAdapterInfo(LocatorAdapterInfoSeq& adapters, int& nReplicas, bool& replicaGroup, bool& roundRobin, const set& excludes) { vector replicas; bool adaptive = false; LoadSample loadSample = LoadSample1; { Lock sync(*this); replicaGroup = true; roundRobin = false; nReplicas = _loadBalancingNReplicas > 0 ? _loadBalancingNReplicas : static_cast(_replicas.size()); if(_replicas.empty()) { return; } replicas.reserve(_replicas.size()); if(RoundRobinLoadBalancingPolicyPtr::dynamicCast(_loadBalancing)) { // Serialize round-robin requests while(_requestInProgress) { wait(); } _requestInProgress = true; for(unsigned int i = 0; i < _replicas.size(); ++i) { replicas.push_back(_replicas[(_lastReplica + i) % _replicas.size()]); } _lastReplica = (_lastReplica + 1) % static_cast(_replicas.size()); roundRobin = true; } else if(AdaptiveLoadBalancingPolicyPtr::dynamicCast(_loadBalancing)) { replicas = _replicas; RandomNumberGenerator rng; random_shuffle(replicas.begin(), replicas.end(), rng); loadSample = _loadSample; adaptive = true; } else if(OrderedLoadBalancingPolicyPtr::dynamicCast(_loadBalancing)) { replicas = _replicas; sort(replicas.begin(), replicas.end(), ReplicaPriorityComp()); } else if(RandomLoadBalancingPolicyPtr::dynamicCast(_loadBalancing)) { replicas = _replicas; RandomNumberGenerator rng; random_shuffle(replicas.begin(), replicas.end(), rng); } } int unreachable = 0; bool synchronizing = false; try { if(adaptive) { // // This must be done outside the synchronization block since // the trasnform() might call and lock each server adapter // entry. We also can't sort directly as the load of each // server adapter is not stable so we first take a snapshot of // each adapter and sort the snapshot. // vector > rl; transform(replicas.begin(), replicas.end(), back_inserter(rl), TransformToReplicaLoad(loadSample)); sort(rl.begin(), rl.end(), ReplicaLoadComp()); replicas.clear(); transform(rl.begin(), rl.end(), back_inserter(replicas), TransformToReplica()); } // // Retrieve the proxy of each adapter from the server. The adapter // might not exist anymore at this time or the node might not be // reachable. // set emptyExcludes; bool firstUnreachable = true; for(vector::const_iterator p = replicas.begin(); p != replicas.end(); ++p) { if(!roundRobin || excludes.find((*p)->getId()) == excludes.end()) { try { int dummy; bool dummy2; bool dummy3; (*p)->getLocatorAdapterInfo(adapters, dummy, dummy2, dummy3, emptyExcludes); firstUnreachable = false; } catch(const SynchronizationException&) { synchronizing = true; } catch(const Ice::UserException&) { if(firstUnreachable) { ++unreachable; // Count the number of un-reachable nodes. } } } } } catch(...) { if(roundRobin) { Lock sync(*this); assert(_requestInProgress); _requestInProgress = false; notify(); } throw; } if(roundRobin) { Lock sync(*this); assert(_requestInProgress); _requestInProgress = false; notify(); if(unreachable > 0) { _lastReplica = (_lastReplica + unreachable) % static_cast(_replicas.size()); } } if(adapters.empty() && synchronizing) { throw SynchronizationException(__FILE__, __LINE__); } } float ReplicaGroupEntry::getLeastLoadedNodeLoad(LoadSample loadSample) const { vector replicas; { Lock sync(*this); replicas = _replicas; } if(replicas.empty()) { return 999.9f; } else if(replicas.size() == 1) { return replicas.back()->getLeastLoadedNodeLoad(loadSample); } else { RandomNumberGenerator rng; random_shuffle(replicas.begin(), replicas.end(), rng); vector > rl; transform(replicas.begin(), replicas.end(), back_inserter(rl), TransformToReplicaLoad(loadSample)); return min_element(rl.begin(), rl.end(), ReplicaLoadComp())->first; } } AdapterInfoSeq ReplicaGroupEntry::getAdapterInfo() const { // // This method is called with the database locked so we're sure // that no new adapters will be added or removed concurrently. // vector replicas; { Lock sync(*this); replicas = _replicas; } AdapterInfoSeq infos; for(vector::const_iterator p = replicas.begin(); p != replicas.end(); ++p) { AdapterInfoSeq infs = (*p)->getAdapterInfo(); assert(infs.size() == 1); infos.push_back(infs[0]); } return infos; } bool ReplicaGroupEntry::hasAdaptersFromOtherApplications() const { vector replicas; { Lock sync(*this); replicas = _replicas; } AdapterInfoSeq infos; for(vector::const_iterator p = replicas.begin(); p != replicas.end(); ++p) { if((*p)->getApplication() != _application) { return true; } } return false; } Ice-3.5.1/cpp/src/IceGrid/TraceLevels.cpp0000644000076400007640000000374412223561476016176 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace IceGrid; TraceLevels::TraceLevels(const Ice::CommunicatorPtr& communicator, const string& prefix) : application(0), applicationCat("Application"), node(0), nodeCat("Node"), replica(0), replicaCat("Replica"), server(0), serverCat("Server"), adapter(0), adapterCat("Adapter"), object(0), objectCat("Object"), activator(0), activatorCat("Activator"), patch(0), patchCat("Patch"), locator(0), locatorCat("Locator"), session(0), sessionCat("Session"), logger(communicator->getLogger()) { Ice::PropertiesPtr properties = communicator->getProperties(); string keyBase = prefix + ".Trace."; const_cast(application) = properties->getPropertyAsInt(keyBase + applicationCat); const_cast(node) = properties->getPropertyAsInt(keyBase + nodeCat); const_cast(replica) = properties->getPropertyAsInt(keyBase + replicaCat); const_cast(server) = properties->getPropertyAsInt(keyBase + serverCat); const_cast(adapter) = properties->getPropertyAsInt(keyBase + adapterCat); const_cast(object) = properties->getPropertyAsInt(keyBase + objectCat); const_cast(activator) = properties->getPropertyAsInt(keyBase + activatorCat); const_cast(patch) = properties->getPropertyAsInt(keyBase + patchCat); const_cast(locator) = properties->getPropertyAsInt(keyBase + locatorCat); const_cast(session) = properties->getPropertyAsInt(keyBase + sessionCat); } TraceLevels::~TraceLevels() { } Ice-3.5.1/cpp/src/IceGrid/ReapThread.cpp0000644000076400007640000001037412223561476016001 0ustar mesmes// ********************************************************************** // // 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 #include using namespace std; using namespace IceGrid; ReapThread::ReapThread() : IceUtil::Thread("Icegrid reaper thread"), _terminated(false) { } void ReapThread::run() { vector reap; while(true) { { Lock sync(*this); if(_terminated) { break; } calcWakeInterval(); // // If the wake interval is zero then we wait forever. // if(_wakeInterval == IceUtil::Time()) { wait(); } else { timedWait(_wakeInterval); } if(_terminated) { break; } list::iterator p = _sessions.begin(); while(p != _sessions.end()) { try { if(p->timeout == IceUtil::Time()) { p->item->timestamp(); // This should throw if the reapable is destroyed. ++p; } else if((IceUtil::Time::now(IceUtil::Time::Monotonic) - p->item->timestamp()) > p->timeout) { reap.push_back(*p); p = _sessions.erase(p); } else { ++p; } } catch(const Ice::ObjectNotExistException&) { p = _sessions.erase(p); } } } for(vector::const_iterator p = reap.begin(); p != reap.end(); ++p) { p->item->destroy(false); } reap.clear(); } } void ReapThread::terminate() { list reap; { Lock sync(*this); if(_terminated) { assert(_sessions.empty()); return; } _terminated = true; notify(); reap.swap(_sessions); } for(list::iterator p = reap.begin(); p != reap.end(); ++p) { p->item->destroy(true); } } void ReapThread::add(const ReapablePtr& reapable, int timeout) { Lock sync(*this); if(_terminated) { return; } // // NOTE: registering a reapable with a null timeout is allowed. The reapable is reaped // only when the reaper thread is shutdown. // // // 10 seconds is the minimum permissable timeout. // if(timeout > 0 && timeout < 10) { timeout = 10; } ReapableItem item; item.item = reapable; item.timeout = timeout == 0 ? IceUtil::Time() : IceUtil::Time::seconds(timeout); _sessions.push_back(item); if(timeout > 0) { // // If there is a new minimum wake interval then wake the reaping // thread. // if(calcWakeInterval()) { notify(); } // // Since we just added a new session with a non null timeout there // must be a non-zero wakeInterval. // assert(_wakeInterval != IceUtil::Time()); } } // // Returns true if the calculated wake interval is less than the current wake // interval (or if the original wake interval was "forever"). // bool ReapThread::calcWakeInterval() { // Re-calculate minimum timeout IceUtil::Time oldWakeInterval = _wakeInterval; IceUtil::Time minimum; bool first = true; for(list::const_iterator p = _sessions.begin(); p != _sessions.end(); ++p) { if(p->timeout != IceUtil::Time() && (first || p->timeout < minimum)) { minimum = p->timeout; first = false; } } _wakeInterval = minimum; return oldWakeInterval == IceUtil::Time() || minimum < oldWakeInterval; } Ice-3.5.1/cpp/src/IceGrid/RegistryServerAdminRouter.cpp0000644000076400007640000000376512223561476021141 0ustar mesmes// ********************************************************************** // // 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 #include using namespace IceGrid; using namespace Ice; using namespace std; namespace { class InvokeAMICallback : public AMI_Array_Object_ice_invoke { public: InvokeAMICallback(const AMD_Object_ice_invokePtr& cb) : _cb(cb) { } virtual void ice_response(bool ok, const pair& outParams) { _cb->ice_response(ok, outParams); } virtual void ice_exception(const Ice::Exception&) { _cb->ice_exception(ObjectNotExistException(__FILE__, __LINE__)); // Server admin object is unreachable } private: AMD_Object_ice_invokePtr _cb; }; } IceGrid::RegistryServerAdminRouter::RegistryServerAdminRouter(const DatabasePtr& database) : _database(database) { } void IceGrid::RegistryServerAdminRouter::ice_invoke_async(const AMD_Object_ice_invokePtr& cb, const pair& inParams, const Current& current) { ObjectPrx target = 0; try { target = _database->getServer(current.id.name)->getAdminProxy(); } catch(const ServerNotExistException&) { } catch(const NodeUnreachableException&) { } catch(const DeploymentException&) { } if(target == 0) { throw ObjectNotExistException(__FILE__, __LINE__); } // // Set the facet // target = target->ice_facet(current.facet); // // Call with AMI // target->ice_invoke_async(new InvokeAMICallback(cb), current.operation, current.mode, inParams, current.ctx); } Ice-3.5.1/cpp/src/IceGrid/IceGridRegistry.cpp0000644000076400007640000001251212223561476017015 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceGrid; namespace IceGrid { class RegistryService : public Service { public: RegistryService(); ~RegistryService(); virtual bool shutdown(); protected: virtual bool start(int, char*[], int&); virtual void waitForShutdown(); virtual bool stop(); virtual CommunicatorPtr initializeCommunicator(int&, char*[], const InitializationData&); private: void usage(const std::string&); RegistryIPtr _registry; }; } // End of namespace IceGrid RegistryService::RegistryService() { } RegistryService::~RegistryService() { } bool RegistryService::shutdown() { assert(_registry); _registry->shutdown(); return true; } bool RegistryService::start(int argc, char* argv[], int& status) { bool nowarn; bool readonly; std::string initFromReplica; IceUtilInternal::Options opts; opts.addOpt("h", "help"); opts.addOpt("v", "version"); opts.addOpt("", "nowarn"); opts.addOpt("", "readonly"); opts.addOpt("", "initdb-from-replica", IceUtilInternal::Options::NeedArg); vector args; try { args = opts.parse(argc, (const char**)argv); } catch(const IceUtilInternal::BadOptException& e) { error(e.reason); usage(argv[0]); return false; } if(opts.isSet("help")) { usage(argv[0]); status = EXIT_SUCCESS; return false; } if(opts.isSet("version")) { print(ICE_STRING_VERSION); status = EXIT_SUCCESS; return false; } nowarn = opts.isSet("nowarn"); readonly = opts.isSet("readonly"); if(opts.isSet("initdb-from-replica")) { initFromReplica = opts.optArg("initdb-from-replica"); } if(!args.empty()) { cerr << argv[0] << ": too many arguments" << endl; usage(argv[0]); return false; } Ice::PropertiesPtr properties = communicator()->getProperties(); // // Warn the user that setting Ice.ThreadPool.Server isn't useful. // if(!nowarn && properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 0) > 0) { Warning out(communicator()->getLogger()); out << "setting `Ice.ThreadPool.Server.Size' is not useful, "; out << "you should set individual adapter thread pools instead."; } TraceLevelsPtr traceLevels = new TraceLevels(communicator(), "IceGrid.Registry"); _registry = new RegistryI(communicator(), traceLevels, nowarn, readonly, initFromReplica); if(!_registry->start()) { return false; } return true; } void RegistryService::waitForShutdown() { // // Wait for the activator shutdown. Once the run method returns // all the servers have been deactivated. // enableInterrupt(); _registry->waitForShutdown(); disableInterrupt(); } bool RegistryService::stop() { _registry->stop(); return true; } CommunicatorPtr RegistryService::initializeCommunicator(int& argc, char* argv[], const InitializationData& initializationData) { InitializationData initData = initializationData; initData.properties = createProperties(argc, argv, initData.properties); // // Make sure that IceGridRegistry doesn't use collocation optimization. // initData.properties->setProperty("Ice.Default.CollocationOptimized", "0"); // // Default backend database plugin is Freeze if none is specified. // if(initData.properties->getProperty("Ice.Plugin.DB").empty()) { initData.properties->setProperty("Ice.Plugin.DB", "IceGridFreezeDB:createFreezeDB"); } // // Setup the client thread pool size. // setupThreadPool(initData.properties, "Ice.ThreadPool.Client", 1, 100); return Service::initializeCommunicator(argc, argv, initData); } void RegistryService::usage(const string& appName) { string options = "Options:\n" "-h, --help Show this message.\n" "-v, --version Display the Ice version.\n" "--nowarn Don't print any security warnings.\n" "--readonly Start the master registry in read-only mode.\n" "--initdb-from-replica=\n" " Initialize the database from the given replica."; #ifndef _WIN32 options.append( "\n" "\n" "--daemon Run as a daemon.\n" "--pidfile FILE Write process ID into FILE.\n" "--noclose Do not close open file descriptors.\n" "--nochdir Do not change the current working directory.\n" ); #endif print("Usage: " + appName + " [options]\n" + options); } #ifdef _WIN32 int wmain(int argc, wchar_t* argv[]) #else int main(int argc, char* argv[]) #endif { RegistryService svc; return svc.main(argc, argv); } Ice-3.5.1/cpp/src/IceGrid/Scanner.l0000644000076400007640000001440212223561476015020 0ustar mesmes%{ // ********************************************************************** // // 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 #include #include #if defined(_MSC_VER) && defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // # pragma warning( 4 : 4267 ) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // # pragma warning( 4 : 4244 ) #endif using namespace std; using namespace Ice; using namespace IceGrid; #ifdef _MSC_VER # ifdef yywrap # undef yywrap # define yywrap() 1 # endif # define YY_NO_UNISTD_H #endif #ifdef __SUNPRO_CC # ifdef yywrap # undef yywrap # define yywrap() 1 # endif # ifdef ICE_64 # pragma error_messages(off,truncwarn) # endif #endif #define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) namespace IceGrid { typedef std::map StringTokenMap; static StringTokenMap keywordMap; void initScanner(); std::string parseDoubleQuotedString(); std::string parseSingleQuotedString(); } #define YY_USER_INIT initScanner(); %} WS [ \t\v\f\r] NL [\n] keyword [[:alpha:]]* %option noyywrap %option always-interactive %% "//" { // C++-style comment int c; do { c = yyinput(); } while(c != '\n' && c != EOF); } "/*" { // C-style comment while(true) { int c = yyinput(); if(c == '*') { int next = yyinput(); if(next == '/') { break; } else { unput(next); } } else if(c == EOF) { parser->warning("EOF in comment"); break; } } } {WS}*(\\{WS}*{NL})? { size_t len = strlen(yytext); for(size_t i = 0; i < len; ++i) { if(yytext[i] == '\\') { parser->continueLine(); } } } {NL}|; { return ';'; } \" { // "..."-type strings string s = parseDoubleQuotedString(); yylvalp->clear(); yylvalp->push_back(s); return ICE_GRID_STRING; } \' { // '...'-type strings string s; while(true) { char c = static_cast(yyinput()); if(c == '\'') { break; } else if(c == EOF) { parser->warning("EOF in string"); break; } else { s += c; } } yylvalp->clear(); yylvalp->push_back(s); return ICE_GRID_STRING; } . { // Simple strings string s; s += yytext[0]; while(true) { char c = static_cast(yyinput()); if(c == EOF) { break; } else if(c == '"') { s += parseDoubleQuotedString(); continue; } else if(c == '\'') { s += parseSingleQuotedString(); continue; } else if(isspace(static_cast(c)) || c == ';') { unput(c); break; } s += c; } yylvalp->clear(); yylvalp->push_back(s); StringTokenMap::const_iterator pos = keywordMap.find(s); return pos != keywordMap.end() ? pos->second : ICE_GRID_STRING; } %% namespace IceGrid { // // initScanner() fills the keyword map with all keyword-token pairs. // void initScanner() { keywordMap["help"] = ICE_GRID_HELP; keywordMap["quit"] = ICE_GRID_EXIT; keywordMap["exit"] = ICE_GRID_EXIT; keywordMap["application"] = ICE_GRID_APPLICATION; keywordMap["server"] = ICE_GRID_SERVER; keywordMap["adapter"] = ICE_GRID_ADAPTER; keywordMap["add"] = ICE_GRID_ADD; keywordMap["remove"] = ICE_GRID_REMOVE; keywordMap["list"] = ICE_GRID_LIST; keywordMap["shutdown"] = ICE_GRID_SHUTDOWN; keywordMap["describe"] = ICE_GRID_DESCRIBE; keywordMap["properties"] = ICE_GRID_PROPERTIES; keywordMap["property"] = ICE_GRID_PROPERTY; keywordMap["state"] = ICE_GRID_STATE; keywordMap["pid"] = ICE_GRID_PID; keywordMap["endpoints"] = ICE_GRID_ENDPOINTS; keywordMap["start"] = ICE_GRID_START; keywordMap["patch"] = ICE_GRID_PATCH; keywordMap["stop"] = ICE_GRID_STOP; keywordMap["signal"] = ICE_GRID_SIGNAL; keywordMap["stdout"] = ICE_GRID_STDOUT; keywordMap["stderr"] = ICE_GRID_STDERR; keywordMap["node"] = ICE_GRID_NODE; keywordMap["registry"] = ICE_GRID_REGISTRY; keywordMap["ping"] = ICE_GRID_PING; keywordMap["load"] = ICE_GRID_LOAD; keywordMap["processors"] = ICE_GRID_SOCKETS; keywordMap["sockets"] = ICE_GRID_SOCKETS; keywordMap["activation"] = ICE_GRID_ACTIVATION; keywordMap["object"] = ICE_GRID_OBJECT; keywordMap["find"] = ICE_GRID_FIND; keywordMap["show"] = ICE_GRID_SHOW; keywordMap["copying"] = ICE_GRID_COPYING; keywordMap["warranty"] = ICE_GRID_WARRANTY; keywordMap["diff"] = ICE_GRID_DIFF; keywordMap["update"] = ICE_GRID_UPDATE; keywordMap["instantiate"] = ICE_GRID_INSTANTIATE; keywordMap["template"] = ICE_GRID_TEMPLATE; keywordMap["service"] = ICE_GRID_SERVICE; keywordMap["enable"] = ICE_GRID_ENABLE; keywordMap["disable"] = ICE_GRID_DISABLE; } std::string parseDoubleQuotedString() { string s; while(true) { char c = static_cast(yyinput()); if(c == '"') { break; } else if(c == EOF) { parser->warning("EOF in string"); break; } else if(c == '\\') { char next = static_cast(yyinput()); switch(next) { case '\\': case '"': { s += next; break; } case 'n': { s += '\n'; break; } case 'r': { s += '\r'; break; } case 't': { s += '\t'; break; } case 'v': { s += '\v'; break; } case 'f': { s += '\f'; break; } default: { s += c; unput(next); } } } else { s += c; } } return s; } std::string parseSingleQuotedString() { string s; while(true) { char c = static_cast(yyinput()); if(c == '\'') { break; } else if(c == EOF) { parser->warning("EOF in string"); break; } else { s += c; } } return s; } } Ice-3.5.1/cpp/src/IceGrid/Util.cpp0000644000076400007640000001701712223561476014700 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace Ice; using namespace IceGrid; string IceGrid::toString(const vector& v, const string& sep) { ostringstream os; Ice::StringSeq::const_iterator p = v.begin(); while(p != v.end()) { os << *p; ++p; if(p != v.end()) { os << sep; } } return os.str(); } string IceGrid::toString(const Ice::Exception& exception) { std::ostringstream os; try { exception.ice_throw(); } catch(const NodeUnreachableException& ex) { os << ex << ":"; os << "\nnode: " << ex.name; os << "\nreason: " << ex.reason; } catch(const DeploymentException& ex) { os << ex << ":"; os << "\nreason: " << ex.reason; } catch(const Ice::Exception& ex) { os << ex; } return os.str(); } string IceGrid::getProperty(const PropertyDescriptorSeq& properties, const string& name, const string& def) { string result = def; for(PropertyDescriptorSeq::const_iterator q = properties.begin(); q != properties.end(); ++q) { if(q->name == name) { result = q->value; } } return result; } bool IceGrid::hasProperty(const PropertyDescriptorSeq& properties, const string& name) { for(PropertyDescriptorSeq::const_iterator q = properties.begin(); q != properties.end(); ++q) { if(q->name == name) { return true; } } return false; } PropertyDescriptor IceGrid::createProperty(const string& name, const string& value) { PropertyDescriptor prop; prop.name = name; prop.value = value; return prop; } string IceGrid::escapeProperty(const string& s, bool escapeEqual) { size_t firstChar = s.find_first_not_of(' '); size_t lastChar = s.find_last_not_of(' '); string result; bool previousCharIsEscape = false; for(unsigned int i = 0; i < s.size(); ++i) { char c = s[i]; switch(c) { case ' ': { // // We only escape the space character when it's at the beginning // or at the end of the string // if(i < firstChar || i > lastChar) { if(previousCharIsEscape) { result.push_back('\\'); // escape the previous char, by adding another escape. } result.push_back('\\'); } result.push_back(c); previousCharIsEscape = false; break; } case '\\': case '#': case '=': { if(c == '=' && !escapeEqual) { previousCharIsEscape = false; } else { // // We only escape the \ character when it is followed by a // character that we escape, e.g. \# is encoded as \\\#, not \# // and \\server is encoded as \\\server. // if(previousCharIsEscape) { result.push_back('\\'); // escape the previous char, by adding another escape. } if(c == '\\') { previousCharIsEscape = true; // deferring the potential escaping to the next loop } else { result.push_back('\\'); previousCharIsEscape = false; } } result.push_back(c); break; } default: { result.push_back(c); previousCharIsEscape = false; break; } } } return result; } ObjectInfo IceGrid::toObjectInfo(const Ice::CommunicatorPtr& communicator, const ObjectDescriptor& object, const string& adapterId) { ObjectInfo info; info.type = object.type; ostringstream proxyStr; proxyStr << "\"" << communicator->identityToString(object.id) << "\""; if(!object.proxyOptions.empty()) { proxyStr << ' ' << object.proxyOptions; } proxyStr << " @ " << adapterId; try { info.proxy = communicator->stringToProxy(proxyStr.str()); } catch(const Ice::ProxyParseException&) { ostringstream fallbackProxyStr; fallbackProxyStr << "\"" << communicator->identityToString(object.id) << "\"" << " @ " << adapterId; info.proxy = communicator->stringToProxy(fallbackProxyStr.str()); } return info; } void IceGrid::setupThreadPool(const PropertiesPtr& properties, const string& name, int size, int sizeMax, bool serialize) { if(properties->getPropertyAsIntWithDefault(name + ".Size", 0) < size) { ostringstream os; os << size; properties->setProperty(name + ".Size", os.str()); } else { size = properties->getPropertyAsInt(name + ".Size"); } if(sizeMax > 0 && properties->getPropertyAsIntWithDefault(name + ".SizeMax", 0) < sizeMax) { if(size >= sizeMax) { sizeMax = size * 10; } ostringstream os; os << sizeMax; properties->setProperty(name + ".SizeMax", os.str()); } if(serialize) { properties->setProperty(name + ".Serialize", "1"); } } int IceGrid::getMMVersion(const string& o) { // // Strip the version // string::size_type beg = o.find_first_not_of(' '); string::size_type end = o.find_last_not_of(' '); string version = o.substr(beg == string::npos ? 0 : beg, end == string::npos ? o.length() - 1 : end - beg + 1); string::size_type minorPos = version.find('.'); string::size_type patchPos = version.find('.', minorPos + 1); if(minorPos != 1 && minorPos != 2) { return -1; } if(patchPos != string::npos) { if((minorPos == 1 && patchPos != 3 && patchPos != 4) || (minorPos == 2 && patchPos != 4 && patchPos != 5)) { return -1; } else if((version.size() - patchPos - 1) > 2) { return -1; } } else if((version.size() - minorPos - 1) > 2) { return -1; } int v, ver; istringstream major(version.substr(0, minorPos)); major >> v; if(major.fail() || v > 99 || v < 1) { return -1; } ver = v; ver *= 100; istringstream minor(version.substr(minorPos + 1, patchPos != string::npos ? patchPos : version.size())); minor >> v; if(minor.fail() || v > 99 || v < 0) { return -1; } ver += v; ver *= 100; // // No need to get the patch number, we're only interested in // MAJOR.MINOR // // if(patchPos != string::npos) // { // istringstream patch(version.substr(patchPos + 1)); // patch >> v; // if(patch.fail() || v > 99 || v < 0) // { // return -1; // } // ver += v; // } return ver; } Ice-3.5.1/cpp/src/IceGrid/SessionI.h0000644000076400007640000001107212223561476015157 0ustar mesmes// ********************************************************************** // // 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 ICEGRID_SESSIONI_H #define ICEGRID_SESSIONI_H #include #include #include #include #include #include namespace IceGrid { class Database; typedef IceUtil::Handle DatabasePtr; class TraceLevels; typedef IceUtil::Handle TraceLevelsPtr; class AllocationRequest; typedef IceUtil::Handle AllocationRequestPtr; class Allocatable; typedef IceUtil::Handle AllocatablePtr; class SessionI; typedef IceUtil::Handle SessionIPtr; class BaseSessionI : virtual public Ice::Object, public IceUtil::Mutex { public: virtual ~BaseSessionI(); virtual void keepAlive(const Ice::Current&); IceUtil::Time timestamp() const; void shutdown(); Glacier2::IdentitySetPrx getGlacier2IdentitySet(); Glacier2::StringSetPrx getGlacier2AdapterIdSet(); const std::string& getId() const { return _id; } protected: virtual void destroyImpl(bool); BaseSessionI(const std::string&, const std::string&, const DatabasePtr&); const std::string _id; const std::string _prefix; const TraceLevelsPtr _traceLevels; const DatabasePtr _database; SessionServantManagerPtr _servantManager; bool _destroyed; IceUtil::Time _timestamp; }; typedef IceUtil::Handle BaseSessionIPtr; class SessionDestroyedException { }; class SessionI : public BaseSessionI, public Session { public: SessionI(const std::string&, const DatabasePtr&, const IceUtil::TimerPtr&); virtual ~SessionI(); Ice::ObjectPrx _register(const SessionServantManagerPtr&, const Ice::ConnectionPtr&); virtual void keepAlive(const Ice::Current& current) { BaseSessionI::keepAlive(current); } virtual void allocateObjectById_async(const AMD_Session_allocateObjectByIdPtr&, const Ice::Identity&, const Ice::Current&); virtual void allocateObjectByType_async(const AMD_Session_allocateObjectByTypePtr&, const std::string&, const Ice::Current&); virtual void releaseObject(const Ice::Identity&, const Ice::Current&); virtual void setAllocationTimeout(int, const Ice::Current&); virtual void destroy(const Ice::Current&); int getAllocationTimeout() const; const IceUtil::TimerPtr& getTimer() const { return _timer; } bool addAllocationRequest(const AllocationRequestPtr&); void removeAllocationRequest(const AllocationRequestPtr&); void addAllocation(const AllocatablePtr&); void removeAllocation(const AllocatablePtr&); protected: virtual void destroyImpl(bool); const IceUtil::TimerPtr _timer; int _allocationTimeout; std::set _requests; std::set _allocations; }; class ClientSessionFactory : virtual public IceUtil::Shared { public: ClientSessionFactory(const SessionServantManagerPtr&, const DatabasePtr&, const IceUtil::TimerPtr&, const ReapThreadPtr&); Glacier2::SessionPrx createGlacier2Session(const std::string&, const Glacier2::SessionControlPrx&); SessionIPtr createSessionServant(const std::string&, const Glacier2::SessionControlPrx&); const TraceLevelsPtr& getTraceLevels() const; private: const SessionServantManagerPtr _servantManager; const DatabasePtr _database; const IceUtil::TimerPtr _timer; const ReapThreadPtr _reaper; const bool _filters; }; typedef IceUtil::Handle ClientSessionFactoryPtr; class ClientSessionManagerI : virtual public Glacier2::SessionManager { public: ClientSessionManagerI(const ClientSessionFactoryPtr&); virtual Glacier2::SessionPrx create(const std::string&, const Glacier2::SessionControlPrx&, const Ice::Current&); private: const ClientSessionFactoryPtr _factory; }; class ClientSSLSessionManagerI : virtual public Glacier2::SSLSessionManager { public: ClientSSLSessionManagerI(const ClientSessionFactoryPtr&); virtual Glacier2::SessionPrx create(const Glacier2::SSLInfo&, const Glacier2::SessionControlPrx&, const Ice::Current&); private: const ClientSessionFactoryPtr _factory; }; }; #endif Ice-3.5.1/cpp/src/IceGrid/LocatorI.cpp0000644000076400007640000007364212223561476015505 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace IceGrid; namespace IceGrid { // // Callback from asynchronous call to adapter->getDirectProxy() invoked in LocatorI::findAdapterById_async(). // class AdapterGetDirectProxyCallback : virtual public IceUtil::Shared { public: AdapterGetDirectProxyCallback(const LocatorIPtr& locator, const LocatorAdapterInfo& adapter) : _locator(locator), _adapter(adapter) { } virtual void response(const ::Ice::ObjectPrx& obj) { assert(obj); _locator->getDirectProxyResponse(_adapter, obj); } virtual void exception(const ::Ice::Exception& e) { _locator->getDirectProxyException(_adapter, e); } private: const LocatorIPtr _locator; const LocatorAdapterInfo _adapter; }; class AdapterActivateCallback : virtual public IceUtil::Shared { public: AdapterActivateCallback(const LocatorIPtr& locator, const LocatorAdapterInfo& adapter) : _locator(locator), _adapter(adapter) { } virtual void response(const ::Ice::ObjectPrx& obj) { _locator->getDirectProxyResponse(_adapter, obj); } virtual void exception(const ::Ice::Exception& ex) { _locator->getDirectProxyException(_adapter, ex); } private: const LocatorIPtr _locator; const LocatorAdapterInfo _adapter; }; // // Callback from asynchrnous call to LocatorI::findAdapterById_async() // invoked in LocatorI::findObjectById_async(). // class AMD_Locator_findAdapterByIdI : public Ice::AMD_Locator_findAdapterById { public: AMD_Locator_findAdapterByIdI(const Ice::AMD_Locator_findObjectByIdPtr& cb, const Ice::ObjectPrx& obj) : _cb(cb), _obj(obj) { } virtual void ice_response(const ::Ice::ObjectPrx& obj) { // // If the adapter dummy direct proxy is not null, return a // proxy containing the identity we were looking for and the // endpoints of the adapter. // // If null, return the proxy registered with the object // registry. // if(obj) { _cb->ice_response(obj->ice_identity(_obj->ice_getIdentity())); } else { _cb->ice_response(_obj); } } virtual void ice_exception(const ::Ice::Exception& ex) { try { ex.ice_throw(); } catch(Ice::AdapterNotFoundException&) { // // We couldn't find the adapter, we ignore and return the // original proxy containing the adapter id. // _cb->ice_response(_obj); return; } catch(const Ice::Exception& ex) { // // Rethrow unexpected exception. // _cb->ice_exception(ex); return; } assert(false); } virtual void ice_exception(const std::exception& ex) { _cb->ice_exception(ex); } virtual void ice_exception() { _cb->ice_exception(); } private: const Ice::AMD_Locator_findObjectByIdPtr _cb; const Ice::ObjectPrx _obj; }; class AdapterRequest : public LocatorI::Request { public: AdapterRequest(const Ice::AMD_Locator_findAdapterByIdPtr& amdCB, const LocatorIPtr& locator, const Ice::EncodingVersion& encoding, const LocatorAdapterInfo& adapter) : _amdCB(amdCB), _locator(locator), _encoding(encoding), _adapter(adapter), _traceLevels(locator->getTraceLevels()) { assert(_adapter.proxy); } virtual void execute() { _locator->getDirectProxy(_adapter, this); } virtual void activating(const string&) { // Nothing to do. } virtual void response(const std::string& id, const Ice::ObjectPrx& proxy) { assert(proxy); // // Ensure the server supports the request encoding. // if(!IceInternal::isSupported(_encoding, proxy->ice_getEncodingVersion())) { exception(id, Ice::UnsupportedEncodingException(__FILE__, __LINE__, "server doesn't support requested encoding", _encoding, proxy->ice_getEncodingVersion())); return; } _amdCB->ice_response(proxy->ice_identity(_locator->getCommunicator()->stringToIdentity("dummy"))); } virtual void exception(const std::string&, const Ice::Exception& ex) { if(_traceLevels->locator > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat); out << "couldn't resolve adapter`" << _adapter.id << "' endpoints:\n" << toString(ex); } _amdCB->ice_response(0); } private: const Ice::AMD_Locator_findAdapterByIdPtr _amdCB; const LocatorIPtr _locator; const Ice::EncodingVersion _encoding; const LocatorAdapterInfo _adapter; const TraceLevelsPtr _traceLevels; }; class ReplicaGroupRequest : public LocatorI::Request, public IceUtil::Mutex { public: ReplicaGroupRequest(const Ice::AMD_Locator_findAdapterByIdPtr& amdCB, const LocatorIPtr& locator, const string& id, const Ice::EncodingVersion& encoding, const LocatorAdapterInfoSeq& adapters, int count, Ice::ObjectPrx firstProxy) : _amdCB(amdCB), _locator(locator), _id(id), _encoding(encoding), _adapters(adapters), _traceLevels(locator->getTraceLevels()), _count(count), _lastAdapter(_adapters.begin()) { assert(_adapters.empty() || _count > 0); if(_adapters.empty()) { _count = 0; } // // If the first adapter proxy is provided, store it in _proxies. // if(firstProxy) { assert(!_adapters.empty()); _proxies[_adapters[0].id] = firstProxy; ++_lastAdapter; } } virtual void execute() { // // Otherwise, request as many adapters as required. // LocatorAdapterInfoSeq adapters; { Lock sync(*this); for(unsigned int i = static_cast(_proxies.size()); i < _count; ++i) { if(_lastAdapter == _adapters.end()) { _count = i; break; } assert(_lastAdapter->proxy); adapters.push_back(*_lastAdapter); ++_lastAdapter; } // // If there's no adapters to request, we're done, send the // response. // if(_proxies.size() == _count) { sendResponse(); return; } } for(LocatorAdapterInfoSeq::const_iterator p = adapters.begin(); p != adapters.end(); ++p) { if(_locator->getDirectProxy(*p, this)) { activating(p->id); } } } virtual void activating(const string&) { // // An adapter is being activated. Don't wait for the activation to complete. Instead, // we query the next adapter which might be already active. // LocatorAdapterInfo adapter; do { Lock sync(*this); if(_lastAdapter == _adapters.end()) { break; } adapter = *_lastAdapter; ++_lastAdapter; } while(_locator->getDirectProxy(adapter, this)); } virtual void exception(const string& /*id*/, const Ice::Exception& ex) { LocatorAdapterInfo adapter; { Lock sync(*this); if(_proxies.size() == _count) // Nothing to do if we already sent the response. { return; } if(!_exception.get()) { _exception.reset(ex.ice_clone()); } if(_lastAdapter == _adapters.end()) { --_count; // Expect one less adapter proxy if there's no more adapters to query. // // If we received all the required proxies, it's time to send the // answer back to the client. // if(_count == _proxies.size()) { sendResponse(); } } else { adapter = *_lastAdapter; ++_lastAdapter; } } if(adapter.proxy) { if(_locator->getDirectProxy(adapter, this)) { activating(adapter.id); } } } virtual void response(const string& id, const Ice::ObjectPrx& proxy) { // // Ensure the server supports the request encoding. // if(proxy->ice_getEncodingVersion() < _encoding) { exception(id, Ice::UnsupportedEncodingException(__FILE__, __LINE__, "server doesn't support requested encoding", _encoding, proxy->ice_getEncodingVersion())); return; } Lock sync(*this); assert(proxy); if(_proxies.size() == _count) // Nothing to do if we already sent the response. { return; } _proxies[id] = proxy->ice_identity(_locator->getCommunicator()->stringToIdentity("dummy")); // // If we received all the required proxies, it's time to send the // answer back to the client. // if(_proxies.size() == _count) { sendResponse(); } } private: void sendResponse() { if(_proxies.size() == 1) { _amdCB->ice_response(_proxies.begin()->second); } else if(_proxies.empty()) { // // If there's no proxies, it's either because we couldn't contact the adapters or // because the replica group has no members. // assert(_exception.get() || _adapters.empty()); if(_traceLevels->locator > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat); out << "couldn't resolve replica group `" << _id << "' endpoints:\n"; out << (_exception.get() ? toString(*_exception) : string("replica group is empty")); } _amdCB->ice_response(0); } else if(_proxies.size() > 1) { Ice::EndpointSeq endpoints; endpoints.reserve(_proxies.size()); for(LocatorAdapterInfoSeq::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p) { map::const_iterator q = _proxies.find(p->id); if(q != _proxies.end()) { Ice::EndpointSeq edpts = q->second->ice_getEndpoints(); endpoints.insert(endpoints.end(), edpts.begin(), edpts.end()); } } Ice::ObjectPrx proxy = _locator->getCommunicator()->stringToProxy("dummy:default"); _amdCB->ice_response(proxy->ice_endpoints(endpoints)); } } const Ice::AMD_Locator_findAdapterByIdPtr _amdCB; const LocatorIPtr _locator; const std::string _id; const Ice::EncodingVersion _encoding; LocatorAdapterInfoSeq _adapters; const TraceLevelsPtr _traceLevels; unsigned int _count; LocatorAdapterInfoSeq::const_iterator _lastAdapter; std::map _proxies; IceUtil::UniquePtr _exception; }; class RoundRobinRequest : public LocatorI::Request, SynchronizationCallback, public IceUtil::Mutex { public: RoundRobinRequest(const Ice::AMD_Locator_findAdapterByIdPtr& amdCB, const LocatorIPtr& locator, const DatabasePtr database, const string& id, const Ice::EncodingVersion& encoding, const LocatorAdapterInfoSeq& adapters, int count) : _amdCB(amdCB), _locator(locator), _database(database), _id(id), _encoding(encoding), _adapters(adapters), _traceLevels(locator->getTraceLevels()), _count(count), _waitForActivation(false) { assert(_adapters.empty() || _count > 0); } virtual void execute() { if(_adapters.empty()) { if(_traceLevels->locator > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat); out << "couldn't resolve replica group `" << _id << "' endpoints:\nreplica group is empty"; } _amdCB->ice_response(0); return; } LocatorAdapterInfo adapter = _adapters[0]; assert(adapter.proxy); if(_locator->getDirectProxy(adapter, this)) { activating(adapter.id); } } virtual void activating(const string& id) { LocatorAdapterInfo adapter; adapter.id = id; do { Lock sync(*this); if(_adapters.empty() || _waitForActivation) { return; } _activatingOrFailed.insert(adapter.id); adapter = nextAdapter(); } while(adapter.proxy && _locator->getDirectProxy(adapter, this)); } virtual void response(const std::string& id, const Ice::ObjectPrx& proxy) { // // Ensure the server supports the request encoding. // if(proxy->ice_getEncodingVersion() < _encoding) { exception(id, Ice::UnsupportedEncodingException(__FILE__, __LINE__, "server doesn't support requested encoding", _encoding, proxy->ice_getEncodingVersion())); return; } Lock sync(*this); assert(proxy); if(_adapters.empty() || id != _adapters[0].id) { return; } if(_count > 1) { Ice::ObjectPrx p = proxy->ice_identity(_locator->getCommunicator()->stringToIdentity("dummy")); LocatorI::RequestPtr request = new ReplicaGroupRequest(_amdCB, _locator, _id, _encoding, _adapters, _count, p); request->execute(); } else { _amdCB->ice_response(proxy->ice_identity(_locator->getCommunicator()->stringToIdentity("dummy"))); } _adapters.clear(); } virtual void exception(const std::string& id, const Ice::Exception& ex) { LocatorAdapterInfo adapter; { Lock sync(*this); _failed.insert(id); _activatingOrFailed.insert(id); if(!_exception.get()) { _exception.reset(ex.ice_clone()); } if(_adapters.empty() || id != _adapters[0].id) { return; } adapter = nextAdapter(); } if(adapter.proxy && _locator->getDirectProxy(adapter, this)) { activating(adapter.id); } } void synchronized() { LocatorAdapterInfo adapter; { Lock sync(*this); assert(_adapters.empty()); adapter = nextAdapter(); } if(adapter.proxy && _locator->getDirectProxy(adapter, this)) { activating(adapter.id); } } void synchronized(const Ice::Exception& ex) { LocatorAdapterInfo adapter; { Lock sync(*this); assert(_adapters.empty()); if(_activatingOrFailed.size() > _failed.size()) { _waitForActivation = true; adapter = nextAdapter(); } else { if(_traceLevels->locator > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat); out << "couldn't resolve replica group `" << _id << "' endpoints:\n" << toString(ex); } _amdCB->ice_response(0); return; } } if(adapter.proxy && _locator->getDirectProxy(adapter, this)) { activating(adapter.id); } } private: LocatorAdapterInfo nextAdapter() { bool replicaGroup; bool roundRobin; _adapters.clear(); try { while(true) { try { if(!_waitForActivation) { _database->getLocatorAdapterInfo(_id, _adapters, _count, replicaGroup, roundRobin, _activatingOrFailed); } if(_waitForActivation || (_adapters.empty() && _activatingOrFailed.size() > _failed.size())) { // // If there are no more adapters to try and some servers were being activated, we // try again but this time we wait for the server activation. // _database->getLocatorAdapterInfo(_id, _adapters, _count, replicaGroup, roundRobin, _failed); _waitForActivation = true; } break; } catch(const SynchronizationException&) { assert(_adapters.empty()); bool callback; if(!_waitForActivation) { callback = _database->addAdapterSyncCallback(_id, this, _activatingOrFailed); } else { callback = _database->addAdapterSyncCallback(_id, this, _failed); } if(callback) { return LocatorAdapterInfo(); } } } if(!roundRobin) { try { Ice::Current current; current.encoding = _encoding; _locator->findAdapterById_async(_amdCB, _id, current); } catch(const Ice::Exception& ex) { _amdCB->ice_exception(ex); } _adapters.clear(); return LocatorAdapterInfo(); } else if(!_adapters.empty()) { return _adapters[0]; } else { assert(_adapters.empty()); if(_traceLevels->locator > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat); out << "couldn't resolve replica group `" << _id << "' endpoints:\n"; out << (_exception.get() ? toString(*_exception) : string("replica group is empty")); } _amdCB->ice_response(0); return LocatorAdapterInfo(); } } catch(const AdapterNotExistException&) { assert(_adapters.empty()); _amdCB->ice_exception(Ice::AdapterNotFoundException()); return LocatorAdapterInfo(); } catch(const Ice::Exception& ex) { assert(_adapters.empty()); if(_traceLevels->locator > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat); out << "couldn't resolve replica group `" << _id << "' endpoints:\n" << toString(ex); } _amdCB->ice_response(0); return LocatorAdapterInfo(); } } const Ice::AMD_Locator_findAdapterByIdPtr _amdCB; const LocatorIPtr _locator; const DatabasePtr _database; const std::string _id; const Ice::EncodingVersion _encoding; LocatorAdapterInfoSeq _adapters; const TraceLevelsPtr _traceLevels; int _count; bool _waitForActivation; set _failed; set _activatingOrFailed; IceUtil::UniquePtr _exception; }; class FindAdapterByIdCallback : public SynchronizationCallback { public: FindAdapterByIdCallback(const LocatorIPtr& locator, const Ice::AMD_Locator_findAdapterByIdPtr& cb, const string& id, const Ice::Current& current) : _locator(locator), _cb(cb), _id(id), _current(current) { } virtual void synchronized() { try { _locator->findAdapterById_async(_cb, _id, _current); } catch(const Ice::Exception& ex) { _cb->ice_exception(ex); } } virtual void synchronized(const Ice::Exception& ex) { try { ex.ice_throw(); } catch(const AdapterNotExistException&) { } catch(const Ice::Exception& ex) { const TraceLevelsPtr traceLevels = _locator->getTraceLevels(); if(traceLevels->locator > 0) { Ice::Trace out(traceLevels->logger, traceLevels->locatorCat); out << "couldn't resolve adapter `" << _id << "' endpoints:\n" << toString(ex); } } _cb->ice_response(0); } private: const LocatorIPtr _locator; const Ice::AMD_Locator_findAdapterByIdPtr _cb; const string _id; const Ice::Current _current; }; }; LocatorI::LocatorI(const Ice::CommunicatorPtr& communicator, const DatabasePtr& database, const Ice::LocatorRegistryPrx& locatorRegistry, const RegistryPrx& registry, const QueryPrx& query) : _communicator(communicator), _database(database), _locatorRegistry(locatorRegistry), _localRegistry(registry), _localQuery(query) { } // // Find an object by identity. The object is searched in the object // registry. // void LocatorI::findObjectById_async(const Ice::AMD_Locator_findObjectByIdPtr& cb, const Ice::Identity& id, const Ice::Current&) const { try { cb->ice_response(_database->getObjectProxy(id)); } catch(const ObjectNotRegisteredException&) { throw Ice::ObjectNotFoundException(); } } // // Find an adapter by identity. The object is searched in the adapter // registry. If found, we try to get its direct proxy. // void LocatorI::findAdapterById_async(const Ice::AMD_Locator_findAdapterByIdPtr& cb, const string& id, const Ice::Current& current) const { LocatorIPtr self = const_cast(this); bool replicaGroup = false; try { // // NOTE: getProxies() might throw if the adapter is a server // adapter and the node is unreachable (it doesn't throw for // replica groups). // int count; LocatorAdapterInfoSeq adapters; bool roundRobin; while(true) { try { _database->getLocatorAdapterInfo(id, adapters, count, replicaGroup, roundRobin); break; } catch(const SynchronizationException&) { if(_database->addAdapterSyncCallback(id, new FindAdapterByIdCallback(self, cb, id, current))) { return; } } } RequestPtr request; if(roundRobin) { request = new RoundRobinRequest(cb, self, _database, id, current.encoding, adapters, count); } else if(replicaGroup) { request = new ReplicaGroupRequest(cb, self, id, current.encoding, adapters, count, 0); } else { assert(adapters.size() == 1); request = new AdapterRequest(cb, self, current.encoding, adapters[0]); } request->execute(); return; } catch(const AdapterNotExistException&) { } catch(const Ice::Exception& ex) { const TraceLevelsPtr traceLevels = _database->getTraceLevels(); if(traceLevels->locator > 0) { Ice::Trace out(traceLevels->logger, traceLevels->locatorCat); if(replicaGroup) { out << "couldn't resolve replica group `" << id << "' endpoints:\n" << toString(ex); } else { out << "couldn't resolve adapter `" << id << "' endpoints:\n" << toString(ex); } } cb->ice_response(0); return; } try { cb->ice_response(_database->getAdapterDirectProxy(id, current.encoding)); } catch(const AdapterNotExistException&) { cb->ice_exception(Ice::AdapterNotFoundException()); } } Ice::LocatorRegistryPrx LocatorI::getRegistry(const Ice::Current&) const { return _locatorRegistry; } RegistryPrx LocatorI::getLocalRegistry(const Ice::Current&) const { return _localRegistry; } QueryPrx LocatorI::getLocalQuery(const Ice::Current&) const { return _localQuery; } const Ice::CommunicatorPtr& LocatorI::getCommunicator() const { return _communicator; } const TraceLevelsPtr& LocatorI::getTraceLevels() const { return _database->getTraceLevels(); } bool LocatorI::getDirectProxy(const LocatorAdapterInfo& adapter, const RequestPtr& request) { { Lock sync(*this); PendingRequestsMap::iterator p = _pendingRequests.find(adapter.id); if(p != _pendingRequests.end()) { p->second.push_back(request); return _activating.find(adapter.id) != _activating.end(); } PendingRequests requests; requests.push_back(request); _pendingRequests.insert(make_pair(adapter.id, requests)); } adapter.proxy->begin_getDirectProxy(newCallback_Adapter_getDirectProxy( new AdapterGetDirectProxyCallback(this, adapter), &AdapterGetDirectProxyCallback::response, &AdapterGetDirectProxyCallback::exception)); return false; } void LocatorI::getDirectProxyResponse(const LocatorAdapterInfo& adapter, const Ice::ObjectPrx& proxy) { PendingRequests requests; { Lock sync(*this); PendingRequestsMap::iterator p = _pendingRequests.find(adapter.id); assert(p != _pendingRequests.end()); requests.swap(p->second); _pendingRequests.erase(p); _activating.erase(adapter.id); } if(proxy) { for(PendingRequests::iterator q = requests.begin(); q != requests.end(); ++q) { (*q)->response(adapter.id, proxy); } } else { for(PendingRequests::iterator q = requests.begin(); q != requests.end(); ++q) { (*q)->exception(adapter.id, AdapterNotActiveException()); } } } void LocatorI::getDirectProxyException(const LocatorAdapterInfo& adapter, const Ice::Exception& ex) { bool activate = false; try { ex.ice_throw(); } catch(const AdapterNotActiveException& e) { activate = e.activatable; } catch(const Ice::Exception&) { } PendingRequests requests; { Lock sync(*this); PendingRequestsMap::iterator p = _pendingRequests.find(adapter.id); assert(p != _pendingRequests.end()); if(activate) { _activating.insert(adapter.id); requests = p->second; } else { requests.swap(p->second); _pendingRequests.erase(p); _activating.erase(adapter.id); } } if(activate) { for(PendingRequests::iterator q = requests.begin(); q != requests.end(); ++q) { (*q)->activating(adapter.id); } int timeout = adapter.activationTimeout + adapter.deactivationTimeout; AdapterPrx::uncheckedCast(adapter.proxy->ice_timeout(timeout * 1000))->begin_activate( newCallback_Adapter_activate(new AdapterActivateCallback(this, adapter), &AdapterActivateCallback::response, &AdapterActivateCallback::exception)); } else { for(PendingRequests::iterator q = requests.begin(); q != requests.end(); ++q) { (*q)->exception(adapter.id, ex); } } } Ice-3.5.1/cpp/src/IceGrid/Parser.h0000644000076400007640000001277612223561476014673 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_PARSER_H #define ICE_GRID_PARSER_H #include #include #include #include #include // // Stuff for flex and bison // #define YYSTYPE std::list #define YY_DECL int yylex(YYSTYPE* yylvalp) YY_DECL; int yyparse(); // // I must set the initial stack depth to the maximum stack depth to // disable bison stack resizing. The bison stack resizing routines use // simple malloc/alloc/memcpy calls, which do not work for the // YYSTYPE, since YYSTYPE is a C++ type, with constructor, destructor, // assignment operator, etc. // #define YYMAXDEPTH 10000 // 10000 should suffice. Bison default is 10000 as maximum. #define YYINITDEPTH YYMAXDEPTH // Initial depth is set to max depth, for the reasons described above. // // Newer bison versions allow to disable stack resizing by defining // yyoverflow. // #define yyoverflow(a, b, c, d, e, f) yyerror(a) namespace IceGrid { class Parser; typedef ::IceUtil::Handle ParserPtr; } namespace IceGrid { class Parser : public ::IceUtil::SimpleShared, IceUtil::Monitor { public: static ParserPtr createParser(const Ice::CommunicatorPtr&, const AdminSessionPrx&, const AdminPrx&, bool); void usage(); void usage(const std::string&, const std::string& = std::string()); void usage(const std::string&, const std::list&); void interrupt(); bool interrupted() const; void resetInterrupt(); void checkInterrupted(); void addApplication(const std::list&); void removeApplication(const std::list&); void describeApplication(const std::list&); void diffApplication(const std::list&); void updateApplication(const std::list&); void patchApplication(const std::list&); void listAllApplications(const std::list&); void describeServerTemplate(const std::list&); void describeServiceTemplate(const std::list&); void instantiateServerTemplate(const std::list&); void describeNode(const std::list&); void pingNode(const std::list&); void printLoadNode(const std::list&); void printNodeProcessorSockets(const std::list&); void shutdownNode(const std::list&); void listAllNodes(const std::list&); void describeRegistry(const std::list&); void pingRegistry(const std::list&); void shutdownRegistry(const std::list&); void listAllRegistries(const std::list&); void removeServer(const std::list&); void startServer(const std::list&); void stopServer(const std::list&); void patchServer(const std::list&); void signalServer(const std::list&); void writeMessage(const std::list&, int fd); void describeServer(const std::list&); void stateServer(const std::list&); void enableServer(const std::list&, bool); void pidServer(const std::list&); void propertiesServer(const std::list&, bool); void listAllServers(const std::list&); void startService(const std::list&); void stopService(const std::list&); void propertiesService(const std::list&, bool); void describeService(const std::list&); void listServices(const std::list&); void endpointsAdapter(const std::list&); void removeAdapter(const std::list&); void listAllAdapters(const std::list&); void addObject(const std::list&); void removeObject(const std::list&); void findObject(const std::list&); void describeObject(const std::list&); void listObject(const std::list&); void showFile(const std::string&, const std::list&); void showBanner(); void showCopying(); void showWarranty(); void getInput(char*, int&, int); void continueLine(); const char* getPrompt(); void invalidCommand(const char*); void invalidCommand(const std::string&); void invalidCommand(const std::string&, const std::string&); void invalidCommand(const std::list&); std::string patchFailed(const Ice::StringSeq&); void error(const char*); void error(const std::string&); void warning(const char*); void warning(const std::string&); int parse(FILE*, bool); int parse(const std::string&, bool); private: Parser(const Ice::CommunicatorPtr&, const AdminSessionPrx&, const AdminPrx&, bool); void exception(const Ice::Exception&); std::string _commands; Ice::CommunicatorPtr _communicator; AdminSessionPrx _session; AdminPrx _admin; bool _continue; bool _interrupted; int _errors; bool _interactive; std::map< std::string, std::map > _helpCommands; }; extern Parser* parser; // The current parser for bison/flex } #endif Ice-3.5.1/cpp/src/IceGrid/Topics.h0000644000076400007640000001301712223561476014665 0ustar mesmes// ********************************************************************** // // 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 ICEGRID_TOPICS_H #define ICEGRID_TOPICS_H #include #include #include #include #include #include namespace IceGrid { class ObserverTopic : public IceUtil::Monitor, virtual public Ice::Object { public: ObserverTopic(const IceStorm::TopicManagerPrx&, const std::string&, Ice::Long = 0); virtual ~ObserverTopic(); int subscribe(const Ice::ObjectPrx&, const std::string& = std::string()); void unsubscribe(const Ice::ObjectPrx&, const std::string& = std::string()); void destroy(); void receivedUpdate(const std::string&, int, const std::string&); virtual void initObserver(const Ice::ObjectPrx&) = 0; void waitForSyncedSubscribers(int, const std::string& = std::string()); int getSerial() const; protected: void addExpectedUpdate(int, const std::string& = std::string()); void waitForSyncedSubscribersNoSync(int, const std::string& = std::string()); void updateSerial(Ice::Long = 0); Ice::Context getContext(int, Ice::Long = 0) const; template std::vector getPublishers() const { std::vector publishers; for(std::vector::const_iterator p = _basePublishers.begin(); p != _basePublishers.end(); ++p) { publishers.push_back(T::uncheckedCast(*p)); } return publishers; } Ice::LoggerPtr _logger; std::map _topics; std::vector _basePublishers; int _serial; Ice::Long _dbSerial; std::set _syncSubscribers; std::map > _waitForUpdates; std::map > _updateFailures; }; typedef IceUtil::Handle ObserverTopicPtr; class RegistryObserverTopic : public ObserverTopic { public: RegistryObserverTopic(const IceStorm::TopicManagerPrx&); void registryUp(const RegistryInfo&); void registryDown(const std::string&); virtual void initObserver(const Ice::ObjectPrx&); private: std::vector _publishers; std::map _registries; }; typedef IceUtil::Handle RegistryObserverTopicPtr; class NodeObserverTopic : public ObserverTopic, public NodeObserver { public: NodeObserverTopic(const IceStorm::TopicManagerPrx&, const Ice::ObjectAdapterPtr&); virtual void nodeInit(const NodeDynamicInfoSeq&, const Ice::Current&); virtual void nodeUp(const NodeDynamicInfo&, const Ice::Current&); virtual void nodeDown(const std::string&, const Ice::Current&); virtual void updateServer(const std::string&, const ServerDynamicInfo&, const Ice::Current&); virtual void updateAdapter(const std::string&, const AdapterDynamicInfo&, const Ice::Current&); const NodeObserverPrx& getPublisher() { return _externalPublisher; } void nodeDown(const std::string&); virtual void initObserver(const Ice::ObjectPrx&); private: const NodeObserverPrx _externalPublisher; std::vector _publishers; std::map _nodes; }; typedef IceUtil::Handle NodeObserverTopicPtr; class ApplicationObserverTopic : public ObserverTopic { public: ApplicationObserverTopic(const IceStorm::TopicManagerPrx&, const ApplicationsWrapperPtr&); int applicationInit(Ice::Long, const ApplicationInfoSeq&); int applicationAdded(Ice::Long, const ApplicationInfo&); int applicationRemoved(Ice::Long, const std::string&); int applicationUpdated(Ice::Long, const ApplicationUpdateInfo&); virtual void initObserver(const Ice::ObjectPrx&); private: std::vector _publishers; std::map _applications; }; typedef IceUtil::Handle ApplicationObserverTopicPtr; class AdapterObserverTopic : public ObserverTopic { public: AdapterObserverTopic(const IceStorm::TopicManagerPrx&, const AdaptersWrapperPtr&); int adapterInit(Ice::Long, const AdapterInfoSeq&); int adapterAdded(Ice::Long, const AdapterInfo&); int adapterUpdated(Ice::Long, const AdapterInfo&); int adapterRemoved(Ice::Long, const std::string&); virtual void initObserver(const Ice::ObjectPrx&); private: std::vector _publishers; std::map _adapters; }; typedef IceUtil::Handle AdapterObserverTopicPtr; class ObjectObserverTopic : public ObserverTopic { public: ObjectObserverTopic(const IceStorm::TopicManagerPrx&, const ObjectsWrapperPtr&); int objectInit(Ice::Long, const ObjectInfoSeq&); int objectAdded(Ice::Long, const ObjectInfo&); int objectUpdated(Ice::Long, const ObjectInfo&); int objectRemoved(Ice::Long, const Ice::Identity&); int wellKnownObjectsAddedOrUpdated(const ObjectInfoSeq&); int wellKnownObjectsRemoved(const ObjectInfoSeq&); virtual void initObserver(const Ice::ObjectPrx&); private: std::vector _publishers; std::map _objects; }; typedef IceUtil::Handle ObjectObserverTopicPtr; }; #endif Ice-3.5.1/cpp/src/IceGrid/Grammar.y0000644000076400007640000003630012223561476015033 0ustar mesmes%{ // ********************************************************************** // // 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 #include #ifdef _MSC_VER // I get these warnings from some bison versions: // warning C4102: 'yyoverflowlab' : unreferenced label # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) #endif using namespace std; using namespace Ice; using namespace IceGrid; void yyerror(const char* s) { parser->invalidCommand(s); } %} %pure_parser // // All keyword tokens. Make sure to modify the "keyword" rule in this // file if the list of keywords is changed. Also make sure to add the // keyword to the keyword table in Scanner.l. // %token ICE_GRID_HELP %token ICE_GRID_EXIT %token ICE_GRID_APPLICATION %token ICE_GRID_NODE %token ICE_GRID_REGISTRY %token ICE_GRID_SERVER %token ICE_GRID_ADAPTER %token ICE_GRID_PING %token ICE_GRID_LOAD %token ICE_GRID_SOCKETS %token ICE_GRID_ADD %token ICE_GRID_REMOVE %token ICE_GRID_LIST %token ICE_GRID_SHUTDOWN %token ICE_GRID_STRING %token ICE_GRID_START %token ICE_GRID_STOP %token ICE_GRID_PATCH %token ICE_GRID_SIGNAL %token ICE_GRID_STDOUT %token ICE_GRID_STDERR %token ICE_GRID_DESCRIBE %token ICE_GRID_PROPERTIES %token ICE_GRID_PROPERTY %token ICE_GRID_STATE %token ICE_GRID_PID %token ICE_GRID_ENDPOINTS %token ICE_GRID_ACTIVATION %token ICE_GRID_OBJECT %token ICE_GRID_FIND %token ICE_GRID_SHOW %token ICE_GRID_COPYING %token ICE_GRID_WARRANTY %token ICE_GRID_DIFF %token ICE_GRID_UPDATE %token ICE_GRID_INSTANTIATE %token ICE_GRID_TEMPLATE %token ICE_GRID_SERVICE %token ICE_GRID_ENABLE %token ICE_GRID_DISABLE %% // ---------------------------------------------------------------------- start // ---------------------------------------------------------------------- : commands { } | { } ; // ---------------------------------------------------------------------- commands // ---------------------------------------------------------------------- : commands checkInterrupted command { } | checkInterrupted command { } ; checkInterrupted : { parser->checkInterrupted(); } ; // ---------------------------------------------------------------------- command // ---------------------------------------------------------------------- : ICE_GRID_HELP ';' { parser->usage(); } | ICE_GRID_EXIT ';' { return 0; } | ICE_GRID_APPLICATION ICE_GRID_ADD strings ';' { parser->addApplication($3); } | ICE_GRID_APPLICATION ICE_GRID_ADD ICE_GRID_HELP ';' { parser->usage("application", "add"); } | ICE_GRID_APPLICATION ICE_GRID_REMOVE strings ';' { parser->removeApplication($3); } | ICE_GRID_APPLICATION ICE_GRID_REMOVE ICE_GRID_HELP ';' { parser->usage("application", "remove"); } | ICE_GRID_APPLICATION ICE_GRID_DIFF strings ';' { parser->diffApplication($3); } | ICE_GRID_APPLICATION ICE_GRID_DIFF ICE_GRID_HELP ';' { parser->usage("application", "diff"); } | ICE_GRID_APPLICATION ICE_GRID_UPDATE strings ';' { parser->updateApplication($3); } | ICE_GRID_APPLICATION ICE_GRID_UPDATE ICE_GRID_HELP ';' { parser->usage("application", "update"); } | ICE_GRID_APPLICATION ICE_GRID_DESCRIBE strings ';' { parser->describeApplication($3); } | ICE_GRID_APPLICATION ICE_GRID_DESCRIBE ICE_GRID_HELP ';' { parser->usage("application", "describe"); } | ICE_GRID_APPLICATION ICE_GRID_PATCH strings ';' { parser->patchApplication($3); } | ICE_GRID_APPLICATION ICE_GRID_PATCH ICE_GRID_HELP ';' { parser->usage("application", "patch"); } | ICE_GRID_APPLICATION ICE_GRID_LIST strings ';' { parser->listAllApplications($3); } | ICE_GRID_APPLICATION ICE_GRID_LIST ICE_GRID_HELP ';' { parser->usage("application", "list"); } | ICE_GRID_SERVER ICE_GRID_TEMPLATE ICE_GRID_DESCRIBE strings ';' { parser->describeServerTemplate($4); } | ICE_GRID_SERVER ICE_GRID_TEMPLATE ICE_GRID_DESCRIBE ICE_GRID_HELP ';' { parser->usage("server template", "describe"); } | ICE_GRID_SERVER ICE_GRID_TEMPLATE ICE_GRID_INSTANTIATE strings ';' { parser->instantiateServerTemplate($4); } | ICE_GRID_SERVER ICE_GRID_TEMPLATE ICE_GRID_INSTANTIATE ICE_GRID_HELP ';' { parser->usage("server template", "instantiate"); } | ICE_GRID_SERVER ICE_GRID_TEMPLATE ICE_GRID_HELP ';' { parser->usage("server template"); } | ICE_GRID_SERVICE ICE_GRID_TEMPLATE ICE_GRID_DESCRIBE strings ';' { parser->describeServiceTemplate($4); } | ICE_GRID_SERVICE ICE_GRID_TEMPLATE ICE_GRID_DESCRIBE ICE_GRID_HELP ';' { parser->usage("service template", "describe"); } | ICE_GRID_SERVICE ICE_GRID_TEMPLATE ICE_GRID_HELP ';' { parser->usage("service template"); } | ICE_GRID_NODE ICE_GRID_DESCRIBE strings ';' { parser->describeNode($3); } | ICE_GRID_NODE ICE_GRID_DESCRIBE ICE_GRID_HELP ';' { parser->usage("node", "describe"); } | ICE_GRID_NODE ICE_GRID_PING strings ';' { parser->pingNode($3); } | ICE_GRID_NODE ICE_GRID_PING ICE_GRID_HELP ';' { parser->usage("node", "ping"); } | ICE_GRID_NODE ICE_GRID_LOAD strings ';' { parser->printLoadNode($3); } | ICE_GRID_NODE ICE_GRID_LOAD ICE_GRID_HELP ';' { parser->usage("node", "load"); } | ICE_GRID_NODE ICE_GRID_SOCKETS strings ';' { parser->printNodeProcessorSockets($3); } | ICE_GRID_NODE ICE_GRID_SOCKETS ICE_GRID_HELP ';' { parser->usage("node", "sockets"); } | ICE_GRID_NODE ICE_GRID_SHUTDOWN strings ';' { parser->shutdownNode($3); } | ICE_GRID_NODE ICE_GRID_SHUTDOWN ICE_GRID_HELP ';' { parser->usage("node", "shutdown"); } | ICE_GRID_NODE ICE_GRID_LIST strings ';' { parser->listAllNodes($3); } | ICE_GRID_NODE ICE_GRID_LIST ICE_GRID_HELP ';' { parser->usage("node", "list"); } | ICE_GRID_NODE ICE_GRID_SHOW strings ';' { parser->showFile("node", $3); } | ICE_GRID_NODE ICE_GRID_SHOW ICE_GRID_HELP ';' { parser->usage("node", "show"); } | ICE_GRID_REGISTRY ICE_GRID_DESCRIBE strings ';' { parser->describeRegistry($3); } | ICE_GRID_REGISTRY ICE_GRID_DESCRIBE ICE_GRID_HELP ';' { parser->usage("registry", "describe"); } | ICE_GRID_REGISTRY ICE_GRID_PING strings ';' { parser->pingRegistry($3); } | ICE_GRID_REGISTRY ICE_GRID_PING ICE_GRID_HELP ';' { parser->usage("registry", "ping"); } | ICE_GRID_REGISTRY ICE_GRID_SHUTDOWN strings ';' { parser->shutdownRegistry($3); } | ICE_GRID_REGISTRY ICE_GRID_SHUTDOWN ICE_GRID_HELP ';' { parser->usage("registry", "shutdown"); } | ICE_GRID_REGISTRY ICE_GRID_LIST strings ';' { parser->listAllRegistries($3); } | ICE_GRID_REGISTRY ICE_GRID_LIST ICE_GRID_HELP ';' { parser->usage("registry", "list"); } | ICE_GRID_REGISTRY ICE_GRID_SHOW strings ';' { parser->showFile("registry", $3); } | ICE_GRID_REGISTRY ICE_GRID_SHOW ICE_GRID_HELP ';' { parser->usage("registry", "show"); } | ICE_GRID_SERVER ICE_GRID_REMOVE strings ';' { parser->removeServer($3); } | ICE_GRID_SERVER ICE_GRID_REMOVE ICE_GRID_HELP ';' { parser->usage("server", "remove"); } | ICE_GRID_SERVER ICE_GRID_DESCRIBE strings ';' { parser->describeServer($3); } | ICE_GRID_SERVER ICE_GRID_DESCRIBE ICE_GRID_HELP ';' { parser->usage("server", "describe"); } | ICE_GRID_SERVER ICE_GRID_START strings ';' { parser->startServer($3); } | ICE_GRID_SERVER ICE_GRID_START ICE_GRID_HELP ';' { parser->usage("server", "start"); } | ICE_GRID_SERVER ICE_GRID_STOP strings ';' { parser->stopServer($3); } | ICE_GRID_SERVER ICE_GRID_STOP ICE_GRID_HELP ';' { parser->usage("server", "stop"); } | ICE_GRID_SERVER ICE_GRID_PATCH strings ';' { parser->patchServer($3); } | ICE_GRID_SERVER ICE_GRID_PATCH ICE_GRID_HELP ';' { parser->usage("server", "patch"); } | ICE_GRID_SERVER ICE_GRID_SIGNAL strings ';' { parser->signalServer($3); } | ICE_GRID_SERVER ICE_GRID_SIGNAL ICE_GRID_HELP ';' { parser->usage("server", "signal"); } | ICE_GRID_SERVER ICE_GRID_STDOUT strings ';' { parser->writeMessage($3, 1); } | ICE_GRID_SERVER ICE_GRID_STDOUT ICE_GRID_HELP ';' { parser->usage("server", "stdout"); } | ICE_GRID_SERVER ICE_GRID_STDERR strings ';' { parser->writeMessage($3, 2); } | ICE_GRID_SERVER ICE_GRID_STDERR ICE_GRID_HELP ';' { parser->usage("server", "stderr"); } | ICE_GRID_SERVER ICE_GRID_STATE strings ';' { parser->stateServer($3); } | ICE_GRID_SERVER ICE_GRID_STATE ICE_GRID_HELP ';' { parser->usage("server", "start"); } | ICE_GRID_SERVER ICE_GRID_PID strings ';' { parser->pidServer($3); } | ICE_GRID_SERVER ICE_GRID_PID ICE_GRID_HELP ';' { parser->usage("server", "pid"); } | ICE_GRID_SERVER ICE_GRID_PROPERTIES strings ';' { parser->propertiesServer($3, false); } | ICE_GRID_SERVER ICE_GRID_PROPERTIES ICE_GRID_HELP ';' { parser->usage("server", "properties"); } | ICE_GRID_SERVER ICE_GRID_PROPERTY strings ';' { parser->propertiesServer($3, true); } | ICE_GRID_SERVER ICE_GRID_PROPERTY ICE_GRID_HELP ';' { parser->usage("server", "property"); } | ICE_GRID_SERVER ICE_GRID_ENABLE strings ';' { parser->enableServer($3, true); } | ICE_GRID_SERVER ICE_GRID_ENABLE ICE_GRID_HELP ';' { parser->usage("server", "enable"); } | ICE_GRID_SERVER ICE_GRID_DISABLE strings ';' { parser->enableServer($3, false); } | ICE_GRID_SERVER ICE_GRID_DISABLE ICE_GRID_HELP ';' { parser->usage("server", "disable"); } | ICE_GRID_SERVER ICE_GRID_LIST strings ';' { parser->listAllServers($3); } | ICE_GRID_SERVER ICE_GRID_LIST ICE_GRID_HELP ';' { parser->usage("server", "list"); } | ICE_GRID_SERVER ICE_GRID_SHOW strings ';' { parser->showFile("server", $3); } | ICE_GRID_SERVER ICE_GRID_SHOW ICE_GRID_HELP ';' { parser->usage("server", "show"); } | ICE_GRID_SERVICE ICE_GRID_START strings ';' { parser->startService($3); } | ICE_GRID_SERVICE ICE_GRID_START ICE_GRID_HELP ';' { parser->usage("service", "start"); } | ICE_GRID_SERVICE ICE_GRID_STOP strings ';' { parser->stopService($3); } | ICE_GRID_SERVICE ICE_GRID_STOP ICE_GRID_HELP ';' { parser->usage("service", "stop"); } | ICE_GRID_SERVICE ICE_GRID_DESCRIBE strings ';' { parser->describeService($3); } | ICE_GRID_SERVICE ICE_GRID_DESCRIBE ICE_GRID_HELP ';' { parser->usage("service", "describe"); } | ICE_GRID_SERVICE ICE_GRID_PROPERTIES strings ';' { parser->propertiesService($3, false); } | ICE_GRID_SERVICE ICE_GRID_PROPERTIES ICE_GRID_HELP ';' { parser->usage("service", "properties"); } | ICE_GRID_SERVICE ICE_GRID_PROPERTY strings ';' { parser->propertiesService($3, true); } | ICE_GRID_SERVICE ICE_GRID_PROPERTY ICE_GRID_HELP ';' { parser->usage("service", "property"); } | ICE_GRID_SERVICE ICE_GRID_LIST strings ';' { parser->listServices($3); } | ICE_GRID_SERVICE ICE_GRID_LIST ICE_GRID_HELP ';' { parser->usage("service", "list"); } | ICE_GRID_ADAPTER ICE_GRID_ENDPOINTS strings ';' { parser->endpointsAdapter($3); } | ICE_GRID_ADAPTER ICE_GRID_ENDPOINTS ICE_GRID_HELP ';' { parser->usage("adapter", "endpoints"); } | ICE_GRID_ADAPTER ICE_GRID_REMOVE strings ';' { parser->removeAdapter($3); } | ICE_GRID_ADAPTER ICE_GRID_REMOVE ICE_GRID_HELP ';' { parser->usage("adapter", "remove"); } | ICE_GRID_ADAPTER ICE_GRID_LIST strings ';' { parser->listAllAdapters($3); } | ICE_GRID_ADAPTER ICE_GRID_LIST ICE_GRID_HELP ';' { parser->usage("adapter", "list"); } | ICE_GRID_OBJECT ICE_GRID_ADD strings ';' { parser->addObject($3); } | ICE_GRID_OBJECT ICE_GRID_ADD ICE_GRID_HELP ';' { parser->usage("object", "add"); } | ICE_GRID_OBJECT ICE_GRID_REMOVE strings ';' { parser->removeObject($3); } | ICE_GRID_OBJECT ICE_GRID_REMOVE ICE_GRID_HELP ';' { parser->usage("object", "remove"); } | ICE_GRID_OBJECT ICE_GRID_FIND strings ';' { parser->findObject($3); } | ICE_GRID_OBJECT ICE_GRID_FIND ICE_GRID_HELP ';' { parser->usage("object", "find"); } | ICE_GRID_OBJECT ICE_GRID_LIST strings ';' { parser->listObject($3); } | ICE_GRID_OBJECT ICE_GRID_LIST ICE_GRID_HELP ';' { parser->usage("object", "list"); } | ICE_GRID_OBJECT ICE_GRID_DESCRIBE strings ';' { parser->describeObject($3); } | ICE_GRID_OBJECT ICE_GRID_DESCRIBE ICE_GRID_HELP ';' { parser->usage("object", "describe"); } | ICE_GRID_SHOW ICE_GRID_COPYING ';' { parser->showCopying(); } | ICE_GRID_SHOW ICE_GRID_WARRANTY ';' { parser->showWarranty(); } | ICE_GRID_HELP keyword ';' { parser->usage($2.front()); } | ICE_GRID_HELP keyword keyword ';' { if(($2.front() == "server" || $2.front() == "service") && $3.front() == "template") { parser->usage($2.front() + " " + $3.front()); } else { parser->usage($2.front(), $3.front()); } } | ICE_GRID_HELP keyword ICE_GRID_STRING strings ';' { parser->usage($2.front(), $3.front()); } | ICE_GRID_HELP keyword keyword keyword ';' { if(($2.front() == "server" || $2.front() == "service") && $3.front() == "template") { parser->usage($2.front() + " " + $3.front(), $4.front()); } else { parser->usage($2.front(), $3.front()); } } | ICE_GRID_HELP keyword keyword ICE_GRID_STRING strings ';' { if(($2.front() == "server" || $2.front() == "service") && $3.front() == "template") { parser->usage($2.front() + " " + $3.front(), $4.front()); } else { parser->usage($2.front(), $3.front()); } } | ICE_GRID_HELP ICE_GRID_STRING strings ';' { parser->usage($2.front()); } | ICE_GRID_HELP error ';' { parser->usage(); } | keyword ICE_GRID_HELP ';' { parser->usage($1.front()); } | keyword ICE_GRID_STRING error ';' { $1.push_back($2.front()); parser->invalidCommand($1); yyerrok; } | keyword error ';' { parser->invalidCommand($1); yyerrok; } | ICE_GRID_STRING error ';' { parser->invalidCommand($1); yyerrok; } | error ';' { yyerrok; } | ';' { } ; // ---------------------------------------------------------------------- strings // ---------------------------------------------------------------------- : ICE_GRID_STRING strings { $$ = $2; $$.push_front($1.front()); } | keyword strings { $$ = $2; $$.push_front($1.front()); } | ICE_GRID_STRING ICE_GRID_HELP strings { $$ = $2; $$.push_front("help"); $$.push_front($1.front()); } | keyword ICE_GRID_HELP strings { $$ = $2; $$.push_front("help"); $$.push_front($1.front()); } | { $$ = YYSTYPE(); } ; // ---------------------------------------------------------------------- keyword // ---------------------------------------------------------------------- : ICE_GRID_EXIT { } | ICE_GRID_APPLICATION { } | ICE_GRID_NODE { } | ICE_GRID_REGISTRY { } | ICE_GRID_SERVER { } | ICE_GRID_ADAPTER { } | ICE_GRID_PING { } | ICE_GRID_LOAD { } | ICE_GRID_SOCKETS { } | ICE_GRID_ADD { } | ICE_GRID_REMOVE { } | ICE_GRID_LIST { } | ICE_GRID_SHUTDOWN { } | ICE_GRID_START { } | ICE_GRID_STOP { } | ICE_GRID_PATCH { } | ICE_GRID_SIGNAL { } | ICE_GRID_DESCRIBE { } | ICE_GRID_STATE { } | ICE_GRID_PID { } | ICE_GRID_PROPERTIES { } | ICE_GRID_PROPERTY { } | ICE_GRID_ENDPOINTS { } | ICE_GRID_ACTIVATION { } | ICE_GRID_OBJECT { } | ICE_GRID_FIND { } | ICE_GRID_SHOW { } | ICE_GRID_COPYING { } | ICE_GRID_WARRANTY { } | ICE_GRID_DIFF { } | ICE_GRID_UPDATE { } | ICE_GRID_INSTANTIATE { } | ICE_GRID_TEMPLATE { } | ICE_GRID_SERVICE { } | ICE_GRID_ENABLE { } | ICE_GRID_DISABLE { } | ICE_GRID_STDERR { } | ICE_GRID_STDOUT { } ; Ice-3.5.1/cpp/src/IceGrid/RegistryI.cpp0000644000076400007640000014313712223561476015707 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include // Just to get the hostname #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // For crypt() passwords #include using namespace std; using namespace Ice; using namespace IceGrid; namespace { class NullPermissionsVerifierI : public Glacier2::PermissionsVerifier { public: bool checkPermissions(const string& /*userId*/, const string& /*password*/, string&, const Current&) const { return true; } }; class NullSSLPermissionsVerifierI : public Glacier2::SSLPermissionsVerifier { public: virtual bool authorize(const Glacier2::SSLInfo&, std::string&, const Ice::Current&) const { return true; } }; class CryptPermissionsVerifierI : public Glacier2::PermissionsVerifier { public: CryptPermissionsVerifierI(const map& passwords) : _passwords(passwords) { } bool checkPermissions(const string& userId, const string& password, string&, const Current&) const { map::const_iterator p = _passwords.find(userId); if(p == _passwords.end()) { return false; } if(p->second.size() != 13) // Crypt passwords are 13 characters long. { return false; } char buff[14]; string salt = p->second.substr(0, 2); #if OPENSSL_VERSION_NUMBER >= 0x0090700fL DES_fcrypt(password.c_str(), salt.c_str(), buff); #else des_fcrypt(password.c_str(), salt.c_str(), buff); #endif return p->second == buff; } private: const std::map _passwords; }; class DefaultServantLocator : public Ice::ServantLocator { public: DefaultServantLocator(const ObjectPtr& servant) : _servant(servant) { } virtual ObjectPtr locate(const Current&, LocalObjectPtr&) { return _servant; } virtual void finished(const Current&, const ObjectPtr&, const LocalObjectPtr&) { } virtual void deactivate(const string&) { } private: ObjectPtr _servant; }; } RegistryI::RegistryI(const CommunicatorPtr& communicator, const TraceLevelsPtr& traceLevels, bool nowarn, bool readonly, const string& initFromReplica) : _communicator(communicator), _traceLevels(traceLevels), _nowarn(nowarn), _readonly(readonly), _initFromReplica(initFromReplica), _session(communicator), _platform("IceGrid.Registry", communicator, traceLevels) { } RegistryI::~RegistryI() { } bool RegistryI::start() { try { if(!startImpl()) { stop(); return false; } } catch(...) { stop(); throw; } return true; } bool RegistryI::startImpl() { assert(_communicator); PropertiesPtr properties = _communicator->getProperties(); // // Check that required properties are set and valid. // if(properties->getProperty("IceGrid.Registry.Client.Endpoints").empty()) { Error out(_communicator->getLogger()); out << "property `IceGrid.Registry.Client.Endpoints' is not set"; return false; } if(properties->getProperty("IceGrid.Registry.Server.Endpoints").empty()) { Error out(_communicator->getLogger()); out << "property `IceGrid.Registry.Server.Endpoints' is not set"; return false; } if(properties->getProperty("IceGrid.Registry.Internal.Endpoints").empty()) { Error out(_communicator->getLogger()); out << "property `IceGrid.Registry.Internal.Endpoints' is not set"; return false; } if(!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty()) { if(!_nowarn) { Warning out(_communicator->getLogger()); out << "session manager endpoints `IceGrid.Registry.SessionManager.Endpoints' enabled"; if(properties->getPropertyAsInt("IceGrid.Registry.SessionFilters") == 0) { out << " (with Glacier2 filters disabled)"; } } } if(!properties->getProperty("IceGrid.Registry.AdminSessionManager.Endpoints").empty()) { if(!_nowarn) { Warning out(_communicator->getLogger()); out << "administrative session manager endpoints `IceGrid.Registry.AdminSessionManager.Endpoints' enabled"; if(properties->getPropertyAsInt("IceGrid.Registry.AdminSessionFilters") == 0) { out << " (with Glacier2 filters disabled)"; } } } properties->setProperty("Ice.PrintProcessId", "0"); properties->setProperty("Ice.ServerIdleTime", "0"); properties->setProperty("IceGrid.Registry.Client.AdapterId", ""); properties->setProperty("IceGrid.Registry.Server.AdapterId", ""); properties->setProperty("IceGrid.Registry.SessionManager.AdapterId", ""); properties->setProperty("IceGrid.Registry.AdminSessionManager.AdapterId", ""); properties->setProperty("IceGrid.Registry.Internal.AdapterId", ""); setupThreadPool(properties, "IceGrid.Registry.Client.ThreadPool", 1, 10); setupThreadPool(properties, "IceGrid.Registry.Server.ThreadPool", 1, 10, true); // Serialize for admin callbacks setupThreadPool(properties, "IceGrid.Registry.SessionManager.ThreadPool", 1, 10); setupThreadPool(properties, "IceGrid.Registry.AdminSessionManager.ThreadPool", 1, 10); setupThreadPool(properties, "IceGrid.Registry.Internal.ThreadPool", 1, 100); _replicaName = properties->getPropertyWithDefault("IceGrid.Registry.ReplicaName", "Master"); _master = _replicaName == "Master"; _sessionTimeout = properties->getPropertyAsIntWithDefault("IceGrid.Registry.SessionTimeout", 30); if(!_initFromReplica.empty() && (_initFromReplica == _replicaName || (_master && _initFromReplica == "Master"))) { Error out(_communicator->getLogger()); out << "invalid --initdb-from-replica option: identical replica"; return false; } if(properties->getProperty("IceGrid.Registry.Client.ACM").empty()) { // // Set the client object adapter ACM timeout to the session // timeout * 2. If no session timeout is set, ACM is disabled. // ostringstream os; os << _sessionTimeout * 2; properties->setProperty("IceGrid.Registry.Client.ACM", os.str()); } if(properties->getProperty("IceGrid.Registry.Server.ACM").empty()) { properties->setProperty("IceGrid.Registry.Server.ACM", "30"); } if(properties->getProperty("IceGrid.Registry.Internal.ACM").empty()) { int nt = properties->getPropertyAsIntWithDefault("IceGrid.Registry.NodeSessionTimeout", 30); int rt = properties->getPropertyAsIntWithDefault("IceGrid.Registry.ReplicaSessionTimeout", 30); // // Set the internal object adapter ACM timeout to the replica // or node session timeout * 2. If no session timeout is set, // ACM is disabled. // ostringstream os; os << std::max(nt, rt) * 2; properties->setProperty("IceGrid.Registry.Internal.ACM", os.str()); } if(!_master && properties->getProperty("Ice.Default.Locator").empty()) { if(properties->getProperty("Ice.Default.Locator").empty()) { Error out(_communicator->getLogger()); out << "property `Ice.Default.Locator' is not set"; return false; } } // // Get the instance name // if(_master) { _instanceName = properties->getProperty("IceGrid.InstanceName"); if(_instanceName.empty()) { if(_communicator->getDefaultLocator()) { _instanceName = _communicator->getDefaultLocator()->ice_getIdentity().category; } else { _instanceName = "IceGrid"; } } } else { _instanceName = _communicator->getDefaultLocator()->ice_getIdentity().category; } // // Create the registry database. // DatabasePluginPtr plugin; try { plugin = DatabasePluginPtr::dynamicCast(_communicator->getPluginManager()->getPlugin("DB")); } catch(const NotRegisteredException&) { } if(!plugin) { Error out(_communicator->getLogger()); out << "no database plugin configured with `Ice.Plugin.DB' or plugin is not a database plugin"; return false; } if(!plugin->initDB()) { return false; } // // Ensure that nothing is running on this port. This is also // useful to ensure that we don't run twice the same instance of // the service too (which would cause the database environment of // the already running instance to be "corrupted".) // try { string endpoints = properties->getProperty("IceGrid.Registry.Client.Endpoints"); string strPrx = _instanceName + "/Locator:" + endpoints; _communicator->stringToProxy(strPrx)->ice_timeout(5000)->ice_ping(); Error out(_communicator->getLogger()); out << "an IceGrid registry is already running and listening on the client endpoints `" << endpoints << "'"; return false; } catch(const Ice::LocalException&) { } // // Create the reaper thread. // _reaper = new ReapThread(); _reaper->start(); // // Create the internal registry object adapter. // ObjectAdapterPtr registryAdapter = _communicator->createObjectAdapter("IceGrid.Registry.Internal"); registryAdapter->activate(); // // Create the internal IceStorm service. // Identity registryTopicManagerId; registryTopicManagerId.category = _instanceName; registryTopicManagerId.name = "RegistryTopicManager"; _iceStorm = IceStormInternal::Service::create(_communicator, registryAdapter, registryAdapter, "IceGrid.Registry", registryTopicManagerId, "Registry"); const IceStorm::TopicManagerPrx topicManager = _iceStorm->getTopicManager(); _database = new Database(registryAdapter, topicManager, _instanceName, _traceLevels, getInfo(), plugin, _readonly); _wellKnownObjects = new WellKnownObjectsManager(_database); if(!_initFromReplica.empty()) { Ice::Identity id; id.category = _instanceName; id.name = (_initFromReplica == "Master") ? "Registry" : "Registry-" + _initFromReplica; Ice::ObjectPrx proxy; try { proxy = _database->getObjectProxy(id); id.name = "Query"; IceGrid::QueryPrx query = IceGrid::QueryPrx::uncheckedCast(proxy->ice_identity(id)); if(query) { id.name = "InternalRegistry-" + _initFromReplica; try { proxy = query->findObjectById(id); } catch(const Ice::Exception&) { } } } catch(const ObjectNotRegisteredException&) { id.name = "InternalRegistry-" + _initFromReplica; try { proxy = _database->getObjectProxy(id); } catch(const ObjectNotRegisteredException&) { } } // If we still didn't find the replica proxy, check with the // locator or the IceGrid.Registry.ReplicaEndpoints properties // if we can find it. if(!proxy) { id.name = "InternalRegistry-" + (_initFromReplica.empty() ? "Master" : _initFromReplica); proxy = _session.findInternalRegistryForReplica(id); } if(!proxy) { Error out(_communicator->getLogger()); out << "couldn't find replica `" << _initFromReplica << "' to\n"; out << "initialize the database (specify the replica endpoints in the endpoints of\n"; out << "the `Ice.Default.Locator' proxy property to allow finding the replica)"; return false; } try { Ice::Long serial; IceGrid::InternalRegistryPrx registry = IceGrid::InternalRegistryPrx::checkedCast(proxy); ApplicationInfoSeq applications = registry->getApplications(serial); _database->syncApplications(applications, serial); AdapterInfoSeq adapters = registry->getAdapters(serial); _database->syncAdapters(adapters, serial); ObjectInfoSeq objects = registry->getObjects(serial); _database->syncObjects(objects, serial); } catch(const Ice::OperationNotExistException&) { Error out(_communicator->getLogger()); out << "couldn't initialize database from replica `" << _initFromReplica << "':\n"; out << "replica doesn't support this functionality (IceGrid < 3.5.1)"; return false; } catch(const Ice::Exception& ex) { Error out(_communicator->getLogger()); out << "couldn't initialize database from replica `" << _initFromReplica << "':\n"; out << ex; return false; } } // // Get proxies for nodes that we were connected with on last // shutdown. // NodePrxSeq nodes; ObjectProxySeq proxies = _database->getInternalObjectsByType(Node::ice_staticId()); for(ObjectProxySeq::const_iterator p = proxies.begin(); p != proxies.end(); ++p) { nodes.push_back(NodePrx::uncheckedCast(*p)); } // // NOTE: The internal registry object must be added only once the // node/replica proxies are retrieved. Otherwise, if some // replica/node register as soon as the internal registry is setup // we might clear valid proxies. // InternalRegistryPrx internalRegistry = setupInternalRegistry(registryAdapter); if(_master) { nodes = registerReplicas(internalRegistry, nodes); registerNodes(internalRegistry, nodes); } else { InternalReplicaInfoPtr info = _platform.getInternalReplicaInfo(); _session.create(_replicaName, info, _database, _wellKnownObjects, internalRegistry); registerNodes(internalRegistry, _session.getNodes(nodes)); } _serverAdapter = _communicator->createObjectAdapter("IceGrid.Registry.Server"); _clientAdapter = _communicator->createObjectAdapter("IceGrid.Registry.Client"); Ice::Identity dummy; dummy.name = "dummy"; _wellKnownObjects->addEndpoint("Client", _clientAdapter->createDirectProxy(dummy)); _wellKnownObjects->addEndpoint("Server", _serverAdapter->createDirectProxy(dummy)); _wellKnownObjects->addEndpoint("Internal", registryAdapter->createDirectProxy(dummy)); setupNullPermissionsVerifier(registryAdapter); if(!setupUserAccountMapper(registryAdapter)) { return false; } QueryPrx query = setupQuery(_clientAdapter); RegistryPrx registry = setupRegistry(_clientAdapter); Ice::LocatorRegistryPrx locatorRegistry = setupLocatorRegistry(_serverAdapter); LocatorPrx internalLocator = setupLocator(_clientAdapter, registryAdapter, locatorRegistry, registry, query); // // Create the session servant manager. The session servant manager is responsible // for managing sessions servants and to ensure that session servants are only // accessed by the connection that created the session. The session servant manager // also takes care of providing the router servant for server admin objects. // ObjectPtr serverAdminRouter = new RegistryServerAdminRouter(_database); AdminCallbackRouterPtr adminCallbackRouter = new AdminCallbackRouter; _servantManager = new SessionServantManager(_clientAdapter, _instanceName, true, getServerAdminCategory(), serverAdminRouter, adminCallbackRouter); _clientAdapter->addServantLocator(_servantManager, ""); _serverAdapter->addServantLocator(new DefaultServantLocator(adminCallbackRouter), ""); ObjectAdapterPtr sessionAdpt = setupClientSessionFactory(registryAdapter, internalLocator); ObjectAdapterPtr admSessionAdpt = setupAdminSessionFactory(registryAdapter, serverAdminRouter, internalLocator); _wellKnownObjects->finish(); if(_master) { _wellKnownObjects->registerAll(); } else { _session.registerAllWellKnownObjects(); } // // We are ready to go! // _serverAdapter->activate(); _clientAdapter->activate(); if(sessionAdpt) { sessionAdpt->activate(); } if(admSessionAdpt) { admSessionAdpt->activate(); } return true; } Ice::LocatorRegistryPrx RegistryI::setupLocatorRegistry(const Ice::ObjectAdapterPtr& serverAdapter) { bool dynReg = _communicator->getProperties()->getPropertyAsInt("IceGrid.Registry.DynamicRegistration") > 0; Identity locatorRegId; locatorRegId.category = _instanceName; locatorRegId.name = "LocatorRegistry-" + _replicaName; ObjectPrx obj = serverAdapter->add(new LocatorRegistryI(_database, dynReg, _master, _session), locatorRegId); return LocatorRegistryPrx::uncheckedCast(obj); } IceGrid::LocatorPrx RegistryI::setupLocator(const Ice::ObjectAdapterPtr& clientAdapter, const Ice::ObjectAdapterPtr& registryAdapter, const Ice::LocatorRegistryPrx& locatorRegistry, const RegistryPrx& registry, const QueryPrx& query) { LocatorPtr locator = new LocatorI(_communicator, _database, locatorRegistry, registry, query); Identity locatorId; locatorId.category = _instanceName; locatorId.name = "Locator"; clientAdapter->add(locator, locatorId); locatorId.name = "Locator-" + _replicaName; clientAdapter->add(locator, locatorId); return LocatorPrx::uncheckedCast(registryAdapter->addWithUUID(locator)); } QueryPrx RegistryI::setupQuery(const Ice::ObjectAdapterPtr& clientAdapter) { Identity queryId; queryId.category = _instanceName; queryId.name = "Query"; return QueryPrx::uncheckedCast(clientAdapter->add(new QueryI(_communicator, _database), queryId)); } RegistryPrx RegistryI::setupRegistry(const Ice::ObjectAdapterPtr& clientAdapter) { Identity registryId; registryId.category = _instanceName; registryId.name = "Registry"; if(!_master) { registryId.name += "-" + _replicaName; } RegistryPrx proxy = RegistryPrx::uncheckedCast(clientAdapter->add(this, registryId)); _wellKnownObjects->add(proxy, Registry::ice_staticId()); return proxy; } InternalRegistryPrx RegistryI::setupInternalRegistry(const Ice::ObjectAdapterPtr& registryAdapter) { Identity internalRegistryId; internalRegistryId.category = _instanceName; internalRegistryId.name = "InternalRegistry-" + _replicaName; assert(_reaper); ObjectPtr internalRegistry = new InternalRegistryI(this, _database, _reaper, _wellKnownObjects, _session); Ice::ObjectPrx proxy = registryAdapter->add(internalRegistry, internalRegistryId); _wellKnownObjects->add(proxy, InternalRegistry::ice_staticId()); InternalRegistryPrx registry = InternalRegistryPrx::uncheckedCast(proxy); _database->getReplicaCache().setInternalRegistry(registry); return registry; } void RegistryI::setupNullPermissionsVerifier(const Ice::ObjectAdapterPtr& registryAdapter) { Identity nullPermVerifId; nullPermVerifId.category = _instanceName; nullPermVerifId.name = "NullPermissionsVerifier"; _nullPermissionsVerifier = Glacier2::PermissionsVerifierPrx::uncheckedCast( registryAdapter->add(new NullPermissionsVerifierI(), nullPermVerifId)->ice_collocationOptimized(true)); Identity nullSSLPermVerifId; nullSSLPermVerifId.category = _instanceName; nullSSLPermVerifId.name = "NullSSLPermissionsVerifier"; _nullSSLPermissionsVerifier = Glacier2::SSLPermissionsVerifierPrx::uncheckedCast( registryAdapter->add(new NullSSLPermissionsVerifierI(), nullSSLPermVerifId)->ice_collocationOptimized(true)); } bool RegistryI::setupUserAccountMapper(const Ice::ObjectAdapterPtr& registryAdapter) { Ice::PropertiesPtr properties = _communicator->getProperties(); // // Setup file user account mapper object if the property is set. // string userAccountFileProperty = properties->getProperty("IceGrid.Registry.UserAccounts"); if(!userAccountFileProperty.empty()) { try { Identity mapperId; mapperId.category = _instanceName; mapperId.name = "RegistryUserAccountMapper"; if(!_master) { mapperId.name += "-" + _replicaName; } registryAdapter->add(new FileUserAccountMapperI(userAccountFileProperty), mapperId); _wellKnownObjects->add(registryAdapter->createProxy(mapperId), UserAccountMapper::ice_staticId()); } catch(const std::string& msg) { Error out(_communicator->getLogger()); out << msg; return false; } } return true; } Ice::ObjectAdapterPtr RegistryI::setupClientSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter, const IceGrid::LocatorPrx& locator) { Ice::PropertiesPtr properties = _communicator->getProperties(); Ice::ObjectAdapterPtr adapter; SessionServantManagerPtr servantManager; if(!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty()) { adapter = _communicator->createObjectAdapter("IceGrid.Registry.SessionManager"); servantManager = new SessionServantManager(adapter, _instanceName, false, "", 0, 0); adapter->addServantLocator(servantManager, ""); } assert(_reaper); _timer = new IceUtil::Timer(); // Used for session allocation timeout. _clientSessionFactory = new ClientSessionFactory(servantManager, _database, _timer, _reaper); if(servantManager && _master) // Slaves don't support client session manager objects. { Identity sessionMgrId; sessionMgrId.category = _instanceName; sessionMgrId.name = "SessionManager"; Identity sslSessionMgrId; sslSessionMgrId.category = _instanceName; sslSessionMgrId.name = "SSLSessionManager"; adapter->add(new ClientSessionManagerI(_clientSessionFactory), sessionMgrId); adapter->add(new ClientSSLSessionManagerI(_clientSessionFactory), sslSessionMgrId); _wellKnownObjects->add(adapter->createProxy(sessionMgrId), Glacier2::SessionManager::ice_staticId()); _wellKnownObjects->add(adapter->createProxy(sslSessionMgrId), Glacier2::SSLSessionManager::ice_staticId()); } if(adapter) { Ice::Identity dummy; dummy.name = "dummy"; _wellKnownObjects->addEndpoint("SessionManager", adapter->createDirectProxy(dummy)); } _clientVerifier = getPermissionsVerifier(registryAdapter, locator, "IceGrid.Registry.PermissionsVerifier", properties->getProperty("IceGrid.Registry.CryptPasswords")); _sslClientVerifier = getSSLPermissionsVerifier(locator, "IceGrid.Registry.SSLPermissionsVerifier"); return adapter; } Ice::ObjectAdapterPtr RegistryI::setupAdminSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter, const Ice::ObjectPtr& router, const IceGrid::LocatorPrx& locator) { Ice::PropertiesPtr properties = _communicator->getProperties(); Ice::ObjectAdapterPtr adapter; SessionServantManagerPtr servantManager; if(!properties->getProperty("IceGrid.Registry.AdminSessionManager.Endpoints").empty()) { adapter = _communicator->createObjectAdapter("IceGrid.Registry.AdminSessionManager"); servantManager = new SessionServantManager(adapter, _instanceName, false, getServerAdminCategory(), router, 0); adapter->addServantLocator(servantManager, ""); } assert(_reaper); _adminSessionFactory = new AdminSessionFactory(servantManager, _database, _reaper, this); if(servantManager) { Identity sessionMgrId; sessionMgrId.category = _instanceName; sessionMgrId.name = "AdminSessionManager"; Identity sslSessionMgrId; sslSessionMgrId.category = _instanceName; sslSessionMgrId.name = "AdminSSLSessionManager"; if(!_master) { sessionMgrId.name += "-" + _replicaName; sslSessionMgrId.name += "-" + _replicaName; } adapter->add(new AdminSessionManagerI(_adminSessionFactory), sessionMgrId); adapter->add(new AdminSSLSessionManagerI(_adminSessionFactory), sslSessionMgrId); _wellKnownObjects->add(adapter->createProxy(sessionMgrId), Glacier2::SessionManager::ice_staticId()); _wellKnownObjects->add(adapter->createProxy(sslSessionMgrId), Glacier2::SSLSessionManager::ice_staticId()); } if(adapter) { Ice::Identity dummy; dummy.name = "dummy"; _wellKnownObjects->addEndpoint("AdminSessionManager", adapter->createDirectProxy(dummy)); } _adminVerifier = getPermissionsVerifier(registryAdapter, locator, "IceGrid.Registry.AdminPermissionsVerifier", properties->getProperty("IceGrid.Registry.AdminCryptPasswords")); _sslAdminVerifier = getSSLPermissionsVerifier(locator, "IceGrid.Registry.AdminSSLPermissionsVerifier"); return adapter; } void RegistryI::stop() { _session.destroy(); // // We destroy the topics before to shutdown the communicator to // ensure that there will be no more invocations on IceStorm once // it's shutdown. // if(_database) { _database->destroyTopics(); } try { _communicator->shutdown(); _communicator->waitForShutdown(); } catch(const Ice::LocalException& ex) { Warning out(_communicator->getLogger()); out << "unexpected exception while shutting down registry communicator:\n" << ex; } if(_reaper) { _reaper->terminate(); _reaper->getThreadControl().join(); _reaper = 0; } if(_timer) { _timer->destroy(); _timer = 0; } if(_iceStorm) { _iceStorm->stop(); _iceStorm = 0; } _wellKnownObjects = 0; _clientSessionFactory = 0; _adminSessionFactory = 0; _database = 0; } SessionPrx RegistryI::createSession(const string& user, const string& password, const Current& current) { if(!_master) { PermissionDeniedException ex; ex.reason = "client session creation is only allowed with the master registry."; throw ex; } assert(_reaper && _clientSessionFactory); if(!_clientVerifier) { PermissionDeniedException ex; ex.reason = "no permissions verifier configured, use the property\n"; ex.reason += "`IceGrid.Registry.PermissionsVerifier' to configure\n"; ex.reason += "a permissions verifier."; throw ex; } if(user.empty()) { PermissionDeniedException ex; ex.reason = "empty user id"; throw ex; } try { string reason; if(!_clientVerifier->checkPermissions(user, password, reason, current.ctx)) { PermissionDeniedException exc; exc.reason = reason; throw exc; } } catch(const Glacier2::PermissionDeniedException& ex) { PermissionDeniedException exc; exc.reason = ex.reason; throw exc; } catch(const LocalException& ex) { if(_traceLevels && _traceLevels->session > 0) { Trace out(_traceLevels->logger, _traceLevels->sessionCat); out << "exception while verifying password with client permission verifier:\n" << ex; } PermissionDeniedException exc; exc.reason = "internal server error"; throw exc; } SessionIPtr session = _clientSessionFactory->createSessionServant(user, 0); Ice::ObjectPrx proxy = session->_register(_servantManager, current.con); _reaper->add(new SessionReapable(_traceLevels->logger, session), _sessionTimeout); return SessionPrx::uncheckedCast(proxy); } AdminSessionPrx RegistryI::createAdminSession(const string& user, const string& password, const Current& current) { assert(_reaper && _adminSessionFactory); if(!_adminVerifier) { PermissionDeniedException ex; ex.reason = "no admin permissions verifier configured, use the property\n"; ex.reason += "`IceGrid.Registry.AdminPermissionsVerifier' to configure\n"; ex.reason += "a permissions verifier."; throw ex; } if(user.empty()) { PermissionDeniedException ex; ex.reason = "empty user id"; throw ex; } try { string reason; if(!_adminVerifier->checkPermissions(user, password, reason, current.ctx)) { PermissionDeniedException exc; exc.reason = reason; throw exc; } } catch(const Glacier2::PermissionDeniedException& ex) { PermissionDeniedException exc; exc.reason = ex.reason; throw exc; } catch(const LocalException& ex) { if(_traceLevels && _traceLevels->session > 0) { Trace out(_traceLevels->logger, _traceLevels->sessionCat); out << "exception while verifying password with admin permission verifier:\n" << ex; } PermissionDeniedException exc; exc.reason = "internal server error"; throw exc; } AdminSessionIPtr session = _adminSessionFactory->createSessionServant(user); Ice::ObjectPrx proxy = session->_register(_servantManager, current.con); _reaper->add(new SessionReapable(_traceLevels->logger, session), _sessionTimeout); return AdminSessionPrx::uncheckedCast(proxy); } SessionPrx RegistryI::createSessionFromSecureConnection(const Current& current) { if(!_master) { PermissionDeniedException ex; ex.reason = "client session creation is only allowed with the master registry."; throw ex; } assert(_reaper && _clientSessionFactory); if(!_sslClientVerifier) { PermissionDeniedException ex; ex.reason = "no ssl permissions verifier configured, use the property\n"; ex.reason += "`IceGrid.Registry.SSLPermissionsVerifier' to configure\n"; ex.reason += "a permissions verifier."; throw ex; } string userDN; Glacier2::SSLInfo info = getSSLInfo(current.con, userDN); if(userDN.empty()) { PermissionDeniedException ex; ex.reason = "empty user DN"; throw ex; } try { string reason; if(!_sslClientVerifier->authorize(info, reason, current.ctx)) { PermissionDeniedException exc; exc.reason = reason; throw exc; } } catch(const Glacier2::PermissionDeniedException& ex) { PermissionDeniedException exc; exc.reason = ex.reason; throw exc; } catch(const LocalException& ex) { if(_traceLevels && _traceLevels->session > 0) { Trace out(_traceLevels->logger, _traceLevels->sessionCat); out << "exception while verifying password with SSL client permission verifier:\n" << ex; } PermissionDeniedException exc; exc.reason = "internal server error"; throw exc; } SessionIPtr session = _clientSessionFactory->createSessionServant(userDN, 0); Ice::ObjectPrx proxy = session->_register(_servantManager, current.con); _reaper->add(new SessionReapable(_traceLevels->logger, session), _sessionTimeout); return SessionPrx::uncheckedCast(proxy); } AdminSessionPrx RegistryI::createAdminSessionFromSecureConnection(const Current& current) { assert(_reaper && _adminSessionFactory); if(!_sslAdminVerifier) { PermissionDeniedException ex; ex.reason = "no ssl admin permissions verifier configured, use the property\n"; ex.reason += "`IceGrid.Registry.AdminSSLPermissionsVerifier' to configure\n"; ex.reason += "a permissions verifier."; throw ex; } string userDN; Glacier2::SSLInfo info = getSSLInfo(current.con, userDN); try { string reason; if(!_sslAdminVerifier->authorize(info, reason, current.ctx)) { PermissionDeniedException exc; exc.reason = reason; throw exc; } } catch(const Glacier2::PermissionDeniedException& ex) { PermissionDeniedException exc; exc.reason = ex.reason; throw exc; } catch(const LocalException& ex) { if(_traceLevels && _traceLevels->session > 0) { Trace out(_traceLevels->logger, _traceLevels->sessionCat); out << "exception while verifying password with SSL admin permission verifier:\n" << ex; } PermissionDeniedException exc; exc.reason = "internal server error"; throw exc; } // // We let the connection access the administrative interface. // AdminSessionIPtr session = _adminSessionFactory->createSessionServant(userDN); Ice::ObjectPrx proxy = session->_register(_servantManager, current.con); _reaper->add(new SessionReapable(_traceLevels->logger, session), _sessionTimeout); return AdminSessionPrx::uncheckedCast(proxy); } int RegistryI::getSessionTimeout(const Ice::Current& /*current*/) const { return _sessionTimeout; } string RegistryI::getName() const { return _replicaName; } RegistryInfo RegistryI::getInfo() const { return _platform.getRegistryInfo(); } void RegistryI::waitForShutdown() { assert(_clientAdapter); _clientAdapter->waitForDeactivate(); } void RegistryI::shutdown() { assert(_clientAdapter); _clientAdapter->deactivate(); } Ice::ObjectPrx RegistryI::createAdminCallbackProxy(const Identity& id) const { return _serverAdapter->createProxy(id); } Glacier2::PermissionsVerifierPrx RegistryI::getPermissionsVerifier(const ObjectAdapterPtr& adapter, const IceGrid::LocatorPrx& locator, const string& verifierProperty, const string& passwordsProperty) { // // Get the permissions verifier, or create a default one if no // verifier is specified. // ObjectPrx verifier; string verifierPropertyValue = _communicator->getProperties()->getProperty(verifierProperty); if(!verifierPropertyValue.empty()) { try { try { verifier = _communicator->propertyToProxy(verifierProperty); } catch(const ProxyParseException&) { // // Check if the property is just the identity of the null permissions verifier // (the identity might contain spaces which would prevent it to be parsed as a // proxy). // if(_communicator->stringToIdentity(verifierPropertyValue) == _nullPermissionsVerifier->ice_getIdentity()) { verifier = _communicator->stringToProxy("\"" + verifierPropertyValue + "\""); } } if(!verifier) { Error out(_communicator->getLogger()); out << "permissions verifier `" + verifierPropertyValue + "' is invalid"; return 0; } assert(_nullPermissionsVerifier); if(verifier->ice_getIdentity() == _nullPermissionsVerifier->ice_getIdentity()) { verifier = _nullPermissionsVerifier; } } catch(const LocalException& ex) { Error out(_communicator->getLogger()); out << "permissions verifier `" + verifierPropertyValue + "' is invalid:\n" << ex; return 0; } } else if(!passwordsProperty.empty()) { // // No nativeToUTF8 conversion necessary here, since no string // converter is installed by IceGrid the string is UTF-8. // IceUtilInternal::ifstream passwordFile(passwordsProperty); if(!passwordFile) { Error out(_communicator->getLogger()); string err = strerror(errno); out << "cannot open `" + passwordsProperty + "' for reading: " + err; return 0; } map passwords; while(true) { string userId; passwordFile >> userId; if(!passwordFile) { break; } string password; passwordFile >> password; if(!passwordFile) { break; } assert(!userId.empty()); assert(!password.empty()); passwords.insert(make_pair(userId, password)); } verifier = adapter->addWithUUID(new CryptPermissionsVerifierI(passwords)); } else { return 0; } assert(verifier); Glacier2::PermissionsVerifierPrx verifierPrx; try { // // Set the permission verifier proxy locator to the internal // locator. We can't use the "public" locator, this could lead // to deadlocks if there's not enough threads in the client // thread pool anymore. // verifierPrx = Glacier2::PermissionsVerifierPrx::checkedCast(verifier->ice_locator(locator)); if(!verifierPrx) { Error out(_communicator->getLogger()); out << "permissions verifier `" + verifierProperty + "' is invalid"; return 0; } } catch(const LocalException& ex) { if(!_nowarn) { Warning out(_communicator->getLogger()); out << "couldn't contact permissions verifier `" + verifierProperty + "':\n" << ex; } verifierPrx = Glacier2::PermissionsVerifierPrx::uncheckedCast(verifier->ice_locator(locator)); } return verifierPrx; } Glacier2::SSLPermissionsVerifierPrx RegistryI::getSSLPermissionsVerifier(const IceGrid::LocatorPrx& locator, const string& verifierProperty) { // // Get the permissions verifier, or create a default one if no // verifier is specified. // ObjectPrx verifier; string verifierPropertyValue = _communicator->getProperties()->getProperty(verifierProperty); if(!verifierPropertyValue.empty()) { try { try { verifier = _communicator->propertyToProxy(verifierProperty); } catch(const ProxyParseException&) { // // Check if the property is just the identity of the null permissions verifier // (the identity might contain spaces which would prevent it to be parsed as a // proxy). // if(_communicator->stringToIdentity(verifierPropertyValue) == _nullSSLPermissionsVerifier->ice_getIdentity()) { verifier = _communicator->stringToProxy("\"" + verifierPropertyValue + "\""); } } if(!verifier) { Error out(_communicator->getLogger()); out << "ssl permissions verifier `" + verifierPropertyValue + "' is invalid"; return 0; } assert(_nullSSLPermissionsVerifier); if(verifier->ice_getIdentity() == _nullSSLPermissionsVerifier->ice_getIdentity()) { verifier = _nullSSLPermissionsVerifier; } } catch(const LocalException& ex) { Error out(_communicator->getLogger()); out << "ssl permissions verifier `" + verifierPropertyValue + "' is invalid:\n" << ex; return 0; } } else { return 0; } Glacier2::SSLPermissionsVerifierPrx verifierPrx; try { // // Set the permission verifier proxy locator to the internal // locator. We can't use the "public" locator, this could lead // to deadlocks if there's not enough threads in the client // thread pool anymore. // verifierPrx = Glacier2::SSLPermissionsVerifierPrx::checkedCast(verifier->ice_locator(locator)); if(!verifierPrx) { Error out(_communicator->getLogger()); out << "ssl permissions verifier `" + verifierProperty + "' is invalid"; return 0; } } catch(const LocalException& ex) { if(!_nowarn) { Warning out(_communicator->getLogger()); out << "couldn't contact ssl permissions verifier `" + verifierProperty + "':\n" << ex; } verifierPrx = Glacier2::SSLPermissionsVerifierPrx::uncheckedCast(verifier->ice_locator(locator)); } return verifierPrx; } Glacier2::SSLInfo RegistryI::getSSLInfo(const ConnectionPtr& connection, string& userDN) { Glacier2::SSLInfo sslinfo; try { IceSSL::ConnectionInfoPtr info = IceSSL::ConnectionInfoPtr::dynamicCast(connection->getInfo()); if(!info) { PermissionDeniedException exc; exc.reason = "not ssl connection"; throw exc; } sslinfo.remotePort = info->remotePort; sslinfo.remoteHost = info->remoteAddress; sslinfo.localPort = info->localPort; sslinfo.localHost = info->localAddress; sslinfo.cipher = info->cipher; sslinfo.certs = info->certs; if(info->certs.size() > 0) { userDN = IceSSL::Certificate::decode(info->certs[0])->getSubjectDN(); } } catch(const IceSSL::CertificateEncodingException&) { PermissionDeniedException exc; exc.reason = "certificate encoding exception"; throw exc; } catch(const Ice::LocalException&) { PermissionDeniedException exc; exc.reason = "connection exception"; throw exc; } return sslinfo; } NodePrxSeq RegistryI::registerReplicas(const InternalRegistryPrx& internalRegistry, const NodePrxSeq& dbNodes) { // // Get proxies for slaves that we we connected with on last // shutdown. // // We first get the internal registry proxies and then also check // the public registry proxies. If we find public registry // proxies, we use indirect proxies setup with a locator using the // public proxy in preference over the internal proxy which might // contain stale endpoints if the slave was restarted. IceGrid // version <= 3.5.0 also kept the internal proxy in the database // instead of the public proxy. // map replicas; Ice::ObjectProxySeq proxies = _database->getObjectsByType(InternalRegistry::ice_staticId()); for(ObjectProxySeq::const_iterator p = proxies.begin(); p != proxies.end(); ++p) { replicas.insert(pair(InternalRegistryPrx::uncheckedCast(*p), RegistryPrx())); } proxies = _database->getObjectsByType(Registry::ice_staticId()); for(ObjectProxySeq::const_iterator p = proxies.begin(); p != proxies.end(); ++p) { Ice::Identity id = (*p)->ice_getIdentity(); const string prefix("Registry-"); string::size_type pos = id.name.find(prefix); if(pos == string::npos) { continue; // Ignore the master registry proxy. } id.name = "InternalRegistry-" + id.name.substr(prefix.size()); Ice::ObjectPrx prx = (*p)->ice_identity(id)->ice_endpoints(Ice::EndpointSeq()); id.name = "Locator"; prx = prx->ice_locator(Ice::LocatorPrx::uncheckedCast((*p)->ice_identity(id))); for(map::iterator q = replicas.begin(); q != replicas.end(); ++q) { if(q->first->ice_getIdentity() == prx->ice_getIdentity()) { replicas.erase(q); break; } } replicas.insert(pair(InternalRegistryPrx::uncheckedCast(prx), RegistryPrx::uncheckedCast(*p))); } set nodes; nodes.insert(dbNodes.begin(), dbNodes.end()); vector results; for(map::const_iterator r = replicas.begin(); r != replicas.end(); ++r) { if(r->first->ice_getIdentity() != internalRegistry->ice_getIdentity()) { results.push_back(r->first->begin_registerWithReplica(internalRegistry)); } } for(vector::const_iterator p = results.begin(); p != results.end(); ++p) { InternalRegistryPrx replica = InternalRegistryPrx::uncheckedCast((*p)->getProxy()); string replicaName; if(_traceLevels && _traceLevels->replica > 1) { replicaName = replica->ice_getIdentity().name; const string prefix("InternalRegistry-"); string::size_type pos = replicaName.find(prefix); if(pos != string::npos) { replicaName = replicaName.substr(prefix.size()); } Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat); out << "creating replica `" << replicaName << "' session"; } try { replica->end_registerWithReplica(*p); NodePrxSeq nds = replica->getNodes(); nodes.insert(nds.begin(), nds.end()); if(_traceLevels && _traceLevels->replica > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat); out << "replica `" << replicaName << "' session created"; } } catch(const Ice::LocalException& ex) { // // Clear the proxy from the database if we can't // contact the replica. // RegistryPrx registry; for(map::const_iterator q = replicas.begin(); q != replicas.end(); ++q) { if(q->first->ice_getIdentity() == replica->ice_getIdentity()) { registry = q->second; break; } } ObjectInfoSeq infos; if(registry) { try { infos.push_back(_database->getObjectInfo(registry->ice_getIdentity())); } catch(const ObjectNotRegisteredException&) { } } try { infos.push_back(_database->getObjectInfo(replica->ice_getIdentity())); } catch(const ObjectNotRegisteredException&) { } _database->removeRegistryWellKnownObjects(infos); if(_traceLevels && _traceLevels->replica > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat); out << "replica `" << replicaName << "' session creation failed:\n" << ex; } } } NodePrxSeq result; for(set::iterator p = nodes.begin(); p != nodes.end(); ++p) { result.push_back(*p); } return result; } void RegistryI::registerNodes(const InternalRegistryPrx& /*internalRegistry*/, const NodePrxSeq& nodes) { const string prefix("Node-"); for(NodePrxSeq::const_iterator p = nodes.begin(); p != nodes.end(); ++p) { assert((*p)->ice_getIdentity().name.find(prefix) != string::npos); try { _database->getNode((*p)->ice_getIdentity().name.substr(prefix.size()))->setProxy(*p); } catch(const NodeNotExistException&) { // // Ignore, if nothing's deployed on the node we won't need // to contact it for locator requests so we don't need to // keep its proxy. // try { _database->removeInternalObject((*p)->ice_getIdentity()); } catch(const ObjectNotRegisteredException&) { } } } } Ice-3.5.1/cpp/src/IceGrid/DescriptorHelper.h0000644000076400007640000003047112223561476016705 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_DESCRIPTOR_HELPER_H #define ICE_GRID_DESCRIPTOR_HELPER_H #include #include #include #include #include namespace IceGrid { class ApplicationHelper; class Resolver { public: Resolver(const ApplicationDescriptor&, const Ice::CommunicatorPtr&, bool); Resolver(const Resolver&, const std::map&, bool); Resolver(const InternalNodeInfoPtr&, const Ice::CommunicatorPtr&); std::string operator()(const std::string&, const std::string& = std::string(), bool = true) const; Ice::StringSeq operator()(const Ice::StringSeq&, const std::string&) const; DistributionDescriptor operator()(const DistributionDescriptor&) const; PropertyDescriptorSeq operator()(const PropertyDescriptorSeq&, const std::string& = std::string("property")) const; PropertySetDescriptorDict operator()(const PropertySetDescriptorDict&) const; ObjectDescriptorSeq operator()(const ObjectDescriptorSeq&, const std::string&, const std::string&) const; Ice::Identity operator()(const Ice::Identity&, const std::string&) const; PropertySetDescriptor operator()(const PropertySetDescriptor&) const; std::string asInt(const std::string&, const std::string& = std::string()) const; std::string asFloat(const std::string&, const std::string& = std::string()) const; std::string asId(const std::string&, const std::string& = std::string(), bool = false) const; void setReserved(const std::string&, const std::string&); void setContext(const std::string&); void addPropertySets(const PropertySetDescriptorDict&); const PropertySetDescriptor& getPropertySet(const std::string&) const; PropertyDescriptorSeq getProperties(const Ice::StringSeq&) const; void addIgnored(const std::string&); void setVersion(const std::string&); int getVersion() const; void exception(const std::string&) const; TemplateDescriptor getServerTemplate(const std::string&) const; TemplateDescriptor getServiceTemplate(const std::string&) const; bool hasReplicaGroup(const std::string&) const; Ice::CommunicatorPtr getCommunicator() const { return _communicator; } bool warningEnabled() const { return _enableWarning; } private: std::string substitute(const std::string&, bool, bool) const; std::string getVariable(const std::string&, bool, bool&) const; PropertyDescriptorSeq getProperties(const Ice::StringSeq&, std::set&) const; static std::map getReserved(); void checkReserved(const std::string&, const std::map&) const; const ApplicationDescriptor* _application; const Ice::CommunicatorPtr _communicator; const bool _escape; const bool _enableWarning; std::string _context; std::map _variables; std::map _parameters; PropertySetDescriptorDict _propertySets; std::map _reserved; std::set _ignore; int _version; }; class CommunicatorHelper { public: CommunicatorHelper(const CommunicatorDescriptorPtr&, bool = false); CommunicatorHelper() : _ignoreProps(false) { } virtual ~CommunicatorHelper() { } virtual bool operator==(const CommunicatorHelper&) const; virtual bool operator!=(const CommunicatorHelper&) const; virtual void getIds(std::multiset&, std::multiset&) const; virtual void getReplicaGroups(std::set&) const; void print(const Ice::CommunicatorPtr&, IceUtilInternal::Output&) const; protected: void printDbEnv(IceUtilInternal::Output&, const DbEnvDescriptor&) const; void printObjectAdapter(const Ice::CommunicatorPtr&, IceUtilInternal::Output&, const AdapterDescriptor&) const; void printPropertySet(IceUtilInternal::Output&, const PropertySetDescriptor&) const; virtual std::string getProperty(const std::string&) const; void instantiateImpl(const CommunicatorDescriptorPtr&, const Resolver&) const; private: CommunicatorDescriptorPtr _desc; bool _ignoreProps; }; class ServiceHelper : public CommunicatorHelper { public: ServiceHelper(const ServiceDescriptorPtr&, bool = false); ServiceHelper() { } virtual bool operator==(const CommunicatorHelper&) const; virtual bool operator!=(const CommunicatorHelper&) const; ServiceDescriptorPtr getDescriptor() const; ServiceDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&, const PropertySetDescriptorDict&) const; void print(const Ice::CommunicatorPtr&, IceUtilInternal::Output&) const; protected: using CommunicatorHelper::instantiateImpl; void instantiateImpl(const ServiceDescriptorPtr&, const Resolver&, const PropertyDescriptorSeq&, const PropertySetDescriptorDict&) const; private: ServiceDescriptorPtr _desc; }; class ServerHelper : public CommunicatorHelper, public IceUtil::SimpleShared { public: ServerHelper(const ServerDescriptorPtr&, bool = false); ServerHelper() { } virtual bool operator==(const CommunicatorHelper&) const; virtual bool operator!=(const CommunicatorHelper&) const; ServerDescriptorPtr getDescriptor() const; virtual ServerDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&, const PropertySetDescriptorDict&) const; void print(const Ice::CommunicatorPtr&, IceUtilInternal::Output&) const; void print(const Ice::CommunicatorPtr&, IceUtilInternal::Output&, const ServerInfo&) const; protected: using CommunicatorHelper::instantiateImpl; void printImpl(const Ice::CommunicatorPtr&, IceUtilInternal::Output&, const ServerInfo&) const; void instantiateImpl(const ServerDescriptorPtr&, const Resolver&, const PropertyDescriptorSeq&) const; private: ServerDescriptorPtr _desc; }; typedef IceUtil::Handle ServerHelperPtr; class InstanceHelper { protected: std::map instantiateParams(const Resolver&, const std::string&, const std::map&, const std::vector&, const std::map&) const; }; class ServiceInstanceHelper : public InstanceHelper { public: ServiceInstanceHelper(const ServiceInstanceDescriptor&, bool); bool operator==(const ServiceInstanceHelper&) const; bool operator!=(const ServiceInstanceHelper&) const; ServiceInstanceDescriptor instantiate(const Resolver&, const PropertySetDescriptorDict&) const; void getIds(std::multiset&, std::multiset&) const; void getReplicaGroups(std::set&) const; void print(const Ice::CommunicatorPtr&, IceUtilInternal::Output&) const; private: ServiceInstanceDescriptor _def; mutable ServiceHelper _service; }; class IceBoxHelper : public ServerHelper { public: IceBoxHelper(const IceBoxDescriptorPtr&, bool = false); IceBoxHelper() { } virtual bool operator==(const CommunicatorHelper&) const; virtual bool operator!=(const CommunicatorHelper&) const; virtual ServerDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&, const PropertySetDescriptorDict&) const; virtual void getIds(std::multiset&, std::multiset&) const; virtual void getReplicaGroups(std::set&) const; void print(const Ice::CommunicatorPtr&, IceUtilInternal::Output&) const; void print(const Ice::CommunicatorPtr&, IceUtilInternal::Output&, const ServerInfo&) const; protected: #ifdef __SUNPRO_CC using ServerHelper::instantiateImpl; #endif void instantiateImpl(const IceBoxDescriptorPtr&, const Resolver&, const PropertyDescriptorSeq&, const PropertySetDescriptorDict&) const; private: IceBoxDescriptorPtr _desc; std::vector _services; }; class ServerInstanceHelper : public InstanceHelper { public: ServerInstanceHelper(const ServerInstanceDescriptor&, const Resolver&, bool); ServerInstanceHelper(const ServerDescriptorPtr&, const Resolver&, bool); void operator=(const ServerInstanceHelper&); bool operator==(const ServerInstanceHelper&) const; bool operator!=(const ServerInstanceHelper&) const; std::string getId() const; ServerInstanceDescriptor getDefinition() const; ServerInstanceDescriptor getInstance() const; ServerDescriptorPtr getServerDefinition() const; ServerDescriptorPtr getServerInstance() const; void getIds(std::multiset&, std::multiset&) const; void getReplicaGroups(std::set&) const; private: void init(const ServerDescriptorPtr&, const Resolver&, bool); const ServerInstanceDescriptor _def; std::string _id; ServerInstanceDescriptor _instance; ServerHelperPtr _serverDefinition; ServerHelperPtr _serverInstance; }; class NodeHelper { public: NodeHelper(const std::string&, const NodeDescriptor&, const Resolver&, bool); virtual ~NodeHelper() { } virtual bool operator==(const NodeHelper&) const; virtual bool operator!=(const NodeHelper&) const; NodeUpdateDescriptor diff(const NodeHelper&) const; NodeDescriptor update(const NodeUpdateDescriptor&, const Resolver&) const; void getIds(std::multiset&, std::multiset&, std::multiset&) const; void getReplicaGroups(std::set&) const; const NodeDescriptor& getDefinition() const; const NodeDescriptor& getInstance() const; void getServerInfos(const std::string&, const std::string&, int, std::map&) const; bool hasDistributions(const std::string&) const; bool hasServers() const; bool hasServer(const std::string&) const; void print(IceUtilInternal::Output&) const; void printDiff(IceUtilInternal::Output&, const NodeHelper&) const; private: NodeDescriptor instantiate(const Resolver&) const; std::string _name; NodeDescriptor _def; NodeDescriptor _instance; bool _instantiated; typedef std::map ServerInstanceHelperDict; ServerInstanceHelperDict _serverInstances; ServerInstanceHelperDict _servers; }; class ApplicationHelper { public: ApplicationHelper(const Ice::CommunicatorPtr&, const ApplicationDescriptor&, bool = false, bool = true); ApplicationUpdateDescriptor diff(const ApplicationHelper&) const; ApplicationDescriptor update(const ApplicationUpdateDescriptor&) const; ApplicationDescriptor instantiateServer(const std::string&, const ServerInstanceDescriptor&) const; void getIds(std::set&, std::set&, std::set&) const; void getReplicaGroups(std::set&, std::set&) const; const ApplicationDescriptor& getDefinition() const; const ApplicationDescriptor& getInstance() const; void getDistributions(DistributionDescriptor&, std::vector&,const std::string& = std::string()) const; void print(IceUtilInternal::Output&, const ApplicationInfo&) const; void printDiff(IceUtilInternal::Output&, const ApplicationHelper&) const; std::map getServerInfos(const std::string&, int) const; private: Ice::CommunicatorPtr _communicator; ApplicationDescriptor _def; ApplicationDescriptor _instance; typedef std::map NodeHelperDict; NodeHelperDict _nodes; }; bool descriptorEqual(const ServerDescriptorPtr&, const ServerDescriptorPtr&, bool = false); ServerHelperPtr createHelper(const ServerDescriptorPtr&); bool isServerUpdated(const ServerInfo&, const ServerInfo&, bool = false); } #endif Ice-3.5.1/cpp/src/IceGrid/NodeCache.h0000644000076400007640000000610012223561476015230 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_NODECACHE_H #define ICE_GRID_NODECACHE_H #include #include #include #include namespace IceGrid { class NodeCache; class SessionI; typedef IceUtil::Handle SessionIPtr; class NodeSessionI; typedef IceUtil::Handle NodeSessionIPtr; class ServerEntry; typedef IceUtil::Handle ServerEntryPtr; typedef std::vector ServerEntrySeq; class ReplicaCache; class NodeEntry : private IceUtil::Monitor { public: NodeEntry(NodeCache&, const std::string&); virtual ~NodeEntry(); void addDescriptor(const std::string&, const NodeDescriptor&); void removeDescriptor(const std::string&); void addServer(const ServerEntryPtr&); void removeServer(const ServerEntryPtr&); void setSession(const NodeSessionIPtr&); NodePrx getProxy() const; InternalNodeInfoPtr getInfo() const; ServerEntrySeq getServers() const; LoadInfo getLoadInfoAndLoadFactor(const std::string&, float&) const; NodeSessionIPtr getSession() const; bool canRemove(); void loadServer(const ServerEntryPtr&, const ServerInfo&, const SessionIPtr&, int, bool); void destroyServer(const ServerEntryPtr&, const ServerInfo&, int); ServerInfo getServerInfo(const ServerInfo&, const SessionIPtr&); InternalServerDescriptorPtr getInternalServerDescriptor(const ServerInfo&, const SessionIPtr&); void __incRef(); void __decRef(); void checkSession() const; void setProxy(const NodePrx&); void finishedRegistration(); void finishedRegistration(const Ice::Exception&); private: ServerDescriptorPtr getServerDescriptor(const ServerInfo&, const SessionIPtr&); InternalServerDescriptorPtr getInternalServerDescriptor(const ServerInfo&) const; NodeCache& _cache; IceUtil::Mutex _refMutex; int _ref; const std::string _name; NodeSessionIPtr _session; std::map _servers; std::map _descriptors; mutable bool _registering; mutable NodePrx _proxy; }; typedef IceUtil::Handle NodeEntryPtr; class NodeCache : public CacheByString { public: NodeCache(const Ice::CommunicatorPtr&, ReplicaCache&, const std::string&); NodeEntryPtr get(const std::string&, bool = false) const; const Ice::CommunicatorPtr& getCommunicator() const { return _communicator; } const std::string& getReplicaName() const { return _replicaName; } ReplicaCache& getReplicaCache() const { return _replicaCache; } private: const Ice::CommunicatorPtr _communicator; const std::string _replicaName; ReplicaCache& _replicaCache; }; }; #endif Ice-3.5.1/cpp/src/IceGrid/WellKnownObjectsManager.cpp0000644000076400007640000000532112223561476020503 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace IceGrid; WellKnownObjectsManager::WellKnownObjectsManager(const DatabasePtr& database) : _database(database), _initialized(false) { } void WellKnownObjectsManager::add(const Ice::ObjectPrx& proxy, const string& type) { assert(!_initialized); ObjectInfo info; info.type = type; info.proxy = proxy; _wellKnownObjects.push_back(info); } void WellKnownObjectsManager::addEndpoint(const string& name, const Ice::ObjectPrx& proxy) { _endpoints.insert(make_pair(name, proxy)); } void WellKnownObjectsManager::finish() { Lock sync(*this); _initialized = true; } void WellKnownObjectsManager::registerAll(const ReplicaSessionPrx& session) { if(!initialized()) { return; } assert(session); // // If initialized, the endpoints and well known objects are immutable. // session->setEndpoints(_endpoints); session->registerWellKnownObjects(_wellKnownObjects); } void WellKnownObjectsManager::registerAll() { if(!initialized()) { return; } // // If initialized, the endpoints and well known objects are immutable. // updateReplicatedWellKnownObjects(); _database->addOrUpdateRegistryWellKnownObjects(_wellKnownObjects); } void WellKnownObjectsManager::updateReplicatedWellKnownObjects() { if(!initialized()) { return; } // // Update replicated objects. // Ice::Identity id; id.category = _database->getInstanceName(); ObjectInfo info; ObjectInfoSeq objects; Lock sync(*this); Ice::ObjectPrx replicatedClientProxy = _database->getReplicaCache().getEndpoints("Client", _endpoints["Client"]); id.name = "Query"; info.type = Query::ice_staticId(); info.proxy = replicatedClientProxy->ice_identity(id); objects.push_back(info); id.name = "Locator"; info.type = Ice::Locator::ice_staticId(); info.proxy = replicatedClientProxy->ice_identity(id); objects.push_back(info); _database->addOrUpdateRegistryWellKnownObjects(objects); } bool WellKnownObjectsManager::initialized() const { Lock sync(*this); return _initialized; } Ice::ObjectPrx WellKnownObjectsManager::getEndpoints(const string& name) { Lock sync(*this); return _endpoints[name]; } Ice-3.5.1/cpp/src/IceGrid/FileParserI.h0000644000076400007640000000117012223561476015566 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_FILE_PARSERI_H #define ICE_GRID_FILE_PARSERI_H #include class FileParserI : public IceGrid::FileParser { public: IceGrid::ApplicationDescriptor parse(const std::string& file, const IceGrid::AdminPrx& admin, const Ice::Current&); }; #endif Ice-3.5.1/cpp/src/IceGrid/Cache.h0000644000076400007640000000664612223561476014441 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_CACHE_H #define ICE_GRID_CACHE_H #include #include #include #include namespace IceGrid { class SynchronizationCallback : virtual public IceUtil::Shared { public: virtual void synchronized() = 0; virtual void synchronized(const Ice::Exception&) = 0; }; typedef IceUtil::Handle SynchronizationCallbackPtr; template class Cache : public IceUtil::Monitor { typedef IceUtil::Handle ValuePtr; typedef std::map ValueMap; public: Cache() : _entriesHint(_entries.end()) { } virtual ~Cache() { } bool has(const Key& key) const { Lock sync(*this); return getImpl(key); } void remove(const Key& key) { Lock sync(*this); removeImpl(key); } void setTraceLevels(const TraceLevelsPtr& traceLevels) { _traceLevels = traceLevels; } const TraceLevelsPtr& getTraceLevels() const { return _traceLevels; } protected: virtual ValuePtr getImpl(const Key& key) const { typename ValueMap::iterator p = const_cast(_entries).end(); if(_entriesHint != p) { if(_entriesHint->first == key) { p = _entriesHint; } } if(p == const_cast(_entries).end()) { p = const_cast(_entries).find(key); } if(p != const_cast(_entries).end()) { const_cast(_entriesHint) = p; return p->second; } else { return 0; } } virtual ValuePtr addImpl(const Key& key, const ValuePtr& entry) { typename ValueMap::value_type v(key, entry); _entriesHint = _entries.insert(_entriesHint, v); return entry; } virtual void removeImpl(const Key& key) { typename ValueMap::iterator p = _entries.end(); if(_entriesHint != _entries.end()) { if(_entriesHint->first == key) { p = _entriesHint; } } if(p == _entries.end()) { p = _entries.find(key); } assert(p != _entries.end()); if(p->second->canRemove()) { _entries.erase(p); _entriesHint = _entries.end(); } else { _entriesHint = p; } } TraceLevelsPtr _traceLevels; ValueMap _entries; typename ValueMap::iterator _entriesHint; }; template class CacheByString : public Cache { typedef IceUtil::Handle TPtr; public: virtual std::vector getAll(const std::string& expr) { IceUtil::Monitor::Lock sync(*this); return getMatchingKeys >(Cache::_entries, expr); } }; }; #endif Ice-3.5.1/cpp/src/IceGrid/ServerCache.cpp0000644000076400007640000007301512223561476016155 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace IceGrid; namespace IceGrid { struct AddCommunicator : std::unary_function { AddCommunicator(ServerCache& serverCache, const ServerEntryPtr& entry, const string& application) : _serverCache(serverCache), _entry(entry), _application(application) { } void operator()(const CommunicatorDescriptorPtr& desc) { _serverCache.addCommunicator(desc, _entry, _application); } ServerCache& _serverCache; const ServerEntryPtr _entry; const string _application; }; struct RemoveCommunicator : std::unary_function { RemoveCommunicator(ServerCache& serverCache, const ServerEntryPtr& entry) : _serverCache(serverCache), _entry(entry) { } void operator()(const CommunicatorDescriptorPtr& desc) { _serverCache.removeCommunicator(desc, _entry); } ServerCache& _serverCache; const ServerEntryPtr _entry; }; } CheckUpdateResult::CheckUpdateResult(const string& server, const string& node, bool noRestart, const Ice::AsyncResultPtr& result) : _server(server), _node(node), _noRestart(noRestart), _result(result) { } bool CheckUpdateResult::getResult() { try { return ServerPrx::uncheckedCast(_result->getProxy())->end_checkUpdate(_result); } catch(const DeploymentException& ex) { ostringstream os; os << "check for server `" << _server << "' update failed: " << ex.reason; throw DeploymentException(os.str()); } catch(const Ice::OperationNotExistException&) { if(_noRestart) { throw DeploymentException("server `" + _server + "' doesn't support check for updates"); } return false; } catch(const Ice::Exception& ex) { ostringstream os; os << ex; throw NodeUnreachableException(_node, os.str()); } return false; } ServerCache::ServerCache(const Ice::CommunicatorPtr& communicator, const string& instanceName, NodeCache& nodeCache, AdapterCache& adapterCache, ObjectCache& objectCache, AllocatableObjectCache& allocatableObjectCache) : _communicator(communicator), _instanceName(instanceName), _nodeCache(nodeCache), _adapterCache(adapterCache), _objectCache(objectCache), _allocatableObjectCache(allocatableObjectCache) { } ServerEntryPtr ServerCache::add(const ServerInfo& info, bool noRestart) { Lock sync(*this); ServerEntryPtr entry = getImpl(info.descriptor->id); if(!entry) { entry = new ServerEntry(*this, info.descriptor->id); addImpl(info.descriptor->id, entry); } entry->update(info, noRestart); _nodeCache.get(info.node, true)->addServer(entry); forEachCommunicator(AddCommunicator(*this, entry, info.application))(info.descriptor); if(_traceLevels && _traceLevels->server > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat); out << "added server `" << info.descriptor->id << "' (`" << info.uuid << "', `" << info.revision << "')"; } return entry; } ServerEntryPtr ServerCache::get(const string& id) const { Lock sync(*this); ServerEntryPtr entry = getImpl(id); if(!entry) { ServerNotExistException ex; ex.id = id; throw ex; } return entry; } bool ServerCache::has(const string& id) const { Lock sync(*this); ServerEntryPtr entry = getImpl(id); return entry && !entry->isDestroyed(); } ServerEntryPtr ServerCache::remove(const string& id, bool destroy) { Lock sync(*this); ServerEntryPtr entry = getImpl(id); ServerInfo info = entry->getInfo(); forEachCommunicator(RemoveCommunicator(*this, entry))(info.descriptor); _nodeCache.get(info.node)->removeServer(entry); if(destroy) { entry->destroy(); // This must be done after otherwise some allocatable objects // might allocate a destroyed server. } if(_traceLevels && _traceLevels->server > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat); out << "removed server `" << id << "'"; } return entry; } void ServerCache::clear(const string& id) { Lock sync(*this); CacheByString::removeImpl(id); } void ServerCache::addCommunicator(const CommunicatorDescriptorPtr& comm, const ServerEntryPtr& server, const string& application) { for(AdapterDescriptorSeq::const_iterator q = comm->adapters.begin() ; q != comm->adapters.end(); ++q) { assert(!q->id.empty()); _adapterCache.addServerAdapter(*q, server, application); for(ObjectDescriptorSeq::const_iterator r = q->objects.begin(); r != q->objects.end(); ++r) { _objectCache.add(toObjectInfo(_communicator, *r, q->id), application); } for(ObjectDescriptorSeq::const_iterator r = q->allocatables.begin(); r != q->allocatables.end(); ++r) { _allocatableObjectCache.add(toObjectInfo(_communicator, *r, q->id), server); } } } void ServerCache::removeCommunicator(const CommunicatorDescriptorPtr& comm, const ServerEntryPtr& /*entry*/) { for(AdapterDescriptorSeq::const_iterator q = comm->adapters.begin() ; q != comm->adapters.end(); ++q) { for(ObjectDescriptorSeq::const_iterator r = q->objects.begin(); r != q->objects.end(); ++r) { _objectCache.remove(r->id); } for(ObjectDescriptorSeq::const_iterator r = q->allocatables.begin(); r != q->allocatables.end(); ++r) { _allocatableObjectCache.remove(r->id); } _adapterCache.removeServerAdapter(q->id); } } ServerEntry::ServerEntry(ServerCache& cache, const string& id) : Allocatable(false, 0), _cache(cache), _id(id), _activationTimeout(-1), _deactivationTimeout(-1), _synchronizing(false), _updated(false), _noRestart(false) { } void ServerEntry::sync() { syncImpl(); } void ServerEntry::waitForSync(int timeout) { waitImpl(timeout); } void ServerEntry::waitForSyncNoThrow(int timeout) { try { waitImpl(timeout); } catch(SynchronizationException&) { assert(timeout >= 0); } catch(const Ice::Exception&) { } } void ServerEntry::unsync() { Lock sync(*this); if(_loaded.get()) { _load = _loaded; } _proxy = 0; _adapters.clear(); _activationTimeout = -1; _deactivationTimeout = -1; } bool ServerEntry::addSyncCallback(const SynchronizationCallbackPtr& callback) { Lock sync(*this); if(!_loaded.get() && !_load.get()) { throw ServerNotExistException(); } if(_synchronizing) { _callbacks.push_back(callback); } return _synchronizing; } void ServerEntry::update(const ServerInfo& info, bool noRestart) { Lock sync(*this); IceUtil::UniquePtr descriptor(new ServerInfo()); *descriptor = info; _updated = true; if(!_destroy.get()) { if(_loaded.get() && descriptor->node != _loaded->node) { _destroy = _loaded; } else if(_load.get() && descriptor->node != _load->node) { _destroy = _load; } } _load = descriptor; _noRestart = noRestart; _loaded.reset(0); _allocatable = info.descriptor->allocatable; if(info.descriptor->activation == "session") { _allocatable = true; _load->sessionId = _session ? _session->getId() : string(""); } } void ServerEntry::destroy() { Lock sync(*this); _updated = true; assert(_loaded.get() || _load.get()); if(!_destroy.get()) { if(_loaded.get()) { assert(!_destroy.get()); _destroy = _loaded; } else if(_load.get()) { assert(!_destroy.get()); _destroy = _load; } } _load.reset(0); _loaded.reset(0); _allocatable = false; } ServerInfo ServerEntry::getInfo(bool resolve) const { ServerInfo info; SessionIPtr session; { Lock sync(*this); if(!_loaded.get() && !_load.get()) { throw ServerNotExistException(); } info = _loaded.get() ? *_loaded : *_load; session = _session; } assert(info.descriptor); if(resolve) { try { return _cache.getNodeCache().get(info.node)->getServerInfo(info, session); } catch(const DeploymentException&) { } catch(const NodeNotExistException&) { } catch(const NodeUnreachableException&) { } } return info; } string ServerEntry::getId() const { return _id; } ServerPrx ServerEntry::getProxy(bool upToDate, int timeout) { // // NOTE: this might throw ServerNotExistException, NodeUnreachableException // or DeploymentException. // int actTimeout, deactTimeout; string node; return getProxy(actTimeout, deactTimeout, node, upToDate, timeout); } ServerPrx ServerEntry::getProxy(int& activationTimeout, int& deactivationTimeout, string& node, bool upToDate, int timeout) { // // NOTE: this might throw ServerNotExistException, NodeUnreachableException // or DeploymentException. // while(true) { { Lock sync(*this); if(_loaded.get() || (_proxy && _synchronizing && !upToDate)) // Synced or if not up to date is fine { assert(_loaded.get() || _load.get() || _destroy.get()); activationTimeout = _activationTimeout; deactivationTimeout = _deactivationTimeout; node = _loaded.get() ? _loaded->node : (_load.get() ? _load->node : _destroy->node); return _proxy; } else if(!_load.get() && !_destroy.get()) { throw ServerNotExistException(_id); } } syncImpl(); waitImpl(timeout); } } Ice::ObjectPrx ServerEntry::getAdminProxy() { // // The category must match the server admin category used by nodes // Ice::Identity adminId; adminId.name = _id; adminId.category = _cache.getInstanceName() + "-NodeRouter"; try { return getProxy(true)->ice_identity(adminId); } catch(const SynchronizationException&) { } return 0; } AdapterPrx ServerEntry::getAdapter(const string& id, bool upToDate) { // // NOTE: this might throw AdapterNotExistException, NodeUnreachableException // or DeploymentException. // int activationTimeout, deactivationTimeout; return getAdapter(activationTimeout, deactivationTimeout, id, upToDate); } AdapterPrx ServerEntry::getAdapter(int& activationTimeout, int& deactivationTimeout, const string& id, bool upToDate) { // // NOTE: this might throw AdapterNotExistException, NodeUnreachableException // or DeploymentException. // while(true) { { Lock sync(*this); if(_loaded.get() || (_proxy && _synchronizing && !upToDate)) // Synced or if not up to date is fine { AdapterPrxDict::const_iterator p = _adapters.find(id); if(p != _adapters.end()) { assert(p->second); activationTimeout = _activationTimeout; deactivationTimeout = _deactivationTimeout; return p->second; } else { throw AdapterNotExistException(id); } } else if(!_load.get() && !_destroy.get()) { throw AdapterNotExistException(id); } } syncImpl(); waitImpl(0); // Don't wait, just check for the result or throw SynchronizationException } } float ServerEntry::getLoad(LoadSample sample) const { string application; string node; { Lock sync(*this); if(_loaded.get()) { application = _loaded->application; node = _loaded->node; } else if(_load.get()) { application = _load->application; node = _load->node; } else { throw ServerNotExistException(); } } float factor; LoadInfo load = _cache.getNodeCache().get(node)->getLoadInfoAndLoadFactor(application, factor); switch(sample) { case LoadSample1: return load.avg1 < 0.f ? 1.0f : load.avg1 * factor; case LoadSample5: return load.avg5 < 0.f ? 1.0f : load.avg5 * factor; case LoadSample15: return load.avg15 < 0.f ? 1.0f : load.avg15 * factor; default: assert(false); return 1.0f; } } void ServerEntry::syncImpl() { ServerInfo load; SessionIPtr session; ServerInfo destroy; int timeout = -1; bool noRestart = false; { Lock sync(*this); if(_synchronizing) { return; } if(!_load.get() && !_destroy.get()) { _load = _loaded; // Re-load the current server. } _updated = false; _exception.reset(0); if(_destroy.get()) { destroy = *_destroy; timeout = _deactivationTimeout; } else if(_load.get()) { load = *_load; session = _session; timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server. noRestart = _noRestart; } else { return; } _synchronizing = true; } if(destroy.descriptor) { try { _cache.getNodeCache().get(destroy.node)->destroyServer(this, destroy, timeout); } catch(NodeNotExistException&) { exception(NodeUnreachableException(destroy.node, "node is not active")); } } else if(load.descriptor) { try { _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout, noRestart); } catch(NodeNotExistException&) { exception(NodeUnreachableException(load.node, "node is not active")); } } } void ServerEntry::waitImpl(int timeout) { Lock sync(*this); if(timeout != 0) { while(_synchronizing) { if(timeout > 0) { if(!timedWait(IceUtil::Time::seconds(timeout))) { break; // Timeout } } else { wait(); } } } if(_synchronizing) // If we are still synchronizing, throw SynchronizationException { throw SynchronizationException(__FILE__, __LINE__); } if(_exception.get()) { try { _exception->ice_throw(); } catch(const DeploymentException&) { throw; } catch(const NodeUnreachableException&) { throw; } catch(const Ice::Exception& ex) // This shouln't happen. { ostringstream os; os << "unexpected exception while synchronizing server `" + _id + "':\n" << ex; TraceLevelsPtr traceLevels = _cache.getTraceLevels(); if(traceLevels) { Ice::Error err(traceLevels->logger); err << os.str(); } throw DeploymentException(os.str()); } } } void ServerEntry::synchronized() { vector callbacks; { Lock sync(*this); _callbacks.swap(callbacks); } for(vector::const_iterator p = callbacks.begin(); p != callbacks.end(); ++p) { try { (*p)->synchronized(); } catch(...) { assert(false); } } } void ServerEntry::synchronized(const Ice::Exception& ex) { vector callbacks; { Lock sync(*this); _callbacks.swap(callbacks); } for(vector::const_iterator p = callbacks.begin(); p != callbacks.end(); ++p) { try { (*p)->synchronized(ex); } catch(...) { assert(false); } } } void ServerEntry::loadCallback(const ServerPrx& proxy, const AdapterPrxDict& adpts, int at, int dt) { ServerInfo load; SessionIPtr session; ServerInfo destroy; int timeout = -1; bool synced = false; bool noRestart = false; { Lock sync(*this); if(!_updated) { // // Set timeout on server and adapter proxies. Most of the // calls on the proxies shouldn't block for longer than the // node session timeout. Calls that might block for a longer // time should set the correct timeout before invoking on the // proxy (e.g.: server start/stop, adapter activate). // _loaded = _load; assert(_loaded.get()); _proxy = proxy; _adapters = adpts; _activationTimeout = at; _deactivationTimeout = dt; assert(!_destroy.get() && !_load.get()); _synchronizing = false; synced = true; notifyAll(); } else { _updated = false; if(_destroy.get()) { destroy = *_destroy; } else if(_load.get()) { load = *_load; noRestart = _noRestart; session = _session; timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server. } } } if(synced) { synchronized(); return; } assert(destroy.descriptor || load.descriptor); if(destroy.descriptor) { try { _cache.getNodeCache().get(destroy.node)->destroyServer(this, destroy, timeout); } catch(NodeNotExistException&) { exception(NodeUnreachableException(destroy.node, "node is not active")); } } else if(load.descriptor) { try { _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout, noRestart); } catch(NodeNotExistException&) { exception(NodeUnreachableException(load.node, "node is not active")); } } } void ServerEntry::destroyCallback() { ServerInfo load; bool noRestart = false; SessionIPtr session; { Lock sync(*this); _destroy.reset(0); _proxy = 0; _adapters.clear(); _activationTimeout = -1; _deactivationTimeout = -1; if(!_load.get()) { assert(!_load.get() && !_loaded.get()); _synchronizing = false; notifyAll(); } else { _updated = false; load = *_load; noRestart = _noRestart; session = _session; } } if(load.descriptor) { try { _cache.getNodeCache().get(load.node)->loadServer(this, load, session, -1, noRestart); } catch(NodeNotExistException&) { exception(NodeUnreachableException(load.node, "node is not active")); } } else { synchronized(); _cache.clear(_id); } } void ServerEntry::exception(const Ice::Exception& ex) { ServerInfo load; SessionIPtr session; bool noRestart = false; bool remove = false; int timeout = -1; { Lock sync(*this); if((_destroy.get() && !_load.get()) || (!_destroy.get() && !_updated)) { remove = _destroy.get(); _destroy.reset(0); _exception.reset(ex.ice_clone()); _proxy = 0; _adapters.clear(); _activationTimeout = -1; _deactivationTimeout = -1; _synchronizing = false; notifyAll(); } else { _destroy.reset(0); _updated = false; load = *_load.get(); noRestart = _noRestart; session = _session; timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server. } } if(load.descriptor) { try { _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout, noRestart); } catch(NodeNotExistException&) { exception(NodeUnreachableException(load.node, "node is not active")); } } else { synchronized(ex); if(remove) { _cache.clear(_id); } } } bool ServerEntry::isDestroyed() { Lock sync(*this); return !_loaded.get() && !_load.get(); } bool ServerEntry::canRemove() { Lock sync(*this); return !_loaded.get() && !_load.get() && !_destroy.get(); } CheckUpdateResultPtr ServerEntry::checkUpdate(const ServerInfo& info, bool noRestart) { SessionIPtr session; { Lock sync(*this); if(!_loaded.get() && !_load.get()) { throw ServerNotExistException(); } ServerInfo oldInfo = _loaded.get() ? *_loaded : *_load; if(noRestart && info.node != oldInfo.node) { throw DeploymentException("server `" + _id + "' is moving to another node"); } session = _session; } NodeEntryPtr node; try { node = _cache.getNodeCache().get(info.node); } catch(NodeNotExistException&) { throw NodeUnreachableException(info.node, "node is not active"); } ServerPrx server; try { server = getProxy(true, 5); } catch(const SynchronizationException&) { ostringstream os; os << "check for server `" << _id << "' update failed:"; os << "timeout while waiting for the server to be loaded on the node"; throw DeploymentException(os.str()); } catch(const DeploymentException&) { if(noRestart) { // If the server can't be loaded and no restart is required, we throw // to indicate that the server update can't be checked. throw; } else { // Otherwise, we do as if the update is valid. return 0; } } InternalServerDescriptorPtr desc = node->getInternalServerDescriptor(info, session); return new CheckUpdateResult(_id, info.node, noRestart, server->begin_checkUpdate(desc, noRestart)); } void ServerEntry::allocated(const SessionIPtr& session) { if(!_loaded.get() && !_load.get()) { return; } TraceLevelsPtr traceLevels = _cache.getTraceLevels(); if(traceLevels && traceLevels->server > 1) { Ice::Trace out(traceLevels->logger, traceLevels->serverCat); out << "server `" << _id << "' allocated by `" << session->getId() << "' (" << _count << ")"; } ServerDescriptorPtr desc = _loaded.get() ? _loaded->descriptor : _load->descriptor; // // If the server has the session activation mode, we re-load the // server on the node as its deployment might have changed (it's // possible to use ${session.*} variable with server with the // session activation mode. // if(desc->activation == "session") { _updated = true; if(!_load.get()) { _load = _loaded; } _session = session; _load->sessionId = session->getId(); } Glacier2::IdentitySetPrx identitySet = session->getGlacier2IdentitySet(); Glacier2::StringSetPrx adapterIdSet = session->getGlacier2AdapterIdSet(); if(identitySet && adapterIdSet) { ServerHelperPtr helper = createHelper(desc); multiset adapterIds; multiset identities; helper->getIds(adapterIds, identities); try { // // SunCC won't accept the following: // // ctl->adapterIds()->add(Ice::StringSeq(adapterIds.begin(), adapterIds.end())); // ctl->identities()->add(Ice::IdentitySeq(identities.begin(), identities.end())); // Ice::StringSeq adapterIdSeq; for(multiset::iterator p = adapterIds.begin(); p != adapterIds.end(); ++p) { adapterIdSeq.push_back(*p); } Ice::IdentitySeq identitySeq; for(multiset::iterator q = identities.begin(); q != identities.end(); ++q) { identitySeq.push_back(*q); } adapterIdSet->add(adapterIdSeq); identitySet->add(identitySeq); } catch(const Ice::LocalException& ex) { if(traceLevels && traceLevels->server > 0) { Ice::Trace out(traceLevels->logger, traceLevels->serverCat); out << "couldn't add Glacier2 filters for server `" << _id << "' allocated by `" << session->getId() << ":\n" << ex; } } } } void ServerEntry::allocatedNoSync(const SessionIPtr& /*session*/) { { Lock sync(*this); if(!_updated || (_loaded.get() && _loaded->descriptor->activation != "session") || (_load.get() && _load->descriptor->activation != "session")) { return; } } sync(); waitForSyncNoThrow(); } void ServerEntry::released(const SessionIPtr& session) { if(!_loaded.get() && !_load.get()) { return; } ServerDescriptorPtr desc = _loaded.get() ? _loaded->descriptor : _load->descriptor; // // If the server has the session activation mode, we re-load the // server on the node as its deployment might have changed (it's // possible to use ${session.*} variable with server with the // session activation mode. Synchronizing the server will also // shutdown the server on the node. // if(desc->activation == "session") { _updated = true; if(!_load.get()) { _load = _loaded; } _load->sessionId = ""; _session = 0; } TraceLevelsPtr traceLevels = _cache.getTraceLevels(); Glacier2::IdentitySetPrx identitySet = session->getGlacier2IdentitySet(); Glacier2::StringSetPrx adapterIdSet = session->getGlacier2AdapterIdSet(); if(identitySet && adapterIdSet) { ServerHelperPtr helper = createHelper(desc); multiset adapterIds; multiset identities; helper->getIds(adapterIds, identities); try { // // SunCC won't accept the following: // // ctl->adapterIds()->remove(Ice::StringSeq(adapterIds.begin(), adapterIds.end())); // ctl->identities()->remove(Ice::IdentitySeq(identities.begin(), identities.end())); // Ice::StringSeq adapterIdSeq; for(multiset::iterator p = adapterIds.begin(); p != adapterIds.end(); ++p) { adapterIdSeq.push_back(*p); } Ice::IdentitySeq identitySeq; for(multiset::iterator q = identities.begin(); q != identities.end(); ++q) { identitySeq.push_back(*q); } adapterIdSet->remove(adapterIdSeq); identitySet->remove(identitySeq); } catch(const Ice::LocalException& ex) { if(traceLevels && traceLevels->server > 0) { Ice::Trace out(traceLevels->logger, traceLevels->serverCat); out << "couldn't remove Glacier2 filters for server `" << _id << "' allocated by `"; out << session->getId() << ":\n" << ex; } } } if(traceLevels && traceLevels->server > 1) { Ice::Trace out(traceLevels->logger, traceLevels->serverCat); out << "server `" << _id << "' released by `" << session->getId() << "' (" << _count << ")"; } } void ServerEntry::releasedNoSync(const SessionIPtr& /*session*/) { { Lock sync(*this); if(!_updated || (_loaded.get() && _loaded->descriptor->activation != "session") || (_load.get() && _load->descriptor->activation != "session")) { return; } } sync(); waitForSyncNoThrow(); } Ice-3.5.1/cpp/src/IceGrid/AdminCallbackRouter.h0000644000076400007640000000360012223561476017267 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_ADMIN_CALLBACK_ROUTER_H #define ICE_GRID_ADMIN_CALLBACK_ROUTER_H #include #include #include namespace IceGrid { // // The AdminCallbackRouter routes callbacks from the servers, nodes etc. to the // admin clients using the admin-client => registry connection. // class AdminCallbackRouter : public Ice::BlobjectArrayAsync { public: void addMapping(const std::string&, const Ice::ConnectionPtr&); void removeMapping(const std::string&); class InvokeCookie : public Ice::LocalObject { public: InvokeCookie(const Ice::AMD_Object_ice_invokePtr& cb) : _cb(cb) { } Ice::AMD_Object_ice_invokePtr cb() { return _cb; } private: Ice::AMD_Object_ice_invokePtr _cb; }; typedef IceUtil::Handle InvokeCookiePtr; virtual void invokeResponse(bool, const std::pair&, const InvokeCookiePtr&); virtual void invokeException(const Ice::Exception&, const InvokeCookiePtr&); virtual void ice_invoke_async(const Ice::AMD_Object_ice_invokePtr&, const std::pair&, const Ice::Current&); private: IceUtil::Mutex _mutex; std::map _categoryToConnection; }; typedef IceUtil::Handle AdminCallbackRouterPtr; } #endif Ice-3.5.1/cpp/src/IceGrid/DescriptorBuilder.cpp0000644000076400007640000006441212223561476017411 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace IceGrid; XmlAttributesHelper::XmlAttributesHelper(const IceXML::Attributes& attrs, const Ice::LoggerPtr& logger, const string& filename, int line) : _attributes(attrs), _logger(logger), _filename(filename), _line(line) { } void XmlAttributesHelper::checkUnknownAttributes() { vector notUsed; for(map::const_iterator p = _attributes.begin(); p != _attributes.end(); ++p) { if(_used.find(p->first) == _used.end()) { notUsed.push_back(p->first); } } if(!notUsed.empty()) { ostringstream os; os << "unknown attributes in <" << _filename << "> descriptor, line " << _line << ":\n" << toString(notUsed); throw os.str(); } } bool XmlAttributesHelper::contains(const string& name) const { _used.insert(name); return _attributes.find(name) != _attributes.end(); } string XmlAttributesHelper::operator()(const string& name) const { _used.insert(name); IceXML::Attributes::const_iterator p = _attributes.find(name); if(p == _attributes.end()) { throw "missing attribute '" + name + "'"; } string v = p->second; if(v.empty()) { throw "attribute '" + name + "' is empty"; } return v; } string XmlAttributesHelper::operator()(const string& name, const string& def) const { _used.insert(name); IceXML::Attributes::const_iterator p = _attributes.find(name); if(p == _attributes.end()) { return def; } else { return p->second; } } map XmlAttributesHelper::asMap() const { for(map::const_iterator p = _attributes.begin(); p != _attributes.end(); ++p) { _used.insert(p->first); } return _attributes; } bool XmlAttributesHelper::asBool(const string& name) const { _used.insert(name); IceXML::Attributes::const_iterator p = _attributes.find(name); if(p == _attributes.end()) { throw "missing attribute '" + name + "'"; return true; // Keep the compiler happy. } else if(p->second == "true") { return true; } else if(p->second == "false") { return false; } else { throw "invalid attribute `" + name + "': value is not 'false' or 'true'"; return true; // Keep the compiler happy. } } bool XmlAttributesHelper::asBool(const string& name, bool def) const { _used.insert(name); IceXML::Attributes::const_iterator p = _attributes.find(name); if(p == _attributes.end()) { return def; } else if(p->second == "true") { return true; } else if(p->second == "false") { return false; } else { throw "invalid attribute `" + name + "': value is not 'false' or 'true'"; return true; // Keep the compiler happy. } } void DescriptorBuilder::addVariable(const XmlAttributesHelper&) { throw "the element can't be a child of this element"; } PropertySetDescriptorBuilder::PropertySetDescriptorBuilder() : _inPropertySetRef(false) { } void PropertySetDescriptorBuilder::setId(const string& id) { _id = id; } void PropertySetDescriptorBuilder::setService(const string& service) { _service = service; } const string& PropertySetDescriptorBuilder::getService() const { return _service; } const string& PropertySetDescriptorBuilder::getId() const { assert(!_id.empty()); return _id; } const PropertySetDescriptor& PropertySetDescriptorBuilder::getDescriptor() const { return _descriptor; } void PropertySetDescriptorBuilder::addProperty(const XmlAttributesHelper& attrs) { PropertyDescriptor prop; prop.name = attrs("name"); prop.value = attrs("value", ""); _descriptor.properties.push_back(prop); } void PropertySetDescriptorBuilder::addPropertySet(const XmlAttributesHelper& attrs) { if(attrs.contains("id") || !attrs.contains("refid")) { throw "only can be a child of a element"; } if(!_descriptor.properties.empty()) { throw " can't be defined after a element"; } _descriptor.references.push_back(attrs("refid")); _inPropertySetRef = true; } bool PropertySetDescriptorBuilder::finish() { if(_inPropertySetRef) { _inPropertySetRef = false; return false; } return true; } ApplicationDescriptorBuilder::ApplicationDescriptorBuilder(const Ice::CommunicatorPtr& communicator, const XmlAttributesHelper& attrs, const map& overrides) : _communicator(communicator), _overrides(overrides) { _descriptor.name = attrs("name"); _descriptor.variables = overrides; } ApplicationDescriptorBuilder::ApplicationDescriptorBuilder(const Ice::CommunicatorPtr& communicator, const ApplicationDescriptor& app, const XmlAttributesHelper& attrs, const map& overrides) : _communicator(communicator), _descriptor(app), _overrides(overrides) { _descriptor.name = attrs("name"); _descriptor.variables = overrides; } const ApplicationDescriptor& ApplicationDescriptorBuilder::getDescriptor() const { return _descriptor; } void ApplicationDescriptorBuilder::setDescription(const string& desc) { _descriptor.description = desc; } void ApplicationDescriptorBuilder::addReplicaGroup(const XmlAttributesHelper& attrs) { ReplicaGroupDescriptor adapter; adapter.id = attrs("id"); adapter.proxyOptions = attrs("proxy-options", ""); _descriptor.replicaGroups.push_back(adapter); } void ApplicationDescriptorBuilder::finishReplicaGroup() { if(!_descriptor.replicaGroups.back().loadBalancing) { _descriptor.replicaGroups.back().loadBalancing = new RandomLoadBalancingPolicy(); _descriptor.replicaGroups.back().loadBalancing->nReplicas = "0"; } } void ApplicationDescriptorBuilder::setLoadBalancing(const XmlAttributesHelper& attrs) { LoadBalancingPolicyPtr policy; string type = attrs("type"); if(type == "random") { policy = new RandomLoadBalancingPolicy(); } else if(type == "ordered") { policy = new OrderedLoadBalancingPolicy(); } else if(type == "round-robin") { policy = new RoundRobinLoadBalancingPolicy(); } else if(type == "adaptive") { AdaptiveLoadBalancingPolicyPtr alb = new AdaptiveLoadBalancingPolicy(); alb->loadSample = attrs("load-sample", "1"); policy = alb; } else { throw "invalid load balancing policy `" + type + "'"; } policy->nReplicas = attrs("n-replicas", "1"); _descriptor.replicaGroups.back().loadBalancing = policy; } void ApplicationDescriptorBuilder::setReplicaGroupDescription(const string& description) { _descriptor.replicaGroups.back().description = description; } void ApplicationDescriptorBuilder::addObject(const XmlAttributesHelper& attrs) { ObjectDescriptor object; object.type = attrs("type", ""); object.id = _communicator->stringToIdentity(attrs("identity")); object.proxyOptions = attrs("proxy-options", ""); if(attrs.contains("property")) { throw "property attribute is not allowed in object descriptors from a replica group"; } _descriptor.replicaGroups.back().objects.push_back(object); } void ApplicationDescriptorBuilder::addVariable(const XmlAttributesHelper& attrs) { if(!isOverride(attrs("name"))) { _descriptor.variables[attrs("name")] = attrs("value", ""); } else { attrs.contains("value"); // NOTE: prevents warning about "value" not being used. } } NodeDescriptorBuilder* ApplicationDescriptorBuilder::createNode(const XmlAttributesHelper& attrs) { return new NodeDescriptorBuilder(*this, _descriptor.nodes[attrs("name")], attrs); } TemplateDescriptorBuilder* ApplicationDescriptorBuilder::createServerTemplate(const XmlAttributesHelper& attrs) { return new TemplateDescriptorBuilder(*this, attrs, false); } TemplateDescriptorBuilder* ApplicationDescriptorBuilder::createServiceTemplate(const XmlAttributesHelper& attrs) { return new TemplateDescriptorBuilder(*this, attrs, true); } PropertySetDescriptorBuilder* ApplicationDescriptorBuilder::createPropertySet(const XmlAttributesHelper& attrs) const { string id = attrs("id"); PropertySetDescriptorBuilder* builder = new PropertySetDescriptorBuilder(); builder->setId(id); return builder; } void ApplicationDescriptorBuilder::addNode(const string& name, const NodeDescriptor& desc) { _descriptor.nodes[name] = desc; } void ApplicationDescriptorBuilder::addServerTemplate(const string& id, const TemplateDescriptor& templ) { if(!templ.descriptor) { throw "invalid server template `" + id + "': server definition is missing"; } if(!_descriptor.serverTemplates.insert(make_pair(id, templ)).second) { throw "duplicate server template `" + id + "'"; } } void ApplicationDescriptorBuilder::addServiceTemplate(const string& id, const TemplateDescriptor& templ) { if(!templ.descriptor) { throw "invalid service template `" + id + "': service definition is missing"; } if(!_descriptor.serviceTemplates.insert(make_pair(id, templ)).second) { throw "duplicate service template `" + id + "'"; } } void ApplicationDescriptorBuilder::addPropertySet(const string& id, const PropertySetDescriptor& desc) { if(!_descriptor.propertySets.insert(make_pair(id, desc)).second) { throw "duplicate property set `" + id + "'"; } } void ApplicationDescriptorBuilder::addDistribution(const XmlAttributesHelper& attrs) { _descriptor.distrib.icepatch = attrs("icepatch", "${application}.IcePatch2/server"); } void ApplicationDescriptorBuilder::addDistributionDirectory(const string& directory) { _descriptor.distrib.directories.push_back(directory); } bool ApplicationDescriptorBuilder::isOverride(const string& name) { return _overrides.find(name) != _overrides.end(); } ServerInstanceDescriptorBuilder::ServerInstanceDescriptorBuilder(const XmlAttributesHelper& attrs) { _descriptor._cpp_template = attrs("template"); _descriptor.parameterValues = attrs.asMap(); _descriptor.parameterValues.erase("template"); } PropertySetDescriptorBuilder* ServerInstanceDescriptorBuilder::createPropertySet(const XmlAttributesHelper& attrs) const { string service; if(attrs.contains("service")) { service = attrs("service"); // Can't be empty. } PropertySetDescriptorBuilder* builder = new PropertySetDescriptorBuilder(); builder->setService(service); return builder; } void ServerInstanceDescriptorBuilder::addPropertySet(const string& service, const PropertySetDescriptor& desc) { // // Allow re-opening of unamed property sets. // PropertySetDescriptor& p = service.empty() ? _descriptor.propertySet : _descriptor.servicePropertySets[service]; p.references.insert(p.references.end(), desc.references.begin(), desc.references.end()); p.properties.insert(p.properties.end(), desc.properties.begin(), desc.properties.end()); } NodeDescriptorBuilder::NodeDescriptorBuilder(ApplicationDescriptorBuilder& app, const NodeDescriptor& desc, const XmlAttributesHelper& attrs) : _application(app), _descriptor(desc) { _name = attrs("name"); _descriptor.loadFactor = attrs("load-factor", ""); } ServerDescriptorBuilder* NodeDescriptorBuilder::createServer(const XmlAttributesHelper& attrs) { return new ServerDescriptorBuilder(_application.getCommunicator(), attrs); } ServerDescriptorBuilder* NodeDescriptorBuilder::createIceBox(const XmlAttributesHelper& attrs) { return new IceBoxDescriptorBuilder(_application.getCommunicator(), attrs); } ServerInstanceDescriptorBuilder* NodeDescriptorBuilder::createServerInstance(const XmlAttributesHelper& attrs) { return new ServerInstanceDescriptorBuilder(attrs); } PropertySetDescriptorBuilder* NodeDescriptorBuilder::createPropertySet(const XmlAttributesHelper& attrs) const { string id = attrs("id"); PropertySetDescriptorBuilder* builder = new PropertySetDescriptorBuilder(); builder->setId(id); return builder; } void NodeDescriptorBuilder::addVariable(const XmlAttributesHelper& attrs) { if(!_application.isOverride(attrs("name"))) { _descriptor.variables[attrs("name")] = attrs("value", ""); } else { attrs.contains("value"); // NOTE: prevents warning about "value" not being used. } } void NodeDescriptorBuilder::addServerInstance(const ServerInstanceDescriptor& desc) { _descriptor.serverInstances.push_back(desc); } void NodeDescriptorBuilder::addServer(const ServerDescriptorPtr& server) { _descriptor.servers.push_back(server); } void NodeDescriptorBuilder::addPropertySet(const string& id, const PropertySetDescriptor& desc) { if(!_descriptor.propertySets.insert(make_pair(id, desc)).second) { throw "duplicate property set `" + id + "'"; } } void NodeDescriptorBuilder::setDescription(const string& description) { _descriptor.description = description; } TemplateDescriptorBuilder::TemplateDescriptorBuilder(ApplicationDescriptorBuilder& application, const XmlAttributesHelper& attrs, bool serviceTemplate) : _application(application), _serviceTemplate(serviceTemplate), _id(attrs("id")) { } void TemplateDescriptorBuilder::addParameter(const XmlAttributesHelper& attrs) { if(find(_descriptor.parameters.begin(), _descriptor.parameters.end(), attrs("name")) != _descriptor.parameters.end()) { throw "duplicate parameter `" + attrs("name") + "'"; } _descriptor.parameters.push_back(attrs("name")); if(attrs.contains("default")) { _descriptor.parameterDefaults.insert(make_pair(attrs("name"), attrs("default", ""))); } } void TemplateDescriptorBuilder::setDescriptor(const CommunicatorDescriptorPtr& desc) { _descriptor.descriptor = desc; } ServerDescriptorBuilder* TemplateDescriptorBuilder::createServer(const XmlAttributesHelper& attrs) { if(_serviceTemplate) { throw " element can't be a child of "; } return new ServerDescriptorBuilder(_application.getCommunicator(), attrs); } ServerDescriptorBuilder* TemplateDescriptorBuilder::createIceBox(const XmlAttributesHelper& attrs) { if(_serviceTemplate) { throw " element can't be a child of "; } return new IceBoxDescriptorBuilder(_application.getCommunicator(), attrs); } ServiceDescriptorBuilder* TemplateDescriptorBuilder::createService(const XmlAttributesHelper& attrs) { if(!_serviceTemplate) { throw " element can't be a child of "; } return new ServiceDescriptorBuilder(_application.getCommunicator(), attrs); } CommunicatorDescriptorBuilder::CommunicatorDescriptorBuilder(const Ice::CommunicatorPtr& communicator) : _communicator(communicator) { } void CommunicatorDescriptorBuilder::init(const CommunicatorDescriptorPtr& desc, const XmlAttributesHelper&) { _descriptor = desc; } void CommunicatorDescriptorBuilder::finish() { // // Add the hidden properties at the begining of the communicator // properties. These properties are not added directly to the // property set because it's not allowed to define properties // before references to property sets. // _descriptor->propertySet.properties.insert(_descriptor->propertySet.properties.begin(), _hiddenProperties.begin(), _hiddenProperties.end()); } void CommunicatorDescriptorBuilder::setDescription(const string& desc) { _descriptor->description = desc; } void CommunicatorDescriptorBuilder::addProperty(const XmlAttributesHelper& attrs) { addProperty(_descriptor->propertySet.properties, attrs("name"), attrs("value", "")); } PropertySetDescriptorBuilder* CommunicatorDescriptorBuilder::createPropertySet() const { return new PropertySetDescriptorBuilder(); } void CommunicatorDescriptorBuilder::addPropertySet(const PropertySetDescriptor& desc) { // // Allow re-opening of unamed property sets. // PropertySetDescriptor& p = _descriptor->propertySet; p.references.insert(p.references.end(), desc.references.begin(), desc.references.end()); p.properties.insert(p.properties.end(), desc.properties.begin(), desc.properties.end()); } void CommunicatorDescriptorBuilder::addAdapter(const XmlAttributesHelper& attrs) { AdapterDescriptor desc; desc.name = attrs("name"); if(attrs.contains("id")) { desc.id = attrs("id"); } else { string fqn = "${server}"; if(ServiceDescriptorPtr::dynamicCast(_descriptor)) { fqn += ".${service}"; } desc.id = fqn + "." + desc.name; } desc.replicaGroupId = attrs("replica-group", ""); desc.priority = attrs("priority", ""); desc.registerProcess = attrs.asBool("register-process", false); if(desc.id == "") { throw "empty `id' for adapter `" + desc.name + "'"; } desc.serverLifetime = attrs.asBool("server-lifetime", true); _descriptor->adapters.push_back(desc); addProperty(_hiddenProperties, desc.name + ".Endpoints", attrs("endpoints", "default")); if(attrs.contains("proxy-options")) { addProperty(_hiddenProperties, desc.name + ".ProxyOptions", attrs("proxy-options", "")); } } void CommunicatorDescriptorBuilder::setAdapterDescription(const string& value) { _descriptor->adapters.back().description = value; } void CommunicatorDescriptorBuilder::addObject(const XmlAttributesHelper& attrs) { ObjectDescriptor object; object.type = attrs("type", ""); object.id = _communicator->stringToIdentity(attrs("identity")); object.proxyOptions = attrs("proxy-options", ""); if(attrs.contains("property")) { addProperty(_hiddenProperties, attrs("property"), attrs("identity")); } _descriptor->adapters.back().objects.push_back(object); } void CommunicatorDescriptorBuilder::addAllocatable(const XmlAttributesHelper& attrs) { ObjectDescriptor object; object.type = attrs("type", ""); object.id = _communicator->stringToIdentity(attrs("identity")); object.proxyOptions = attrs("proxy-options", ""); if(attrs.contains("property")) { addProperty(_hiddenProperties, attrs("property"), attrs("identity")); } _descriptor->adapters.back().allocatables.push_back(object); } void CommunicatorDescriptorBuilder::addDbEnv(const XmlAttributesHelper& attrs) { DbEnvDescriptor desc; desc.name = attrs("name"); DbEnvDescriptorSeq::iterator p; for(p = _descriptor->dbEnvs.begin(); p != _descriptor->dbEnvs.end(); ++p) { // // We are re-opening the dbenv element to define more properties. // if(p->name == desc.name) { break; } } if(p != _descriptor->dbEnvs.end()) { // // Remove the previously defined dbenv, we'll add it back again when // the dbenv element end tag is reached. // desc = *p; _descriptor->dbEnvs.erase(p); } if(desc.dbHome.empty()) { desc.dbHome = attrs("home", ""); } _descriptor->dbEnvs.push_back(desc); } void CommunicatorDescriptorBuilder::addDbEnvProperty(const XmlAttributesHelper& attrs) { if(!_descriptor->dbEnvs.back().dbHome.empty()) { throw "can't add property to the database environment:\n" "properties are only allowed if the database\n" "environment home directory is managed by the node"; } PropertyDescriptor prop; prop.name = attrs("name"); prop.value = attrs("value", ""); _descriptor->dbEnvs.back().properties.push_back(prop); } void CommunicatorDescriptorBuilder::setDbEnvDescription(const string& value) { _descriptor->dbEnvs.back().description = value; } void CommunicatorDescriptorBuilder::addLog(const XmlAttributesHelper& attrs) { if(attrs.contains("property")) { addProperty(_hiddenProperties, attrs("property"), attrs("path")); } _descriptor->logs.push_back(attrs("path")); } void CommunicatorDescriptorBuilder::addProperty(PropertyDescriptorSeq& properties, const string& name, const string& value) { PropertyDescriptor prop; prop.name = name; prop.value = value; properties.push_back(prop); } ServiceInstanceDescriptorBuilder::ServiceInstanceDescriptorBuilder(const XmlAttributesHelper& attrs) { _descriptor._cpp_template = attrs("template"); _descriptor.parameterValues = attrs.asMap(); _descriptor.parameterValues.erase("template"); } PropertySetDescriptorBuilder* ServiceInstanceDescriptorBuilder::createPropertySet() const { return new PropertySetDescriptorBuilder(); } void ServiceInstanceDescriptorBuilder::addPropertySet(const PropertySetDescriptor& desc) { // // Allow re-opening of unamed property sets. // PropertySetDescriptor& p = _descriptor.propertySet; p.references.insert(p.references.end(), desc.references.begin(), desc.references.end()); p.properties.insert(p.properties.end(), desc.properties.begin(), desc.properties.end()); } ServerDescriptorBuilder::ServerDescriptorBuilder(const Ice::CommunicatorPtr& communicator, const XmlAttributesHelper& attrs) : CommunicatorDescriptorBuilder(communicator) { init(new ServerDescriptor(), attrs); } ServerDescriptorBuilder::ServerDescriptorBuilder(const Ice::CommunicatorPtr& communicator) : CommunicatorDescriptorBuilder(communicator) { } void ServerDescriptorBuilder::init(const ServerDescriptorPtr& desc, const XmlAttributesHelper& attrs) { CommunicatorDescriptorBuilder::init(desc, attrs); _descriptor = desc; _descriptor->id = attrs("id"); _descriptor->exe = attrs("exe"); _descriptor->activationTimeout = attrs("activation-timeout", ""); _descriptor->deactivationTimeout = attrs("deactivation-timeout", ""); _descriptor->pwd = attrs("pwd", ""); _descriptor->activation = attrs("activation", "manual"); _descriptor->applicationDistrib = attrs.asBool("application-distrib", true); _descriptor->allocatable = attrs.asBool("allocatable", false); _descriptor->user = attrs("user", ""); _descriptor->iceVersion = attrs("ice-version", ""); } ServiceDescriptorBuilder* ServerDescriptorBuilder::createService(const XmlAttributesHelper& /*attrs*/) { throw " element can only be a child of an element"; return 0; } ServiceInstanceDescriptorBuilder* ServerDescriptorBuilder::createServiceInstance(const XmlAttributesHelper& /*attrs*/) { throw " element can only be a child of an element"; return 0; } void ServerDescriptorBuilder::addOption(const string& v) { _descriptor->options.push_back(v); } void ServerDescriptorBuilder::addEnv(const string& v) { _descriptor->envs.push_back(v); } void ServerDescriptorBuilder::addService(const ServiceDescriptorPtr& /*desc*/) { assert(false); } void ServerDescriptorBuilder::addServiceInstance(const ServiceInstanceDescriptor& /*desc*/) { assert(false); } void ServerDescriptorBuilder::addDistribution(const XmlAttributesHelper& attrs) { _descriptor->distrib.icepatch = attrs("icepatch", "${application}.IcePatch2/server"); } void ServerDescriptorBuilder::addDistributionDirectory(const string& directory) { _descriptor->distrib.directories.push_back(directory); } IceBoxDescriptorBuilder::IceBoxDescriptorBuilder(const Ice::CommunicatorPtr& communicator, const XmlAttributesHelper& attrs) : ServerDescriptorBuilder(communicator) { init(new IceBoxDescriptor(), attrs); } void IceBoxDescriptorBuilder::init(const IceBoxDescriptorPtr& desc, const XmlAttributesHelper& attrs) { ServerDescriptorBuilder::init(desc, attrs); _descriptor = desc; } ServiceDescriptorBuilder* IceBoxDescriptorBuilder::createService(const XmlAttributesHelper& attrs) { return new ServiceDescriptorBuilder(_communicator, attrs); } ServiceInstanceDescriptorBuilder* IceBoxDescriptorBuilder::createServiceInstance(const XmlAttributesHelper& attrs) { return new ServiceInstanceDescriptorBuilder(attrs); } void IceBoxDescriptorBuilder::addAdapter(const XmlAttributesHelper& /*attrs*/) { throw " element can't be a child of an element"; } void IceBoxDescriptorBuilder::addDbEnv(const XmlAttributesHelper& /*attrs*/) { throw " element can't be a child of an element"; } void IceBoxDescriptorBuilder::addServiceInstance(const ServiceInstanceDescriptor& desc) { _descriptor->services.push_back(desc); } void IceBoxDescriptorBuilder::addService(const ServiceDescriptorPtr& desc) { ServiceInstanceDescriptor instance; assert(desc); instance.descriptor = desc; _descriptor->services.push_back(instance); } ServiceDescriptorBuilder::ServiceDescriptorBuilder(const Ice::CommunicatorPtr& communicator, const XmlAttributesHelper& attrs) : CommunicatorDescriptorBuilder(communicator) { init(new ServiceDescriptor(), attrs); } void ServiceDescriptorBuilder::init(const ServiceDescriptorPtr& desc, const XmlAttributesHelper& attrs) { CommunicatorDescriptorBuilder::init(desc, attrs); _descriptor = desc; _descriptor->name = attrs("name"); _descriptor->entry = attrs("entry"); } Ice-3.5.1/cpp/src/IceGrid/NodeSessionI.h0000644000076400007640000000636512223561476015776 0ustar mesmes// ********************************************************************** // // 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 ICEGRID_NODE_SESSION_H #define ICEGRID_NODE_SESSION_H #include #include namespace IceGrid { class Database; typedef IceUtil::Handle DatabasePtr; class TraceLevels; typedef IceUtil::Handle TraceLevelsPtr; class PatcherFeedbackAggregator : public IceUtil::Mutex, public IceUtil::Shared { public: PatcherFeedbackAggregator(Ice::Identity, const TraceLevelsPtr&, const std::string&, const std::string&, int); virtual ~PatcherFeedbackAggregator(); void finished(const std::string&); void failed(const std::string&, const std::string&); protected: virtual void exception(const Ice::Exception&) = 0; virtual void response() = 0; private: void checkIfDone(); const Ice::Identity _id; const TraceLevelsPtr _traceLevels; const std::string _type; const std::string _name; const int _count; std::set _successes; std::set _failures; Ice::StringSeq _reasons; }; typedef IceUtil::Handle PatcherFeedbackAggregatorPtr; class NodeSessionI : public NodeSession, public IceUtil::Mutex { public: NodeSessionI(const DatabasePtr&, const NodePrx&, const InternalNodeInfoPtr&, int, const LoadInfo&); virtual void keepAlive(const LoadInfo&, const Ice::Current&); virtual void setReplicaObserver(const ReplicaObserverPrx&, const Ice::Current&); virtual int getTimeout(const Ice::Current& = Ice::Current()) const; virtual NodeObserverPrx getObserver(const Ice::Current&) const; virtual void loadServers_async(const AMD_NodeSession_loadServersPtr&, const Ice::Current&) const; virtual Ice::StringSeq getServers(const Ice::Current&) const; virtual void waitForApplicationUpdate_async(const AMD_NodeSession_waitForApplicationUpdatePtr&, const std::string&, int, const Ice::Current&) const; virtual void destroy(const Ice::Current& = Ice::Current()); virtual IceUtil::Time timestamp() const; virtual void shutdown(); void patch(const PatcherFeedbackAggregatorPtr&, const std::string&, const std::string&, const InternalDistributionDescriptorPtr&, bool); const NodePrx& getNode() const; const InternalNodeInfoPtr& getInfo() const; const LoadInfo& getLoadInfo() const; NodeSessionPrx getProxy() const; bool isDestroyed() const; void removeFeedback(const PatcherFeedbackPtr&, const Ice::Identity&); private: void destroyImpl(bool); const DatabasePtr _database; const TraceLevelsPtr _traceLevels; const std::string _name; const NodePrx _node; const InternalNodeInfoPtr _info; const int _timeout; NodeSessionPrx _proxy; ReplicaObserverPrx _replicaObserver; IceUtil::Time _timestamp; LoadInfo _load; bool _destroy; std::set _feedbacks; }; typedef IceUtil::Handle NodeSessionIPtr; }; #endif Ice-3.5.1/cpp/src/IceGrid/ReapThread.h0000644000076400007640000000442612223561476015447 0ustar mesmes// ********************************************************************** // // 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 ICEGRID_REAPER_THREAD_H #define ICEGRID_REAPER_THREAD_H #include #include #include #include #include #include #include namespace IceGrid { class Reapable : public IceUtil::Shared { public: virtual ~Reapable() { } virtual IceUtil::Time timestamp() const = 0; virtual void destroy(bool) = 0; }; typedef IceUtil::Handle ReapablePtr; template class SessionReapable : public Reapable { typedef IceUtil::Handle TPtr; public: SessionReapable(const Ice::LoggerPtr& logger, const TPtr& session) : _logger(logger), _session(session) { } virtual ~SessionReapable() { } virtual IceUtil::Time timestamp() const { return _session->timestamp(); } virtual void destroy(bool shutdown) { try { if(shutdown) { _session->shutdown(); } else { _session->destroy(Ice::Current()); } } catch(const Ice::ObjectNotExistException&) { } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while reaping session:\n" << ex; } } private: const Ice::LoggerPtr _logger; const TPtr _session; }; class ReapThread : public IceUtil::Thread, public IceUtil::Monitor { public: ReapThread(); virtual void run(); void terminate(); void add(const ReapablePtr&, int); private: bool calcWakeInterval(); IceUtil::Time _wakeInterval; bool _terminated; struct ReapableItem { ReapablePtr item; IceUtil::Time timeout; }; std::list _sessions; }; typedef IceUtil::Handle ReapThreadPtr; }; #endif Ice-3.5.1/cpp/src/IceGrid/ReplicaSessionI.cpp0000644000076400007640000002464212223561476017021 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace IceGrid; namespace IceGrid { static bool operator==(const ObjectInfo& info, const Ice::Identity& id) { return info.proxy->ice_getIdentity() == id; } } ReplicaSessionI::ReplicaSessionI(const DatabasePtr& database, const WellKnownObjectsManagerPtr& wellKnownObjects, const InternalReplicaInfoPtr& info, const InternalRegistryPrx& proxy, int timeout) : _database(database), _wellKnownObjects(wellKnownObjects), _traceLevels(database->getTraceLevels()), _internalRegistry(proxy), _info(info), _timeout(timeout), _timestamp(IceUtil::Time::now(IceUtil::Time::Monotonic)), _destroy(false) { __setNoDelete(true); try { _database->getReplicaCache().add(info->name, this); ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName); RegistryObserverTopicPtr::dynamicCast(obsv)->registryUp(toRegistryInfo(_info)); _proxy = ReplicaSessionPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(this)); } catch(const ReplicaActiveException&) { __setNoDelete(false); throw; } catch(...) { ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName); RegistryObserverTopicPtr::dynamicCast(obsv)->registryDown(_info->name); _database->getReplicaCache().remove(_info->name, false); __setNoDelete(false); throw; } __setNoDelete(false); } void ReplicaSessionI::keepAlive(const Ice::Current&) { Lock sync(*this); if(_destroy) { throw Ice::ObjectNotExistException(__FILE__, __LINE__); } _timestamp = IceUtil::Time::now(IceUtil::Time::Monotonic); if(_traceLevels->replica > 2) { Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat); out << "replica `" << _info->name << "' keep alive "; } } int ReplicaSessionI::getTimeout(const Ice::Current&) const { return _timeout; } void ReplicaSessionI::setDatabaseObserver(const DatabaseObserverPrx& observer, const IceUtil::Optional& slaveSerials, const Ice::Current&) { // // If it's a read only master, we don't setup the observer to not // modify the replica database. // if(_database->isReadOnly()) { return; } // // If the slave provides serials (Ice >= 3.5.1), we check the // serials and disable database synchronization if the slave has // earlier updates. // if(slaveSerials) { StringLongDict masterSerials = _database->getSerials(); bool error = false; for(StringLongDict::const_iterator p = slaveSerials->begin(); p != slaveSerials->end(); ++p) { Ice::Long serial = masterSerials[p->first]; if(serial < p->second) { error = true; break; } } if(error) { ostringstream os; os << "database from replica `" << _info->name << "' contains earlier updates:\n"; for(StringLongDict::const_iterator p = slaveSerials->begin(); p != slaveSerials->end(); ++p) { Ice::Long serial = masterSerials[p->first]; os << "database `" << p->first << "': "; os << "master serial = " << serial << ", replica serial = " << p->second << '\n'; } os << "(database replication is disabled for this replica, please check the\n"; os << " master and slave database with an administrative client and either:\n"; os << " - restart the slave with --initdb-from-replica=Master\n"; os << " - restart the master with --initdb-from-replica=" << _info->name; Ice::Error out(_traceLevels->logger); out << os.str(); throw DeploymentException(os.str()); } } int serialApplicationObserver; int serialAdapterObserver; int serialObjectObserver; const ObserverTopicPtr applicationObserver = _database->getObserverTopic(ApplicationObserverTopicName); const ObserverTopicPtr adapterObserver = _database->getObserverTopic(AdapterObserverTopicName); const ObserverTopicPtr objectObserver = _database->getObserverTopic(ObjectObserverTopicName); { Lock sync(*this); if(_destroy) { throw Ice::ObjectNotExistException(__FILE__, __LINE__); } _observer = observer; serialApplicationObserver = applicationObserver->subscribe(_observer, _info->name); serialAdapterObserver = adapterObserver->subscribe(_observer, _info->name); serialObjectObserver = objectObserver->subscribe(_observer, _info->name); } applicationObserver->waitForSyncedSubscribers(serialApplicationObserver, _info->name); adapterObserver->waitForSyncedSubscribers(serialAdapterObserver, _info->name); objectObserver->waitForSyncedSubscribers(serialObjectObserver, _info->name); } void ReplicaSessionI::setEndpoints(const StringObjectProxyDict& endpoints, const Ice::Current&) { { Lock sync(*this); if(_destroy) { throw Ice::ObjectNotExistException(__FILE__, __LINE__); } _replicaEndpoints = endpoints; } _wellKnownObjects->updateReplicatedWellKnownObjects(); } void ReplicaSessionI::registerWellKnownObjects(const ObjectInfoSeq& objects, const Ice::Current&) { int serial; { Lock sync(*this); if(_destroy) { throw Ice::ObjectNotExistException(__FILE__, __LINE__); } _replicaWellKnownObjects = objects; serial = _database->addOrUpdateRegistryWellKnownObjects(objects); } // // We wait for the replica to receive the database replication // updates. This is to ensure that the replica well-known objects // are correctly setup when the replica starts accepting requests // from clients (if the replica is being started). // _database->getObserverTopic(ObjectObserverTopicName)->waitForSyncedSubscribers(serial, _info->name); } void ReplicaSessionI::setAdapterDirectProxy(const string& adapterId, const string& replicaGroupId, const Ice::ObjectPrx& proxy, const Ice::Current&) { if(_database->getCommunicator()->getProperties()->getPropertyAsInt("IceGrid.Registry.DynamicRegistration") <= 0) { throw AdapterNotExistException(); } _database->setAdapterDirectProxy(adapterId, replicaGroupId, proxy); } void ReplicaSessionI::receivedUpdate(TopicName topicName, int serial, const string& failure, const Ice::Current&) { ObserverTopicPtr topic = _database->getObserverTopic(topicName); if(topic) { topic->receivedUpdate(_info->name, serial, failure); } } void ReplicaSessionI::destroy(const Ice::Current&) { destroyImpl(false); } IceUtil::Time ReplicaSessionI::timestamp() const { Lock sync(*this); if(_destroy) { throw Ice::ObjectNotExistException(__FILE__, __LINE__); } return _timestamp; } void ReplicaSessionI::shutdown() { destroyImpl(true); } const InternalRegistryPrx& ReplicaSessionI::getInternalRegistry() const { return _internalRegistry; } const InternalReplicaInfoPtr& ReplicaSessionI::getInfo() const { return _info; } ReplicaSessionPrx ReplicaSessionI::getProxy() const { return _proxy; } Ice::ObjectPrx ReplicaSessionI::getEndpoint(const std::string& name) { Lock sync(*this); if(_destroy) { return 0; } return _replicaEndpoints[name]; } bool ReplicaSessionI::isDestroyed() const { Lock sync(*this); return _destroy; } void ReplicaSessionI::destroyImpl(bool shutdown) { { Lock sync(*this); if(_destroy) { throw Ice::ObjectNotExistException(__FILE__, __LINE__); } _destroy = true; } if(_observer) { _database->getObserverTopic(ApplicationObserverTopicName)->unsubscribe(_observer, _info->name); _database->getObserverTopic(AdapterObserverTopicName)->unsubscribe(_observer, _info->name); _database->getObserverTopic(ObjectObserverTopicName)->unsubscribe(_observer, _info->name); } // Don't remove the replica proxy from the database if the registry is being shutdown. if(!_replicaWellKnownObjects.empty()) { if(shutdown) // Don't remove the replica proxy from the database if the registry is being shutdown. { Ice::Identity id; id.category = _internalRegistry->ice_getIdentity().category; id.name = "Registry-" + _info->name; ObjectInfoSeq::iterator p = find(_replicaWellKnownObjects.begin(), _replicaWellKnownObjects.end(), id); if(p != _replicaWellKnownObjects.end()) { _replicaWellKnownObjects.erase(p); } } _database->removeRegistryWellKnownObjects(_replicaWellKnownObjects); } if(!shutdown) { _wellKnownObjects->updateReplicatedWellKnownObjects(); // No need to update these if we're shutting down. } // // Notify the observer that the registry is down. // ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName); RegistryObserverTopicPtr::dynamicCast(obsv)->registryDown(_info->name); // // Remove the replica from the cache. This must be done last. As // soon as the replica is removed another session might be // created. // _database->getReplicaCache().remove(_info->name, shutdown); if(!shutdown) { try { _database->getInternalAdapter()->remove(_proxy->ice_getIdentity()); } catch(const Ice::ObjectAdapterDeactivatedException&) { } } } Ice-3.5.1/cpp/src/IceGrid/RegistryI.h0000644000076400007640000001161312223561476015345 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_REGISTRYI_H #define ICE_GRID_REGISTRYI_H #include #include #include #include #include #include #include #include #include namespace IceGrid { class Database; typedef IceUtil::Handle DatabasePtr; class WellKnownObjectsManager; typedef IceUtil::Handle WellKnownObjectsManagerPtr; class TraceLevels; typedef IceUtil::Handle TraceLevelsPtr; class ReapThread; typedef IceUtil::Handle ReapThreadPtr; class SessionServantManager; typedef IceUtil::Handle SessionServantManagerPtr; class ClientSessionFactory; typedef IceUtil::Handle ClientSessionFactoryPtr; class AdminSessionFactory; typedef IceUtil::Handle AdminSessionFactoryPtr; std::string getInstanceName(const Ice::CommunicatorPtr&); class RegistryI : public Registry { public: RegistryI(const Ice::CommunicatorPtr&, const TraceLevelsPtr&, bool, bool, const std::string&); ~RegistryI(); bool start(); bool startImpl(); void stop(); virtual SessionPrx createSession(const std::string&, const std::string&, const Ice::Current&); virtual AdminSessionPrx createAdminSession(const std::string&, const std::string&, const Ice::Current&); virtual SessionPrx createSessionFromSecureConnection(const Ice::Current&); virtual AdminSessionPrx createAdminSessionFromSecureConnection(const Ice::Current&); virtual int getSessionTimeout(const Ice::Current& = Ice::Current()) const; std::string getName() const; RegistryInfo getInfo() const; void waitForShutdown(); virtual void shutdown(); std::string getServerAdminCategory() const { return _instanceName + "-RegistryRouter"; } Ice::ObjectPrx createAdminCallbackProxy(const Ice::Identity&) const; private: Ice::LocatorRegistryPrx setupLocatorRegistry(const Ice::ObjectAdapterPtr&); LocatorPrx setupLocator(const Ice::ObjectAdapterPtr&, const Ice::ObjectAdapterPtr&, const Ice::LocatorRegistryPrx&, const RegistryPrx&, const QueryPrx&); QueryPrx setupQuery(const Ice::ObjectAdapterPtr&); RegistryPrx setupRegistry(const Ice::ObjectAdapterPtr&); InternalRegistryPrx setupInternalRegistry(const Ice::ObjectAdapterPtr&); void setupNullPermissionsVerifier(const Ice::ObjectAdapterPtr&); bool setupUserAccountMapper(const Ice::ObjectAdapterPtr&); Ice::ObjectAdapterPtr setupClientSessionFactory(const Ice::ObjectAdapterPtr&, const LocatorPrx&); Ice::ObjectAdapterPtr setupAdminSessionFactory(const Ice::ObjectAdapterPtr&, const Ice::ObjectPtr&, const LocatorPrx&); Glacier2::PermissionsVerifierPrx getPermissionsVerifier(const Ice::ObjectAdapterPtr&, const LocatorPrx&, const std::string&, const std::string&); Glacier2::SSLPermissionsVerifierPrx getSSLPermissionsVerifier(const LocatorPrx&, const std::string&); Glacier2::SSLInfo getSSLInfo(const Ice::ConnectionPtr&, std::string&); NodePrxSeq registerReplicas(const InternalRegistryPrx&, const NodePrxSeq&); void registerNodes(const InternalRegistryPrx&, const NodePrxSeq&); const Ice::CommunicatorPtr _communicator; const TraceLevelsPtr _traceLevels; const bool _nowarn; const bool _readonly; const std::string _initFromReplica; DatabasePtr _database; Ice::ObjectAdapterPtr _clientAdapter; Ice::ObjectAdapterPtr _serverAdapter; WellKnownObjectsManagerPtr _wellKnownObjects; std::string _instanceName; bool _master; std::string _replicaName; ReapThreadPtr _reaper; IceUtil::TimerPtr _timer; SessionServantManagerPtr _servantManager; int _sessionTimeout; ReplicaSessionManager _session; mutable PlatformInfo _platform; Glacier2::PermissionsVerifierPrx _nullPermissionsVerifier; Glacier2::SSLPermissionsVerifierPrx _nullSSLPermissionsVerifier; ClientSessionFactoryPtr _clientSessionFactory; Glacier2::PermissionsVerifierPrx _clientVerifier; Glacier2::SSLPermissionsVerifierPrx _sslClientVerifier; AdminSessionFactoryPtr _adminSessionFactory; Glacier2::PermissionsVerifierPrx _adminVerifier; Glacier2::SSLPermissionsVerifierPrx _sslAdminVerifier; IceStormInternal::ServicePtr _iceStorm; }; typedef IceUtil::Handle RegistryIPtr; } #endif Ice-3.5.1/cpp/src/IceGrid/Grammar.h0000644000076400007640000000605312223561476015014 0ustar mesmes /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { ICE_GRID_HELP = 258, ICE_GRID_EXIT = 259, ICE_GRID_APPLICATION = 260, ICE_GRID_NODE = 261, ICE_GRID_REGISTRY = 262, ICE_GRID_SERVER = 263, ICE_GRID_ADAPTER = 264, ICE_GRID_PING = 265, ICE_GRID_LOAD = 266, ICE_GRID_SOCKETS = 267, ICE_GRID_ADD = 268, ICE_GRID_REMOVE = 269, ICE_GRID_LIST = 270, ICE_GRID_SHUTDOWN = 271, ICE_GRID_STRING = 272, ICE_GRID_START = 273, ICE_GRID_STOP = 274, ICE_GRID_PATCH = 275, ICE_GRID_SIGNAL = 276, ICE_GRID_STDOUT = 277, ICE_GRID_STDERR = 278, ICE_GRID_DESCRIBE = 279, ICE_GRID_PROPERTIES = 280, ICE_GRID_PROPERTY = 281, ICE_GRID_STATE = 282, ICE_GRID_PID = 283, ICE_GRID_ENDPOINTS = 284, ICE_GRID_ACTIVATION = 285, ICE_GRID_OBJECT = 286, ICE_GRID_FIND = 287, ICE_GRID_SHOW = 288, ICE_GRID_COPYING = 289, ICE_GRID_WARRANTY = 290, ICE_GRID_DIFF = 291, ICE_GRID_UPDATE = 292, ICE_GRID_INSTANTIATE = 293, ICE_GRID_TEMPLATE = 294, ICE_GRID_SERVICE = 295, ICE_GRID_ENABLE = 296, ICE_GRID_DISABLE = 297 }; #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif Ice-3.5.1/cpp/src/IceGrid/Database.cpp0000644000076400007640000022672212223561476015474 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace IceGrid; using namespace IceDB; namespace { struct ObjectLoadCI : binary_function&, pair&, bool> { bool operator()(const pair& lhs, const pair& rhs) { return lhs.second < rhs.second; } }; template vector toVector(const map& m) { vector v; for(typename map::const_iterator p = m.begin(); p != m.end(); ++p) { v.push_back(p->second); } return v; } void halt(const Ice::CommunicatorPtr& com, const DatabaseException& ex) { { Ice::Error error(com->getLogger()); error << "fatal exception: " << ex << "\n*** Aborting application ***"; } abort(); } } Database::Database(const Ice::ObjectAdapterPtr& registryAdapter, const IceStorm::TopicManagerPrx& topicManager, const string& instanceName, const TraceLevelsPtr& traceLevels, const RegistryInfo& info, const DatabasePluginPtr& plugin, bool readonly) : _communicator(registryAdapter->getCommunicator()), _internalAdapter(registryAdapter), _topicManager(topicManager), _instanceName(instanceName), _traceLevels(traceLevels), _master(info.name == "Master"), _readonly(readonly || !_master), _replicaCache(_communicator, topicManager), _nodeCache(_communicator, _replicaCache, _readonly && _master ? string("Master (read-only)") : info.name), _adapterCache(_communicator), _objectCache(_communicator), _allocatableObjectCache(_communicator), _serverCache(_communicator, _instanceName, _nodeCache, _adapterCache, _objectCache, _allocatableObjectCache), _connectionPool(plugin->getConnectionPool()), _databasePlugin(plugin), _lock(0) { ServerEntrySeq entries; DatabaseConnectionPtr connection = _connectionPool->getConnection(); ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); map applications = applicationsWrapper->getMap(); for(map::iterator p = applications.begin(); p != applications.end(); ++p) { try { load(ApplicationHelper(_communicator, p->second.descriptor), entries, p->second.uuid, p->second.revision); } catch(const DeploymentException& ex) { Ice::Error err(_traceLevels->logger); err << "invalid application `" << p->first << "':\n" << ex.reason; } } _serverCache.setTraceLevels(_traceLevels); _nodeCache.setTraceLevels(_traceLevels); _replicaCache.setTraceLevels(_traceLevels); _adapterCache.setTraceLevels(_traceLevels); _objectCache.setTraceLevels(_traceLevels); _allocatableObjectCache.setTraceLevels(_traceLevels); _nodeObserverTopic = new NodeObserverTopic(_topicManager, _internalAdapter); _registryObserverTopic = new RegistryObserverTopic(_topicManager); _applicationObserverTopic = new ApplicationObserverTopic(_topicManager, applicationsWrapper); _adapterObserverTopic = new AdapterObserverTopic(_topicManager, _connectionPool->getAdapters(connection)); _objectObserverTopic = new ObjectObserverTopic(_topicManager, _connectionPool->getObjects(connection)); _registryObserverTopic->registryUp(info); } Database::~Database() { // // Release first the cache and then the plugin. This must be done in this order // to make sure the plugin is destroyed after the database cache. // _connectionPool = 0; _databasePlugin = 0; } std::string Database::getInstanceName() const { return _instanceName; } void Database::destroyTopics() { _registryObserverTopic->destroy(); _nodeObserverTopic->destroy(); _applicationObserverTopic->destroy(); _adapterObserverTopic->destroy(); _objectObserverTopic->destroy(); } ObserverTopicPtr Database::getObserverTopic(TopicName name) const { switch(name) { case RegistryObserverTopicName: return _registryObserverTopic; case NodeObserverTopicName: return _nodeObserverTopic; case ApplicationObserverTopicName: return _applicationObserverTopic; case AdapterObserverTopicName: return _adapterObserverTopic; case ObjectObserverTopicName: return _objectObserverTopic; default: break; } return 0; } void Database::checkSessionLock(AdminSessionI* session) { if(_lock != 0 && session != _lock) { throw AccessDeniedException(_lockUserId); // Lock held by another session. } } int Database::lock(AdminSessionI* session, const string& userId) { Lock sync(*this); if(_lock != 0 && session != _lock) { throw AccessDeniedException(_lockUserId); // Lock held by another session. } assert(_lock == 0 || _lock == session); _lock = session; _lockUserId = userId; return _applicationObserverTopic->getSerial(); } void Database::unlock(AdminSessionI* session) { Lock sync(*this); if(_lock != session) { throw AccessDeniedException(); } _lock = 0; _lockUserId.clear(); } void Database::syncApplications(const ApplicationInfoSeq& newApplications, Ice::Long dbSerial) { assert(dbSerial != 0); int serial = 0; { Lock sync(*this); map oldApplications; for(;;) { DatabaseConnectionPtr connection = _connectionPool->getConnection(); try { TransactionHolder txHolder(connection); ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); oldApplications = applicationsWrapper->getMap(); applicationsWrapper->clear(); for(ApplicationInfoSeq::const_iterator p = newApplications.begin(); p != newApplications.end(); ++p) { applicationsWrapper->put(p->descriptor.name, *p); } dbSerial = applicationsWrapper->updateSerial(dbSerial); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } ServerEntrySeq entries; set names; for(ApplicationInfoSeq::const_iterator p = newApplications.begin(); p != newApplications.end(); ++p) { try { map::const_iterator q = oldApplications.find(p->descriptor.name); if(q != oldApplications.end()) { ApplicationHelper previous(_communicator, q->second.descriptor); ApplicationHelper helper(_communicator, p->descriptor); reload(previous, helper, entries, p->uuid, p->revision, false); } else { load(ApplicationHelper(_communicator, p->descriptor), entries, p->uuid, p->revision); } } catch(const DeploymentException& ex) { Ice::Warning warn(_traceLevels->logger); warn << "invalid application `" << p->descriptor.name << "':\n" << ex.reason; } names.insert(p->descriptor.name); } for(map::iterator s = oldApplications.begin(); s != oldApplications.end(); ++s) { if(names.find(s->first) == names.end()) { unload(ApplicationHelper(_communicator, s->second.descriptor), entries); } } for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); if(_traceLevels->application > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat); out << "synchronized applications (serial = `" << dbSerial << "')"; } serial = _applicationObserverTopic->applicationInit(dbSerial, newApplications); } _applicationObserverTopic->waitForSyncedSubscribers(serial); } void Database::syncAdapters(const AdapterInfoSeq& adapters, Ice::Long dbSerial) { assert(dbSerial != 0); int serial = 0; { Lock sync(*this); for(;;) { DatabaseConnectionPtr connection = _connectionPool->getConnection(); try { TransactionHolder txHolder(connection); AdaptersWrapperPtr adaptersWrapper = _connectionPool->getAdapters(connection); adaptersWrapper->clear(); for(AdapterInfoSeq::const_iterator r = adapters.begin(); r != adapters.end(); ++r) { adaptersWrapper->put(r->id, *r); } dbSerial = adaptersWrapper->updateSerial(dbSerial); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } if(_traceLevels->adapter > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat); out << "synchronized adapters (serial = `" << dbSerial << "')"; } serial = _adapterObserverTopic->adapterInit(dbSerial, adapters); } _adapterObserverTopic->waitForSyncedSubscribers(serial); } void Database::syncObjects(const ObjectInfoSeq& objects, Ice::Long dbSerial) { assert(dbSerial != 0); int serial = 0; { Lock sync(*this); for(;;) { DatabaseConnectionPtr connection = _connectionPool->getConnection(); try { TransactionHolder txHolder(connection); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); objectsWrapper->clear(); for(ObjectInfoSeq::const_iterator q = objects.begin(); q != objects.end(); ++q) { objectsWrapper->put(q->proxy->ice_getIdentity(), *q); } dbSerial = objectsWrapper->updateSerial(dbSerial); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } if(_traceLevels->object > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat); out << "synchronized objects (serial = `" << dbSerial << "')"; } serial = _objectObserverTopic->objectInit(dbSerial, objects); } _objectObserverTopic->waitForSyncedSubscribers(serial); } ApplicationInfoSeq Database::getApplications(Ice::Long& serial) const { for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->newConnection(); TransactionHolder txHolder(connection); ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); serial = applicationsWrapper->getSerial(); return toVector(applicationsWrapper->getMap()); } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } } AdapterInfoSeq Database::getAdapters(Ice::Long& serial) const { for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->newConnection(); TransactionHolder txHolder(connection); AdaptersWrapperPtr adaptersWrapper = _connectionPool->getAdapters(connection); serial = adaptersWrapper->getSerial(); return toVector(adaptersWrapper->getMap()); } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } } ObjectInfoSeq Database::getObjects(Ice::Long& serial) const { for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->newConnection(); TransactionHolder txHolder(connection); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); serial = objectsWrapper->getSerial(); return toVector(objectsWrapper->getMap()); } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } } StringLongDict Database::getSerials() const { return _connectionPool->getSerials(); } void Database::addApplication(const ApplicationInfo& info, AdminSessionI* session, Ice::Long dbSerial) { assert(dbSerial != 0 || _master); int serial = 0; // Initialize to prevent warning. ServerEntrySeq entries; try { Lock sync(*this); checkSessionLock(session); waitForUpdate(info.descriptor.name); DatabaseConnectionPtr connection = _connectionPool->getConnection(); try { ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); applicationsWrapper->find(info.descriptor.name); throw DeploymentException("application `" + info.descriptor.name + "' already exists"); } catch(const NotFoundException&) { } ApplicationHelper helper(_communicator, info.descriptor, true); checkForAddition(helper, connection); dbSerial = saveApplication(info, connection, dbSerial); load(helper, entries, info.uuid, info.revision); startUpdating(info.descriptor.name, info.uuid, info.revision); for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); serial = _applicationObserverTopic->applicationAdded(dbSerial, info); } catch(const DatabaseException& ex) { halt(_communicator, ex); } _applicationObserverTopic->waitForSyncedSubscribers(serial); // Wait for replicas to be updated. // // Mark the application as updated. All the replicas received the update so it's now safe // for the nodes to start the servers. // { Lock sync(*this); vector::iterator p = find(_updating.begin(), _updating.end(), info.descriptor.name); assert(p != _updating.end()); p->markUpdated(); } if(_master) { try { for(ServerEntrySeq::const_iterator p = entries.begin(); p != entries.end(); ++p) { try { (*p)->waitForSync(); } catch(const NodeUnreachableException&) { // Ignore. } } } catch(const DeploymentException& ex) { try { Lock sync(*this); entries.clear(); unload(ApplicationHelper(_communicator, info.descriptor), entries); dbSerial = removeApplication(info.descriptor.name, _connectionPool->getConnection()); for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); serial = _applicationObserverTopic->applicationRemoved(dbSerial, info.descriptor.name); } catch(const DeploymentException& ex) { Ice::Error err(_traceLevels->logger); err << "failed to rollback previous application `" << info.descriptor.name << "':\n" << ex.reason; } catch(const DatabaseException& ex) { halt(_communicator, ex); } _applicationObserverTopic->waitForSyncedSubscribers(serial); for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::waitForSyncNoThrow)); finishUpdating(info.descriptor.name); throw ex; } } if(_traceLevels->application > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat); out << "added application `" << info.descriptor.name << "' (serial = `" << dbSerial << "')"; } finishUpdating(info.descriptor.name); } void Database::updateApplication(const ApplicationUpdateInfo& updt, bool noRestart, AdminSessionI* session, Ice::Long dbSerial) { assert(dbSerial != 0 || _master); ApplicationInfo oldApp; ApplicationUpdateInfo update = updt; IceUtil::UniquePtr previous; IceUtil::UniquePtr helper; try { Lock sync(*this); checkSessionLock(session); waitForUpdate(update.descriptor.name); DatabaseConnectionPtr connection = _connectionPool->getConnection(); ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); try { oldApp = applicationsWrapper->find(update.descriptor.name); } catch(const NotFoundException&) { throw ApplicationNotExistException(update.descriptor.name); } if(update.revision < 0) { update.revision = oldApp.revision + 1; } previous.reset(new ApplicationHelper(_communicator, oldApp.descriptor)); helper.reset(new ApplicationHelper(_communicator, previous->update(update.descriptor), true)); startUpdating(update.descriptor.name, oldApp.uuid, oldApp.revision + 1); } catch(const DatabaseException& ex) { halt(_communicator, ex); } finishApplicationUpdate(update, oldApp, *previous, *helper, session, noRestart, dbSerial); } void Database::syncApplicationDescriptor(const ApplicationDescriptor& newDesc, bool noRestart, AdminSessionI* session) { assert(_master); ApplicationUpdateInfo update; ApplicationInfo oldApp; IceUtil::UniquePtr previous; IceUtil::UniquePtr helper; try { Lock sync(*this); checkSessionLock(session); waitForUpdate(newDesc.name); DatabaseConnectionPtr connection = _connectionPool->getConnection(); ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); try { oldApp = applicationsWrapper->find(newDesc.name); } catch(const NotFoundException&) { throw ApplicationNotExistException(newDesc.name); } previous.reset(new ApplicationHelper(_communicator, oldApp.descriptor)); helper.reset(new ApplicationHelper(_communicator, newDesc, true)); update.updateTime = IceUtil::Time::now().toMilliSeconds(); update.updateUser = _lockUserId; update.revision = oldApp.revision + 1; update.descriptor = helper->diff(*previous); startUpdating(update.descriptor.name, oldApp.uuid, oldApp.revision + 1); } catch(const DatabaseException& ex) { halt(_communicator, ex); } finishApplicationUpdate(update, oldApp, *previous, *helper, session, noRestart); } void Database::instantiateServer(const string& application, const string& node, const ServerInstanceDescriptor& instance, AdminSessionI* session) { assert(_master); ApplicationUpdateInfo update; ApplicationInfo oldApp; IceUtil::UniquePtr previous; IceUtil::UniquePtr helper; try { Lock sync(*this); checkSessionLock(session); waitForUpdate(application); DatabaseConnectionPtr connection = _connectionPool->getConnection(); ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); try { oldApp = applicationsWrapper->find(application); } catch(const NotFoundException&) { throw ApplicationNotExistException(application); } previous.reset(new ApplicationHelper(_communicator, oldApp.descriptor)); helper.reset(new ApplicationHelper(_communicator, previous->instantiateServer(node, instance), true)); update.updateTime = IceUtil::Time::now().toMilliSeconds(); update.updateUser = _lockUserId; update.revision = oldApp.revision + 1; update.descriptor = helper->diff(*previous); startUpdating(update.descriptor.name, oldApp.uuid, oldApp.revision + 1); } catch(const DatabaseException& ex) { halt(_communicator, ex); } finishApplicationUpdate(update, oldApp, *previous, *helper, session, true); } void Database::removeApplication(const string& name, AdminSessionI* session, Ice::Long dbSerial) { assert(dbSerial != 0 || _master); ServerEntrySeq entries; int serial = 0; // Initialize to prevent warning. try { Lock sync(*this); checkSessionLock(session); waitForUpdate(name); DatabaseConnectionPtr connection = _connectionPool->getConnection(); ApplicationInfo appInfo; try { ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); appInfo = applicationsWrapper->find(name); } catch(const NotFoundException&) { throw ApplicationNotExistException(name); } bool init = false; try { ApplicationHelper helper(_communicator, appInfo.descriptor); init = true; checkForRemove(helper); unload(helper, entries); } catch(const DeploymentException&) { if(init) { throw; } } dbSerial = removeApplication(name, connection, dbSerial); startUpdating(name, appInfo.uuid, appInfo.revision); for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); serial = _applicationObserverTopic->applicationRemoved(dbSerial, name); } catch(const DatabaseException& ex) { halt(_communicator, ex); } _applicationObserverTopic->waitForSyncedSubscribers(serial); if(_master) { for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::waitForSyncNoThrow)); } if(_traceLevels->application > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat); out << "removed application `" << name << "' (serial = `" << dbSerial << "')"; } finishUpdating(name); } ApplicationInfo Database::getApplicationInfo(const std::string& name) { DatabaseConnectionPtr connection = _connectionPool->newConnection(); try { ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); return applicationsWrapper->find(name); } catch(const NotFoundException&) { throw ApplicationNotExistException(name); } } Ice::StringSeq Database::getAllApplications(const string& expression) { DatabaseConnectionPtr connection = _connectionPool->newConnection(); ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); return getMatchingKeys >(applicationsWrapper->getMap(), expression); } void Database::waitForApplicationUpdate(const AMD_NodeSession_waitForApplicationUpdatePtr& cb, const string& uuid, int revision) { Lock sync(*this); vector::iterator p = find(_updating.begin(), _updating.end(), make_pair(uuid, revision)); if(p != _updating.end() && !p->updated) { p->cbs.push_back(cb); } else { cb->ice_response(); } } NodeCache& Database::getNodeCache() { return _nodeCache; } NodeEntryPtr Database::getNode(const string& name, bool create) const { return _nodeCache.get(name, create); } ReplicaCache& Database::getReplicaCache() { return _replicaCache; } ReplicaEntryPtr Database::getReplica(const string& name) const { return _replicaCache.get(name); } ServerCache& Database::getServerCache() { return _serverCache; } ServerEntryPtr Database::getServer(const string& id) const { return _serverCache.get(id); } AllocatableObjectCache& Database::getAllocatableObjectCache() { return _allocatableObjectCache; } AllocatableObjectEntryPtr Database::getAllocatableObject(const Ice::Identity& id) const { return _allocatableObjectCache.get(id); } void Database::setAdapterDirectProxy(const string& adapterId, const string& replicaGroupId, const Ice::ObjectPrx& proxy, Ice::Long dbSerial) { assert(dbSerial != 0 || _master); int serial = 0; // Initialize to prevent warning. { Lock sync(*this); if(_adapterCache.has(adapterId)) { throw AdapterExistsException(adapterId); } AdapterInfo info; info.id = adapterId; info.proxy = proxy; info.replicaGroupId = replicaGroupId; bool updated = false; for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->getConnection(); TransactionHolder txHolder(connection); AdaptersWrapperPtr adaptersWrapper = _connectionPool->getAdapters(connection); try { adaptersWrapper->find(adapterId); updated = true; } catch(const NotFoundException&) { } if(proxy) { adaptersWrapper->put(adapterId, info); } else { adaptersWrapper->erase(adapterId); } dbSerial = adaptersWrapper->updateSerial(dbSerial); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } if(_traceLevels->adapter > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat); out << (proxy ? (updated ? "updated" : "added") : "removed") << " adapter `" << adapterId << "'"; if(!replicaGroupId.empty()) { out << " with replica group `" << replicaGroupId << "'"; } out << " (serial = `" << dbSerial << "')"; } if(proxy) { if(updated) { serial = _adapterObserverTopic->adapterUpdated(dbSerial, info); } else { serial = _adapterObserverTopic->adapterAdded(dbSerial, info); } } else { serial = _adapterObserverTopic->adapterRemoved(dbSerial, adapterId); } } _adapterObserverTopic->waitForSyncedSubscribers(serial); } Ice::ObjectPrx Database::getAdapterDirectProxy(const string& id, const Ice::EncodingVersion& encoding) { DatabaseConnectionPtr connection = _connectionPool->newConnection(); AdaptersWrapperPtr adaptersWrapper = _connectionPool->getAdapters(connection); try { return adaptersWrapper->find(id).proxy; } catch(const NotFoundException&) { } Ice::EndpointSeq endpoints; vector infos = adaptersWrapper->findByReplicaGroupId(id); for(unsigned int i = 0; i < infos.size(); ++i) { if(infos[i].proxy->ice_getEncodingVersion() < encoding) { Ice::EndpointSeq edpts = infos[i].proxy->ice_getEndpoints(); endpoints.insert(endpoints.end(), edpts.begin(), edpts.end()); } } if(!endpoints.empty()) { return _communicator->stringToProxy("dummy:default")->ice_endpoints(endpoints); } throw AdapterNotExistException(id); } void Database::removeAdapter(const string& adapterId) { assert(_master); int serial = 0; // Initialize to prevent warning. { Lock sync(*this); if(_adapterCache.has(adapterId)) { AdapterEntryPtr adpt = _adapterCache.get(adapterId); DeploymentException ex; ex.reason = "removing adapter `" + adapterId + "' is not allowed:\n"; ex.reason += "the adapter was added with the application descriptor `" + adpt->getApplication() + "'"; throw ex; } AdapterInfoSeq infos; Ice::Long dbSerial = 0; for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->getConnection(); TransactionHolder txHolder(connection); AdaptersWrapperPtr adaptersWrapper = _connectionPool->getAdapters(connection); try { adaptersWrapper->find(adapterId); adaptersWrapper->erase(adapterId); } catch(const NotFoundException&) { infos = adaptersWrapper->findByReplicaGroupId(adapterId); if(infos.empty()) { throw AdapterNotExistException(adapterId); } for(AdapterInfoSeq::iterator p = infos.begin(); p != infos.end(); ++p) { p->replicaGroupId.clear(); adaptersWrapper->put(p->id, *p); } } dbSerial = adaptersWrapper->updateSerial(); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } if(_traceLevels->adapter > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat); out << "removed " << (infos.empty() ? "adapter" : "replica group") << " `" << adapterId << "' (serial = `" << dbSerial << "')"; } if(infos.empty()) { serial = _adapterObserverTopic->adapterRemoved(dbSerial, adapterId); } else { for(AdapterInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p) { serial = _adapterObserverTopic->adapterUpdated(dbSerial, *p); } } } _adapterObserverTopic->waitForSyncedSubscribers(serial); } AdapterPrx Database::getAdapterProxy(const string& adapterId, const string& replicaGroupId, bool upToDate) { Lock sync(*this); // Make sure this isn't call during an update. return _adapterCache.get(adapterId)->getProxy(replicaGroupId, upToDate); } void Database::getLocatorAdapterInfo(const string& id, LocatorAdapterInfoSeq& adpts, int& count, bool& replicaGroup, bool& roundRobin, const set& excludes) { Lock sync(*this); // Make sure this isn't call during an update. _adapterCache.get(id)->getLocatorAdapterInfo(adpts, count, replicaGroup, roundRobin, excludes); } bool Database::addAdapterSyncCallback(const string& id, const SynchronizationCallbackPtr& callback, const std::set& excludes) { Lock sync(*this); // Make sure this isn't call during an update. return _adapterCache.get(id)->addSyncCallback(callback, excludes); } AdapterInfoSeq Database::getAdapterInfo(const string& id) { // // First we check if the given adapter id is associated to a // server, if that's the case we get the adapter proxy from the // server. // try { Lock sync(*this); // Make sure this isn't call during an update. return _adapterCache.get(id)->getAdapterInfo(); } catch(AdapterNotExistException&) { } // // Otherwise, we check the adapter endpoint table -- if there's an // entry the adapter is managed by the registry itself. // DatabaseConnectionPtr connection = _connectionPool->newConnection(); AdaptersWrapperPtr adaptersWrapper = _connectionPool->getAdapters(connection); AdapterInfoSeq infos; try { infos.push_back(adaptersWrapper->find(id)); } catch(const NotFoundException&) { // // If it's not a regular object adapter, perhaps it's a replica // group... // infos = adaptersWrapper->findByReplicaGroupId(id); if(infos.size() == 0) { throw AdapterNotExistException(id); } } return infos; } Ice::StringSeq Database::getAllAdapters(const string& expression) { Lock sync(*this); vector result; vector ids = _adapterCache.getAll(expression); result.swap(ids); set groups; DatabaseConnectionPtr connection = _connectionPool->getConnection(); AdaptersWrapperPtr adaptersWrapper = _connectionPool->getAdapters(connection); map adapters = adaptersWrapper->getMap(); for(map::const_iterator p = adapters.begin(); p != adapters.end(); ++p) { if(expression.empty() || IceUtilInternal::match(p->first, expression, true)) { result.push_back(p->first); } string replicaGroupId = p->second.replicaGroupId; if(!replicaGroupId.empty() && (expression.empty() || IceUtilInternal::match(replicaGroupId, expression, true))) { groups.insert(replicaGroupId); } } // // COMPILERFIX: We're not using result.insert() here, this doesn't compile on Sun. // //result.insert(result.end(), groups.begin(), groups.end()) for(set::const_iterator q = groups.begin(); q != groups.end(); ++q) { result.push_back(*q); } return result; } void Database::addObject(const ObjectInfo& info) { assert(_master); int serial = 0; { Lock sync(*this); const Ice::Identity id = info.proxy->ice_getIdentity(); if(_objectCache.has(id)) { throw ObjectExistsException(id); } Ice::Long dbSerial = 0; for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->getConnection(); TransactionHolder txHolder(connection); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); try { objectsWrapper->find(id); throw ObjectExistsException(id); } catch(const NotFoundException&) { } objectsWrapper->put(id, info); dbSerial = objectsWrapper->updateSerial(); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } serial = _objectObserverTopic->objectAdded(dbSerial, info); if(_traceLevels->object > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat); out << "added object `" << _communicator->identityToString(id) << "' (serial = `" << dbSerial << "')"; } } _objectObserverTopic->waitForSyncedSubscribers(serial); } void Database::addOrUpdateObject(const ObjectInfo& info, Ice::Long dbSerial) { assert(dbSerial != 0 || _master); int serial = 0; // Initialize to prevent warning. { Lock sync(*this); const Ice::Identity id = info.proxy->ice_getIdentity(); if(_objectCache.has(id)) { throw ObjectExistsException(id); } bool update = false; for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->getConnection(); TransactionHolder txHolder(connection); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); try { objectsWrapper->find(id); update = true; } catch(const NotFoundException&) { } objectsWrapper->put(id, info); dbSerial = objectsWrapper->updateSerial(dbSerial); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } if(update) { serial = _objectObserverTopic->objectUpdated(dbSerial, info); } else { serial = _objectObserverTopic->objectAdded(dbSerial, info); } if(_traceLevels->object > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat); out << (!update ? "added" : "updated") << " object `" << _communicator->identityToString(id) << "' (serial = `" << dbSerial << "')"; } } _objectObserverTopic->waitForSyncedSubscribers(serial); } void Database::removeObject(const Ice::Identity& id, Ice::Long dbSerial) { assert(dbSerial != 0 || _master); int serial = 0; // Initialize to prevent warning. { Lock sync(*this); if(_objectCache.has(id)) { DeploymentException ex; ex.reason = "removing object `" + _communicator->identityToString(id) + "' is not allowed:\n"; ex.reason += "the object was added with the application descriptor `"; ex.reason += _objectCache.get(id)->getApplication(); ex.reason += "'"; throw ex; } for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->getConnection(); TransactionHolder txHolder(connection); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); try { objectsWrapper->find(id); } catch(const NotFoundException&) { ObjectNotRegisteredException ex; ex.id = id; throw ex; } objectsWrapper->erase(id); dbSerial = objectsWrapper->updateSerial(dbSerial); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } serial = _objectObserverTopic->objectRemoved(dbSerial, id); if(_traceLevels->object > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat); out << "removed object `" << _communicator->identityToString(id) << "' (serial = `" << dbSerial << "')"; } } _objectObserverTopic->waitForSyncedSubscribers(serial); } void Database::updateObject(const Ice::ObjectPrx& proxy) { assert(_master); int serial = 0; { Lock sync(*this); const Ice::Identity id = proxy->ice_getIdentity(); if(_objectCache.has(id)) { DeploymentException ex; ex.reason = "updating object `" + _communicator->identityToString(id) + "' is not allowed:\n"; ex.reason += "the object was added with the application descriptor `"; ex.reason += _objectCache.get(id)->getApplication(); ex.reason += "'"; throw ex; } ObjectInfo info; Ice::Long dbSerial = 0; for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->getConnection(); TransactionHolder txHolder(connection); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); try { info = objectsWrapper->find(id); } catch(const NotFoundException&) { ObjectNotRegisteredException ex; ex.id = id; throw ex; } info.proxy = proxy; objectsWrapper->put(id, info); dbSerial = objectsWrapper->updateSerial(); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } serial = _objectObserverTopic->objectUpdated(dbSerial, info); if(_traceLevels->object > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat); out << "updated object `" << _communicator->identityToString(id) << "' (serial = `" << dbSerial << "')"; } } _objectObserverTopic->waitForSyncedSubscribers(serial); } int Database::addOrUpdateRegistryWellKnownObjects(const ObjectInfoSeq& objects) { Lock sync(*this); for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->getConnection(); TransactionHolder txHolder(connection); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); for(ObjectInfoSeq::const_iterator p = objects.begin(); p != objects.end(); ++p) { objectsWrapper->put(p->proxy->ice_getIdentity(), *p); } txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } return _objectObserverTopic->wellKnownObjectsAddedOrUpdated(objects); } int Database::removeRegistryWellKnownObjects(const ObjectInfoSeq& objects) { Lock sync(*this); for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->getConnection(); TransactionHolder txHolder(connection); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); for(ObjectInfoSeq::const_iterator p = objects.begin(); p != objects.end(); ++p) { objectsWrapper->erase(p->proxy->ice_getIdentity()); } txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } return _objectObserverTopic->wellKnownObjectsRemoved(objects); } Ice::ObjectPrx Database::getObjectProxy(const Ice::Identity& id) { try { // // Only return proxies for non allocatable objects. // return _objectCache.get(id)->getProxy(); } catch(ObjectNotRegisteredException&) { } DatabaseConnectionPtr connection = _connectionPool->newConnection(); try { ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); return objectsWrapper->find(id).proxy; } catch(const NotFoundException&) { ObjectNotRegisteredException ex; ex.id = id; throw ex; } } Ice::ObjectPrx Database::getObjectByType(const string& type) { Ice::ObjectProxySeq objs = getObjectsByType(type); if(objs.empty()) { return 0; } return objs[IceUtilInternal::random(static_cast(objs.size()))]; } Ice::ObjectPrx Database::getObjectByTypeOnLeastLoadedNode(const string& type, LoadSample sample) { Ice::ObjectProxySeq objs = getObjectsByType(type); if(objs.empty()) { return 0; } RandomNumberGenerator rng; random_shuffle(objs.begin(), objs.end(), rng); vector > objectsWithLoad; objectsWithLoad.reserve(objs.size()); for(Ice::ObjectProxySeq::const_iterator p = objs.begin(); p != objs.end(); ++p) { float load = 1.0f; if(!(*p)->ice_getAdapterId().empty()) { try { load = _adapterCache.get((*p)->ice_getAdapterId())->getLeastLoadedNodeLoad(sample); } catch(const AdapterNotExistException&) { } } objectsWithLoad.push_back(make_pair(*p, load)); } return min_element(objectsWithLoad.begin(), objectsWithLoad.end(), ObjectLoadCI())->first; } Ice::ObjectProxySeq Database::getObjectsByType(const string& type) { Ice::ObjectProxySeq proxies = _objectCache.getObjectsByType(type); DatabaseConnectionPtr connection = _connectionPool->newConnection(); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); vector infos = objectsWrapper->findByType(type); for(unsigned int i = 0; i < infos.size(); ++i) { proxies.push_back(infos[i].proxy); } return proxies; } ObjectInfo Database::getObjectInfo(const Ice::Identity& id) { try { ObjectEntryPtr object = _objectCache.get(id); return object->getObjectInfo(); } catch(ObjectNotRegisteredException&) { } DatabaseConnectionPtr connection = _connectionPool->newConnection(); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); try { return objectsWrapper->find(id); } catch(const NotFoundException&) { throw ObjectNotRegisteredException(id); } } ObjectInfoSeq Database::getAllObjectInfos(const string& expression) { ObjectInfoSeq infos = _objectCache.getAll(expression); DatabaseConnectionPtr connection = _connectionPool->newConnection(); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); map objects = objectsWrapper->getMap(); for(map::const_iterator p = objects.begin(); p != objects.end(); ++p) { if(expression.empty() || IceUtilInternal::match(_communicator->identityToString(p->first), expression, true)) { infos.push_back(p->second); } } return infos; } ObjectInfoSeq Database::getObjectInfosByType(const string& type) { ObjectInfoSeq infos = _objectCache.getAllByType(type); DatabaseConnectionPtr connection = _connectionPool->newConnection(); ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); ObjectInfoSeq dbInfos = objectsWrapper->findByType(type); for(unsigned int i = 0; i < dbInfos.size(); ++i) { infos.push_back(dbInfos[i]); } return infos; } void Database::addInternalObject(const ObjectInfo& info, bool replace) { Lock sync(*this); const Ice::Identity id = info.proxy->ice_getIdentity(); for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->getConnection(); TransactionHolder txHolder(connection); ObjectsWrapperPtr internalObjectsWrapper = _connectionPool->getInternalObjects(connection); if(!replace) { try { internalObjectsWrapper->find(id); throw ObjectExistsException(id); } catch(const NotFoundException&) { } } internalObjectsWrapper->put(id, info); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } } void Database::removeInternalObject(const Ice::Identity& id) { Lock sync(*this); for(;;) { try { DatabaseConnectionPtr connection = _connectionPool->getConnection(); TransactionHolder txHolder(connection); ObjectsWrapperPtr internalObjectsWrapper = _connectionPool->getInternalObjects(connection); try { internalObjectsWrapper->find(id); } catch(const NotFoundException&) { ObjectNotRegisteredException ex; ex.id = id; throw ex; } internalObjectsWrapper->erase(id); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } } Ice::ObjectProxySeq Database::getInternalObjectsByType(const string& type) { Ice::ObjectProxySeq proxies; DatabaseConnectionPtr connection = _connectionPool->newConnection(); ObjectsWrapperPtr internalObjectsWrapper = _connectionPool->getInternalObjects(connection); vector infos = internalObjectsWrapper->findByType(type); for(unsigned int i = 0; i < infos.size(); ++i) { proxies.push_back(infos[i].proxy); } return proxies; } void Database::checkForAddition(const ApplicationHelper& app, const DatabaseConnectionPtr& connection) { set serverIds; set adapterIds; set objectIds; app.getIds(serverIds, adapterIds, objectIds); for_each(serverIds.begin(), serverIds.end(), objFunc(*this, &Database::checkServerForAddition)); if(!adapterIds.empty()) { AdaptersWrapperPtr adaptersWrapper = _connectionPool->getAdapters(connection); for(set::const_iterator p = adapterIds.begin(); p != adapterIds.end(); ++p) { checkAdapterForAddition(*p, adaptersWrapper); } } if(!objectIds.empty()) { ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); for(set::const_iterator p = objectIds.begin(); p != objectIds.end(); ++p) { checkObjectForAddition(*p, objectsWrapper); } } set repGrps; set adptRepGrps; app.getReplicaGroups(repGrps, adptRepGrps); for_each(adptRepGrps.begin(), adptRepGrps.end(), objFunc(*this, &Database::checkReplicaGroupExists)); } void Database::checkForUpdate(const ApplicationHelper& origApp, const ApplicationHelper& newApp, const DatabaseConnectionPtr& connection) { set oldSvrs, newSvrs; set oldAdpts, newAdpts; set oldObjs, newObjs; origApp.getIds(oldSvrs, oldAdpts, oldObjs); newApp.getIds(newSvrs, newAdpts, newObjs); Ice::StringSeq addedSvrs; set_difference(newSvrs.begin(), newSvrs.end(), oldSvrs.begin(), oldSvrs.end(), back_inserter(addedSvrs)); for_each(addedSvrs.begin(), addedSvrs.end(), objFunc(*this, &Database::checkServerForAddition)); Ice::StringSeq addedAdpts; set_difference(newAdpts.begin(), newAdpts.end(), oldAdpts.begin(), oldAdpts.end(), back_inserter(addedAdpts)); if(!addedAdpts.empty()) { AdaptersWrapperPtr adaptersWrapper = _connectionPool->getAdapters(connection); for(Ice::StringSeq::const_iterator p = addedAdpts.begin(); p != addedAdpts.end(); ++p) { checkAdapterForAddition(*p, adaptersWrapper); } } vector addedObjs; set_difference(newObjs.begin(), newObjs.end(), oldObjs.begin(), oldObjs.end(), back_inserter(addedObjs)); if(!addedObjs.empty()) { ObjectsWrapperPtr objectsWrapper = _connectionPool->getObjects(connection); for(vector::const_iterator p = addedObjs.begin(); p != addedObjs.end(); ++p) { checkObjectForAddition(*p, objectsWrapper); } } set oldRepGrps, newRepGrps; set oldAdptRepGrps, newAdptRepGrps; origApp.getReplicaGroups(oldRepGrps, oldAdptRepGrps); newApp.getReplicaGroups(newRepGrps, newAdptRepGrps); set rmRepGrps; set_difference(oldRepGrps.begin(), oldRepGrps.end(), newRepGrps.begin(),newRepGrps.end(), set_inserter(rmRepGrps)); for_each(rmRepGrps.begin(), rmRepGrps.end(), objFunc(*this, &Database::checkReplicaGroupForRemove)); set addedAdptRepGrps; set_difference(newAdptRepGrps.begin(),newAdptRepGrps.end(), oldAdptRepGrps.begin(), oldAdptRepGrps.end(), set_inserter(addedAdptRepGrps)); for_each(addedAdptRepGrps.begin(), addedAdptRepGrps.end(), objFunc(*this, &Database::checkReplicaGroupExists)); vector invalidAdptRepGrps; set_intersection(rmRepGrps.begin(), rmRepGrps.end(), newAdptRepGrps.begin(), newAdptRepGrps.end(), back_inserter(invalidAdptRepGrps)); if(!invalidAdptRepGrps.empty()) { DeploymentException ex; ex.reason = "couldn't find replica group `" + invalidAdptRepGrps.front() + "'"; throw ex; } } void Database::checkForRemove(const ApplicationHelper& app) { set replicaGroups; set adapterReplicaGroups; app.getReplicaGroups(replicaGroups, adapterReplicaGroups); for_each(replicaGroups.begin(), replicaGroups.end(), objFunc(*this, &Database::checkReplicaGroupForRemove)); } void Database::checkServerForAddition(const string& id) { if(_serverCache.has(id)) { DeploymentException ex; ex.reason = "server `" + id + "' is already registered"; throw ex; } } void Database::checkAdapterForAddition(const string& id, const AdaptersWrapperPtr& adaptersWrapper) { bool found = false; if(_adapterCache.has(id)) { found = true; } else { try { adaptersWrapper->find(id); found = true; } catch(const NotFoundException&) { if(adaptersWrapper->findByReplicaGroupId(id).size() != 0) { found = true; } } } if(found) { DeploymentException ex; ex.reason = "adapter `" + id + "' is already registered"; throw ex; } } void Database::checkObjectForAddition(const Ice::Identity& objectId, const ObjectsWrapperPtr& objectsWrapper) { bool found = false; if(_objectCache.has(objectId) || _allocatableObjectCache.has(objectId)) { found = true; } else { try { objectsWrapper->find(objectId); found = true; } catch(const NotFoundException&) { } } if(found) { DeploymentException ex; ex.reason = "object `" + _communicator->identityToString(objectId) + "' is already registered"; throw ex; } } void Database::checkReplicaGroupExists(const string& replicaGroup) { ReplicaGroupEntryPtr entry; try { entry = ReplicaGroupEntryPtr::dynamicCast(_adapterCache.get(replicaGroup)); } catch(const AdapterNotExistException&) { } if(!entry) { DeploymentException ex; ex.reason = "couldn't find replica group `" + replicaGroup + "'"; throw ex; } } void Database::checkReplicaGroupForRemove(const string& replicaGroup) { ReplicaGroupEntryPtr entry; try { entry = ReplicaGroupEntryPtr::dynamicCast(_adapterCache.get(replicaGroup)); } catch(const AdapterNotExistException&) { } if(!entry) { // // This would indicate an inconsistency with the cache and // database. We don't print an error, it will be printed // when the application is actually removed. // return; } if(entry->hasAdaptersFromOtherApplications()) { DeploymentException ex; ex.reason = "couldn't remove application because the replica group `" + replicaGroup + "' is used by object adapters from other applications."; throw ex; } } void Database::load(const ApplicationHelper& app, ServerEntrySeq& entries, const string& uuid, int revision) { const NodeDescriptorDict& nodes = app.getInstance().nodes; const string application = app.getInstance().name; for(NodeDescriptorDict::const_iterator n = nodes.begin(); n != nodes.end(); ++n) { _nodeCache.get(n->first, true)->addDescriptor(application, n->second); } const ReplicaGroupDescriptorSeq& adpts = app.getInstance().replicaGroups; for(ReplicaGroupDescriptorSeq::const_iterator r = adpts.begin(); r != adpts.end(); ++r) { assert(!r->id.empty()); _adapterCache.addReplicaGroup(*r, application); for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o) { _objectCache.add(toObjectInfo(_communicator, *o, r->id), application); } } map servers = app.getServerInfos(uuid, revision); for(map::const_iterator p = servers.begin(); p != servers.end(); ++p) { entries.push_back(_serverCache.add(p->second, false)); } } void Database::unload(const ApplicationHelper& app, ServerEntrySeq& entries) { map servers = app.getServerInfos("", 0); for(map::const_iterator p = servers.begin(); p != servers.end(); ++p) { entries.push_back(_serverCache.remove(p->first)); } const ReplicaGroupDescriptorSeq& adpts = app.getInstance().replicaGroups; for(ReplicaGroupDescriptorSeq::const_iterator r = adpts.begin(); r != adpts.end(); ++r) { for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o) { _objectCache.remove(o->id); } _adapterCache.removeReplicaGroup(r->id); } const NodeDescriptorDict& nodes = app.getInstance().nodes; const string application = app.getInstance().name; for(NodeDescriptorDict::const_iterator n = nodes.begin(); n != nodes.end(); ++n) { _nodeCache.get(n->first)->removeDescriptor(application); } } void Database::reload(const ApplicationHelper& oldApp, const ApplicationHelper& newApp, ServerEntrySeq& entries, const string& uuid, int revision, bool noRestart) { const string application = oldApp.getInstance().name; // // Remove destroyed servers. // map oldServers = oldApp.getServerInfos(uuid, revision); map newServers = newApp.getServerInfos(uuid, revision); vector load; for(map::const_iterator p = newServers.begin(); p != newServers.end(); ++p) { map::const_iterator q = oldServers.find(p->first); if(q == oldServers.end()) { load.push_back(p->second); } else if(isServerUpdated(p->second, q->second)) { _serverCache.remove(p->first, false); // Don't destroy the server if it was updated. load.push_back(p->second); } else { ServerEntryPtr server = _serverCache.get(p->first); server->update(q->second, noRestart); // Just update the server revision on the node. entries.push_back(server); } } for(map::const_iterator p = oldServers.begin(); p != oldServers.end(); ++p) { map::const_iterator q = newServers.find(p->first); if(q == newServers.end()) { entries.push_back(_serverCache.remove(p->first)); } } // // Remove destroyed replica groups. // const ReplicaGroupDescriptorSeq& oldAdpts = oldApp.getInstance().replicaGroups; const ReplicaGroupDescriptorSeq& newAdpts = newApp.getInstance().replicaGroups; for(ReplicaGroupDescriptorSeq::const_iterator r = oldAdpts.begin(); r != oldAdpts.end(); ++r) { ReplicaGroupDescriptorSeq::const_iterator t; for(t = newAdpts.begin(); t != newAdpts.end(); ++t) { if(t->id == r->id) { break; } } for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o) { _objectCache.remove(o->id); } if(t == newAdpts.end()) { _adapterCache.removeReplicaGroup(r->id); } } // // Remove all the node descriptors. // const NodeDescriptorDict& oldNodes = oldApp.getInstance().nodes; for(NodeDescriptorDict::const_iterator n = oldNodes.begin(); n != oldNodes.end(); ++n) { _nodeCache.get(n->first)->removeDescriptor(application); } // // Add back node descriptors. // const NodeDescriptorDict& newNodes = newApp.getInstance().nodes; for(NodeDescriptorDict::const_iterator n = newNodes.begin(); n != newNodes.end(); ++n) { _nodeCache.get(n->first, true)->addDescriptor(application, n->second); } // // Add back replica groups. // for(ReplicaGroupDescriptorSeq::const_iterator r = newAdpts.begin(); r != newAdpts.end(); ++r) { try { ReplicaGroupEntryPtr entry = ReplicaGroupEntryPtr::dynamicCast(_adapterCache.get(r->id)); assert(entry); entry->update(r->loadBalancing); } catch(const AdapterNotExistException&) { _adapterCache.addReplicaGroup(*r, application); } for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o) { _objectCache.add(toObjectInfo(_communicator, *o, r->id), application); } } // // Add back servers. // for(vector::const_iterator q = load.begin(); q != load.end(); ++q) { entries.push_back(_serverCache.add(*q, noRestart)); } } Ice::Long Database::saveApplication(const ApplicationInfo& info, const DatabaseConnectionPtr& connection, Ice::Long dbSerial) { assert(dbSerial != 0 || _master); for(;;) { try { ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); TransactionHolder txHolder(connection); applicationsWrapper->put(info.descriptor.name, info); dbSerial = applicationsWrapper->updateSerial(dbSerial); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } return dbSerial; } Ice::Long Database::removeApplication(const string& name, const DatabaseConnectionPtr& connection, Ice::Long dbSerial) { assert(dbSerial != 0 || _master); for(;;) { try { ApplicationsWrapperPtr applicationsWrapper = _connectionPool->getApplications(connection); TransactionHolder txHolder(connection); applicationsWrapper->erase(name); dbSerial = applicationsWrapper->updateSerial(dbSerial); txHolder.commit(); break; } catch(const DeadlockException&) { continue; } catch(const DatabaseException& ex) { halt(_communicator, ex); } } return dbSerial; } void Database::checkUpdate(const ApplicationHelper& oldApp, const ApplicationHelper& newApp, const string& uuid, int revision, bool noRestart) { const string application = oldApp.getInstance().name; map oldServers = oldApp.getServerInfos(uuid, revision); map newServers = newApp.getServerInfos(uuid, revision + 1); map::const_iterator p; vector servers; vector reasons; if(noRestart) { for(p = oldServers.begin(); p != oldServers.end(); ++p) { map::const_iterator q = newServers.find(p->first); if(q == newServers.end()) { servers.push_back(p->first); reasons.push_back("server `" + p->first + "' needs to be removed"); } } } vector results; set unreachableNodes; for(p = newServers.begin(); p != newServers.end(); ++p) { map::const_iterator q = oldServers.find(p->first); if(q != oldServers.end() && isServerUpdated(p->second, q->second)) { if(noRestart && isServerUpdated(p->second, q->second, true)) // Ignore properties { // // The updates are not only property updates and noRestart is required, no // need to check the server update on the node, we know already it requires // a restart. // servers.push_back(p->first); reasons.push_back("update requires the server `" + p->first + "' to be stopped"); } else { // // Ask the node to check the server update. // try { CheckUpdateResultPtr result = _serverCache.get(p->first)->checkUpdate(p->second, noRestart); if(result) { results.push_back(result); } } catch(const NodeUnreachableException& ex) { unreachableNodes.insert(ex.name); } catch(const DeploymentException& ex) { servers.push_back(p->first); reasons.push_back(ex.reason); } } } } for(vector::const_iterator q = results.begin(); q != results.end(); ++q) { try { (*q)->getResult(); } catch(const NodeUnreachableException& ex) { unreachableNodes.insert(ex.name); } catch(const DeploymentException& ex) { servers.push_back((*q)->getServer()); reasons.push_back(ex.reason); } } if(noRestart) { if(!servers.empty() || !unreachableNodes.empty()) { if(_traceLevels->application > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat); out << "check for application `" << application << "' update failed:"; if(!unreachableNodes.empty()) { #if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES) Ice::StringSeq nodes; for(set::const_iterator p = unreachableNodes.begin(); p != unreachableNodes.end(); ++p) { nodes.push_back(*p); } #else Ice::StringSeq nodes(unreachableNodes.begin(), unreachableNodes.end()); #endif if(nodes.size() == 1) { out << "\nthe node `" << nodes[0] << "' is down"; } else { out << "\nthe nodes `" << toString(nodes, ", ") << "' are down"; } } if(!reasons.empty()) { for(vector::const_iterator p = reasons.begin(); p != reasons.end(); ++p) { out << "\n" << *p; } } } ostringstream os; os << "check for application `" << application << "' update failed:"; if(!servers.empty()) { if(servers.size() == 1) { os << "\nthe server `" << servers[0] << "' would need to be stopped"; } else { os << "\nthe servers `" << toString(servers, ", ") << "' would need to be stopped"; } } if(!unreachableNodes.empty()) { #if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES) Ice::StringSeq nodes; for(set::const_iterator p = unreachableNodes.begin(); p != unreachableNodes.end\ (); ++p) { nodes.push_back(*p); } #else Ice::StringSeq nodes(unreachableNodes.begin(), unreachableNodes.end()); #endif if(nodes.size() == 1) { os << "\nthe node `" << nodes[0] << "' is down"; } else { os << "\nthe nodes `" << toString(nodes, ", ") << "' are down"; } } throw DeploymentException(os.str()); } } else if(!reasons.empty()) { ostringstream os; os << "check for application `" << application << "' update failed:"; for(vector::const_iterator p = reasons.begin(); p != reasons.end(); ++p) { os << "\n" << *p; } throw DeploymentException(os.str()); } } void Database::finishApplicationUpdate(const ApplicationUpdateInfo& update, const ApplicationInfo& oldApp, const ApplicationHelper& previous, const ApplicationHelper& helper, AdminSessionI* /*session*/, bool noRestart, Ice::Long dbSerial) { const ApplicationDescriptor& newDesc = helper.getDefinition(); DatabaseConnectionPtr connection = _connectionPool->newConnection(); ServerEntrySeq entries; int serial = 0; try { if(_master) { checkUpdate(previous, helper, oldApp.uuid, oldApp.revision, noRestart); } Lock sync(*this); checkForUpdate(previous, helper, connection); reload(previous, helper, entries, oldApp.uuid, oldApp.revision + 1, noRestart); for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); ApplicationInfo info = oldApp; info.updateTime = update.updateTime; info.updateUser = update.updateUser; info.revision = update.revision; info.descriptor = newDesc; dbSerial = saveApplication(info, connection, dbSerial); serial = _applicationObserverTopic->applicationUpdated(dbSerial, update); } catch(const DeploymentException&) { finishUpdating(update.descriptor.name); throw; } _applicationObserverTopic->waitForSyncedSubscribers(serial); // Wait for replicas to be updated. // // Mark the application as updated. All the replicas received the update so it's now safe // for the nodes to start servers. // { Lock sync(*this); vector::iterator p = find(_updating.begin(), _updating.end(), update.descriptor.name); assert(p != _updating.end()); p->markUpdated(); } if(_master) { try { for(ServerEntrySeq::const_iterator p = entries.begin(); p != entries.end(); ++p) { try { (*p)->waitForSync(); } catch(const NodeUnreachableException&) { // Ignore. } } } catch(const DeploymentException& ex) { ApplicationUpdateInfo newUpdate; { Lock sync(*this); entries.clear(); ApplicationHelper previous(_communicator, newDesc); ApplicationHelper helper(_communicator, oldApp.descriptor); ApplicationInfo info = oldApp; info.revision = update.revision + 1; dbSerial = saveApplication(info, connection); reload(previous, helper, entries, info.uuid, info.revision, noRestart); newUpdate.updateTime = IceUtil::Time::now().toMilliSeconds(); newUpdate.updateUser = _lockUserId; newUpdate.revision = info.revision; newUpdate.descriptor = helper.diff(previous); vector::iterator p = find(_updating.begin(), _updating.end(), update.descriptor.name); assert(p != _updating.end()); p->unmarkUpdated(); for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); serial = _applicationObserverTopic->applicationUpdated(dbSerial, newUpdate); } _applicationObserverTopic->waitForSyncedSubscribers(serial); // Wait for subscriber to be updated. for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::waitForSyncNoThrow)); finishUpdating(newDesc.name); throw ex; } } if(_traceLevels->application > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat); out << "updated application `" << update.descriptor.name << "' (serial = `" << dbSerial << "')"; } finishUpdating(update.descriptor.name); } void Database::waitForUpdate(const string& name) { while(find(_updating.begin(), _updating.end(), name) != _updating.end()) { wait(); } } void Database::startUpdating(const string& name, const string& uuid, int revision) { // Must be called within the synchronization. assert(find(_updating.begin(), _updating.end(), name) == _updating.end()); _updating.push_back(UpdateInfo(name, uuid, revision)); } void Database::finishUpdating(const string& name) { Lock sync(*this); vector::iterator p = find(_updating.begin(), _updating.end(), name); assert(p != _updating.end()); p->markUpdated(); _updating.erase(p); notifyAll(); } Ice-3.5.1/cpp/src/IceGrid/LocatorRegistryI.cpp0000644000076400007640000003546212223561476017234 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include using namespace std; using namespace IceGrid; namespace IceGrid { template class SetDirectProxyCB : public LocatorRegistryI::AdapterSetDirectProxyCB { public: SetDirectProxyCB(const AmdCB& cb, const TraceLevelsPtr& traceLevels, const string& id, const Ice::ObjectPrx& proxy) : _cb(cb), _traceLevels(traceLevels), _id(id), _proxy(proxy) { } virtual void response() { if(_traceLevels->locator > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat); out << "registered adapter `" << _id << "' endpoints: `"; out << (_proxy ? _proxy->ice_toString() : string("")) << "'"; } _cb->ice_response(); } virtual void exception(const ::Ice::Exception& ex) { if(_traceLevels->locator > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat); out << "failed to register adapter `" << _id << "' endpoints:\n" << ex; } try { ex.ice_throw(); } catch(const AdapterActiveException&) { _cb->ice_exception(Ice::AdapterAlreadyActiveException()); return; } catch(const Ice::ObjectNotExistException&) { _cb->ice_exception(Ice::AdapterNotFoundException()); // Expected if the adapter was destroyed. return; } catch(const Ice::Exception&) { _cb->ice_exception(Ice::AdapterNotFoundException()); return; } assert(false); } private: const AmdCB _cb; const TraceLevelsPtr _traceLevels; const string _id; const Ice::ObjectPrx _proxy; }; template SetDirectProxyCB* newSetDirectProxyCB(const AmdCB& cb, const TraceLevelsPtr& traceLevels, const string& id, const Ice::ObjectPrx& p) { return new SetDirectProxyCB(cb, traceLevels, id, p); } class ServerSetProcessCB : virtual public IceUtil::Shared { public: ServerSetProcessCB(const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr& cb, const TraceLevelsPtr& traceLevels, const string& id, const Ice::ObjectPrx& proxy) : _cb(cb), _traceLevels(traceLevels), _id(id), _proxy(proxy) { } virtual void ice_response() { if(_traceLevels->locator > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat); out << "registered server `" << _id << "' process proxy: `"; out << (_proxy ? _proxy->ice_toString() : string("")) << "'"; } _cb->ice_response(); } virtual void ice_exception(const ::Ice::Exception& ex) { if(_traceLevels->locator > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat); out << "failed to register server process proxy `" << _id << "':\n" << ex; } try { ex.ice_throw(); } catch(const Ice::ObjectNotExistException&) { // Expected if the server was destroyed. _cb->ice_exception(Ice::ServerNotFoundException()); return; } catch(const Ice::LocalException&) { _cb->ice_exception(Ice::ServerNotFoundException()); return; } assert(false); } private: const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr _cb; const TraceLevelsPtr _traceLevels; const string _id; const Ice::ObjectPrx _proxy; }; typedef IceUtil::Handle ServerSetProcessCBPtr; class SetAdapterDirectProxyCallback : public SynchronizationCallback { public: SetAdapterDirectProxyCallback(const LocatorRegistryIPtr& registry, const LocatorRegistryI::AdapterSetDirectProxyCBPtr& amiCB, const string& adapterId, const string& replicaGroupId, const Ice::ObjectPrx& proxy) : _registry(registry), _amiCB(amiCB), _adapterId(adapterId), _replicaGroupId(replicaGroupId), _proxy(proxy) { } virtual void synchronized() { try { _registry->setAdapterDirectProxy(_amiCB, _adapterId, _replicaGroupId, _proxy); } catch(const Ice::Exception& ex) { _amiCB->exception(ex); } } virtual void synchronized(const Ice::Exception& ex) { try { ex.ice_throw(); } catch(const Ice::Exception& ex) { _amiCB->exception(ex); } } private: const LocatorRegistryIPtr _registry; const LocatorRegistryI::AdapterSetDirectProxyCBPtr _amiCB; const string _adapterId; const string _replicaGroupId; const Ice::ObjectPrx _proxy; }; class SetServerProcessProxyCallback : public SynchronizationCallback { public: SetServerProcessProxyCallback(const LocatorRegistryIPtr& registry, const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr& cb, const string& id, const Ice::ProcessPrx& proxy) : _registry(registry), _cb(cb), _id(id), _proxy(proxy) { } virtual void synchronized() { try { _registry->setServerProcessProxy_async(_cb, _id, _proxy, Ice::Current()); } catch(const Ice::Exception& ex) { _cb->ice_exception(ex); } } virtual void synchronized(const Ice::Exception& ex) { try { ex.ice_throw(); } catch(const ServerNotExistException&) { _cb->ice_exception(Ice::ServerNotFoundException()); } catch(const Ice::Exception& ex) { const TraceLevelsPtr traceLevels = _registry->getTraceLevels(); if(traceLevels->locator > 0) { Ice::Trace out(traceLevels->logger, traceLevels->locatorCat); out << "couldn't register server `" << _id << "' process proxy:\n" << toString(ex); } _cb->ice_exception(Ice::ServerNotFoundException()); } } private: const LocatorRegistryIPtr _registry; const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr _cb; const string _id; const Ice::ProcessPrx _proxy; }; }; LocatorRegistryI::LocatorRegistryI(const DatabasePtr& database, bool dynamicRegistration, bool master, ReplicaSessionManager& session) : _database(database), _dynamicRegistration(dynamicRegistration), _master(master), _session(session) { } void LocatorRegistryI::setAdapterDirectProxy_async(const Ice::AMD_LocatorRegistry_setAdapterDirectProxyPtr& cb, const string& adapterId, const Ice::ObjectPrx& proxy, const Ice::Current&) { setAdapterDirectProxy(newSetDirectProxyCB(cb, _database->getTraceLevels(), adapterId, proxy), adapterId, "", proxy); } void LocatorRegistryI::setReplicatedAdapterDirectProxy_async( const Ice::AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr& cb, const string& adapterId, const string& replicaGroupId, const Ice::ObjectPrx& proxy, const Ice::Current&) { setAdapterDirectProxy(newSetDirectProxyCB(cb, _database->getTraceLevels(), adapterId, proxy), adapterId, replicaGroupId, proxy); } void LocatorRegistryI::setServerProcessProxy_async(const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr& cb, const string& id, const Ice::ProcessPrx& proxy, const Ice::Current&) { try { // // Get the server from the registry and set its process proxy. // // NOTE: We pass false to the getServer call to indicate that // we don't necessarily want an up-to-date adapter proxy. This // is needed for the session activation mode for cases where // the server is released during the server startup. // ServerPrx server; while(true) { try { server = _database->getServer(id)->getProxy(false); break; } catch(const SynchronizationException&) { if(_database->getServer(id)->addSyncCallback(new SetServerProcessProxyCallback(this, cb, id, proxy))) { return; } } } server->begin_setProcess(proxy, IceGrid::newCallback_Server_setProcess( new ServerSetProcessCB(cb, _database->getTraceLevels(), id, proxy), &ServerSetProcessCB::ice_response, &ServerSetProcessCB::ice_exception)); } catch(const ServerNotExistException&) { cb->ice_exception(Ice::ServerNotFoundException()); } catch(const Ice::Exception& ex) { const TraceLevelsPtr traceLevels = _database->getTraceLevels(); if(traceLevels->locator > 0) { Ice::Trace out(traceLevels->logger, traceLevels->locatorCat); out << "couldn't register server `" << id << "' process proxy:\n" << toString(ex); } cb->ice_exception(Ice::ServerNotFoundException()); } } void LocatorRegistryI::setAdapterDirectProxy(const LocatorRegistryI::AdapterSetDirectProxyCBPtr& amiCB, const string& adapterId, const string& replicaGroupId, const Ice::ObjectPrx& proxy) { // // Ignore request with empty adapter id. // if(adapterId.empty()) { amiCB->response(); return; } int nRetry = 5; do { try { // // Get the adapter from the registry and set its direct proxy. // AdapterPrx adapter; while(true) { try { adapter = _database->getAdapterProxy(adapterId, replicaGroupId, false); if(!adapter) { throw Ice::AdapterNotFoundException(); } break; } catch(const SynchronizationException&) { if(_database->addAdapterSyncCallback(adapterId, new SetAdapterDirectProxyCallback( this, amiCB, adapterId, replicaGroupId, proxy))) { return; } } } adapter->begin_setDirectProxy(proxy, IceGrid::newCallback_Adapter_setDirectProxy(amiCB, &LocatorRegistryI::AdapterSetDirectProxyCB::response, &LocatorRegistryI::AdapterSetDirectProxyCB::exception)); return; } catch(const AdapterNotExistException&) { if(!_dynamicRegistration) { throw Ice::AdapterNotFoundException(); } } catch(const Ice::Exception& ex) { const TraceLevelsPtr traceLevels = _database->getTraceLevels(); if(traceLevels->locator > 0) { Ice::Trace out(traceLevels->logger, traceLevels->locatorCat); out << "couldn't register adapter `" << adapterId << "' endpoints:\n" << toString(ex); } throw Ice::AdapterNotFoundException(); } assert(_dynamicRegistration); if(_master) { try { _database->setAdapterDirectProxy(adapterId, replicaGroupId, proxy); amiCB->response(); return; } catch(const AdapterExistsException&) { // Continue } } else { ReplicaSessionPrx session = _session.getSession(); if(!session) { const TraceLevelsPtr traceLevels = _database->getTraceLevels(); if(traceLevels->locator > 0) { Ice::Trace out(traceLevels->logger, traceLevels->locatorCat); out << "couldn't register adapter `" << adapterId << "' endpoints with master:\n"; out << "no session established with the master"; } throw Ice::AdapterNotFoundException(); } try { session->setAdapterDirectProxy(adapterId, replicaGroupId, proxy); amiCB->response(); return; } catch(const AdapterExistsException&) { // Continue } catch(const AdapterNotExistException&) { throw Ice::AdapterNotFoundException(); // Dynamic registration not allowed on the master. } catch(const Ice::LocalException& ex) { const TraceLevelsPtr traceLevels = _database->getTraceLevels(); if(traceLevels->locator > 0) { Ice::Trace out(traceLevels->logger, traceLevels->locatorCat); out << "couldn't register adapter `" << adapterId << "' endpoints with master:\n" << toString(ex); } throw Ice::AdapterNotFoundException(); } } } while(nRetry-- > 0); throw Ice::AdapterNotFoundException(); } const TraceLevelsPtr& LocatorRegistryI::getTraceLevels() const { return _database->getTraceLevels(); } Ice-3.5.1/cpp/src/IceGrid/dummyinclude/0000755000076400007640000000000012223561476015750 5ustar mesmesIce-3.5.1/cpp/src/IceGrid/dummyinclude/unistd.h0000644000076400007640000000015412223561476017427 0ustar mesmes// // Files generated by flex need unistd.h, which is not available on // Windows. Thus this dummy file. // Ice-3.5.1/cpp/src/IceGrid/ServerAdapterI.h0000644000076400007640000000313312223561476016302 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_SERVER_ADAPTER_I_H #define ICE_GRID_SERVER_ADAPTER_I_H #include #include namespace IceGrid { class NodeI; typedef IceUtil::Handle NodeIPtr; class ServerI; class ServerAdapterI : public Adapter, public IceUtil::Mutex { public: ServerAdapterI(const NodeIPtr&, ServerI*, const std::string&, const AdapterPrx&, const std::string&, bool); virtual ~ServerAdapterI(); virtual void activate_async(const AMD_Adapter_activatePtr& cb, const Ice::Current&); virtual Ice::ObjectPrx getDirectProxy(const Ice::Current& = Ice::Current()) const; virtual void setDirectProxy(const ::Ice::ObjectPrx&, const ::Ice::Current& = Ice::Current()); void destroy(); void updateEnabled(); void clear(); void activationFailed(const std::string&); void activationCompleted(); AdapterPrx getProxy() const; private: const NodeIPtr _node; const AdapterPrx _this; const std::string _serverId; const std::string _id; const std::string _replicaId; ServerI* _server; Ice::ObjectPrx _proxy; bool _enabled; std::vector _activateCB; bool _activateAfterDeactivating; }; typedef IceUtil::Handle ServerAdapterIPtr; } #endif Ice-3.5.1/cpp/src/IceGrid/Topics.cpp0000644000076400007640000007066312223561476015232 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace IceGrid; namespace { // // Encodings supported by the observers. We create one topic per // encoding version and subscribe the observer to the appropriate // topic depending on its encoding. // Ice::EncodingVersion encodings[] = { { 1, 0 }, { 1, 1 } }; } ObserverTopic::ObserverTopic(const IceStorm::TopicManagerPrx& topicManager, const string& name, Ice::Long dbSerial) : _logger(topicManager->ice_getCommunicator()->getLogger()), _serial(0), _dbSerial(dbSerial) { for(int i = 0; i < static_cast(sizeof(encodings) / sizeof(Ice::EncodingVersion)); ++i) { ostringstream os; os << name << "-" << Ice::encodingVersionToString(encodings[i]); IceStorm::TopicPrx t; try { t = topicManager->create(os.str()); } catch(const IceStorm::TopicExists&) { t = topicManager->retrieve(os.str()); } // // NOTE: collocation optimization needs to be turned on for the // topic because the subscribe() method is given a fixed proxy // which can't be marshalled. // _topics[encodings[i]] = t->ice_collocationOptimized(true); _basePublishers.push_back( t->getPublisher()->ice_collocationOptimized(false)->ice_encodingVersion(encodings[i])); } } ObserverTopic::~ObserverTopic() { } int ObserverTopic::subscribe(const Ice::ObjectPrx& obsv, const string& name) { Lock sync(*this); if(_topics.empty()) { return -1; } assert(obsv); try { IceStorm::QoS qos; qos["reliability"] = "ordered"; Ice::EncodingVersion v = IceInternal::getCompatibleEncoding(obsv->ice_getEncodingVersion()); map::const_iterator p = _topics.find(v); if(p == _topics.end()) { Ice::Warning out(_logger); out << "unsupported encoding version for observer `" << obsv << "'"; return -1; } initObserver(p->second->subscribeAndGetPublisher(qos, obsv->ice_twoway())); } catch(const IceStorm::AlreadySubscribed&) { throw ObserverAlreadyRegisteredException(obsv->ice_getIdentity()); } if(!name.empty()) { assert(_syncSubscribers.find(name) == _syncSubscribers.end()); _syncSubscribers.insert(name); addExpectedUpdate(_serial, name); return _serial; } return -1; } void ObserverTopic::unsubscribe(const Ice::ObjectPrx& observer, const string& name) { Lock sync(*this); Ice::EncodingVersion v = IceInternal::getCompatibleEncoding(observer->ice_getEncodingVersion()); map::const_iterator p = _topics.find(v); if(p == _topics.end()) { return; } p->second->unsubscribe(observer); assert(observer); if(!name.empty()) { assert(_syncSubscribers.find(name) != _syncSubscribers.end()); _syncSubscribers.erase(name); map >::iterator p = _waitForUpdates.begin(); bool notifyMonitor = false; while(p != _waitForUpdates.end()) { p->second.erase(name); if(p->second.empty()) { _waitForUpdates.erase(p++); notifyMonitor = true; } else { ++p; } } if(notifyMonitor) { notifyAll(); } } } void ObserverTopic::destroy() { Lock sync(*this); _topics.clear(); notifyAll(); } void ObserverTopic::receivedUpdate(const string& name, int serial, const string& failure) { Lock sync(*this); map >::iterator p = _waitForUpdates.find(serial); if(p != _waitForUpdates.end()) { p->second.erase(name); if(!failure.empty()) { map >::iterator q = _updateFailures.find(serial); if(q == _updateFailures.end()) { q = _updateFailures.insert(make_pair(serial, map())).first; } q->second.insert(make_pair(name, failure)); } if(p->second.empty()) { _waitForUpdates.erase(p); } notifyAll(); } } void ObserverTopic::waitForSyncedSubscribers(int serial, const string& name) { Lock sync(*this); waitForSyncedSubscribersNoSync(serial, name); } int ObserverTopic::getSerial() const { Lock sync(*this); return _serial; } void ObserverTopic::addExpectedUpdate(int serial, const string& name) { if(_syncSubscribers.empty() && name.empty()) { return; } // Must be called with the lock held. if(name.empty()) { assert(_waitForUpdates[serial].empty()); _waitForUpdates[serial] = _syncSubscribers; } else { _waitForUpdates[serial].insert(name); } } void ObserverTopic::waitForSyncedSubscribersNoSync(int serial, const string& name) { if(serial < 0) { return; } // // Wait until all the updates are received or the service shutdown. // while(!_topics.empty()) { map >::const_iterator p = _waitForUpdates.find(serial); if(p == _waitForUpdates.end()) { map >::iterator q = _updateFailures.find(serial); if(q != _updateFailures.end()) { map failures = q->second; _updateFailures.erase(q); ostringstream os; for(map::const_iterator r = failures.begin(); r != failures.end(); ++r) { os << "replication failed on replica `" << r->first << "':\n" << r->second << "\n"; } Ice::Error err(_logger); err << os.str(); } return; } else { if(!name.empty() && p->second.find(name) == p->second.end()) { return; } wait(); } } } void ObserverTopic::updateSerial(Ice::Long dbSerial) { ++_serial; if(dbSerial > 0) { _dbSerial = dbSerial; } } Ice::Context ObserverTopic::getContext(int serial, Ice::Long dbSerial) const { Ice::Context context; { ostringstream os; os << serial; context["serial"] = os.str(); } if(dbSerial > 0) { ostringstream os; os << dbSerial; context["dbSerial"] = os.str(); } return context; } RegistryObserverTopic::RegistryObserverTopic(const IceStorm::TopicManagerPrx& topicManager) : ObserverTopic(topicManager, "RegistryObserver") { _publishers = getPublishers(); } void RegistryObserverTopic::registryUp(const RegistryInfo& info) { Lock sync(*this); if(_topics.empty()) { return; } updateSerial(); _registries.insert(make_pair(info.name, info)); try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->registryUp(info); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `registryUp' update:\n" << ex; } } void RegistryObserverTopic::registryDown(const string& name) { Lock sync(*this); if(_topics.empty()) { return; } if(_registries.find(name) == _registries.end()) { return; } updateSerial(); _registries.erase(name); try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->registryDown(name); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `registryDown' update:\n" << ex; } } void RegistryObserverTopic::initObserver(const Ice::ObjectPrx& obsv) { RegistryObserverPrx observer = RegistryObserverPrx::uncheckedCast(obsv); RegistryInfoSeq registries; registries.reserve(_registries.size()); for(map::const_iterator p = _registries.begin(); p != _registries.end(); ++p) { registries.push_back(p->second); } observer->registryInit(registries, getContext(_serial)); } NodeObserverTopic::NodeObserverTopic(const IceStorm::TopicManagerPrx& topicManager, const Ice::ObjectAdapterPtr& adapter) : ObserverTopic(topicManager, "NodeObserver") { _publishers = getPublishers(); try { const_cast(_externalPublisher) = NodeObserverPrx::uncheckedCast(adapter->addWithUUID(this)); } catch(const Ice::LocalException&) { } } void NodeObserverTopic::nodeInit(const NodeDynamicInfoSeq&, const Ice::Current&) { assert(false); } void NodeObserverTopic::nodeUp(const NodeDynamicInfo& info, const Ice::Current&) { Lock sync(*this); if(_topics.empty()) { return; } updateSerial(); _nodes.insert(make_pair(info.info.name, info)); try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->nodeUp(info); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing 'nodeUp' update:\n" << ex; } } void NodeObserverTopic::nodeDown(const string& /*name*/, const Ice::Current&) { assert(false); } void NodeObserverTopic::updateServer(const string& node, const ServerDynamicInfo& server, const Ice::Current&) { Lock sync(*this); if(_topics.empty()) { return; } if(_nodes.find(node) == _nodes.end()) { // // If the node isn't known anymore, we ignore the update. // return; } updateSerial(); ServerDynamicInfoSeq& servers = _nodes[node].servers; ServerDynamicInfoSeq::iterator p = servers.begin(); while(p != servers.end()) { if(p->id == server.id) { if(server.state == Destroyed || (server.state == Inactive && server.enabled)) { servers.erase(p); } else { *p = server; } break; } ++p; } if(server.state != Destroyed && (server.state != Inactive || !server.enabled) && p == servers.end()) { servers.push_back(server); } try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->updateServer(node, server); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `updateServer' update:\n" << ex; } } void NodeObserverTopic::updateAdapter(const string& node, const AdapterDynamicInfo& adapter, const Ice::Current&) { Lock sync(*this); if(_topics.empty()) { return; } if(_nodes.find(node) == _nodes.end()) { // // If the node isn't known anymore, we ignore the update. // return; } updateSerial(); AdapterDynamicInfoSeq& adapters = _nodes[node].adapters; AdapterDynamicInfoSeq::iterator p = adapters.begin(); while(p != adapters.end()) { if(p->id == adapter.id) { if(adapter.proxy) { *p = adapter; } else { adapters.erase(p); } break; } ++p; } if(adapter.proxy && p == adapters.end()) { adapters.push_back(adapter); } try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->updateAdapter(node, adapter); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `updateAdapter' update:\n" << ex; } } void NodeObserverTopic::nodeDown(const string& name) { Lock sync(*this); if(_topics.empty()) { return; } updateSerial(); if(_nodes.find(name) != _nodes.end()) { _nodes.erase(name); try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->nodeDown(name); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `nodeDown' update:\n" << ex; } } } void NodeObserverTopic::initObserver(const Ice::ObjectPrx& obsv) { NodeObserverPrx observer = NodeObserverPrx::uncheckedCast(obsv); NodeDynamicInfoSeq nodes; nodes.reserve(_nodes.size()); for(map::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p) { nodes.push_back(p->second); } observer->nodeInit(nodes, getContext(_serial)); } ApplicationObserverTopic::ApplicationObserverTopic(const IceStorm::TopicManagerPrx& topicManager, const ApplicationsWrapperPtr& wrapper) : ObserverTopic(topicManager, "ApplicationObserver", wrapper->getSerial()), _applications(wrapper->getMap()) { _publishers = getPublishers(); } int ApplicationObserverTopic::applicationInit(Ice::Long dbSerial, const ApplicationInfoSeq& apps) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _applications.clear(); for(ApplicationInfoSeq::const_iterator p = apps.begin(); p != apps.end(); ++p) { _applications.insert(make_pair(p->descriptor.name, *p)); } try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->applicationInit(_serial, apps, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `applicationInit' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } int ApplicationObserverTopic::applicationAdded(Ice::Long dbSerial, const ApplicationInfo& info) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _applications.insert(make_pair(info.descriptor.name, info)); try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->applicationAdded(_serial, info, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `applicationAdded' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } int ApplicationObserverTopic::applicationRemoved(Ice::Long dbSerial, const string& name) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _applications.erase(name); try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->applicationRemoved(_serial, name, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `applicationRemoved' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } int ApplicationObserverTopic::applicationUpdated(Ice::Long dbSerial, const ApplicationUpdateInfo& info) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); try { map::iterator p = _applications.find(info.descriptor.name); if(p != _applications.end()) { ApplicationHelper helper(_publishers[0]->ice_getCommunicator(), p->second.descriptor); p->second.descriptor = helper.update(info.descriptor); p->second.updateTime = info.updateTime; p->second.updateUser = info.updateUser; p->second.revision = info.revision; } } catch(const DeploymentException& ex) { Ice::Error out(_logger); out << "unexpected exception while instantiating application `" << info.descriptor.name << "':\n" << ex.reason; assert(false); } catch(const std::string& msg) { Ice::Error out(_logger); out << "unexpected exception while instantiating application `" << info.descriptor.name << "':\n" << msg; assert(false); } catch(const char* msg) { Ice::Error out(_logger); out << "unexpected exception while instantiating application `" << info.descriptor.name << "':\n" << msg; assert(false); } catch(...) { Ice::Error out(_logger); out << "unexpected exception while instantiating application `" << info.descriptor.name << "'"; assert(false); } try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->applicationUpdated(_serial, info, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `applicationUpdated' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } void ApplicationObserverTopic::initObserver(const Ice::ObjectPrx& obsv) { ApplicationObserverPrx observer = ApplicationObserverPrx::uncheckedCast(obsv); ApplicationInfoSeq applications; for(map::const_iterator p = _applications.begin(); p != _applications.end(); ++p) { applications.push_back(p->second); } observer->applicationInit(_serial, applications, getContext(_serial, _dbSerial)); } AdapterObserverTopic::AdapterObserverTopic(const IceStorm::TopicManagerPrx& topicManager, const AdaptersWrapperPtr& wrapper) : ObserverTopic(topicManager, "AdapterObserver", wrapper->getSerial()), _adapters(wrapper->getMap()) { _publishers = getPublishers(); } int AdapterObserverTopic::adapterInit(Ice::Long dbSerial, const AdapterInfoSeq& adpts) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _adapters.clear(); for(AdapterInfoSeq::const_iterator q = adpts.begin(); q != adpts.end(); ++q) { _adapters.insert(make_pair(q->id, *q)); } try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->adapterInit(adpts, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `adapterInit' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } int AdapterObserverTopic::adapterAdded(Ice::Long dbSerial, const AdapterInfo& info) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _adapters.insert(make_pair(info.id, info)); try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->adapterAdded(info, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `adapterAdded' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } int AdapterObserverTopic::adapterUpdated(Ice::Long dbSerial, const AdapterInfo& info) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _adapters[info.id] = info; try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->adapterUpdated(info, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `adapterUpdated' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } int AdapterObserverTopic::adapterRemoved(Ice::Long dbSerial, const string& id) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _adapters.erase(id); try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->adapterRemoved(id, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `adapterRemoved' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } void AdapterObserverTopic::initObserver(const Ice::ObjectPrx& obsv) { AdapterObserverPrx observer = AdapterObserverPrx::uncheckedCast(obsv); AdapterInfoSeq adapters; for(map::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p) { adapters.push_back(p->second); } observer->adapterInit(adapters, getContext(_serial, _dbSerial)); } ObjectObserverTopic::ObjectObserverTopic(const IceStorm::TopicManagerPrx& topicManager, const ObjectsWrapperPtr& wrapper) : ObserverTopic(topicManager, "ObjectObserver", wrapper->getSerial()), _objects(wrapper->getMap()) { _publishers = getPublishers(); } int ObjectObserverTopic::objectInit(Ice::Long dbSerial, const ObjectInfoSeq& objects) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _objects.clear(); for(ObjectInfoSeq::const_iterator r = objects.begin(); r != objects.end(); ++r) { _objects.insert(make_pair(r->proxy->ice_getIdentity(), *r)); } try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->objectInit(objects, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `objectInit' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } int ObjectObserverTopic::objectAdded(Ice::Long dbSerial, const ObjectInfo& info) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _objects.insert(make_pair(info.proxy->ice_getIdentity(), info)); try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->objectAdded(info, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `objectAdded' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } int ObjectObserverTopic::objectUpdated(Ice::Long dbSerial, const ObjectInfo& info) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _objects[info.proxy->ice_getIdentity()] = info; try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->objectUpdated(info, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `objectUpdated' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } int ObjectObserverTopic::objectRemoved(Ice::Long dbSerial, const Ice::Identity& id) { Lock sync(*this); if(_topics.empty()) { return -1; } updateSerial(dbSerial); _objects.erase(id); try { for(vector::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) { (*p)->objectRemoved(id, getContext(_serial, dbSerial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `objectRemoved' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; } int ObjectObserverTopic::wellKnownObjectsAddedOrUpdated(const ObjectInfoSeq& infos) { Lock sync(*this); if(_topics.empty()) { return -1; } for(ObjectInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p) { updateSerial(); map::iterator q = _objects.find(p->proxy->ice_getIdentity()); if(q != _objects.end()) { q->second = *p; try { for(vector::const_iterator q = _publishers.begin(); q != _publishers.end(); ++q) { (*q)->objectUpdated(*p, getContext(_serial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `objectUpdated' update:\n" << ex; } } else { _objects.insert(make_pair(p->proxy->ice_getIdentity(), *p)); try { for(vector::const_iterator q = _publishers.begin(); q != _publishers.end(); ++q) { (*q)->objectAdded(*p, getContext(_serial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `objectAdded' update:\n" << ex; } } } // // We don't wait for the update to be received by the replicas // here. This operation is called by ReplicaSessionI. // addExpectedUpdate(_serial); //waitForSyncedSubscribersNoSync(_serial); return _serial; } int ObjectObserverTopic::wellKnownObjectsRemoved(const ObjectInfoSeq& infos) { Lock sync(*this); if(_topics.empty()) { return -1; } for(ObjectInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p) { updateSerial(); _objects.erase(p->proxy->ice_getIdentity()); try { for(vector::const_iterator q = _publishers.begin(); q != _publishers.end(); ++q) { (*q)->objectRemoved(p->proxy->ice_getIdentity(), getContext(_serial)); } } catch(const Ice::LocalException& ex) { Ice::Warning out(_logger); out << "unexpected exception while publishing `objectUpdated' update:\n" << ex; } } // // We don't need to wait for the update to be received by the // replicas here. This operation is only called internaly by // IceGrid. // addExpectedUpdate(_serial); //waitForSyncedSubscribersNoSync(_serial); return _serial; } void ObjectObserverTopic::initObserver(const Ice::ObjectPrx& obsv) { ObjectObserverPrx observer = ObjectObserverPrx::uncheckedCast(obsv); ObjectInfoSeq objects; for(map::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { objects.push_back(p->second); } observer->objectInit(objects, getContext(_serial, _dbSerial)); } Ice-3.5.1/cpp/src/IceGrid/ServerI.h0000644000076400007640000002317712223561476015013 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_SERVER_I_H #define ICE_GRID_SERVER_I_H #include #include #include #include #include #include #ifndef _WIN32 # include // for uid_t, gid_t #endif namespace IceGrid { class NodeI; typedef IceUtil::Handle NodeIPtr; class ServerAdapterI; typedef IceUtil::Handle ServerAdapterIPtr; class ServerCommand; typedef IceUtil::Handle ServerCommandPtr; class DestroyCommand; typedef IceUtil::Handle DestroyCommandPtr; class StopCommand; typedef IceUtil::Handle StopCommandPtr; class StartCommand; typedef IceUtil::Handle StartCommandPtr; class PatchCommand; typedef IceUtil::Handle PatchCommandPtr; class LoadCommand; typedef IceUtil::Handle LoadCommandPtr; class ServerI : public Server, public IceUtil::Monitor { public: enum InternalServerState { Loading, Patching, Inactive, Activating, WaitForActivation, ActivationTimeout, Active, Deactivating, DeactivatingWaitForProcess, Destroying, Destroyed }; enum ServerActivation { Always, Session, OnDemand, Manual, Disabled }; ServerI(const NodeIPtr&, const ServerPrx&, const std::string&, const std::string&, int); virtual ~ServerI(); void waitForApplicationUpdateCompleted(const Ice::AsyncResultPtr&); virtual void start_async(const AMD_Server_startPtr&, const ::Ice::Current& = Ice::Current()); virtual void stop_async(const AMD_Server_stopPtr&, const ::Ice::Current& = Ice::Current()); virtual void sendSignal(const std::string&, const ::Ice::Current&); virtual void writeMessage(const std::string&, Ice::Int, const ::Ice::Current&); virtual ServerState getState(const ::Ice::Current& = Ice::Current()) const; virtual Ice::Int getPid(const ::Ice::Current& = Ice::Current()) const; virtual void setEnabled(bool, const ::Ice::Current&); virtual bool isEnabled(const ::Ice::Current& = Ice::Current()) const; virtual void setProcess_async(const AMD_Server_setProcessPtr&, const ::Ice::ProcessPrx&, const ::Ice::Current&); virtual Ice::Long getOffsetFromEnd(const std::string&, int, const Ice::Current&) const; virtual bool read(const std::string&, Ice::Long, int, Ice::Long&, Ice::StringSeq&, const Ice::Current&) const; bool isAdapterActivatable(const std::string&) const; const std::string& getId() const; InternalDistributionDescriptorPtr getDistribution() const; bool dependsOnApplicationDistrib() const; void start(ServerActivation, const AMD_Server_startPtr& = AMD_Server_startPtr()); ServerCommandPtr load(const AMD_Node_loadServerPtr&, const InternalServerDescriptorPtr&, const std::string&, bool); bool checkUpdate(const InternalServerDescriptorPtr&, bool, const Ice::Current&); ServerCommandPtr destroy(const AMD_Node_destroyServerPtr&, const std::string&, int, const std::string&); bool startPatch(bool); bool waitForPatch(); void finishPatch(); void adapterActivated(const std::string&); void adapterDeactivated(const std::string&); void activationTimedOut(); void activate(); void kill(); void deactivate(); void update(); void destroy(); void terminated(const std::string&, int); void shutdown(); // // A proxy to the Process facet of the real Admin object; called by the AdminFacade servant implementation // Ice::ObjectPrx getProcess() const; PropertyDescriptorSeqDict getProperties(const InternalServerDescriptorPtr&); void updateRuntimePropertiesCallback(const InternalServerDescriptorPtr&); void updateRuntimePropertiesCallback(const Ice::Exception&, const InternalServerDescriptorPtr&); private: void updateImpl(const InternalServerDescriptorPtr&); void checkRevision(const std::string&, const std::string&, int) const; void checkNoRestart(const InternalServerDescriptorPtr&); void checkAndUpdateUser(const InternalServerDescriptorPtr&, bool); void updateRevision(const std::string&, int); bool checkActivation(); void checkDestroyed() const; void disableOnFailure(); void setState(InternalServerState, const std::string& = std::string()); ServerCommandPtr nextCommand(); void setStateNoSync(InternalServerState, const std::string& = std::string()); void createOrUpdateDirectory(const std::string&); ServerState toServerState(InternalServerState) const; ServerActivation toServerActivation(const std::string&) const; ServerDynamicInfo getDynamicInfo() const; std::string getFilePath(const std::string&) const; const NodeIPtr _node; const ServerPrx _this; const std::string _id; const Ice::Int _waitTime; const std::string _serverDir; const int _disableOnFailure; InternalServerDescriptorPtr _desc; #ifndef _WIN32 uid_t _uid; gid_t _gid; #endif InternalServerState _state; ServerActivation _activation; int _activationTimeout; int _deactivationTimeout; typedef std::map ServerAdapterDict; ServerAdapterDict _adapters; std::set _serverLifetimeAdapters; Ice::ProcessPrx _process; std::set _activatedAdapters; IceUtil::Time _failureTime; ServerActivation _previousActivation; IceUtil::TimerTaskPtr _timerTask; bool _waitForReplication; std::string _stdErrFile; std::string _stdOutFile; Ice::StringSeq _logs; PropertyDescriptorSeq _properties; DestroyCommandPtr _destroy; StopCommandPtr _stop; LoadCommandPtr _load; PatchCommandPtr _patch; StartCommandPtr _start; int _pid; }; typedef IceUtil::Handle ServerIPtr; class ServerCommand : public IceUtil::SimpleShared { public: ServerCommand(const ServerIPtr&); virtual ~ServerCommand(); virtual void execute() = 0; virtual ServerI::InternalServerState nextState() = 0; protected: const ServerIPtr _server; }; typedef IceUtil::Handle ServerCommandPtr; class TimedServerCommand : public ServerCommand { public: TimedServerCommand(const ServerIPtr&, const IceUtil::TimerPtr&, int); virtual void timeout() = 0; void startTimer(); void stopTimer(); private: IceUtil::TimerPtr _timer; IceUtil::TimerTaskPtr _timerTask; int _timeout; }; typedef IceUtil::Handle TimedServerCommandPtr; class DestroyCommand : public ServerCommand { public: DestroyCommand(const ServerIPtr&, bool, bool); bool canExecute(ServerI::InternalServerState); ServerI::InternalServerState nextState(); void execute(); void addCallback(const AMD_Node_destroyServerPtr&); void finished(); bool loadFailure() const; bool clearDir() const; private: const bool _loadFailure; const bool _clearDir; std::vector _destroyCB; }; class StopCommand : public TimedServerCommand { public: StopCommand(const ServerIPtr&, const IceUtil::TimerPtr&, int, bool = true); static bool isStopped(ServerI::InternalServerState); bool canExecute(ServerI::InternalServerState); ServerI::InternalServerState nextState(); void execute(); void timeout(); void addCallback(const AMD_Server_stopPtr&); void failed(const std::string& reason); void finished(); private: std::vector _stopCB; bool _deactivate; }; class StartCommand : public TimedServerCommand { public: StartCommand(const ServerIPtr&, const IceUtil::TimerPtr&, int); bool canExecute(ServerI::InternalServerState); ServerI::InternalServerState nextState(); void execute(); void timeout(); void addCallback(const AMD_Server_startPtr&); void failed(const std::string& reason); void finished(); private: std::vector _startCB; }; class PatchCommand : public ServerCommand, public IceUtil::Monitor { public: PatchCommand(const ServerIPtr&); bool canExecute(ServerI::InternalServerState); ServerI::InternalServerState nextState(); void execute(); bool waitForPatch(); void destroyed(); void finished(); private: bool _notified; bool _destroyed; }; class LoadCommand : public ServerCommand { public: LoadCommand(const ServerIPtr&, const InternalServerDescriptorPtr&, const TraceLevelsPtr&); bool canExecute(ServerI::InternalServerState); ServerI::InternalServerState nextState(); void execute(); void setUpdate(const InternalServerDescriptorPtr&, bool); bool clearDir() const; InternalServerDescriptorPtr getInternalServerDescriptor() const; void addCallback(const AMD_Node_loadServerPtr&); void startRuntimePropertiesUpdate(const Ice::ObjectPrx&); bool finishRuntimePropertiesUpdate(const InternalServerDescriptorPtr&, const Ice::ObjectPrx&); void failed(const Ice::Exception&); void finished(const ServerPrx&, const AdapterPrxDict&, int, int); private: std::vector _loadCB; bool _clearDir; InternalServerDescriptorPtr _desc; IceUtil::UniquePtr _exception; InternalServerDescriptorPtr _runtime; bool _updating; TraceLevelsPtr _traceLevels; }; } #endif Ice-3.5.1/cpp/src/IceGrid/FileParserI.cpp0000644000076400007640000000172612223561476016130 0ustar mesmes// ********************************************************************** // // 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 #include #include #include using namespace std; using namespace IceGrid; ApplicationDescriptor FileParserI::parse(const string& file, const AdminPrx& admin, const Ice::Current& current) { try { return DescriptorParser::parseDescriptor(file, Ice::StringSeq(), map(), current.adapter->getCommunicator(), admin); } catch(const IceXML::ParserException& e) { throw ParseException(e.reason()); return ApplicationDescriptor(); } } Ice-3.5.1/cpp/src/IceGrid/TraceLevels.h0000644000076400007640000000243312223561476015635 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_TRACE_LEVELS_H #define ICE_GRID_TRACE_LEVELS_H #include #include #include namespace IceGrid { class TraceLevels : public ::IceUtil::Shared { public: TraceLevels(const Ice::CommunicatorPtr&, const std::string&); virtual ~TraceLevels(); const int application; const char* applicationCat; const int node; const char* nodeCat; const int replica; const char* replicaCat; const int server; const char* serverCat; const int adapter; const char* adapterCat; const int object; const char* objectCat; const int activator; const char* activatorCat; const int patch; const char* patchCat; const int locator; const char* locatorCat; const int session; const char* sessionCat; const Ice::LoggerPtr logger; }; typedef IceUtil::Handle TraceLevelsPtr; } // End namespace IceGrid #endif Ice-3.5.1/cpp/src/IceGrid/ReplicaCache.h0000644000076400007640000000403012223561476015722 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_REPLICACACHE_H #define ICE_GRID_REPLICACACHE_H #include #include #include #include #include namespace IceGrid { class ReplicaCache; class ReplicaSessionI; typedef IceUtil::Handle ReplicaSessionIPtr; class ReplicaEntry : public IceUtil::Shared { public: ReplicaEntry(const std::string&, const ReplicaSessionIPtr&); virtual ~ReplicaEntry(); bool canRemove() const { return true; } const ReplicaSessionIPtr& getSession() const; InternalReplicaInfoPtr getInfo() const; InternalRegistryPrx getProxy() const; private: const std::string _name; const ReplicaSessionIPtr _session; }; typedef IceUtil::Handle ReplicaEntryPtr; class ReplicaCache : public CacheByString { public: #ifdef __SUNPRO_CC using CacheByString::remove; #endif ReplicaCache(const Ice::CommunicatorPtr&, const IceStorm::TopicManagerPrx&); ReplicaEntryPtr add(const std::string&, const ReplicaSessionIPtr&); ReplicaEntryPtr remove(const std::string&, bool); ReplicaEntryPtr get(const std::string&) const; void subscribe(const ReplicaObserverPrx&); void unsubscribe(const ReplicaObserverPrx&); Ice::ObjectPrx getEndpoints(const std::string&, const Ice::ObjectPrx&) const; void setInternalRegistry(const InternalRegistryPrx&); InternalRegistryPrx getInternalRegistry() const; private: const Ice::CommunicatorPtr _communicator; const IceStorm::TopicPrx _topic; const ReplicaObserverPrx _observers; InternalRegistryPrx _self; // This replica internal registry proxy. }; }; #endif Ice-3.5.1/cpp/src/IceGrid/WellKnownObjectsManager.h0000644000076400007640000000237412223561476020155 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_WELL_KNOWN_OBJECTS_MANAGER_H #define ICE_GRID_WELL_KNOWN_OBJECTS_MANAGER_H #include namespace IceGrid { class Database; typedef IceUtil::Handle DatabasePtr; class WellKnownObjectsManager : public IceUtil::Mutex, public IceUtil::Shared { public: WellKnownObjectsManager(const DatabasePtr&); void add(const Ice::ObjectPrx&, const std::string&); void addEndpoint(const std::string&, const Ice::ObjectPrx&); void finish(); void registerAll(); void registerAll(const ReplicaSessionPrx&); void updateReplicatedWellKnownObjects(); Ice::ObjectPrx getEndpoints(const std::string&); private: bool initialized() const; const DatabasePtr _database; bool _initialized; StringObjectProxyDict _endpoints; ObjectInfoSeq _wellKnownObjects; }; typedef IceUtil::Handle WellKnownObjectsManagerPtr; }; #endif Ice-3.5.1/cpp/src/IceGrid/Activator.cpp0000644000076400007640000011111612223561476015712 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef _WIN32 # include # include # include // for getpwuid #else #ifndef SIGKILL # define SIGKILL 9 #endif #ifndef SIGTERM # define SIGTERM 15 #endif #endif #if defined(__linux) || defined(__sun) # include // for initgroups #endif using namespace std; using namespace Ice; using namespace IceInternal; using namespace IceGrid; #define ICE_STRING(X) #X namespace IceGrid { class TerminationListenerThread : public IceUtil::Thread { public: TerminationListenerThread(Activator& activator) : IceUtil::Thread("IceGrid termination listener thread"), _activator(activator) { } virtual void run() { _activator.runTerminationListener(); } private: Activator& _activator; }; #ifndef _WIN32 // // Helper function for async-signal safe error reporting // void reportChildError(int err, int fd, const char* cannot, const char* name, const TraceLevelsPtr& traceLevels) { // // Send any errors to the parent process, using the write // end of the pipe. // char msg[500]; strcpy(msg, cannot); strcat(msg, " `"); strcat(msg, name); strcat(msg, "'"); if(err) { strcat(msg, ": "); strcat(msg, strerror(err)); } ssize_t sz = write(fd, msg, strlen(msg)); if(sz == -1) { Ice::Warning out(traceLevels->logger); out << "error rerporting child error msg: `" << msg << "'"; } close(fd); // // _exit instead of exit to avoid interferences with the parent // process. // _exit(EXIT_FAILURE); } #endif string signalToString(int signal) { switch(signal) { #ifndef _WIN32 case SIGHUP: { return ICE_STRING(SIGHUP); } case SIGINT: { return ICE_STRING(SIGINT); } case SIGQUIT: { return ICE_STRING(SIGQUIT); } case SIGILL: { return ICE_STRING(SIGILL); } case SIGTRAP: { return ICE_STRING(SIGTRAP); } case SIGABRT: { return ICE_STRING(SIGABRT); } case SIGBUS: { return ICE_STRING(SIGBUS); } case SIGFPE: { return ICE_STRING(SIGFPE); } case SIGUSR1: { return ICE_STRING(SIGUSR1); } case SIGSEGV: { return ICE_STRING(SIGSEGV); } case SIGPIPE: { return ICE_STRING(SIGPIPE); } case SIGALRM: { return ICE_STRING(SIGALRM); } #endif case SIGKILL: { return ICE_STRING(SIGKILL); } case SIGTERM: { return ICE_STRING(SIGTERM); } default: { ostringstream os; os << "signal " << signal; return os.str(); } } } int stringToSignal(const string& str) { #ifndef _WIN32 if(str == ICE_STRING(SIGHUP)) { return SIGHUP; } else if(str == ICE_STRING(SIGINT)) { return SIGINT; } else if(str == ICE_STRING(SIGQUIT)) { return SIGQUIT; } else if(str == ICE_STRING(SIGILL)) { return SIGILL; } else if(str == ICE_STRING(SIGTRAP)) { return SIGTRAP; } else if(str == ICE_STRING(SIGABRT)) { return SIGABRT; } else if(str == ICE_STRING(SIGBUS)) { return SIGBUS; } else if(str == ICE_STRING(SIGFPE)) { return SIGFPE; } else if(str == ICE_STRING(SIGUSR1)) { return SIGUSR1; } else if(str == ICE_STRING(SIGSEGV)) { return SIGSEGV; } else if(str == ICE_STRING(SIGUSR2)) { return SIGUSR2; } else if(str == ICE_STRING(SIGPIPE)) { return SIGPIPE; } else if(str == ICE_STRING(SIGALRM)) { return SIGALRM; } else #endif if(str == ICE_STRING(SIGKILL)) { return SIGKILL; } else if(str == ICE_STRING(SIGTERM)) { return SIGTERM; } else { if(str != "") { char* end; long int signal = strtol(str.c_str(), &end, 10); if(*end == '\0' && signal > 0 && signal < 64) { #ifdef _WIN32 if(signal == SIGKILL || signal == SIGTERM) { return static_cast(signal); } #else return static_cast(signal); #endif } } throw BadSignalException("unknown signal `" + str + "'"); return SIGTERM; // Keep the compiler happy. } } #ifdef _WIN32 struct UnicodeStringLess { bool operator()(const wstring& lhs, const wstring& rhs) const { int r = CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, lhs.c_str(), -1, rhs.c_str(), -1); assert(r > 0); return r == CSTR_LESS_THAN; } }; #endif } Activator::Activator(const TraceLevelsPtr& traceLevels) : _traceLevels(traceLevels), _deactivating(false) { #ifdef _WIN32 _hIntr = CreateEvent( NULL, // Security attributes TRUE, // Manual reset FALSE, // Initial state is nonsignaled NULL // Unnamed ); if(_hIntr == NULL) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } #else int fds[2]; if(pipe(fds) != 0) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } _fdIntrRead = fds[0]; _fdIntrWrite = fds[1]; int flags = fcntl(_fdIntrRead, F_GETFL); flags |= O_NONBLOCK; fcntl(_fdIntrRead, F_SETFL, flags); #endif } Activator::~Activator() { assert(!_thread); #ifdef _WIN32 if(_hIntr != NULL) { CloseHandle(_hIntr); } #else close(_fdIntrRead); close(_fdIntrWrite); #endif } int Activator::activate(const string& name, const string& exePath, const string& pwdPath, #ifndef _WIN32 uid_t uid, gid_t gid, #endif const Ice::StringSeq& options, const Ice::StringSeq& envs, const ServerIPtr& server) { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); if(_deactivating) { throw string("The node is being shutdown."); } string path = exePath; if(path.empty()) { throw string("The server executable path is empty."); } string pwd = IcePatch2::simplify(pwdPath); #ifdef _WIN32 if(!IceUtilInternal::isAbsolutePath(path)) { if(path.find('/') == string::npos) { // // Get the absolute pathname of the executable. // wchar_t absbuf[_MAX_PATH]; wchar_t* fPart; wstring ext = path.size() <= 4 || path[path.size() - 4] != '.' ? L".exe" : L""; if(SearchPathW(NULL, IceUtil::stringToWstring(path).c_str(), ext.c_str(), _MAX_PATH, absbuf, &fPart) == 0) { if(_traceLevels->activator > 0) { Trace out(_traceLevels->logger, _traceLevels->activatorCat); out << "couldn't find `" << path << "' executable."; } throw string("Couldn't find `" + path + "' executable."); } path = IceUtil::wstringToString(absbuf); } else if(!pwd.empty()) { path = pwd + "/" + path; } } // // Get the absolute pathname of the working directory. // if(!pwd.empty()) { wchar_t absbuf[_MAX_PATH]; if(_wfullpath(absbuf, IceUtil::stringToWstring(pwd).c_str(), _MAX_PATH) == NULL) { if(_traceLevels->activator > 0) { Trace out(_traceLevels->logger, _traceLevels->activatorCat); out << "cannot convert `" << pwd << "' into an absolute path"; } throw string("The server working directory path `" + pwd + "' can't be converted into an absolute path."); } pwd = IceUtil::wstringToString(absbuf); } #endif // // Setup arguments. // StringSeq args; args.push_back(path); args.insert(args.end(), options.begin(), options.end()); if(_traceLevels->activator > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); out << "activating server `" << name << "'"; if(_traceLevels->activator > 1) { out << "\n"; out << "path = " << path << "\n"; if(pwd.empty()) { string cwd; if(IceUtilInternal::getcwd(cwd) == 0) { out << "pwd = " << cwd << "\n"; } } else { out << "pwd = " << pwd << "\n"; } #ifndef _WIN32 out << "uid/gid = " << uid << "/" << gid << "\n"; #endif if(!envs.empty()) { out << "envs = " << toString(envs, ", ") << "\n"; } if(!args.empty()) { out << "args = " << toString(args); } } } // // Activate and create. // #ifdef _WIN32 // // Compose command line. // string cmd; for(StringSeq::const_iterator p = args.begin(); p != args.end(); ++p) { if(p != args.begin()) { cmd.push_back(' '); } // // Enclose arguments containing spaces in double quotes. // if((*p).find(' ') != string::npos) { cmd.push_back('"'); cmd.append(*p); cmd.push_back('"'); } else { cmd.append(*p); } } wstring wpwd = IceUtil::stringToWstring(pwd); const wchar_t* dir = !wpwd.empty() ? wpwd.c_str() : NULL; // // Make a copy of the command line. // wchar_t* cmdbuf = _wcsdup(IceUtil::stringToWstring(cmd).c_str()); // // Create the environment block for the child process. We start with the environment // of this process, and then merge environment variables from the server description. // Since Windows is case insensitive wrt environment variables we convert the keys to // uppercase to ensure matches are found. // const wchar_t* env = NULL; wstring envbuf; if(!envs.empty()) { map envMap; LPVOID parentEnv = GetEnvironmentStringsW(); const wchar_t* var = reinterpret_cast(parentEnv); if(*var == L'=') { // // The environment block may start with some information about the // current drive and working directory. This is indicated by a leading // '=' character, so we skip to the first '\0' byte. // while(*var != L'\0') var++; var++; } while(*var != L'\0') { wstring s(var); wstring::size_type pos = s.find(L'='); if(pos != wstring::npos) { envMap[s.substr(0, pos)] = s.substr(pos + 1); } var += s.size(); var++; // Skip the '\0' byte } FreeEnvironmentStringsW(static_cast(parentEnv)); for(StringSeq::const_iterator p = envs.begin(); p != envs.end(); ++p) { wstring s = IceUtil::stringToWstring(*p); wstring::size_type pos = s.find(L'='); if(pos != wstring::npos) { envMap[s.substr(0, pos)] = s.substr(pos + 1); } } for(map::const_iterator q = envMap.begin(); q != envMap.end(); ++q) { envbuf.append(q->first); envbuf.push_back(L'='); envbuf.append(q->second); envbuf.push_back(L'\0'); } envbuf.push_back(L'\0'); env = envbuf.c_str(); } Process process; STARTUPINFOW si; ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); PROCESS_INFORMATION pi; ZeroMemory(&pi, sizeof(pi)); BOOL b = CreateProcessW( NULL, // Executable cmdbuf, // Command line NULL, // Process attributes NULL, // Thread attributes FALSE, // Do NOT inherit handles CREATE_NEW_PROCESS_GROUP | CREATE_UNICODE_ENVIRONMENT, // Process creation flags (LPVOID)env, // Process environment dir, // Current directory &si, // Startup info &pi // Process info ); free(cmdbuf); if(!b) { throw IceUtilInternal::lastErrorToString(); } // // Caller is responsible for closing handles in PROCESS_INFORMATION. We don't need to // keep the thread handle, so we close it now. The process handle will be closed later. // CloseHandle(pi.hThread); process.pid = pi.dwProcessId; process.hnd = pi.hProcess; process.server = server; _processes.insert(make_pair(name, process)); setInterrupt(); // // Don't print the following trace, this might interfere with the // output of the started process if it fails with an error message. // // if(_traceLevels->activator > 0) // { // Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); // out << "activated server `" << name << "' (pid = " << pi.dwProcessId << ")"; // } return static_cast(process.pid); #else int fds[2]; if(pipe(fds) != 0) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } int errorFds[2]; if(pipe(errorFds) != 0) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } // // Convert to standard argc/argv. // IceUtilInternal::ArgVector av(args); IceUtilInternal::ArgVector env(envs); // // Current directory // const char* pwdCStr = pwd.c_str(); pid_t pid = fork(); if(pid == -1) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } if(pid == 0) // Child process. { // // Until exec, we can only use async-signal safe functions // // // Unblock signals blocked by IceUtil::CtrlCHandler. // sigset_t sigs; sigemptyset(&sigs); sigaddset(&sigs, SIGHUP); sigaddset(&sigs, SIGINT); sigaddset(&sigs, SIGTERM); sigprocmask(SIG_UNBLOCK, &sigs, 0); // // Change the uid/gid under which the process will run. // if(setgid(gid) == -1) { ostringstream os; os << gid; reportChildError(getSystemErrno(), errorFds[1], "cannot set process group id", os.str().c_str(), _traceLevels); } errno = 0; struct passwd* pw = getpwuid(uid); if(!pw) { if(errno) { reportChildError(getSystemErrno(), errorFds[1], "cannot read the password database", "", _traceLevels); } else { ostringstream os; os << uid; reportChildError(getSystemErrno(), errorFds[1], "unknown user uid" , os.str().c_str(), _traceLevels); } } // // Don't initialize supplementary groups if we are not running as root. // if(getuid() == 0 && initgroups(pw->pw_name, gid) == -1) { ostringstream os; os << pw->pw_name; reportChildError(getSystemErrno(), errorFds[1], "cannot initialize process supplementary group access list for user", os.str().c_str(), _traceLevels); } if(setuid(uid) == -1) { ostringstream os; os << uid; reportChildError(getSystemErrno(), errorFds[1], "cannot set process user id", os.str().c_str(), _traceLevels); } // // Assign a new process group for this process. // setpgid(0, 0); // // Close all file descriptors, except for standard input, // standard output, standard error, and the write side // of the newly created pipe. // int maxFd = static_cast(sysconf(_SC_OPEN_MAX)); for(int fd = 3; fd < maxFd; ++fd) { if(fd != fds[1] && fd != errorFds[1]) { close(fd); } } for(int i = 0; i < env.argc; i++) { // // Each env is leaked on purpose ... see man putenv(). // if(putenv(strdup(env.argv[i])) != 0) { reportChildError(errno, errorFds[1], "cannot set environment variable", env.argv[i], _traceLevels); } } // // Change working directory. // if(strlen(pwdCStr) != 0) { if(chdir(pwdCStr) == -1) { reportChildError(errno, errorFds[1], "cannot change working directory to", pwdCStr, _traceLevels); } } // // Close on exec the error message file descriptor. // int flags = fcntl(errorFds[1], F_GETFD); flags |= 1; // FD_CLOEXEC if(fcntl(errorFds[1], F_SETFD, flags) == -1) { close(errorFds[1]); errorFds[1] = -1; } if(execvp(av.argv[0], av.argv) == -1) { if(errorFds[1] != -1) { reportChildError(errno, errorFds[1], "cannot execute", av.argv[0], _traceLevels); } else { reportChildError(errno, fds[1], "cannot execute", av.argv[0], _traceLevels); } } } else // Parent process. { close(fds[1]); close(errorFds[1]); // // Read a potential error message over the error message pipe. // char s[16]; ssize_t rs; string message; while((rs = read(errorFds[0], &s, 16)) > 0) { message.append(s, rs); } // // If an error occured before the exec() we do some cleanup and throw. // if(!message.empty()) { close(fds[0]); close(errorFds[0]); waitPid(pid); throw message; } // // Otherwise, the exec() was successfull and we don't need the error message // pipe anymore. // close(errorFds[0]); Process process; process.pid = pid; process.pipeFd = fds[0]; process.server = server; _processes.insert(make_pair(name, process)); int flags = fcntl(process.pipeFd, F_GETFL); flags |= O_NONBLOCK; fcntl(process.pipeFd, F_SETFL, flags); setInterrupt(); // // Don't print the following trace, this might interfere with the // output of the started process if it fails with an error message. // // if(_traceLevels->activator > 0) // { // Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); // out << "activated server `" << name << "' (pid = " << pid << ")"; // } } return pid; #endif } namespace { class ShutdownCallback : public IceUtil::Shared { public: ShutdownCallback(const ActivatorPtr& activator, const string& name, const TraceLevelsPtr& traceLevels) : _activator(activator), _name(name), _traceLevels(traceLevels) { } virtual void exception(const Ice::Exception& ex) { Ice::Warning out(_traceLevels->logger); out << "exception occurred while deactivating `" << _name << "' using process proxy:\n" << ex; // // Send a SIGTERM to the process. // _activator->sendSignal(_name, SIGTERM); } private: const ActivatorPtr _activator; const string _name; const TraceLevelsPtr _traceLevels; }; } void Activator::deactivate(const string& name, const Ice::ProcessPrx& process) { #ifdef _WIN32 Ice::Int pid = getServerPid(name); if(pid == 0) { // // Server is already deactivated. // return; } #endif // // Try to shut down the server gracefully using the process proxy. // if(process) { if(_traceLevels->activator > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); out << "deactivating `" << name << "' using process proxy"; } process->begin_shutdown(Ice::newCallback_Process_shutdown(new ShutdownCallback(this, name, _traceLevels), &ShutdownCallback::exception)); return; } if(_traceLevels->activator > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); out << "no process proxy, deactivating `" << name << "' using signal"; } // // Send a SIGTERM to the process. // sendSignal(name, SIGTERM); } void Activator::kill(const string& name) { sendSignal(name, SIGKILL); } void Activator::sendSignal(const string& name, const string& signal) { sendSignal(name, stringToSignal(signal)); } void Activator::sendSignal(const string& name, int signal) { Ice::Int pid = getServerPid(name); if(pid == 0) { // // Server is already deactivated. // return; } #ifdef _WIN32 if(signal == SIGTERM) { // // Generate a Ctrl+Break event on the child. // if(GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, pid)) { if(_traceLevels->activator > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); out << "sent Ctrl+Break to server `" << name << "' (pid = " << pid << ")"; } } else if(GetLastError() != ERROR_INVALID_PARAMETER) // Process with pid doesn't exist anymore. { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } } else if(signal == SIGKILL) { HANDLE hnd = OpenProcess(PROCESS_TERMINATE, FALSE, pid); if(hnd == NULL) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } TerminateProcess(hnd, 0); // We use 0 for the exit code to make sure it's not considered as a crash. CloseHandle(hnd); if(_traceLevels->activator > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); out << "terminated server `" << name << "' (pid = " << pid << ")"; } } else { throw BadSignalException("signal not supported on Windows"); } #else int ret = ::kill(static_cast(pid), signal); if(ret != 0 && getSystemErrno() != ESRCH) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } if(_traceLevels->activator > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); out << "sent " << signalToString(signal) << " to server `" << name << "' (pid = " << pid << ")"; } #endif } Ice::Int Activator::getServerPid(const string& name) { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); map::const_iterator p = _processes.find(name); if(p == _processes.end()) { return 0; } return static_cast(p->second.pid); } void Activator::start() { // // Create and start the termination listener thread. // _thread = new TerminationListenerThread(*this); _thread->start(); } void Activator::waitForShutdown() { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); while(!_deactivating) { wait(); } } void Activator::shutdown() { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); // // Deactivation has been initiated. Set _deactivating to true to // prevent activation of new processes. This will also cause the // termination listener thread to stop when there are no more // active processes. // _deactivating = true; setInterrupt(); notifyAll(); } void Activator::destroy() { map processes; { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); assert(_deactivating); processes = _processes; } // // Stop all active processes. // for(map::iterator p = processes.begin(); p != processes.end(); ++p) { // // Stop the server. The listener thread should detect the // process deactivation and remove it from the activator's // list of active processes. // try { p->second.server->stop_async(0); } catch(const ServerStopException&) { // Server already stopped or destroyed. } catch(const ObjectNotExistException&) { // // Expected if the server was in the process of being destroyed. // } catch(const Ice::LocalException& ex) { Ice::Warning out(_traceLevels->logger); out << "unexpected exception raised by server `" << p->first << "' stop:\n" << ex; } } // // Join the termination listener thread. This thread terminates // when there's no more processes and when _deactivating is set to // true. // if(_thread) { _thread->getThreadControl().join(); _thread = 0; } assert(_processes.empty()); } bool Activator::isActive() { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); return !_deactivating; } void Activator::runTerminationListener() { while(true) { try { terminationListener(); break; } catch(const Exception& ex) { Error out(_traceLevels->logger); out << "exception in process termination listener:\n" << ex; } catch(...) { Error out(_traceLevels->logger); out << "unknown exception in process termination listener"; } } } void Activator::terminationListener() { #ifdef _WIN32 while(true) { vector handles; // // Lock while we collect the process handles. // { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); for(map::iterator p = _processes.begin(); p != _processes.end(); ++p) { handles.push_back(p->second.hnd); } } handles.push_back(_hIntr); // // Wait for a child to terminate, or the interrupt event to be signaled. // DWORD ret = WaitForMultipleObjects(static_cast(handles.size()), &handles[0], FALSE, INFINITE); if(ret == WAIT_FAILED) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } vector::size_type pos = ret - WAIT_OBJECT_0; assert(pos < handles.size()); HANDLE hnd = handles[pos]; vector terminated; bool deactivated = false; { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); if(hnd == _hIntr) { clearInterrupt(); } else { for(map::iterator p = _processes.begin(); p != _processes.end(); ++p) { if(p->second.hnd == hnd) { terminated.push_back(p->second); _processes.erase(p); break; } } } deactivated = _deactivating && _processes.empty(); } for(vector::const_iterator p = terminated.begin(); p != terminated.end(); ++p) { DWORD status; GetExitCodeProcess(p->hnd, &status); CloseHandle(p->hnd); assert(status != STILL_ACTIVE); if(_traceLevels->activator > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); out << "detected termination of server `" << p->server->getId() << "'"; if(status != 0) { out << "\nexit code = " << status; } } try { p->server->terminated("", status); } catch(const Ice::LocalException& ex) { Ice::Warning out(_traceLevels->logger); out << "unexpected exception raised by server `" << p->server->getId() << "' termination:\n" << ex; } } if(deactivated) { return; } } #else while(true) { fd_set fdSet; int maxFd = _fdIntrRead; FD_ZERO(&fdSet); FD_SET(_fdIntrRead, &fdSet); { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); for(map::iterator p = _processes.begin(); p != _processes.end(); ++p) { int fd = p->second.pipeFd; FD_SET(fd, &fdSet); if(maxFd < fd) { maxFd = fd; } } } repeatSelect: int ret = ::select(maxFd + 1, &fdSet, 0, 0, 0); assert(ret != 0); if(ret == -1) { #ifdef EPROTO if(errno == EINTR || errno == EPROTO) { goto repeatSelect; } #else if(errno == EINTR) { goto repeatSelect; } #endif SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } vector terminated; bool deactivated = false; { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); if(FD_ISSET(_fdIntrRead, &fdSet)) { clearInterrupt(); if(_deactivating && _processes.empty()) { return; } } map::iterator p = _processes.begin(); while(p != _processes.end()) { int fd = p->second.pipeFd; if(!FD_ISSET(fd, &fdSet)) { ++p; continue; } char s[16]; ssize_t rs; string message; // // Read the message over the pipe. // while((rs = read(fd, &s, 16)) > 0) { message.append(s, rs); } // // Keep the received message. // if(!message.empty()) { p->second.msg += message; } if(rs == -1) { if(errno != EAGAIN || message.empty()) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } ++p; } else if(rs == 0) { // // If the pipe was closed, the process has terminated. // terminated.push_back(p->second); close(p->second.pipeFd); _processes.erase(p++); } } // // We are deactivating and there's no more active processes. // deactivated = _deactivating && _processes.empty(); } for(vector::const_iterator p = terminated.begin(); p != terminated.end(); ++p) { int status = waitPid(p->pid); if(_traceLevels->activator > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); out << "detected termination of server `" << p->server->getId() << "'"; if(!p->msg.empty()) { out << "\nreason = " << p->msg; } if(WIFEXITED(status) && status != 0) { out << "\nexit code = " << WEXITSTATUS(status); } else if(WIFSIGNALED(status)) { out << "\nsignal = " << signalToString(WTERMSIG(status)); } } try { p->server->terminated(p->msg, status); } catch(const Ice::LocalException& ex) { Ice::Warning out(_traceLevels->logger); out << "unexpected exception raised by server `" << p->server->getId() << "' termination:\n" << ex; } } if(deactivated) { return; } } #endif } void Activator::clearInterrupt() { #ifdef _WIN32 ResetEvent(_hIntr); #else char c; while(read(_fdIntrRead, &c, 1) == 1) ; #endif } void Activator::setInterrupt() { #ifdef _WIN32 SetEvent(_hIntr); #else char c = 0; ssize_t sz = write(_fdIntrWrite, &c, 1); if(sz == -1) { SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } #endif } #ifndef _WIN32 int Activator::waitPid(pid_t processPid) { try { int status; #if defined(__linux) int nRetry = 0; while(true) // The while loop is necessary for the linux workaround. { pid_t pid = waitpid(processPid, &status, 0); if(pid < 0) { // // Some Linux distribution have a bogus waitpid() (e.g.: CentOS 4.x). It doesn't // block and reports an incorrect ECHILD error on the first call. We sleep a // little and retry to work around this issue (it appears from testing that a // single retry is enough but to make sure we retry up to 10 times before to throw.) // if(errno == ECHILD && nRetry < 10) { // Wait 1ms, 11ms, 21ms, etc. IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(nRetry * 10 + 1)); ++nRetry; continue; } SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } assert(pid == processPid); break; } #else pid_t pid = waitpid(processPid, &status, 0); if(pid < 0) { SyscallException ex(__FILE__, __LINE__); ex.error = getSystemErrno(); throw ex; } assert(pid == processPid); #endif return status; } catch(const Ice::LocalException& ex) { Error out(_traceLevels->logger); out << "unable to get process status:\n" << ex; return -1; } } #endif Ice-3.5.1/cpp/src/IceGrid/FileUserAccountMapperI.h0000644000076400007640000000137412223561476017740 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_FILEUSERACCOUNTMAPPERI_H #define ICE_GRID_FILEUSERACCOUNTMAPPERI_H #include namespace IceGrid { class FileUserAccountMapperI : public UserAccountMapper { public: FileUserAccountMapperI(const std::string&); virtual std::string getUserAccount(const std::string&, const Ice::Current&); private: std::map _accounts; }; }; #endif Ice-3.5.1/cpp/src/IceGrid/ReplicaSessionI.h0000644000076400007640000000506612223561476016465 0ustar mesmes// ********************************************************************** // // 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 ICEGRID_REPLICA_SESSION_H #define ICEGRID_REPLICA_SESSION_H #include #include namespace IceGrid { class Database; typedef IceUtil::Handle DatabasePtr; class WellKnownObjectsManager; typedef IceUtil::Handle WellKnownObjectsManagerPtr; class TraceLevels; typedef IceUtil::Handle TraceLevelsPtr; class ReplicaSessionI : public ReplicaSession, public IceUtil::Mutex { public: ReplicaSessionI(const DatabasePtr&, const WellKnownObjectsManagerPtr&, const InternalReplicaInfoPtr&, const InternalRegistryPrx&, int); virtual void keepAlive(const Ice::Current&); virtual int getTimeout(const Ice::Current&) const; virtual void setDatabaseObserver(const DatabaseObserverPrx&, const IceUtil::Optional&, const Ice::Current&); virtual void setEndpoints(const StringObjectProxyDict&, const Ice::Current&); virtual void registerWellKnownObjects(const ObjectInfoSeq&, const Ice::Current&); virtual void setAdapterDirectProxy(const std::string&, const std::string&, const Ice::ObjectPrx&, const Ice::Current&); virtual void receivedUpdate(TopicName, int, const std::string&, const Ice::Current&); virtual void destroy(const Ice::Current& = Ice::Current()); virtual IceUtil::Time timestamp() const; virtual void shutdown(); const InternalRegistryPrx& getInternalRegistry() const; const InternalReplicaInfoPtr& getInfo() const; ReplicaSessionPrx getProxy() const; Ice::ObjectPrx getEndpoint(const std::string&); bool isDestroyed() const; private: void destroyImpl(bool); const DatabasePtr _database; const WellKnownObjectsManagerPtr _wellKnownObjects; const TraceLevelsPtr _traceLevels; const InternalRegistryPrx _internalRegistry; const InternalReplicaInfoPtr _info; const int _timeout; ReplicaSessionPrx _proxy; DatabaseObserverPrx _observer; ObjectInfoSeq _replicaWellKnownObjects; StringObjectProxyDict _replicaEndpoints; IceUtil::Time _timestamp; bool _destroy; }; typedef IceUtil::Handle ReplicaSessionIPtr; }; #endif Ice-3.5.1/cpp/src/IceGrid/FileUserAccountMapperI.cpp0000644000076400007640000000413712223561476020273 0ustar mesmes// ********************************************************************** // // 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 #include #include using namespace std; using namespace IceGrid; FileUserAccountMapperI::FileUserAccountMapperI(const string& filename) { IceUtilInternal::ifstream file(filename); // filename is a UTF-8 string if(!file) { throw "cannot open `" + filename + "' for reading: " + strerror(errno); } const string delim = " \t\r\n"; while(true) { string line; getline(file, line); if(!file) { break; } string::size_type idx = line.find('#'); if(idx != string::npos) { line.erase(idx); } idx = line.find_last_not_of(delim); if(idx != string::npos && idx + 1 < line.length()) { line.erase(idx + 1); } string::size_type beg = line.find_first_not_of(delim); if(beg == string::npos) { continue; } string::size_type end = line.find_first_of(delim, beg); if(end == string::npos || end <= beg) { continue; } string account = line.substr(beg, end - beg); beg = line.find_first_not_of(delim, end); if(beg == string::npos) { continue; } string user = line.substr(beg); assert(!user.empty()); assert(!account.empty()); _accounts[user] = account; } } string FileUserAccountMapperI::getUserAccount(const string& user, const Ice::Current&) { map::const_iterator p = _accounts.find(user); if(p == _accounts.end()) { throw UserAccountNotFoundException(); } return p->second; } Ice-3.5.1/cpp/src/IceGrid/AdminI.h0000644000076400007640000001236612223561476014573 0ustar mesmes// ********************************************************************** // // 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 ICE_GRID_ADMIN_I_H #define ICE_GRID_ADMIN_I_H #include namespace IceGrid { class Database; typedef IceUtil::Handle DatabasePtr; class TraceLevels; typedef IceUtil::Handle TraceLevelsPtr; class RegistryI; typedef IceUtil::Handle RegistryIPtr; class AdminSessionI; typedef IceUtil::Handle AdminSessionIPtr; class AdminI : public Admin, public IceUtil::Mutex { public: AdminI(const DatabasePtr&, const RegistryIPtr&, const AdminSessionIPtr&); virtual ~AdminI(); virtual void addApplication(const ApplicationDescriptor&, const Ice::Current&); virtual void syncApplication(const ApplicationDescriptor&, const Ice::Current&); virtual void updateApplication(const ApplicationUpdateDescriptor&, const Ice::Current&); virtual void syncApplicationWithoutRestart(const ApplicationDescriptor&, const Ice::Current&); virtual void updateApplicationWithoutRestart(const ApplicationUpdateDescriptor&, const Ice::Current&); virtual void removeApplication(const std::string&, const Ice::Current&); virtual void instantiateServer(const std::string&, const std::string&, const ServerInstanceDescriptor&, const Ice::Current&); virtual void patchApplication_async(const AMD_Admin_patchApplicationPtr&, const std::string&, bool, const Ice::Current&); virtual ApplicationInfo getApplicationInfo(const ::std::string&, const Ice::Current&) const; virtual ApplicationDescriptor getDefaultApplicationDescriptor(const Ice::Current&) const; virtual Ice::StringSeq getAllApplicationNames(const Ice::Current&) const; virtual ServerInfo getServerInfo(const ::std::string&, const Ice::Current&) const; virtual ServerState getServerState(const ::std::string&, const Ice::Current&) const; virtual Ice::Int getServerPid(const ::std::string&, const Ice::Current&) const; virtual std::string getServerAdminCategory(const Ice::Current&) const; virtual Ice::ObjectPrx getServerAdmin(const std::string&, const Ice::Current&) const; virtual void startServer_async(const AMD_Admin_startServerPtr&, const ::std::string&, const Ice::Current&); virtual void stopServer_async(const AMD_Admin_stopServerPtr&, const ::std::string&, const Ice::Current&); virtual void patchServer_async(const AMD_Admin_patchServerPtr&, const ::std::string&, bool, const Ice::Current&); virtual void sendSignal(const ::std::string&, const ::std::string&, const Ice::Current&); virtual void writeMessage(const ::std::string&, const ::std::string&, Ice::Int, const Ice::Current&); virtual Ice::StringSeq getAllServerIds(const Ice::Current&) const; virtual void enableServer(const ::std::string&, bool, const Ice::Current&); virtual bool isServerEnabled(const ::std::string&, const Ice::Current&) const; virtual AdapterInfoSeq getAdapterInfo(const ::std::string&, const ::Ice::Current&) const; virtual void removeAdapter(const std::string&, const Ice::Current&); virtual Ice::StringSeq getAllAdapterIds(const ::Ice::Current&) const; virtual void addObject(const ::Ice::ObjectPrx&, const ::Ice::Current&); virtual void updateObject(const ::Ice::ObjectPrx&, const ::Ice::Current&); virtual void addObjectWithType(const ::Ice::ObjectPrx&, const ::std::string&, const ::Ice::Current&); virtual void removeObject(const ::Ice::Identity&, const ::Ice::Current&); virtual ObjectInfo getObjectInfo(const Ice::Identity&, const ::Ice::Current&) const; virtual ObjectInfoSeq getObjectInfosByType(const std::string&, const ::Ice::Current&) const; virtual ObjectInfoSeq getAllObjectInfos(const std::string&, const ::Ice::Current&) const; virtual NodeInfo getNodeInfo(const std::string&, const Ice::Current&) const; virtual bool pingNode(const std::string&, const Ice::Current&) const; virtual LoadInfo getNodeLoad(const std::string&, const Ice::Current&) const; virtual int getNodeProcessorSocketCount(const std::string&, const Ice::Current&) const; virtual void shutdownNode(const std::string&, const Ice::Current&); virtual std::string getNodeHostname(const std::string&, const Ice::Current&) const; virtual Ice::StringSeq getAllNodeNames(const ::Ice::Current&) const; virtual RegistryInfo getRegistryInfo(const std::string&, const Ice::Current&) const; virtual bool pingRegistry(const std::string&, const Ice::Current&) const; virtual void shutdownRegistry(const std::string&, const Ice::Current&); virtual Ice::StringSeq getAllRegistryNames(const ::Ice::Current&) const; virtual void shutdown(const Ice::Current&); virtual Ice::SliceChecksumDict getSliceChecksums(const Ice::Current&) const; private: void checkIsReadOnly() const; const DatabasePtr _database; const RegistryIPtr _registry; const TraceLevelsPtr _traceLevels; const AdminSessionIPtr _session; }; typedef IceUtil::Handle AdminIPtr; } #endif Ice-3.5.1/cpp/src/IceGrid/FileCache.cpp0000644000076400007640000001350512223561476015564 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include using namespace std; using namespace IceGrid; FileCache::FileCache(const Ice::CommunicatorPtr& com) : _messageSizeMax(com->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024) * 1024 - 256) { } Ice::Long FileCache::getOffsetFromEnd(const string& file, int originalCount) { IceUtilInternal::ifstream is(file); // file is a UTF-8 string if(is.fail()) { throw FileNotAvailableException("failed to open file `" + file + "'"); } if(originalCount < 0) { return 0; } is.seekg(0, ios::end); streampos endOfFile = is.tellg(); if(originalCount == 0) { return endOfFile; } streamoff blockSize = 16 * 1024; // Start reading a block of 16K from the end of the file. streampos lastBlockOffset = endOfFile; int totalCount = 0; string line; deque > lines; do { lines.clear(); // // Move the current position of the stream to the new block to // read. // is.clear(); if(lastBlockOffset - blockSize > streamoff(0)) { is.seekg(lastBlockOffset - blockSize); getline(is, line); // Ignore the first line as it's most likely not complete. } else { is.seekg(0, ios::beg); // We've reach the begining of the file. } // // Read the block and count the number of lines in the block // If we found the "first last N lines", we start throwing out // the lines read at the begining of the file. // int count = originalCount - totalCount; // Number of lines left to find. while(is.good() && is.tellg() <= streamoff(lastBlockOffset)) { streampos beg = is.tellg(); getline(is, line); if(is.eof() && line.empty()) // Don't count the last line if it's empty. { continue; } lines.push_back(make_pair(beg, line)); ++totalCount; if(lines.size() == static_cast(count + 1)) { --totalCount; lines.pop_front(); } } if(lastBlockOffset - blockSize < streamoff(0)) { break; // We're done if the block started at the begining of the file. } else if(totalCount < originalCount) { // // Otherwise, it we still didn't find the required number of lines, // read another block of text before this block. // lastBlockOffset -= blockSize; // Position of the block we just read. blockSize *= 2; // Read a bigger block. } } while(totalCount < originalCount && !is.bad()); if(is.bad()) { throw FileNotAvailableException("unrecoverable error occured while reading file `" + file + "'"); } if(lines.empty()) { return 0; } else { return lines[0].first; } } bool FileCache::read(const string& file, Ice::Long offset, int size, Ice::Long& newOffset, Ice::StringSeq& lines) { assert(size > 0); if(size > _messageSizeMax) { size = _messageSizeMax; } if(size <= 5) { throw FileNotAvailableException("maximum bytes per read request is too low"); } IceUtilInternal::ifstream is(file); // file is a UTF-8 string if(is.fail()) { throw FileNotAvailableException("failed to open file `" + file + "'"); } // // Check if the requested offset is past the end of the file, if // that's the case return an empty sequence of lines and indicate // the EOF. // is.seekg(0, ios::end); if(offset >= is.tellg()) { newOffset = is.tellg(); lines = Ice::StringSeq(); return true; } // // Read lines from the file until we read enough or reached EOF. // newOffset = offset; lines = Ice::StringSeq(); is.seekg(static_cast(offset), ios::beg); int totalSize = 0; string line; for(int i = 0; is.good(); ++i) { getline(is, line); int lineSize = static_cast(line.size()) + 5; // 5 bytes for the encoding of the string size (worst case) if(lineSize + totalSize > size) { if(totalSize + 5 < size) { // There's some room left for a part of the string, return a partial string line = line.substr(0, size - totalSize - 5); lines.push_back(line); newOffset += line.size(); } else { lines.push_back(""); } return false; // We didn't reach the end of file, we've just reached the size limit! } totalSize += lineSize; lines.push_back(line); // // If there was a partial read update the offset using the current line size, // otherwise we have read a new complete line and we can use tellg to update // the offset. // if(!is.good()) { newOffset += line.size(); } else { newOffset = is.tellg(); } } if(is.bad()) { throw FileNotAvailableException("unrecoverable error occured while reading file `" + file + "'"); } return is.eof(); } Ice-3.5.1/cpp/src/IceGrid/ServerI.cpp0000644000076400007640000024770312223561476015351 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef _WIN32 # include # include #else # include # include // for getpwnam # include # include # include #endif using namespace std; using namespace IceGrid; namespace IceGrid { #ifndef _WIN32 void chownRecursive(const string& path, uid_t uid, gid_t gid) { struct dirent **namelist = 0; DIR* d; if((d = opendir(path.c_str())) == 0) { throw "cannot read directory `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } struct dirent* entry; int n = 0; while((entry = readdir(d)) != 0) { namelist = (struct dirent**)realloc((void*)namelist, (size_t)((n + 1) * sizeof(struct dirent*))); if(namelist == 0) { closedir(d); throw "cannot read directory `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } size_t entrysize = sizeof(struct dirent) - sizeof(entry->d_name) + strlen(entry->d_name) + 1; namelist[n] = (struct dirent*)malloc(entrysize); if(namelist[n] == 0) { closedir(d); throw "cannot read directory `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } memcpy(namelist[n], entry, entrysize); ++n; } if(closedir(d)) { throw "cannot read directory `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } for(int i = 0; i < n; ++i) { string name = namelist[i]->d_name; assert(!name.empty()); free(namelist[i]); if(name == ".") { if(chown(path.c_str(), uid, gid) != 0) { throw "can't change permissions on `" + name + "':\n" + IceUtilInternal::lastErrorToString(); } } else if(name != "..") { name = path + "/" + name; IceUtilInternal::structstat buf; if(IceUtilInternal::stat(name, &buf) == -1) { throw "cannot stat `" + name + "':\n" + IceUtilInternal::lastErrorToString(); } if(S_ISDIR(buf.st_mode)) { chownRecursive(name, uid, gid); } else { if(chown(name.c_str(), uid, gid) != 0) { throw "can't change permissions on `" + name + "':\n" + IceUtilInternal::lastErrorToString(); } } } } free(namelist); } #endif static bool descriptorUpdated(const InternalServerDescriptorPtr& lhs, const InternalServerDescriptorPtr& rhs, bool noProps = false) { if(lhs->uuid == rhs->uuid && lhs->revision == rhs->revision) { return false; } if(lhs->id != rhs->id || lhs->application != rhs->application || lhs->uuid != rhs->uuid || lhs->sessionId != rhs->sessionId || lhs->exe != rhs->exe || lhs->pwd != rhs->pwd || lhs->user != rhs->user || lhs->activation != rhs->activation || lhs->activationTimeout != rhs->activationTimeout || lhs->deactivationTimeout != rhs->deactivationTimeout || lhs->applicationDistrib != rhs->applicationDistrib || lhs->processRegistered != rhs->processRegistered || lhs->options != rhs->options || lhs->envs != rhs->envs || lhs->logs != rhs->logs) { return true; } if((!lhs->distrib && rhs->distrib) || (lhs->distrib && !rhs->distrib)) { return true; } else if(lhs->distrib && rhs->distrib) { if(lhs->distrib->icepatch != rhs->distrib->icepatch || lhs->distrib->directories != rhs->distrib->directories) { return true; } } if(lhs->adapters.size() != rhs->adapters.size()) { return true; } else { InternalAdapterDescriptorSeq::const_iterator q = rhs->adapters.begin(); for(InternalAdapterDescriptorSeq::const_iterator p = lhs->adapters.begin(); p != lhs->adapters.end(); ++p, ++q) { if((*p)->id != (*q)->id || (*p)->serverLifetime != (*q)->serverLifetime) { return true; } } } if(lhs->dbEnvs.size() != rhs->dbEnvs.size()) { return true; } else { InternalDbEnvDescriptorSeq::const_iterator q = rhs->dbEnvs.begin(); for(InternalDbEnvDescriptorSeq::const_iterator p = lhs->dbEnvs.begin(); p != lhs->dbEnvs.end(); ++p, ++q) { if((*p)->name != (*q)->name || (*p)->properties != (*q)->properties) { return true; } } } if(!noProps && lhs->properties != rhs->properties) { return true; } return false; } Ice::PropertyDict toPropertyDict(const PropertyDescriptorSeq& seq) { Ice::PropertyDict props; for(PropertyDescriptorSeq::const_iterator q = seq.begin(); q != seq.end(); ++q) { if(q->value.empty() && q->name.find('#') == 0) { continue; // Ignore comments. } if(q->value.empty()) { props.erase(q->name); } else { props[q->name] = q->value; } } return props; } class CommandTimeoutTimerTask : public IceUtil::TimerTask { public: CommandTimeoutTimerTask(const TimedServerCommandPtr& command) : _command(command) { } virtual void runTimerTask() { _command->timeout(); } private: const TimedServerCommandPtr _command; }; class DelayedStart : public IceUtil::TimerTask { public: DelayedStart(const ServerIPtr& server, const TraceLevelsPtr& traceLevels) : _server(server), _traceLevels(traceLevels) { } virtual void runTimerTask() { try { _server->start(ServerI::Always); } catch(const ServerStartException& ex) { Ice::Error out(_traceLevels->logger); out << "couldn't reactivate server `" << _server->getId() << "' with `always' activation mode after failure:\n" << ex.reason; } catch(const Ice::ObjectNotExistException&) { } } private: const ServerIPtr _server; const TraceLevelsPtr _traceLevels; }; class ResetPropertiesCB : public IceUtil::Shared { public: ResetPropertiesCB(const ServerIPtr& server, const Ice::ObjectPrx admin, const InternalServerDescriptorPtr& desc, const InternalServerDescriptorPtr& old, const TraceLevelsPtr& traceLevels) : _server(server), _admin(admin), _desc(desc), _traceLevels(traceLevels), _properties(server->getProperties(desc)), _oldProperties(server->getProperties(old)), _p(_properties.begin()) { } void execute() { assert(_p != _properties.end()); next(); } private: void next() { while(_p != _properties.end() && _p->second == _oldProperties[_p->first]) { ++_p; } if(_p == _properties.end()) { _server->updateRuntimePropertiesCallback(_desc); return; } Ice::PropertyDict oldProps = toPropertyDict(_oldProperties[_p->first]); Ice::PropertyDict props = toPropertyDict(_p->second); for(Ice::PropertyDict::const_iterator q = oldProps.begin(); q != oldProps.end(); ++q) { if(props.find(q->first) == props.end()) { props[q->first] = ""; } } string facet; if(_p->first == "config") { facet = "Properties"; if(_traceLevels->server > 1) { const string id = _server->getId(); Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat); out << "updating runtime properties for server `" << id << "'"; } } else { assert(_p->first.find("config_") == 0); const string service = _p->first.substr(7); facet = "IceBox.Service." + service + ".Properties"; if(_traceLevels->server > 1) { const string id = _server->getId(); Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat); out << "updating runtime properties for service `" << service << "' from server `" + id + "'"; } } // // Increment the iterator *before* invoking setProperties_async to avoid a // race condition. // ++_p; Ice::PropertiesAdminPrx p = Ice::PropertiesAdminPrx::uncheckedCast(_admin, facet); p->begin_setProperties(props, Ice::newCallback_PropertiesAdmin_setProperties(this, &ResetPropertiesCB::next, &ResetPropertiesCB::exception)); } void exception(const Ice::Exception& ex) { _server->updateRuntimePropertiesCallback(ex, _desc); } const ServerIPtr _server; const Ice::ObjectPrx _admin; const InternalServerDescriptorPtr _desc; const TraceLevelsPtr _traceLevels; const PropertyDescriptorSeqDict _properties; PropertyDescriptorSeqDict _oldProperties; PropertyDescriptorSeqDict::const_iterator _p; }; typedef IceUtil::Handle ResetPropertiesCBPtr; struct EnvironmentEval : std::unary_function { string operator()(const std::string& value) { string::size_type assignment = value.find("="); if(assignment == string::npos || assignment >= value.size() - 1) { return value; } string v = value.substr(assignment + 1); assert(v.size()); string::size_type beg = 0; string::size_type end; #ifdef _WIN32 vector buf; buf.resize(32767); while((beg = v.find("%", beg)) != string::npos && beg < v.size() - 1) { end = v.find("%", beg + 1); if(end == string::npos) { break; } string variable = v.substr(beg + 1, end - beg - 1); DWORD ret = GetEnvironmentVariableW(IceUtil::stringToWstring(variable).c_str(), &buf[0], static_cast(buf.size())); string valstr = (ret > 0 && ret < buf.size()) ? IceUtil::wstringToString(&buf[0]) : string(""); v.replace(beg, end - beg + 1, valstr); beg += valstr.size(); } #else while((beg = v.find("$", beg)) != string::npos && beg < v.size() - 1) { string variable; if(v[beg + 1] == '{') { end = v.find("}"); if(end == string::npos) { break; } variable = v.substr(beg + 2, end - beg - 2); } else { end = beg + 1; while((isalnum(static_cast(v[end])) || v[end] == '_') && end < v.size()) { ++end; } variable = v.substr(beg + 1, end - beg - 1); --end; } char* val = getenv(variable.c_str()); string valstr = val ? string(val) : ""; v.replace(beg, end - beg + 1, valstr); beg += valstr.size(); } #endif return value.substr(0, assignment) + "=" + v; } }; } ServerCommand::ServerCommand(const ServerIPtr& server) : _server(server) { } ServerCommand::~ServerCommand() { } TimedServerCommand::TimedServerCommand(const ServerIPtr& server, const IceUtil::TimerPtr& timer, int timeout) : ServerCommand(server), _timer(timer), _timeout(timeout) { } void TimedServerCommand::startTimer() { _timerTask = new CommandTimeoutTimerTask(this); try { _timer->schedule(_timerTask, IceUtil::Time::seconds(_timeout)); } catch(const IceUtil::Exception&) { // Ignore, timer is destroyed because node is shutting down. } } void TimedServerCommand::stopTimer() { if(_timerTask) { _timer->cancel(_timerTask); _timerTask = 0; } } LoadCommand::LoadCommand(const ServerIPtr& server, const InternalServerDescriptorPtr& runtime, const TraceLevelsPtr& traceLevels) : ServerCommand(server), _runtime(runtime), _updating(false), _traceLevels(traceLevels) { } bool LoadCommand::canExecute(ServerI::InternalServerState state) { return state == ServerI::Inactive; } ServerI::InternalServerState LoadCommand::nextState() { return ServerI::Loading; } void LoadCommand::execute() { _server->update(); } void LoadCommand::setUpdate(const InternalServerDescriptorPtr& descriptor, bool clearDir) { _clearDir = clearDir; _desc = descriptor; } InternalServerDescriptorPtr LoadCommand::getInternalServerDescriptor() const { return _desc; } bool LoadCommand::clearDir() const { return _clearDir; } void LoadCommand::addCallback(const AMD_Node_loadServerPtr& amdCB) { _loadCB.push_back(amdCB); } void LoadCommand::startRuntimePropertiesUpdate(const Ice::ObjectPrx& process) { if(_updating) { return; } assert(_desc != _runtime); _updating = true; ResetPropertiesCBPtr cb = new ResetPropertiesCB(_server, process, _desc, _runtime, _traceLevels); cb->execute(); } bool LoadCommand::finishRuntimePropertiesUpdate(const InternalServerDescriptorPtr& runtime, const Ice::ObjectPrx& process) { _updating = false; _runtime = runtime; // The new runtime server descriptor. if(_traceLevels->server > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat); out << "updated runtime properties for server `" << _server->getId() << "'"; } if(_desc != _runtime) { startRuntimePropertiesUpdate(process); return false; } else { return true; } } void LoadCommand::failed(const Ice::Exception& ex) { for(vector::const_iterator p = _loadCB.begin(); p != _loadCB.end(); ++p) { (*p)->ice_exception(ex); } _loadCB.clear(); } void LoadCommand::finished(const ServerPrx& proxy, const AdapterPrxDict& adapters, int at, int dt) { for(vector::const_iterator p = _loadCB.begin(); p != _loadCB.end(); ++p) { (*p)->ice_response(proxy, adapters, at, dt); } _loadCB.clear(); } DestroyCommand::DestroyCommand(const ServerIPtr& server, bool loadFailure, bool clearDir) : ServerCommand(server), _loadFailure(loadFailure), _clearDir(clearDir) { } bool DestroyCommand::canExecute(ServerI::InternalServerState state) { return state == ServerI::Inactive; } ServerI::InternalServerState DestroyCommand::nextState() { return ServerI::Destroying; } void DestroyCommand::execute() { _server->destroy(); } void DestroyCommand::addCallback(const AMD_Node_destroyServerPtr& amdCB) { _destroyCB.push_back(amdCB); } void DestroyCommand::finished() { for(vector::const_iterator p = _destroyCB.begin(); p != _destroyCB.end(); ++p) { (*p)->ice_response(); } } bool DestroyCommand::loadFailure() const { return _loadFailure; } bool DestroyCommand::clearDir() const { return _clearDir; } PatchCommand::PatchCommand(const ServerIPtr& server) : ServerCommand(server), _notified(false), _destroyed(false) { } bool PatchCommand::canExecute(ServerI::InternalServerState state) { return state == ServerI::Inactive; } ServerI::InternalServerState PatchCommand::nextState() { return ServerI::Patching; } void PatchCommand::execute() { Lock sync(*this); _notified = true; notifyAll(); } bool PatchCommand::waitForPatch() { Lock sync(*this); while(!_notified && !_destroyed) { wait(); } return _destroyed; } void PatchCommand::destroyed() { Lock sync(*this); _destroyed = true; notifyAll(); } void PatchCommand::finished() { } StartCommand::StartCommand(const ServerIPtr& server, const IceUtil::TimerPtr& timer, int timeout) : TimedServerCommand(server, timer, timeout) { } bool StartCommand::canExecute(ServerI::InternalServerState state) { return state == ServerI::Inactive; } ServerI::InternalServerState StartCommand::nextState() { startTimer(); return ServerI::Activating; } void StartCommand::execute() { _server->activate(); } void StartCommand::timeout() { _server->activationTimedOut(); } void StartCommand::addCallback(const AMD_Server_startPtr& amdCB) { _startCB.push_back(amdCB); } void StartCommand::failed(const string& reason) { stopTimer(); ServerStartException ex(_server->getId(), reason); for(vector::const_iterator p = _startCB.begin(); p != _startCB.end(); ++p) { (*p)->ice_exception(ex); } _startCB.clear(); } void StartCommand::finished() { stopTimer(); for(vector::const_iterator p = _startCB.begin(); p != _startCB.end(); ++p) { (*p)->ice_response(); } _startCB.clear(); } StopCommand::StopCommand(const ServerIPtr& server, const IceUtil::TimerPtr& timer, int timeout, bool deactivate) : TimedServerCommand(server, timer, timeout), _deactivate(deactivate) { } bool StopCommand::isStopped(ServerI::InternalServerState state) { return state == ServerI::Inactive || state == ServerI::Patching || state == ServerI::Loading; } bool StopCommand::canExecute(ServerI::InternalServerState state) { return state == ServerI::WaitForActivation || state == ServerI::ActivationTimeout || state == ServerI::Active; } ServerI::InternalServerState StopCommand::nextState() { startTimer(); return ServerI::Deactivating; } void StopCommand::execute() { if(_deactivate) { _server->deactivate(); } } void StopCommand::timeout() { _server->kill(); } void StopCommand::addCallback(const AMD_Server_stopPtr& amdCB) { _stopCB.push_back(amdCB); } void StopCommand::failed(const string& reason) { stopTimer(); ServerStopException ex(_server->getId(), reason); for(vector::const_iterator p = _stopCB.begin(); p != _stopCB.end(); ++p) { (*p)->ice_exception(ex); } _stopCB.clear(); } void StopCommand::finished() { stopTimer(); for(vector::const_iterator p = _stopCB.begin(); p != _stopCB.end(); ++p) { (*p)->ice_response(); } _stopCB.clear(); } ServerI::ServerI(const NodeIPtr& node, const ServerPrx& proxy, const string& serversDir, const string& id, int wt) : _node(node), _this(proxy), _id(id), _waitTime(wt), _serverDir(serversDir + "/" + id), _disableOnFailure(0), _state(ServerI::Inactive), _activation(ServerI::Disabled), _failureTime(IceUtil::Time::now(IceUtil::Time::Monotonic)), // Ensure that _activation is init. in updateImpl(). _pid(0) { assert(_node->getActivator()); const_cast(_disableOnFailure) = _node->getCommunicator()->getProperties()->getPropertyAsIntWithDefault("IceGrid.Node.DisableOnFailure", 0); } ServerI::~ServerI() { } void ServerI::waitForApplicationUpdateCompleted(const Ice::AsyncResultPtr&) { activate(); } void ServerI::start_async(const AMD_Server_startPtr& amdCB, const Ice::Current&) { start(Manual, amdCB); } void ServerI::stop_async(const AMD_Server_stopPtr& amdCB, const Ice::Current&) { ServerCommandPtr command; { Lock sync(*this); checkDestroyed(); if(StopCommand::isStopped(_state)) { throw ServerStopException(_id, "The server is already inactive."); } else if(_state == Destroying) { throw ServerStopException(_id, "The server is being destroyed."); } if(!_stop) { _stop = new StopCommand(this, _node->getTimer(), _deactivationTimeout); } if(amdCB) { _stop->addCallback(amdCB); } command = nextCommand(); } if(command) { command->execute(); } } void ServerI::sendSignal(const string& signal, const Ice::Current&) { _node->getActivator()->sendSignal(_id, signal); } void ServerI::writeMessage(const string& message, Ice::Int fd, const Ice::Current&) { Lock sync(*this); checkDestroyed(); if(_process != 0) { try { _process->writeMessage(message, fd); } catch(const Ice::LocalException&) { } } } ServerState ServerI::getState(const Ice::Current&) const { Lock sync(*this); checkDestroyed(); return toServerState(_state); } Ice::Int ServerI::getPid(const Ice::Current&) const { return _node->getActivator()->getServerPid(_id); } Ice::ObjectPrx ServerI::getProcess() const { Lock sync(*this); if(_process == 0 || _state <= Inactive || _state >= Deactivating) { return 0; } else { return _process; } } void ServerI::setEnabled(bool enabled, const ::Ice::Current&) { bool activate = false; ServerAdapterDict adpts; { Lock sync(*this); checkDestroyed(); assert(_desc); if(enabled && _activation == Disabled) { _failureTime = IceUtil::Time(); _activation = toServerActivation(_desc->activation); activate = _state == Inactive && _activation == Always; } else if(!enabled && (_activation != Disabled || _failureTime != IceUtil::Time())) { _failureTime = IceUtil::Time(); _activation = Disabled; if(_timerTask) { _node->getTimer()->cancel(_timerTask); _timerTask = 0; } } else { return; // Nothing to change! } adpts = _adapters; _node->observerUpdateServer(getDynamicInfo()); } for(ServerAdapterDict::iterator r = adpts.begin(); r != adpts.end(); ++r) { r->second->updateEnabled(); } if(activate) { try { start(Always); } catch(const ServerStartException& ex) { Ice::Error out(_node->getTraceLevels()->logger); out << "couldn't reactivate server `" << _id << "' with `always' activation mode:\n" << ex.reason; } catch(const Ice::ObjectNotExistException&) { } } } bool ServerI::isEnabled(const ::Ice::Current&) const { Lock sync(*this); checkDestroyed(); return _activation != Disabled; } void ServerI::setProcess_async(const AMD_Server_setProcessPtr& amdCB, const Ice::ProcessPrx& process, const Ice::Current&) { bool deact = false; ServerAdapterDict adpts; ServerCommandPtr command; { Lock sync(*this); checkDestroyed(); _process = process; if(_state == DeactivatingWaitForProcess) { deact = true; } else { if(checkActivation()) { adpts = _adapters; } command = nextCommand(); } } amdCB->ice_response(); for(ServerAdapterDict::iterator r = adpts.begin(); r != adpts.end(); ++r) { try { r->second->activationCompleted(); } catch(const Ice::ObjectNotExistException&) { } } if(deact) { deactivate(); } if(command) { command->execute(); } } Ice::Long ServerI::getOffsetFromEnd(const string& filename, int count, const Ice::Current&) const { return _node->getFileCache()->getOffsetFromEnd(getFilePath(filename), count); } bool ServerI::read(const string& filename, Ice::Long pos, int size, Ice::Long& newPos, Ice::StringSeq& lines, const Ice::Current&) const { return _node->getFileCache()->read(getFilePath(filename), pos, size, newPos, lines); } bool ServerI::isAdapterActivatable(const string& id) const { Lock sync(*this); if(!_desc || _activation == Disabled) { return false; } if(_desc->activation == "manual" || (_desc->activation == "session" && _desc->sessionId.empty())) { return false; } if(_state <= WaitForActivation) { if(_activatedAdapters.find(id) != _activatedAdapters.end()) { return false; // The adapter was already activated once. } return true; } else if(_state < Deactivating) { return false; // The server is active or its activation timed out. } else if(_state < Destroying) { return _node->getActivator()->isActive(); // The server is being deactivated and the // node isn't shutting down yet. } else { return false; } } const string& ServerI::getId() const { return _id; } InternalDistributionDescriptorPtr ServerI::getDistribution() const { Lock sync(*this); return _desc ? _desc->distrib : InternalDistributionDescriptorPtr(); } bool ServerI::dependsOnApplicationDistrib() const { Lock sync(*this); return _desc ? _desc->applicationDistrib : false; } void ServerI::start(ServerActivation activation, const AMD_Server_startPtr& amdCB) { ServerCommandPtr command; { Lock sync(*this); checkDestroyed(); // // Eventually re-enable the server if it's disabled because of a failure. // if(_disableOnFailure > 0 && _failureTime != IceUtil::Time()) { if(activation == Manual || (_failureTime + IceUtil::Time::seconds(_disableOnFailure) < IceUtil::Time::now(IceUtil::Time::Monotonic))) { _activation = _previousActivation; _failureTime = IceUtil::Time(); } } // // Check the current activation mode and the requested activation. // if(_activation == Disabled) { throw ServerStartException(_id, "The server is disabled."); } else if(_activation != Always && activation == Always) { assert(!amdCB); return; // Nothing to do. } else if(_activation == Manual && activation != Manual) { throw ServerStartException(_id, "The server activation doesn't allow this activation mode."); } else if(_activation == Session && _desc->sessionId.empty()) { throw ServerStartException(_id, "The server is not owned by a session."); } // // Check the current state. // if(_state == ActivationTimeout) { throw ServerStartException(_id, "The server activation timed out."); } else if(_state == Active) { if(activation == Always) { return; // Nothing to do, it's already active (and we // don't want to throw because it would be // considered as an error.) } throw ServerStartException(_id, "The server is already active."); } else if(_state == Destroying) { throw ServerStartException(_id, "The server is being destroyed."); } if(_timerTask) { _node->getTimer()->cancel(_timerTask); _timerTask = 0; } if(!_start) { _start = new StartCommand(this, _node->getTimer(), _activationTimeout); } if(amdCB) { _start->addCallback(amdCB); } command = nextCommand(); } if(command) { command->execute(); } } ServerCommandPtr ServerI::load(const AMD_Node_loadServerPtr& amdCB, const InternalServerDescriptorPtr& desc, const string& replicaName, bool noRestart) { Lock sync(*this); checkDestroyed(); checkRevision(replicaName, desc->uuid, desc->revision); // // Otherwise, if the following conditions are met: // // - the server is already loaded. // - the descriptor is from the master and the session id didn't change or it's coming from a slave. // - the descriptor is the same as the one loaded. // // we don't re-load the server. We just return the server // proxy and the proxies of its adapters. // InternalServerDescriptorPtr d = _load ? _load->getInternalServerDescriptor() : _desc; if(d && (replicaName != "Master" || d->sessionId == desc->sessionId) && !descriptorUpdated(d, desc)) { if(d->revision != desc->revision) { updateRevision(desc->uuid, desc->revision); } if(amdCB) { AdapterPrxDict adapters; for(ServerAdapterDict::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p) { adapters.insert(make_pair(p->first, p->second->getProxy())); } amdCB->ice_response(_this, adapters, _activationTimeout, _deactivationTimeout); } return 0; } if(!StopCommand::isStopped(_state) && !_stop) // Server is running and no stop is scheduled { assert(_desc); if(noRestart) { // // If the server is not inactive, we have to make sure the update doesn't require // a restart. If it requires a restart, we throw. Otherwise we update its properties // now. // checkNoRestart(desc); } else { _stop = new StopCommand(this, _node->getTimer(), _deactivationTimeout); } } if(!_load) { _load = new LoadCommand(this, _desc, _node->getTraceLevels()); } _load->setUpdate(desc, _destroy); if(_destroy && _state != Destroying) { _destroy->finished(); _destroy = 0; } if(_stop || StopCommand::isStopped(_state)) { _load->addCallback(amdCB); // Load will return once the server is loaded. } else { if(_state >= ServerI::Activating && _state < ServerI::Active) { // // If the server is being activated, return the response // now. We can't wait for runtime properties to be updated // as this could cause a deadlock if the registry needs // the server proxy to register the server process proxy // with the node. // AdapterPrxDict adapters; for(ServerAdapterDict::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p) { adapters.insert(make_pair(p->first, p->second->getProxy())); } amdCB->ice_response(_this, adapters, _activationTimeout, _deactivationTimeout); } else if(_state == ServerI::Active) { _load->addCallback(amdCB); // Must be called before startRuntimePropertiesUpdate! updateRevision(desc->uuid, desc->revision); _load->startRuntimePropertiesUpdate(_process); } else { _load->addCallback(amdCB); } } return nextCommand(); } bool ServerI::checkUpdate(const InternalServerDescriptorPtr& desc, bool noRestart, const Ice::Current&) { Lock sync(*this); checkDestroyed(); if(!_desc) { throw DeploymentException("server not loaded"); } InternalServerDescriptorPtr d = _load ? _load->getInternalServerDescriptor() : _desc; if(!descriptorUpdated(d, desc)) { return StopCommand::isStopped(_state); } if(noRestart) { checkNoRestart(desc); } try { checkAndUpdateUser(desc, false); // false = don't update the user, just check. } catch(const Ice::Exception& ex) { ostringstream os; os << ex; throw DeploymentException(os.str()); } catch(const string& msg) { throw DeploymentException(msg); } catch(const char* msg) { throw DeploymentException(msg); } return StopCommand::isStopped(_state); } ServerCommandPtr ServerI::destroy(const AMD_Node_destroyServerPtr& amdCB, const string& uuid, int revision, const string& replicaName) { Lock sync(*this); checkDestroyed(); checkRevision(replicaName, uuid, revision); if(!_desc) { amdCB->ice_response(); return 0; // Server is already destroyed. } if(!StopCommand::isStopped(_state) && !_stop) { _stop = new StopCommand(this, _node->getTimer(), _deactivationTimeout); } if(!_destroy) { // // If uuid is empty, the destroy call comes from the consistency check. In // this case, we clear the server directory only if it contains non-user data. // _destroy = new DestroyCommand(this, false, !uuid.empty()); } if(amdCB) { _destroy->addCallback(amdCB); } return nextCommand(); } bool ServerI::startPatch(bool shutdown) { ServerCommandPtr command; { Lock sync(*this); checkDestroyed(); if(!StopCommand::isStopped(_state)) { if(!shutdown) { return false; } else if(!_stop) { _stop = new StopCommand(this, _node->getTimer(), _deactivationTimeout); } } if(!_patch) { _patch = new PatchCommand(this); } command = nextCommand(); } if(command) { command->execute(); } return true; } bool ServerI::waitForPatch() { PatchCommandPtr patch; { Lock sync(*this); if(!_patch) { return true; } patch = _patch; } return patch->waitForPatch(); } void ServerI::finishPatch() { #ifndef _WIN32 { Lock sync(*this); try { chownRecursive(_serverDir + "/distrib", _uid, _gid); } catch(const string& msg) { Ice::Warning out(_node->getTraceLevels()->logger); out << msg; } } #endif setState(ServerI::Inactive); } void ServerI::adapterActivated(const string& id) { ServerCommandPtr command; ServerAdapterDict adpts; { Lock sync(*this); if(_state != ServerI::Activating && _state != ServerI::WaitForActivation && _state != ServerI::ActivationTimeout) { return; } _activatedAdapters.insert(id); if(checkActivation()) { adpts = _adapters; } command = nextCommand(); } for(ServerAdapterDict::iterator r = adpts.begin(); r != adpts.end(); ++r) { if(r->first != id) { try { r->second->activationCompleted(); } catch(const Ice::ObjectNotExistException&) { } } } if(command) { command->execute(); } } void ServerI::adapterDeactivated(const string& id) { ServerCommandPtr command; { Lock sync(*this); while(_state == ServerI::Activating) { wait(); // Wait for activate() to set the state to WaitForActivation } if((_state == Active || _state == WaitForActivation) && _serverLifetimeAdapters.find(id) != _serverLifetimeAdapters.end()) { _stop = new StopCommand(this, _node->getTimer(), _deactivationTimeout, false); } command = nextCommand(); } if(command) { command->execute(); } } void ServerI::checkDestroyed() const { if(_state == Destroyed) { Ice::ObjectNotExistException ex(__FILE__, __LINE__); ex.id = _this->ice_getIdentity(); throw ex; } } void ServerI::disableOnFailure() { // // If the server is already disabled, nothing to do. // if(_activation == Disabled) { return; } // // If disable on failure is configured or if the activation mode // is always and the server wasn't active at the time of the // failure we disable the server. // if(_disableOnFailure != 0 || (_activation == Always && (_state == Activating || _state == WaitForActivation))) { _previousActivation = _activation; _activation = Disabled; _failureTime = IceUtil::Time::now(IceUtil::Time::Monotonic); } } void ServerI::activationTimedOut() { ServerCommandPtr command; ServerAdapterDict adapters; { Lock sync(*this); if(_state != ServerI::WaitForActivation) { return; } setStateNoSync(ServerI::ActivationTimeout, "The server activation timed out."); if(_node->getTraceLevels()->server > 1) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "server `" << _id << "' activation timed out"; } adapters = _adapters; command = nextCommand(); } for(ServerAdapterDict::const_iterator p = adapters.begin(); p != adapters.end(); ++p) { try { p->second->activationFailed("server activation timed out"); } catch(const Ice::ObjectNotExistException&) { } } if(command) { command->execute(); } } void ServerI::activate() { InternalServerDescriptorPtr desc; ServerAdapterDict adpts; bool waitForReplication; #ifndef _WIN32 uid_t uid; gid_t gid; #endif string failure; try { { Lock sync(*this); assert(_state == Activating && _desc); desc = _desc; adpts = _adapters; if(_activation == Disabled) { throw string("The server is disabled."); } // // The first time the server is started, we ensure that the // replication of its descriptor is completed. This is to make // sure all the replicas are up to date when the server // starts for the first time with a given descriptor. // waitForReplication = _waitForReplication; _waitForReplication = false; _process = 0; #ifndef _WIN32 uid = _uid; gid = _gid; #endif } // // We first ensure that the application is replicated on all the // registries before to start the server. We only do this each // time the server is updated or initialy loaded on the node. // if(waitForReplication) { NodeSessionPrx session = _node->getMasterNodeSession(); if(session) { _node->getMasterNodeSession()->begin_waitForApplicationUpdate( desc->uuid, desc->revision, ::Ice::newCallback(this, &ServerI::waitForApplicationUpdateCompleted)); return; } } // // Compute the server command line options. // Ice::StringSeq options; for(Ice::StringSeq::const_iterator p = desc->options.begin(); p != desc->options.end(); ++p) { if(!p->empty()) { options.push_back(*p); } } options.push_back("--Ice.Config=" + escapeProperty(_serverDir + "/config/config")); Ice::StringSeq envs; transform(desc->envs.begin(), desc->envs.end(), back_inserter(envs), EnvironmentEval()); // // Clear the adapters direct proxy (this is usefull if the server // was manually activated). // for(ServerAdapterDict::iterator p = adpts.begin(); p != adpts.end(); ++p) { try { p->second->clear(); } catch(const Ice::ObjectNotExistException&) { } } #ifndef _WIN32 int pid = _node->getActivator()->activate(desc->id, desc->exe, desc->pwd, uid, gid, options, envs, this); #else int pid = _node->getActivator()->activate(desc->id, desc->exe, desc->pwd, options, envs, this); #endif ServerCommandPtr command; bool active = false; { Lock sync(*this); assert(_state == Activating); _pid = pid; setStateNoSync(ServerI::WaitForActivation); active = checkActivation(); command = nextCommand(); notifyAll(); // Terminated might be waiting for the state change. } if(active) { for(ServerAdapterDict::iterator r = adpts.begin(); r != adpts.end(); ++r) { try { r->second->activationCompleted(); } catch(const Ice::ObjectNotExistException&) { } } } if(command) { command->execute(); } return; } catch(const std::string& ex) { failure = ex; } catch(const Ice::Exception& ex) { Ice::Warning out(_node->getTraceLevels()->logger); out << "activation failed for server `" << _id << "':\n"; out << ex; ostringstream os; os << ex; failure = os.str(); } { Lock sync(*this); disableOnFailure(); setStateNoSync(ServerI::Deactivating, failure); } for(ServerAdapterDict::iterator r = adpts.begin(); r != adpts.end(); ++r) { try { r->second->activationFailed(failure); } catch(const Ice::ObjectNotExistException&) { } } setState(ServerI::Inactive); } void ServerI::kill() { { Lock sync(*this); if(_state != Destroying && _state != Deactivating && _state != DeactivatingWaitForProcess) { return; } } try { _node->getActivator()->kill(_id); } catch(const Ice::SyscallException& ex) { Ice::Warning out(_node->getTraceLevels()->logger); out << "deactivation failed for server `" << _id << "':\n"; out << ex; setState(ServerI::Inactive); // TODO: Is this really correct? } } void ServerI::deactivate() { Ice::ProcessPrx process; { Lock sync(*this); if(_state != Deactivating && _state != DeactivatingWaitForProcess) { return; } assert(_desc); // // If a process object is supposed to be registered and it's // not set yet, we wait for the server to set this process // object before attempting to deactivate the server again. // if(_desc->processRegistered && !_process) { setStateNoSync(ServerI::DeactivatingWaitForProcess); return; } process = _process; } try { // // Deactivate the server and for the termination of the server. // _node->getActivator()->deactivate(_id, process); return; } catch(const Ice::Exception& ex) { Ice::Warning out(_node->getTraceLevels()->logger); out << "graceful server shutdown failed, killing server `" << _id << "':\n"; out << ex; } try { // // If we couldn't deactivate it we kill it. // _node->getActivator()->kill(_id); return; } catch(const Ice::SyscallException& ex) { Ice::Warning out(_node->getTraceLevels()->logger); out << "deactivation failed for server `" << _id << "':\n"; out << ex; setState(ServerI::Inactive); // TODO: Is this really correct? } } void ServerI::destroy() { ServerAdapterDict adpts; { Lock sync(*this); assert(_desc); assert(_state == Destroying); adpts = _adapters; } _node->removeServer(this, _desc->application); // // Remove the server directory only if the clear dir flag is set (user // explicitly destroyed the server) or if the server directory doesn't // contain user data). // if(_destroy->clearDir() || _node->canRemoveServerDirectory(_id)) { try { IcePatch2::removeRecursive(_serverDir); } catch(const string& msg) { if(!_destroy->loadFailure()) { Ice::Warning out(_node->getTraceLevels()->logger); out << "removing server directory `" << _serverDir << "' failed:\n" << msg; } } } // // Destroy the object adapters. // for(ServerAdapterDict::const_iterator p = adpts.begin(); p != adpts.end(); ++p) { try { p->second->destroy(); } catch(const Ice::LocalException&) { } } setState(Destroyed); } void ServerI::terminated(const string& msg, int status) { ServerAdapterDict adpts; { Lock sync(*this); while(_state == ServerI::Activating) { wait(); // Wait for activate() to set the state to WaitForActivation } adpts = _adapters; _activatedAdapters.clear(); _pid = 0; bool failed = false; #ifndef _WIN32 failed = WIFEXITED(status) && WEXITSTATUS(status) != 0; if(WIFSIGNALED(status)) { int s = WTERMSIG(status); failed = s == SIGABRT || s == SIGILL || s == SIGBUS || s == SIGFPE || s == SIGSEGV; } #else failed = status != 0; #endif if(failed) { disableOnFailure(); } if(_state != ServerI::Deactivating && _state != ServerI::DeactivatingWaitForProcess && _state != ServerI::Destroying) { ostringstream os; os << "The server terminated unexpectedly"; #ifndef _WIN32 if(WIFEXITED(status)) { os << " with exit code " << WEXITSTATUS(status); } else if(WIFSIGNALED(status)) { os << " with signal " << signalToString(WTERMSIG(status)); } #else os << " with exit code " << status; #endif os << (msg.empty() ? string(".") : ":\n" + msg); setStateNoSync(ServerI::Deactivating, os.str()); } } // // The server has terminated, set its adapter direct proxies to // null to cause the server re-activation if one of its adapter // direct proxy is requested. // for(ServerAdapterDict::iterator p = adpts.begin(); p != adpts.end(); ++p) { try { p->second->setDirectProxy(0); } catch(const Ice::ObjectNotExistException&) { } } bool doDestroy = false; ServerCommandPtr command; { Lock sync(*this); if(_state == ServerI::Destroying) { doDestroy = true; } else { setStateNoSync(ServerI::Inactive); command = nextCommand(); } } if(doDestroy) { destroy(); } else if(command) { command->execute(); } } void ServerI::shutdown() { Lock sync(*this); assert(_state == ServerI::Inactive); assert(!_destroy); assert(!_stop); assert(!_load); assert(!_patch); assert(!_start); _timerTask = 0; } void ServerI::update() { ServerCommandPtr command; { Lock sync(*this); if(_state != ServerI::Loading) { return; } InternalServerDescriptorPtr oldDescriptor = _desc; bool disabled = oldDescriptor && _activation == Disabled; try { if(_load->clearDir()) { // // The server was explicitely destroyed then updated, // we first need to cleanup the directory to remove // any user created files. // try { IcePatch2::removeRecursive(_serverDir); } catch(const string&) { } } try { updateImpl(_load->getInternalServerDescriptor()); } catch(const Ice::Exception& ex) { ostringstream os; os << ex; throw DeploymentException(os.str()); } catch(const string& msg) { throw DeploymentException(msg); } catch(const char* msg) { throw DeploymentException(msg); } if(oldDescriptor) { if(oldDescriptor->application != _desc->application) { _node->removeServer(this, oldDescriptor->application); _node->addServer(this, _desc->application); } if(_node->getTraceLevels()->server > 0) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "updated configuration for server `" << _id << "'"; } } else { _node->addServer(this, _desc->application); } AdapterPrxDict adapters; for(ServerAdapterDict::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p) { adapters.insert(make_pair(p->first, p->second->getProxy())); } _load->finished(_this, adapters, _activationTimeout, _deactivationTimeout); } catch(const DeploymentException& ex) { // // Rollback old descriptor. // if(oldDescriptor) { try { updateImpl(oldDescriptor); } catch(const Ice::Exception& e) { Ice::Warning out(_node->getTraceLevels()->logger); out << "update failed:\n" << ex.reason << "\nand couldn't rollback old descriptor:\n" << e; } catch(const string& msg) { Ice::Warning out(_node->getTraceLevels()->logger); out << "update failed:\n" << ex.reason << "\nand couldn't rollback old descriptor:\n" << msg; } catch(const char* msg) { Ice::Warning out(_node->getTraceLevels()->logger); out << "update failed:\n" << ex.reason << "\nand couldn't rollback old descriptor:\n" << msg; } } else if(!_destroy) { _destroy = new DestroyCommand(this, true, true); } _load->failed(ex); } if(oldDescriptor && disabled != (_activation == Disabled)) { _node->observerUpdateServer(getDynamicInfo()); } setStateNoSync(Inactive); command = nextCommand(); } if(command) { command->execute(); } } void ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor) { assert(_load && descriptor); _desc = descriptor; _waitForReplication = true; // // Remember if the server was just released by a session, this // will be used later to not update the configuration on the disk // (as an optimization and to allow users to review the // configuration file after allocating a server -- that's useful // if the server configuration is bogus and the session server // can't start). // bool serverSessionReleased = _desc && _desc->activation == "session" && _desc->revision == descriptor->revision && !_desc->sessionId.empty() && descriptor->sessionId.empty(); // // Go through the adapters and create the object adapter Ice // objects if necessary, also remove the old ones. // { ServerAdapterDict oldAdapters; oldAdapters.swap(_adapters); _serverLifetimeAdapters.clear(); Ice::ObjectAdapterPtr adapter = _node->getAdapter(); for(InternalAdapterDescriptorSeq::const_iterator r = _desc->adapters.begin(); r != _desc->adapters.end(); ++r) { try { Ice::Identity id; id.category = _this->ice_getIdentity().category + "Adapter"; id.name = _id + "-" + (*r)->id; ServerAdapterIPtr servant = ServerAdapterIPtr::dynamicCast(adapter->find(id)); if(!servant) { AdapterPrx proxy = AdapterPrx::uncheckedCast(adapter->createProxy(id)); servant = new ServerAdapterI(_node, this, _id, proxy, (*r)->id, _activation != Disabled || _failureTime != IceUtil::Time()); adapter->add(servant, id); } _adapters.insert(make_pair((*r)->id, servant)); if((*r)->serverLifetime) { _serverLifetimeAdapters.insert((*r)->id); } } catch(const Ice::ObjectAdapterDeactivatedException&) { // IGNORE } catch(const Ice::LocalException& ex) { Ice::Error out(_node->getTraceLevels()->logger); out << "couldn't add adapter `" << (*r)->id << "':\n" << ex; } oldAdapters.erase((*r)->id); } // // Remove old object adapters. // for(ServerAdapterDict::const_iterator t = oldAdapters.begin(); t != oldAdapters.end(); ++t) { try { t->second->destroy(); } catch(const Ice::ObjectAdapterDeactivatedException&) { // IGNORE } catch(const Ice::LocalException& ex) { Ice::Error out(_node->getTraceLevels()->logger); out << "couldn't destroy adapter `" << t->first << "':\n" << ex; } } } // // If the server was disabled because it failed (or because it's // the first time it's being updated). Set the activation mode // based on the descriptor activation. Otherwise, if the server is // disabled and failure time isn't set, we don't change the // activation since the user explicitely disabled the server. // if(_activation != Disabled || _failureTime != IceUtil::Time()) { _activation = toServerActivation(_desc->activation); _failureTime = IceUtil::Time(); } if(_timerTask) { _node->getTimer()->cancel(_timerTask); _timerTask = 0; } checkAndUpdateUser(_desc, true); // we pass true to update _uid/_gid. istringstream at(_desc->activationTimeout); if(!(at >> _activationTimeout) || !at.eof() || _activationTimeout == 0) { _activationTimeout = _waitTime; } istringstream dt(_desc->deactivationTimeout); if(!(dt >> _deactivationTimeout) || !dt.eof() || _deactivationTimeout == 0) { _deactivationTimeout = _waitTime; } // // Simplify the log paths and transform relative paths into // absolute paths, also make sure the logs are sorted. // for(Ice::StringSeq::const_iterator p = _desc->logs.begin(); p != _desc->logs.end(); ++p) { string path = IcePatch2::simplify(*p); if(IceUtilInternal::isAbsolutePath(path)) { _logs.push_back(path); } else { _logs.push_back(_node->getPlatformInfo().getCwd() + '/' + path); } } sort(_logs.begin(), _logs.begin()); PropertyDescriptorSeqDict properties = getProperties(_desc); PropertyDescriptorSeq& props = properties["config"]; _stdErrFile = getProperty(props, "Ice.StdErr"); _stdOutFile = getProperty(props, "Ice.StdOut"); // // If the server is a session server and it wasn't udpated but // just released by a session, we don't update the configuration, // it will be done when the server is re-allocated. // if(serverSessionReleased) { return; } // // Update the revision file. // updateRevision(_desc->uuid, _desc->revision); // // Create or update the server directories exists. // createOrUpdateDirectory(_serverDir); createOrUpdateDirectory(_serverDir + "/config"); createOrUpdateDirectory(_serverDir + "/dbs"); createOrUpdateDirectory(_serverDir + "/distrib"); // // Create the configuration files, remove the old ones. // { // // We do not want to esapce the properties if the Ice version is // previous to Ice 3.3. // Ice::StringSeq knownFiles; for(PropertyDescriptorSeqDict::const_iterator p = properties.begin(); p != properties.end(); ++p) { knownFiles.push_back(p->first); const string configFilePath = _serverDir + "/config/" + p->first; IceUtilInternal::ofstream configfile(configFilePath); // configFilePath is a UTF-8 string if(!configfile.good()) { throw "couldn't create configuration file: " + configFilePath; } configfile << "# Configuration file (" << IceUtil::Time::now().toDateTime() << ")" << endl << endl; for(PropertyDescriptorSeq::const_iterator r = p->second.begin(); r != p->second.end(); ++r) { if(r->value.empty() && r->name.find('#') == 0) { configfile << r->name << endl; } else { configfile << r->name << "=" << r->value << endl; } } configfile.close(); } sort(knownFiles.begin(), knownFiles.end()); // // Remove old configuration files. // Ice::StringSeq files = IcePatch2::readDirectory(_serverDir + "/config"); Ice::StringSeq toDel; set_difference(files.begin(), files.end(), knownFiles.begin(), knownFiles.end(), back_inserter(toDel)); for(Ice::StringSeq::const_iterator q = toDel.begin(); q != toDel.end(); ++q) { if(q->find("config_") == 0) { try { IcePatch2::remove(_serverDir + "/config/" + *q); } catch(const string& msg) { Ice::Warning out(_node->getTraceLevels()->logger); out << "couldn't remove file `" + _serverDir + "/config/" + *q + "':\n" + msg; } } } } // // Update the database environments if necessary and remove the // old ones. // { Ice::StringSeq knownDbEnvs; for(InternalDbEnvDescriptorSeq::const_iterator q = _desc->dbEnvs.begin(); q != _desc->dbEnvs.end(); ++q) { knownDbEnvs.push_back((*q)->name); string dbEnvHome = _serverDir + "/dbs/" + (*q)->name; createOrUpdateDirectory(dbEnvHome); if(!(*q)->properties.empty()) { string file = dbEnvHome + "/DB_CONFIG"; IceUtilInternal::ofstream configfile(file); // file is a UTF-8 string if(!configfile.good()) { throw "couldn't create configuration file `" + file + "'"; } for(PropertyDescriptorSeq::const_iterator p = (*q)->properties.begin(); p != (*q)->properties.end(); ++p) { if(!p->name.empty()) { configfile << p->name; if(!p->value.empty()) { configfile << " " << p->value; } configfile << endl; } } configfile.close(); } } sort(knownDbEnvs.begin(), knownDbEnvs.end()); // // Remove old database environments. // Ice::StringSeq dbEnvs = IcePatch2::readDirectory(_serverDir + "/dbs"); Ice::StringSeq toDel; set_difference(dbEnvs.begin(), dbEnvs.end(), knownDbEnvs.begin(), knownDbEnvs.end(), back_inserter(toDel)); for(Ice::StringSeq::const_iterator p = toDel.begin(); p != toDel.end(); ++p) { try { IcePatch2::removeRecursive(_serverDir + "/dbs/" + *p); } catch(const string& msg) { Ice::Warning out(_node->getTraceLevels()->logger); out << "couldn't remove directory `" + _serverDir + "/dbs/" + *p + "':\n" + msg; } } } #ifndef _WIN32 chownRecursive(_serverDir, _uid, _gid); #endif } void ServerI::checkRevision(const string& replicaName, const string& uuid, int revision) const { if(replicaName == "Master") { return; } string descUUID; int descRevision; if(_load) { descUUID = _load->getInternalServerDescriptor()->uuid; descRevision = _load->getInternalServerDescriptor()->revision; } else if(_desc) { descUUID = _desc->uuid; descRevision = _desc->revision; } else { string idFilePath = _serverDir + "/revision"; IceUtilInternal::ifstream is(idFilePath); // idFilePath is a UTF-8 string if(!is.good()) { return; } char line[1024]; is.getline(line, 1024); // Ignore comments is.getline(line, 1024); is.getline(line, 1024); string ignore; is >> ignore >> descUUID; is >> ignore >> descRevision; } if(uuid != descUUID) { DeploymentException ex; ex.reason = "server from replica `" + replicaName + "' is from another application (`" + uuid + "')"; throw ex; } else if(revision != descRevision) { ostringstream os; os << "server from replica `" + replicaName + "' has a different version:\n"; os << "current revision: " << descRevision << "\n"; os << "replica revision: " << revision; throw DeploymentException(os.str()); } } void ServerI::checkNoRestart(const InternalServerDescriptorPtr& desc) { assert(_desc); if(_desc->sessionId != desc->sessionId) { throw DeploymentException("server allocated by another session"); } if(descriptorUpdated(_desc, desc, true)) // true = ignore properties { throw DeploymentException("update requires server to be stopped"); } } #ifndef _WIN32 void ServerI::checkAndUpdateUser(const InternalServerDescriptorPtr& desc, bool update) #else void ServerI::checkAndUpdateUser(const InternalServerDescriptorPtr& desc, bool /*update*/) #endif { #ifndef _WIN32 uid_t uid = getuid(); uid_t gid = getgid(); #endif // // Don't change the user if the server has the session activation // mode and if it's not currently owned by a session. // string user; if(desc->activation != "session" || !desc->sessionId.empty()) { user = desc->user; #ifndef _WIN32 // // Check if the node is running as root, if that's the case we // make sure that a user is set for the process. // if(uid == 0 && user.empty()) { // // If no user is configured and if this server is owned by // a session we set the user to the session id, otherwise // we set it to "nobody". // user = !desc->sessionId.empty() ? desc->sessionId : "nobody"; } #endif } if(!user.empty()) { UserAccountMapperPrx mapper = _node->getUserAccountMapper(); if(mapper) { try { user = mapper->getUserAccount(user); } catch(const UserAccountNotFoundException&) { throw "couldn't find user account for user `" + user + "'"; } catch(const Ice::LocalException& ex) { ostringstream os; os << "unexpected exception while trying to find user account for user `" << user << "':\n" << ex; throw os.str(); } } #ifdef _WIN32 // // Windows doesn't support running processes under another // account (at least not easily, see the CreateProcessAsUser // documentation). So if a user is specified, we just check // that the node is running under the same user account as the // one which is specified. // vector buf(256); buf.resize(256); DWORD size = static_cast(buf.size()); bool success = GetUserName(&buf[0], &size); if(!success && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { buf.resize(size); success = GetUserName(&buf[0], &size); } if(!success) { Ice::SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } if(user != string(&buf[0])) { throw "couldn't load server under user account `" + user + "': feature not supported on Windows"; } } #else // // Get the uid/gid associated with the given user. // struct passwd* pw = getpwnam(user.c_str()); if(!pw) { throw "unknown user account `" + user + "'"; } // // If the node isn't running as root and if the uid of the // configured user is different from the uid of the userr // running the node we throw, a regular user can't run a // process as another user. // if(uid != 0 && pw->pw_uid != uid) { throw "node has insufficient privileges to load server under user account `" + user + "'"; } if(pw->pw_uid == 0 && _node->getCommunicator()->getProperties()->getPropertyAsInt("IceGrid.Node.AllowRunningServersAsRoot") == 0) { throw "running server as `root' is not allowed"; } if(update) { _uid = pw->pw_uid; _gid = pw->pw_gid; } } else if(update) { _uid = uid; _gid = gid; } #endif } void ServerI::updateRevision(const string& uuid, int revision) { _desc->uuid = uuid; _desc->revision = revision; if(_load) { _load->getInternalServerDescriptor()->uuid = uuid; _load->getInternalServerDescriptor()->revision = revision; } string idFilePath = _serverDir + "/revision"; IceUtilInternal::ofstream os(idFilePath); // idFilePath is a UTF-8 string if(os.good()) { os << "#" << endl; os << "# This server belongs to the application `" << _desc->application << "'" << endl; os << "#" << endl; os << "uuid: " << _desc->uuid << endl; os << "revision: " << _desc->revision << endl; } } void ServerI::updateRuntimePropertiesCallback(const InternalServerDescriptorPtr& desc) { Lock sync(*this); if(_state != Active || !_load) { return; } if(_load->finishRuntimePropertiesUpdate(desc, _process)) { AdapterPrxDict adapters; for(ServerAdapterDict::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p) { adapters.insert(make_pair(p->first, p->second->getProxy())); } _load->finished(_this, adapters, _activationTimeout, _deactivationTimeout); } } void ServerI::updateRuntimePropertiesCallback(const Ice::Exception& ex, const InternalServerDescriptorPtr& desc) { Lock sync(*this); if(_state != Active || !_load) { return; } if(_load->finishRuntimePropertiesUpdate(desc, _process)) { _load->failed(ex); } } bool ServerI::checkActivation() { //assert(locked()); if(_state == ServerI::WaitForActivation || _state == ServerI::ActivationTimeout) { // // Mark the server as active if the server process proxy is registered (or it's not expecting // one to be registered) and if all the server lifetime adapters have been activated. // if((!_desc->processRegistered || _process) && includes(_activatedAdapters.begin(), _activatedAdapters.end(), _serverLifetimeAdapters.begin(), _serverLifetimeAdapters.end())) { setStateNoSync(ServerI::Active); return true; } } return false; } void ServerI::setState(InternalServerState st, const std::string& reason) { ServerCommandPtr command; { Lock sync(*this); setStateNoSync(st, reason); command = nextCommand(); } if(command) { command->execute(); } } ServerCommandPtr ServerI::nextCommand() { ServerCommandPtr command; if(_stop && _stop->canExecute(_state)) { command = _stop; } else if(_destroy && _destroy->canExecute(_state)) { command = _destroy; } else if(_load && _load->canExecute(_state)) { command = _load; } else if(_patch && _patch->canExecute(_state)) { command = _patch; } else if(_start && _start->canExecute(_state)) { command = _start; } if(command) { setStateNoSync(command->nextState()); } return command; } void ServerI::setStateNoSync(InternalServerState st, const std::string& reason) { // // Ensure that the given state can be switched to. // switch(st) { case Inactive: break; case Patching: assert(_patch && _patch->canExecute(_state)); break; case Loading: assert(_load && _load->canExecute(_state)); break; case Activating: assert(_start && _start->canExecute(_state)); break; case WaitForActivation: assert(_state == Activating); break; case ActivationTimeout: assert(_state == WaitForActivation); break; case Active: assert(_state == WaitForActivation || _state == ActivationTimeout); break; case Deactivating: //assert(_stop && _stop->canExecute(_state)); break; case DeactivatingWaitForProcess: assert(_state == Deactivating); break; case Destroying: assert(_state == Inactive && _destroy && _destroy->canExecute(_state)); break; case Destroyed: assert(_destroy); break; } // // Change the current state. // InternalServerState previous = _state; _state = st; // // Check if some commands are done. // bool loadFailure = false; switch(_state) { case Inactive: if(previous == Loading) { _load = 0; } if(previous == Patching) { _patch = 0; } if(_stop) { _stop->finished(); _stop = 0; } break; case Active: if(_start) { _start->finished(); _start = 0; } break; case ActivationTimeout: if(_start) { _start->failed(reason); _start = 0; } break; case Deactivating: if(_start) { _start->failed(reason.empty() ? string("The server is being deactivated.") : reason); _start = 0; } break; case Destroying: loadFailure = _destroy->loadFailure(); if(_patch) { _patch->destroyed(); _patch = 0; } if(_load) { _load->failed(DeploymentException("The server is being destroyed.")); _load = 0; } if(_start) { _start->failed("The server is being destroyed."); _start = 0; } if(_stop) { _stop->failed("The server is being destroyed."); _stop = 0; } break; case Destroyed: if(_destroy) { loadFailure = _destroy->loadFailure(); _destroy->finished(); _destroy = 0; } notifyAll(); // for getProperties() break; default: break; } if(_timerTask) { _node->getTimer()->cancel(_timerTask); _timerTask = 0; } if(_state == Destroyed && !_load) { // // If the server is destroyed and there's no load command, we // remove the servant from the ASM. // try { _node->getAdapter()->remove(_this->ice_getIdentity()); } catch(const Ice::ObjectAdapterDeactivatedException&) { // IGNORE } _desc = 0; } else if(_state == Inactive) { if(_activation == Always) { assert(!_timerTask); _timerTask = new DelayedStart(this, _node->getTraceLevels()); try { _node->getTimer()->schedule(_timerTask, IceUtil::Time::milliSeconds(500)); } catch(const IceUtil::Exception&) { // Ignore, timer is destroyed because node is shutting down. } } else if(_activation == Disabled && _disableOnFailure > 0 && _failureTime != IceUtil::Time()) { // // If the server was disabled because it failed, we // schedule a callback to re-enable it. We add 500ms to // the disable on failure duration to make sure that the // server will be ready to be reactivated when the // callback is executed. // assert(!_timerTask); _timerTask = new DelayedStart(this, _node->getTraceLevels()); try { IceUtil::Time now = IceUtil::Time::now(IceUtil::Time::Monotonic); if(now - _failureTime < IceUtil::Time::seconds(_disableOnFailure)) { _node->getTimer()->schedule(_timerTask, IceUtil::Time::seconds(_disableOnFailure) - now + _failureTime + IceUtil::Time::milliSeconds(500)); } else { _node->getTimer()->schedule(_timerTask, IceUtil::Time::milliSeconds(500)); } } catch(const IceUtil::Exception&) { // Ignore, timer is destroyed because node is shutting down. } } } else if(_state == Active && _load) { // // If there's a pending load command, it's time to update the // runtime properties of the server now that it's active. // _load->startRuntimePropertiesUpdate(_process); } // // Don't send the server update if the state didn't change or if // the server couldn't be forked. If the server is destroyed, we // also check if it's the result of a load failure. If that's the // case we don't send an update because the server was never // actually loaded. // if(toServerState(previous) != toServerState(_state) && !(previous == Inactive && _state == Deactivating) && !loadFailure) { _node->observerUpdateServer(getDynamicInfo()); } if(_node->getTraceLevels()->server > 1) { if(_state == ServerI::Active) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `Active'"; } else if(_state == ServerI::Inactive) { if(_node->getTraceLevels()->server != 2 && !(previous == ServerI::Loading || previous == ServerI::Patching)) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `Inactive'"; } } else if(_state == ServerI::Destroyed) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `Destroyed'"; } else if(_node->getTraceLevels()->server > 2) { if(_state == ServerI::WaitForActivation) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `WaitForActivation'"; } else if(_state == ServerI::ActivationTimeout) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `ActivationTimeout'"; } else if(_state == ServerI::Activating) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `Activating'"; } else if(_state == ServerI::Deactivating) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `Deactivating'"; } else if(_state == ServerI::DeactivatingWaitForProcess) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `DeactivatingWaitForProcess'"; } else if(_state == ServerI::Destroying) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `Destroying'"; } else if(_state == ServerI::Loading) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `Loading'"; } else if(_state == ServerI::Patching) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat); out << "changed server `" << _id << "' state to `Loading'"; } } } } void ServerI::createOrUpdateDirectory(const string& dir) { try { IcePatch2::createDirectory(dir); } catch(const string&) { } } ServerState ServerI::toServerState(InternalServerState st) const { switch(st) { case ServerI::Inactive: case ServerI::Activating: case ServerI::Patching: case ServerI::Loading: return IceGrid::Inactive; case ServerI::WaitForActivation: return IceGrid::Activating; case ServerI::ActivationTimeout: return IceGrid::ActivationTimedOut; case ServerI::Active: return IceGrid::Active; case ServerI::Deactivating: case ServerI::DeactivatingWaitForProcess: return IceGrid::Deactivating; case ServerI::Destroying: return IceGrid::Destroying; case ServerI::Destroyed: return IceGrid::Destroyed; default: assert(false); return IceGrid::Destroyed; } } ServerI::ServerActivation ServerI::toServerActivation(const string& activation) const { if(activation == "on-demand") { return OnDemand; } else if(activation == "session") { return Session; } else if(activation == "always") { return Always; } else if(activation == "manual" || activation.empty()) { return Manual; } else { Ice::Warning out(_node->getTraceLevels()->logger); out << "unknown activation mode `" << activation << "' for server `" << _id << "'"; return Manual; } } ServerDynamicInfo ServerI::getDynamicInfo() const { ServerDynamicInfo descriptor; descriptor.id = _id; descriptor.state = toServerState(_state); // // NOTE: this must be done only for the active state. Otherwise, we could get a // deadlock since getPid() will lock the activator and since this method might // be called from the activator locked. // descriptor.pid = _pid; descriptor.enabled = _activation != Disabled; return descriptor; } string ServerI::getFilePath(const string& filename) const { if(filename == "stderr") { if(_stdErrFile.empty()) { throw FileNotAvailableException("Ice.StdErr configuration property is not set"); } return _stdErrFile; } else if(filename == "stdout") { if(_stdOutFile.empty()) { throw FileNotAvailableException("Ice.StdOut configuration property is not set"); } return _stdOutFile; } else if(!filename.empty() && filename[0] == '#') { string path = IcePatch2::simplify(filename.substr(1)); if(!IceUtilInternal::isAbsolutePath(path)) { path = _node->getPlatformInfo().getCwd() + "/" + path; } if(find(_logs.begin(), _logs.end(), path) == _logs.end()) { throw FileNotAvailableException("unknown log file `" + path + "'"); } return path; } else { throw FileNotAvailableException("unknown file"); return ""; // Keep the compiler happy. } } PropertyDescriptorSeqDict ServerI::getProperties(const InternalServerDescriptorPtr& desc) { // // Copy the descriptor properties. // PropertyDescriptorSeqDict properties = desc->properties; PropertyDescriptorSeq& props = properties["config"]; // // Cache the path of the stderr/stdout file, first check if the // node OutputDir property is set and then we check the server // configuration file for the Ice.StdErr and Ice.StdOut // properties. // string stdErrFile = getProperty(props, "Ice.StdErr"); string stdOutFile = getProperty(props, "Ice.StdOut"); string outputDir = _node->getOutputDir(); if(!outputDir.empty()) { if(stdErrFile.empty()) { stdErrFile = outputDir + "/" + _id + (_node->getRedirectErrToOut() ? ".out" : ".err"); props.push_back(createProperty("Ice.StdErr", stdErrFile)); } if(stdOutFile.empty()) { stdOutFile = outputDir + "/" + _id + ".out"; props.push_back(createProperty("Ice.StdOut", stdOutFile)); } } // // Add the locator proxy property and the node properties override // { const PropertyDescriptorSeq& overrides = _node->getPropertiesOverride(); for(PropertyDescriptorSeqDict::iterator p = properties.begin(); p != properties.end(); ++p) { if(getProperty(p->second, "Ice.Default.Locator").empty()) { p->second.push_back( createProperty("Ice.Default.Locator", _node->getCommunicator()->getProperties()->getProperty("Ice.Default.Locator"))); } if(!overrides.empty()) { p->second.push_back(createProperty("# Node properties override")); p->second.insert(p->second.end(), overrides.begin(), overrides.end()); } } } return properties; } Ice-3.5.1/cpp/src/IceGrid/DescriptorParser.cpp0000644000076400007640000006775412223561476017273 0ustar mesmes// ********************************************************************** // // 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 #include #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceGrid; namespace IceGrid { class DescriptorHandler : public IceXML::Handler { public: DescriptorHandler(const string&, const Ice::CommunicatorPtr&); void setAdmin(const IceGrid::AdminPrx&); void setVariables(const map&, const vector&); virtual void startElement(const string&, const IceXML::Attributes&, int, int); virtual void endElement(const string&, int, int); virtual void characters(const string&, int, int); virtual void error(const string&, int, int); const ApplicationDescriptor& getApplicationDescriptor() const; private: bool isCurrentTargetDeployable() const; string elementValue(); vector getTargets(const string&) const; void error(const string&) const; bool isTargetDeployable(const string&) const; const Ice::CommunicatorPtr _communicator; IceGrid::AdminPrx _admin; string _filename; map _overrides; vector _targets; string _data; string _previousElementName; int _targetCounter; bool _isCurrentTargetDeployable; int _line; int _column; IceUtil::UniquePtr _currentApplication; IceUtil::UniquePtr _currentNode; IceUtil::UniquePtr _currentTemplate; IceUtil::UniquePtr _currentServerInstance; IceUtil::UniquePtr _currentServiceInstance; IceUtil::UniquePtr _currentServer; IceUtil::UniquePtr _currentService; CommunicatorDescriptorBuilder* _currentCommunicator; IceUtil::UniquePtr _currentPropertySet; bool _isTopLevel; bool _inAdapter; bool _inReplicaGroup; bool _inDbEnv; bool _inDistrib; }; } DescriptorHandler::DescriptorHandler(const string& filename, const Ice::CommunicatorPtr& communicator) : _communicator(communicator), _filename(filename), _isCurrentTargetDeployable(true), _currentCommunicator(0), _isTopLevel(true), _inAdapter(false), _inReplicaGroup(false), _inDbEnv(false) { } void DescriptorHandler::setAdmin(const AdminPrx& admin) { _admin = admin; } void DescriptorHandler::setVariables(const map& variables, const vector& targets) { _overrides = variables; _targets = targets; } void DescriptorHandler::startElement(const string& name, const IceXML::Attributes& attrs, int line, int column) { _line = line; _column = column; XmlAttributesHelper attributes(attrs, _communicator->getLogger(), _filename, line); try { if(name == "icegrid") { if(!_isTopLevel) { error("element is a top level element"); } _isTopLevel = false; } else if(_isTopLevel) { error("only the element is allowed at the top-level"); } else if(name == "target") { if(!_isCurrentTargetDeployable) { ++_targetCounter; } else { _isCurrentTargetDeployable = isTargetDeployable(attributes("name")); _targetCounter = 1; return; } } else if(!isCurrentTargetDeployable()) { // // We don't bother to parse the elements if the elements are enclosed in a target element // which won't be deployed. // attributes.asMap(); return; } else if(name == "include") { string targets = attributes("targets", ""); string file = attributes("file"); if(file[0] != '/') { string::size_type end = _filename.find_last_of('/'); if(end != string::npos) { file = _filename.substr(0, end) + "/" + file; } } string oldFileName = _filename; vector oldTargets = _targets; _isTopLevel = true; _filename = file; _targets = getTargets(targets); IceXML::Parser::parse(file, *this); _filename = oldFileName; _targets = oldTargets; } else if(name == "application") { if(_currentApplication.get()) { error("only one element is allowed"); } bool importTemplates = attributes.asBool("import-default-templates", false); // // TODO: is ignoring importTemplates the desired behavior when _admin == 0? // if(importTemplates && _admin != 0) { try { ApplicationDescriptor application = _admin->getDefaultApplicationDescriptor(); _currentApplication.reset(new ApplicationDescriptorBuilder(_communicator, application, attributes, _overrides)); } catch(const DeploymentException& ex) { throw ex.reason; } } else { _currentApplication.reset(new ApplicationDescriptorBuilder(_communicator, attributes, _overrides)); } } else if(name == "node") { if(!_currentApplication.get() || _currentNode.get()) { error("the element can only be a child of an element"); } _currentNode.reset(_currentApplication->createNode(attributes)); } else if(name == "server-instance") { if(!_currentNode.get() || _currentServer.get() || _currentServerInstance.get()) { error("the element can only be a child of a element"); } _currentServerInstance.reset(_currentNode->createServerInstance(attributes)); } else if(name == "server") { if((!_currentNode.get() && !_currentTemplate.get()) || _currentServer.get() || _currentServerInstance.get()) { error("the element can only be a child of a or element"); } if(_currentNode.get()) { _currentServer.reset(_currentNode->createServer(attributes)); } else { _currentServer.reset(_currentTemplate->createServer(attributes)); } _currentCommunicator = _currentServer.get(); } else if(name == "icebox") { if((!_currentNode.get() && !_currentTemplate.get()) || _currentServer.get() || _currentServerInstance.get()) { error("the element can only be a child of a or element"); } if(_currentNode.get()) { _currentServer.reset(_currentNode->createIceBox(attributes)); } else { _currentServer.reset(_currentTemplate->createIceBox(attributes)); } _currentCommunicator = _currentServer.get(); } else if(name == "server-template") { if(!_currentApplication.get() || _currentTemplate.get() || _currentNode.get()) { error("the element can only be a child of an element"); } _currentTemplate.reset(_currentApplication->createServerTemplate(attributes)); } else if(name == "service-instance") { if(!_currentServer.get() || _currentServiceInstance.get()) { error("the element can only be a child of an element"); } _currentServiceInstance.reset(_currentServer->createServiceInstance(attributes)); } else if(name == "service") { if((!_currentServer.get() && !_currentTemplate.get()) || _currentService.get() || _currentServiceInstance.get()) { error("the element can only be a child of an or element"); } if(_currentServer.get()) { _currentService.reset(_currentServer->createService(attributes)); } else { _currentService.reset(_currentTemplate->createService(attributes)); } _currentCommunicator = _currentService.get(); } else if(name == "service-template") { if(!_currentApplication.get() || _currentNode.get() || _currentTemplate.get()) { error("the element can only be a child of an element"); } _currentTemplate.reset(_currentApplication->createServiceTemplate(attributes)); } else if(name == "replica-group") { if(!_currentApplication.get()) { error("the element can only be a child of an element"); } _currentApplication->addReplicaGroup(attributes); _inReplicaGroup = true; } else if(name == "load-balancing") { if(!_inReplicaGroup) { error("the element can only be a child of a element"); } _currentApplication->setLoadBalancing(attributes); } else if(name == "variable") { if(_currentNode.get()) { _currentNode->addVariable(attributes); } else if(_currentApplication.get()) { _currentApplication->addVariable(attributes); } else { error("the element can only be a child of an or element"); } } else if(name == "parameter") { if(!_currentTemplate.get()) { error("the element can only be a child of a