blob: 99ef3b17ee0270602c75cf49b3f4cfa349871f03 [file] [log] [blame]
Alexandre Lisionddd731e2014-01-31 11:50:08 -05001// Copyright (C) 2010 David Sugar, Tycho Softworks.
2//
3// This file is part of GNU uCommon C++.
4//
5// GNU uCommon C++ is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published
7// by the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// GNU uCommon C++ is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.
17
18#include "local.h"
19
20SSLBuffer::SSLBuffer(secure::client_t context) :
21TCPBuffer()
22{
23 ssl = NULL;
24 bio = NULL;
25 server = false;
26}
27
28SSLBuffer::SSLBuffer(const TCPServer *tcp, secure::server_t context, size_t size) :
29TCPBuffer(tcp, size)
30{
31 ssl = NULL;
32 bio = NULL;
33 server = true;
34}
35
36
37SSLBuffer::~SSLBuffer()
38{
39}
40
41void SSLBuffer::open(const char *host, const char *service, size_t bufsize)
42{
43 if(server) {
44 ioerr = EBADF;
45 return;
46 }
47
48 TCPBuffer::open(host, service, bufsize);
49}
50
51void SSLBuffer::close(void)
52{
53 if(server) {
54 ioerr = EBADF;
55 return;
56 }
57
58 TCPBuffer::close();
59}
60
61void SSLBuffer::release(void)
62{
63 TCPBuffer::close();
64}
65
66size_t SSLBuffer::_push(const char *address, size_t size)
67{
68 return TCPBuffer::_push(address, size);
69}
70
71size_t SSLBuffer::_pull(char *address, size_t size)
72{
73 return TCPBuffer::_pull(address, size);
74}
75
76bool SSLBuffer::_pending(void)
77{
78 return TCPBuffer::_pending();
79}
80
81bool SSLBuffer::_flush(void)
82{
83 return TCPBuffer::_flush();
84}
85