summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/SslSystem.h
blob: d464aea4db2be5dea5680488ba87e302a255274b (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?
// TODO: <ml>Absolutely. Please do not add yet another reference counting mechanism.</ml>

class System
{
public:

    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; };

    void setLogger(LoggerPtr traceLevels) { _logger = traceLevels; };
    bool isLoggerSet() const { return _logger; };

    void setProperties(PropertiesPtr properties) { _properties = properties; };
    bool isPropertiesSet() const { return _properties; };

protected:

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

    // Reference counting.
    // TODO: Remove this, use IceUtil::Shared or Ice::Shared.
    void incRef() { _refCount++; };
    bool decRef() { return (--_refCount ? true : false); };

    string _systemID;
    int _refCount;

    TraceLevelsPtr _traceLevels;
    LoggerPtr _logger;
    PropertiesPtr _properties;
    
    friend class Factory;
};

}

}

#endif