summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/SslSystem.h
blob: 9fd62fa01ff49e01a1946e628eb9a30a7f71df62 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// **********************************************************************
//
// Copyright (c) 2001
// MutableRealms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************


#ifndef ICE_SSL_SYSTEM_H
#define ICE_SSL_SYSTEM_H

#include <string>
#include <Ice/SslConnection.h>
#include <Ice/Properties.h>

namespace IceSecurity
{

namespace Ssl
{

using std::string;
using Ice::LoggerPtr;
using Ice::PropertiesPtr;

class Factory;

// TODO: Can we derive this from Shared?  How hard would that be?

class System
{

public:
    inline string getSystemID() const { return _systemID; };

    virtual bool isConfigLoaded() = 0;
    virtual void loadConfig() = 0;
    virtual void shutdown() = 0;

    virtual Connection* createServerConnection(int) = 0;
    virtual Connection* createClientConnection(int) = 0;

    void setTrace(TraceLevelsPtr traceLevels) { _traceLevels = traceLevels; };
    bool isTraceSet() const { return (_traceLevels == 0 ? false : true); };

    void setLogger(LoggerPtr traceLevels) { _logger = traceLevels; };
    bool isLoggerSet() const { return (_logger == 0 ? false : true); };

    void setProperties(PropertiesPtr properties) { _properties = properties; };
    bool isPropertiesSet() const { return (_properties == 0 ? false : true); };

protected:

    System(string&);
    virtual ~System();

    // Reference counting.
    inline void incRef() { _refCount++; };
    inline bool decRef() { return (--_refCount ? true : false); };

    string _systemID;
    int _refCount;

    TraceLevelsPtr _traceLevels;
    LoggerPtr _logger;
    PropertiesPtr _properties;

friend class Factory;

};

}

}

#endif