RCFProto

- Main Page
- Classes
- Files

- File List

All Classes Functions Typedefs
IpServerTransport.hpp
1
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2013, Delta V Software. All rights reserved.
6 // http://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF
12 // under GPL terms.
13 //
14 // Version: 2.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18
19 #ifndef INCLUDE_RCF_IPSERVERTRANSPORT_HPP
20 #define INCLUDE_RCF_IPSERVERTRANSPORT_HPP
21
22 #include <string>
23 #include <vector>
24
25 #include <RCF/Export.hpp>
26 #include <RCF/IpAddress.hpp>
27 #include <RCF/ThreadLibrary.hpp>
28 #include <RCF/Tools.hpp>
29 #include <RCF/util/Platform/OS/BsdSockets.hpp>
30
31 namespace RCF {
32
33 // Ip and significant bits.
34 typedef std::pair<IpAddress, std::size_t> IpRule;
35
36 class RCF_EXPORT IpServerTransport
37 {
38 public:
39 IpServerTransport();
40 virtual ~IpServerTransport();
41
42 bool isIpAllowed(const IpAddress &ip) const;
43
44 void setAllowIps(
45 const std::vector<IpRule> &allowedIps);
46
47 void setDenyIps(
48 const std::vector<IpRule> &allowedIps);
49
50 std::vector<IpRule>
51 getAllowIps() const;
52
53 std::vector<IpRule>
54 getDenyIps() const;
55
56 virtual int getPort() const = 0;
57
58 private:
59
60 mutable ReadWriteMutex mReadWriteMutex;
61 std::vector<IpRule> mAllowedIps;
62 std::vector<IpRule> mDisallowedIps;
63 };
64
65 } // namespace RCF
66
67 #endif // ! INCLUDE_RCF_IPSERVERTRANSPORT_HPP