RCFProto
 All Classes Functions Typedefs
Schannel.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_SCHANNEL_HPP
20 #define INCLUDE_RCF_SCHANNEL_HPP
21 
22 #include <RCF/Filter.hpp>
23 #include <RCF/SspiFilter.hpp>
24 #include <RCF/util/Tchar.hpp>
25 
26 #include <schnlsp.h>
27 
28 // missing stuff in mingw headers
29 #ifdef __MINGW32__
30 #ifndef SP_PROT_NONE
31 #define SP_PROT_NONE 0
32 #endif
33 #endif // __MINGW32__
34 
35 namespace RCF {
36 
37  static const ULONG DefaultSchannelContextRequirements =
38  ASC_REQ_SEQUENCE_DETECT |
39  ASC_REQ_REPLAY_DETECT |
40  ASC_REQ_CONFIDENTIALITY |
41  ASC_REQ_EXTENDED_ERROR |
42  ASC_REQ_ALLOCATE_MEMORY |
43  ASC_REQ_STREAM;
44 
45  class SchannelServerFilter : public SspiServerFilter
46  {
47  public:
48  SchannelServerFilter(
49  RcfServer & server,
50  DWORD enabledProtocols,
51  ULONG contextRequirements);
52 
53  int getFilterId() const;
54  };
55 
56  class SchannelFilterFactory : public FilterFactory
57  {
58  public:
59 
60  SchannelFilterFactory(
61  DWORD enabledProtocols = SP_PROT_TLS1_2_SERVER,
62  ULONG contextRequirements = DefaultSchannelContextRequirements);
63 
64  FilterPtr createFilter(RcfServer & server);
65  int getFilterId();
66 
67  private:
68 
69  ULONG mContextRequirements;
70  DWORD mEnabledProtocols;
71  };
72 
73  class SchannelClientFilter : public SspiClientFilter
74  {
75  public:
76  SchannelClientFilter(
77  ClientStub * pClientStub,
78  DWORD enabledProtocols = SP_PROT_TLS1_2_CLIENT | SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_0_CLIENT,
79  ULONG contextRequirements = DefaultSchannelContextRequirements);
80 
81  int getFilterId() const;
82  };
83 
84  typedef SchannelClientFilter SchannelFilter;
85 
86 } // namespace RCF
87 
88 #endif // ! INCLUDE_RCF_SCHANNEL_HPP