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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
#ifndef TEST_API_EXPORTS
# define TEST_API_EXPORTS
#endif
#include <Ice/Initialize.h>
#include <Ice/ProtocolPluginFacade.h>
#include <Ice/EndpointFactoryManager.h>
#include <PluginI.h>
#include <EndpointFactory.h>
using namespace std;
class TestPluginI : public PluginI
{
public:
TestPluginI(const Ice::CommunicatorPtr&);
virtual void initialize();
virtual void destroy();
virtual ConfigurationPtr getConfiguration();
private:
const Ice::CommunicatorPtr _communicator;
const ConfigurationPtr _configuration;
};
//
// Plugin factory function.
//
extern "C"
{
ICE_DECLSPEC_EXPORT Ice::Plugin*
createTestTransport(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&)
{
return new TestPluginI(communicator);
}
}
TestPluginI::TestPluginI(const Ice::CommunicatorPtr& communicator) :
_communicator(communicator),
_configuration(new Configuration())
{
}
void
TestPluginI::initialize()
{
IceInternal::ProtocolPluginFacadePtr facade = IceInternal::getProtocolPluginFacade(_communicator);
for(Ice::Short s = 0; s < 100; ++s)
{
IceInternal::EndpointFactoryPtr factory = facade->getEndpointFactory(s);
if(factory)
{
facade->addEndpointFactory(new EndpointFactory(factory));
}
}
for(Ice::Short s = 1000; s < 1010; ++s)
{
IceInternal::EndpointFactoryPtr factory = facade->getEndpointFactory(s);
if(factory)
{
facade->addEndpointFactory(new EndpointFactory(factory));
}
}
for(Ice::Short s = 10000; s < 10010; ++s)
{
IceInternal::EndpointFactoryPtr factory = facade->getEndpointFactory(s);
if(factory)
{
facade->addEndpointFactory(new EndpointFactory(factory));
}
}
}
void
TestPluginI::destroy()
{
}
ConfigurationPtr
TestPluginI::getConfiguration()
{
return _configuration;
}
|