summaryrefslogtreecommitdiff
path: root/ACE/protocols/ace/INet/SSLSock_IOStream.h
blob: ad6df10810f15177ff4aee81382b9dafd1543223 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// $Id$

/**
 * @file SSLSock_IOStream.h
 *
 * @author Martin Corino <mcorino@remedy.nl>
 */

#ifndef ACE_IOS_SSLSOCK_IOSTREAM_H
#define ACE_IOS_SSLSOCK_IOSTREAM_H

#include /**/ "ace/pre.h"

#include /**/ "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/SSL/SSL_SOCK_Stream.h"
#include "ace/INet/BidirStreamBuffer.h"
#include "ace/INet/StreamHandler.h"
#include "ace/INet/StreamInterceptor.h"
#include <istream>
#include <ostream>

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE
  {
    namespace IOS
      {
        /**
        * @class ACE_IOS_SSLSock_StreamBuffer
        *
        * @brief
        *
        */
        template <ACE_SYNCH_DECL>
        class SSLSock_StreamBufferBase
          : public BidirStreamBuffer<StreamHandler<ACE_SSL_SOCK_Stream, ACE_SYNCH_USE> >
          {
            public:
              typedef StreamHandler<ACE_SSL_SOCK_Stream, ACE_SYNCH_USE> stream_type;

              SSLSock_StreamBufferBase (stream_type* stream);
              virtual ~SSLSock_StreamBufferBase ();

            private:
              enum
              {
                BUFFER_SIZE = 1024
              };
          };

        /**
        * @class ACE_IOS_SSLSock_IOS
        *
        * @brief
        *
        */
        template <ACE_SYNCH_DECL>
        class SSLSock_IOSBase
          : public virtual std::ios
          {
            public:
              typedef SSLSock_StreamBufferBase<ACE_SYNCH_USE> buffer_type;
              typedef typename buffer_type::stream_type stream_type;

              SSLSock_IOSBase (stream_type* stream);
              ~SSLSock_IOSBase ();

              buffer_type* rdbuf ();

              void close ();

              const stream_type& stream () const;

            protected:
              buffer_type streambuf_;
          };

        /**
        * @class ACE_IOS_SSLSock_OStream
        *
        * @brief
        *
        */
        template <ACE_SYNCH_DECL>
        class SSLSock_OStreamBase
          : public SSLSock_IOSBase<ACE_SYNCH_USE>, public std::ostream
          {
            public:
              typedef SSLSock_IOSBase<ACE_SYNCH_USE> ios_base;
              typedef typename ios_base::stream_type stream_type;
              typedef SSLSock_StreamBufferBase<ACE_SYNCH_USE> buffer_type;

              explicit SSLSock_OStreamBase(stream_type* stream);

              ~SSLSock_OStreamBase();

              void set_interceptor (typename buffer_type::interceptor_type& interceptor);
          };

        /**
        * @class ACE_IOS_SSLSock_IStream
        *
        * @brief
        *
        */
        template <ACE_SYNCH_DECL>
        class SSLSock_IStreamBase
          : public SSLSock_IOSBase<ACE_SYNCH_USE>, public std::istream
          {
            public:
              typedef SSLSock_IOSBase<ACE_SYNCH_USE> ios_base;
              typedef typename ios_base::stream_type stream_type;
              typedef SSLSock_StreamBufferBase<ACE_SYNCH_USE> buffer_type;

              explicit SSLSock_IStreamBase(stream_type* stream);

              ~SSLSock_IStreamBase();

              void set_interceptor (typename buffer_type::interceptor_type& interceptor);
          };

        /**
        * @class ACE_IOS_SSLSock_IOStream
        *
        * @brief
        *
        */
        template <ACE_SYNCH_DECL>
        class SSLSock_IOStreamBase
          : public SSLSock_IOSBase<ACE_SYNCH_USE>, public std::iostream
          {
            public:
              typedef SSLSock_IOSBase<ACE_SYNCH_USE> ios_base;
              typedef typename ios_base::stream_type stream_type;
              typedef SSLSock_StreamBufferBase<ACE_SYNCH_USE> buffer_type;

              explicit SSLSock_IOStreamBase(stream_type* stream);

              ~SSLSock_IOStreamBase();

              void set_interceptor (typename buffer_type::interceptor_type& interceptor);
          };

        typedef SSLSock_StreamBufferBase<ACE_NULL_SYNCH> SSLSock_StreamBuffer;
        typedef SSLSock_IOSBase<ACE_NULL_SYNCH> SSLSock_IOS;
        typedef SSLSock_IStreamBase<ACE_NULL_SYNCH> SSLSock_IStream;
        typedef SSLSock_OStreamBase<ACE_NULL_SYNCH> SSLSock_OStream;
        typedef SSLSock_IOStreamBase<ACE_NULL_SYNCH> SSLSock_IOStream;

      }
  }

ACE_END_VERSIONED_NAMESPACE_DECL

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/INet/SSLSock_IOStream.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("SSLSock_IOStream.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

#include /**/ "ace/post.h"
#endif /* ACE_IOS_SSLSOCK_IOSTREAM_H */