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

#ifndef ICE_SSL_GENERAL_CONFIG_H
#define ICE_SSL_GENERAL_CONFIG_H

#include <Ice/SslSystemOpenSSL.h>
#include <string>

namespace IceSecurity
{

namespace Ssl
{

using std::string;
using std::ostream;

class GeneralConfig
{

public:
    GeneralConfig();

    inline SslProtocol getProtocol() const { return _sslVersion; };
    inline int getVerifyMode() const { return _verifyMode; };
    inline int getVerifyDepth() const { return _verifyDepth; };

    inline string getContext() const { return _context; };
    inline string getCipherList() const { return _cipherList; };
    inline string getRandomBytesFiles() const { return _randomBytesFiles; };

    // General method - it will figure out how to properly parse the data.
    void set(string&, string&);

protected:

    SslProtocol _sslVersion;

    int _verifyMode;
    int _verifyDepth;

    string _context;
    string _cipherList;
    string _randomBytesFiles;

    void parseVersion(string&);
    void parseVerifyMode(string&);
};

template<class Stream> inline
Stream& operator << (Stream& target, const GeneralConfig& generalConfig)
{
    target << "Protocol:     " << generalConfig.getProtocol() << endl;
    target << "Verify Mode:  " << generalConfig.getVerifyMode() << endl;
    target << "Verify Depth: " << generalConfig.getVerifyDepth() << endl;
    target << "Context:      " << generalConfig.getContext() << endl;
    target << "Cipher List:  " << generalConfig.getCipherList() << endl;
    target << "Random Bytes: " << generalConfig.getRandomBytesFiles() << endl;

    return target;
}

}

}

#endif