summaryrefslogtreecommitdiff
path: root/cs/src/IceSSL/PluginI.cs
blob: 5ab9490c75d0f469ee6ea2decafae6477a8fd4d0 (plain)
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
// **********************************************************************
//
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

using System.Security.Cryptography.X509Certificates;

namespace IceSSL
{
    public sealed class PluginFactory : Ice.PluginFactory
    {
	public Ice.Plugin
	create(Ice.Communicator communicator, string name, string[] args)
	{
	    if(communicator.getProperties().getPropertyAsInt("Ice.ThreadPerConnection") == 0)
	    {
		communicator.getLogger().error("IceSSL requires Ice.ThreadPerConnection=1");
		return null;
	    }

	    return new PluginI(communicator);
	}
    }

    public sealed class PluginI : Plugin
    {
	public
	PluginI(Ice.Communicator communicator)
	{
	    instance_ = new Instance(communicator);
	}

	public override void initialize()
	{
	    instance_.initialize();
	}

	public override void
	destroy()
	{
	}

	public override void setCertificates(X509Certificate2Collection certs)
	{
	    instance_.setCertificates(certs);
	}

	public override void setCertificateVerifier(CertificateVerifier verifier)
	{
	    instance_.setCertificateVerifier(verifier);
	}

	private Instance instance_;
    }
}