summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/SslFactory.h
blob: bb226619d6d23712dd5c962da4d987320b304cb3 (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
// **********************************************************************
//
// Copyright (c) 2001
// MutableRealms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************

#ifndef ICE_SSL_FACTORY_H
#define ICE_SSL_FACTORY_H

#include <string>
#include <map>
#include <JTC/JTC.h>
#include <Ice/SslSystem.h>

namespace IceSecurity
{

namespace Ssl
{

using std::string;
using std::map;

typedef map<string,System*> SystemMap;
typedef map<void*,System*> SslHandleSystemMap;

// This is defined as a class so as to ensure encapsulation.  We don't
// want just anybody creating System instances - when all this is moved
// out to a DLL/SO, we want to ensure that this vanilla interface is used
// to get whatever flavor of System the DLL/SO is designed to hand out.  As
// a result, different flavors of the Security Extension DLL/SO will have
// different definitions for getSystem().
class Factory
{

public:
    static System* getSystem(string&);
    static void releaseSystem(System*);

    static void addSystemHandle(void*, System*);
    static System* getSystemFromHandle(void*);
    static void releaseSystemFromHandle(void*, System*);

private:
    static SslHandleSystemMap _sslHandleSystemRepository;
    static SystemMap _systemRepository;
    static JTCMutex _systemRepositoryMutex;
};

}

}

#endif