Wolframe, 0.0.3

serverEndpoint.hpp
Go to the documentation of this file.
1 /************************************************************************
2 
3  Copyright (C) 2011 - 2014 Project Wolframe.
4  All rights reserved.
5 
6  This file is part of Project Wolframe.
7 
8  Commercial Usage
9  Licensees holding valid Project Wolframe Commercial licenses may
10  use this file in accordance with the Project Wolframe
11  Commercial License Agreement provided with the Software or,
12  alternatively, in accordance with the terms contained
13  in a written agreement between the licensee and Project Wolframe.
14 
15  GNU General Public License Usage
16  Alternatively, you can redistribute this file and/or modify it
17  under the terms of the GNU General Public License as published by
18  the Free Software Foundation, either version 3 of the License, or
19  (at your option) any later version.
20 
21  Wolframe is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  GNU General Public License for more details.
25 
26  You should have received a copy of the GNU General Public License
27  along with Wolframe. If not, see <http://www.gnu.org/licenses/>.
28 
29  If you have questions regarding the use of this file, please contact
30  Project Wolframe.
31 
32 ************************************************************************/
35 
36 #ifndef _SERVER_ENDPOINT_HPP_INCLUDED
37 #define _SERVER_ENDPOINT_HPP_INCLUDED
38 
39 #include <string>
42 
43 namespace _Wolframe {
44 namespace net {
45 
48  {
49  public:
50  ServerTCPendpoint( const std::string& Host, unsigned short Port,
51  unsigned short maxConn,
52  const LocalEndpointConfig& Config,
53  const types::AddressRestriction& AddressRestriction)
54  : LocalTCPendpoint( Host, Port, Config ),
55  m_maxConn( maxConn ),
56  m_addressRestriction( AddressRestriction ) {}
57 
58  unsigned short maxConnections() const { return m_maxConn; }
60 
61  private:
62  const std::string m_identifier;
63  const unsigned short m_maxConn;
65  };
66 
67 
68 #ifdef WITH_SSL
69  class ServerSSLendpoint : public LocalSSLendpoint
71  {
72  friend class server;
73  public:
74  ServerSSLendpoint( const std::string& Host, unsigned short Port,
75  unsigned short maxConn,
76  const LocalEndpointConfig& Config,
77  const types::AddressRestriction& addressRestriction_,
78  const std::string& Certificate, const std::string& Key,
79  bool verify, const std::string& CAdir, const std::string& CAchainFile )
80  : LocalSSLendpoint( Host, Port, Config ),
81  m_maxConn( maxConn ),
82  m_addressRestriction( addressRestriction_ )
83  {
84  m_cert = Certificate;
85  m_key = Key;
86  m_verify = verify;
87  m_CAdir = CAdir;
88  m_CAchain = CAchainFile;
89  }
90 
91  const types::AddressRestriction& addressRestriction() const { return m_addressRestriction; }
92  unsigned short maxConnections() const { return m_maxConn; }
93  const std::string& certificate() const { return m_cert; }
94  const std::string& key() const { return m_key; }
95  const std::string& CAdirectory() const { return m_CAdir; }
96  const std::string& CAchain() const { return m_CAchain; }
97  bool verifyClientCert() const { return m_verify; }
98 
99  void setAbsolutePath( const std::string& referencePath );
100 
101  private:
102  const std::string m_identifier;
103  const unsigned short m_maxConn;
104  types::AddressRestriction m_addressRestriction;
105  std::string m_cert;
106  std::string m_key;
107  std::string m_CAdir;
108  std::string m_CAchain;
109  bool m_verify;
110  };
111 #endif // WITH_SSL
112 
113 }} // namespace _Wolframe::net
114 
115 #endif // _SERVER_ENDPOINT_HPP_INCLUDED
Structure to define and check configured ip based authorization.
Definition: addressRestriction.hpp:47
No encryption server endpoint.
Definition: serverEndpoint.hpp:47
const types::AddressRestriction & addressRestriction() const
Definition: serverEndpoint.hpp:59
Interface for a map for configured ip based authorization checks.
Classes for network endpoints.
Local connection endpoint configuration for authorization, connection based timeout, etc.
Definition: connectionEndpoint.hpp:94
unsigned short maxConnections() const
Definition: serverEndpoint.hpp:58
Local unencrypted endpoint.
Definition: connectionEndpoint.hpp:167
const unsigned short m_maxConn
Definition: serverEndpoint.hpp:63
types::AddressRestriction m_addressRestriction
Definition: serverEndpoint.hpp:64
const std::string m_identifier
Definition: serverEndpoint.hpp:62
ServerTCPendpoint(const std::string &Host, unsigned short Port, unsigned short maxConn, const LocalEndpointConfig &Config, const types::AddressRestriction &AddressRestriction)
Definition: serverEndpoint.hpp:50