Alexandre Lision | ddd731e | 2014-01-31 11:50:08 -0500 | [diff] [blame] | 1 | // 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 | |
| 20 | #if defined(OLD_STDCPP) || defined(NEW_STDCPP) |
| 21 | |
| 22 | sstream::sstream(secure::client_t context) : |
| 23 | tcpstream() |
| 24 | { |
| 25 | ssl = NULL; |
| 26 | bio = NULL; |
| 27 | server = false; |
| 28 | } |
| 29 | |
| 30 | sstream::sstream(const TCPServer *tcp, secure::server_t context, size_t size) : |
| 31 | tcpstream(tcp, size) |
| 32 | { |
| 33 | ssl = NULL; |
| 34 | bio = NULL; |
| 35 | server = true; |
| 36 | } |
| 37 | |
| 38 | sstream::~sstream() |
| 39 | { |
| 40 | } |
| 41 | |
| 42 | void sstream::open(const char *host, const char *service, size_t bufsize) |
| 43 | { |
| 44 | if(server) |
| 45 | return; |
| 46 | |
| 47 | tcpstream::open(host, service, bufsize); |
| 48 | } |
| 49 | |
| 50 | void sstream::close(void) |
| 51 | { |
| 52 | if(server) |
| 53 | return; |
| 54 | |
| 55 | tcpstream::close(); |
| 56 | } |
| 57 | |
| 58 | void sstream::release(void) |
| 59 | { |
| 60 | tcpstream::close(); |
| 61 | } |
| 62 | |
| 63 | ssize_t sstream::_write(const char *address, size_t size) |
| 64 | { |
| 65 | return tcpstream::_write(address, size); |
| 66 | } |
| 67 | |
| 68 | ssize_t sstream::_read(char *address, size_t size) |
| 69 | { |
| 70 | return tcpstream::_read(address, size); |
| 71 | } |
| 72 | |
| 73 | bool sstream::_wait(void) |
| 74 | { |
| 75 | return tcpstream::_wait(); |
| 76 | } |
| 77 | |
| 78 | int sstream::sync() |
| 79 | { |
| 80 | return tcpstream::sync(); |
| 81 | } |
| 82 | |
| 83 | #endif |