Kinetic C/C++ Client
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Pages
include
kinetic
byte_stream.h
1
/*
2
* kinetic-cpp-client
3
* Copyright (C) 2014 Seagate Technology.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program 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 General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
*
19
*/
20
21
#ifndef KINETIC_CPP_CLIENT_BYTE_STREAM_H_
22
#define KINETIC_CPP_CLIENT_BYTE_STREAM_H_
23
24
#include "openssl/ssl.h"
25
26
#include "common.h"
27
#include "incoming_value.h"
28
#include "outgoing_value.h"
29
30
namespace
kinetic
{
31
32
class
ByteStreamInterface
{
33
public
:
34
virtual
~
ByteStreamInterface
() {}
35
virtual
bool
Read(
void
*buf,
size_t
n) = 0;
36
virtual
bool
Write(
const
void
*buf,
size_t
n) = 0;
37
virtual
IncomingValueInterface
*ReadValue(
size_t
n) = 0;
38
virtual
bool
WriteValue(
const
OutgoingValueInterface
&value,
int
* err) = 0;
39
};
40
41
class
PlainByteStream
:
public
ByteStreamInterface
{
42
public
:
43
PlainByteStream
(
int
fd,
IncomingValueFactoryInterface
&value_factory);
44
bool
Read(
void
*buf,
size_t
n);
45
bool
Write(
const
void
*buf,
size_t
n);
46
IncomingValueInterface
*ReadValue(
size_t
n);
47
bool
WriteValue(
const
OutgoingValueInterface
&value,
int
* err);
48
49
private
:
50
int
fd_;
51
IncomingValueFactoryInterface
&value_factory_;
52
DISALLOW_COPY_AND_ASSIGN(
PlainByteStream
);
53
};
54
55
class
SslByteStream
:
public
ByteStreamInterface
{
56
public
:
57
explicit
SslByteStream
(SSL *ssl);
58
virtual
~
SslByteStream
();
59
bool
Read(
void
*buf,
size_t
n);
60
bool
Write(
const
void
*buf,
size_t
n);
61
IncomingValueInterface
*ReadValue(
size_t
n);
62
bool
WriteValue(
const
OutgoingValueInterface
&value,
int
* err);
63
64
private
:
65
SSL *ssl_;
66
DISALLOW_COPY_AND_ASSIGN(
SslByteStream
);
67
};
68
69
}
// namespace kinetic
70
71
#endif // KINETIC_CPP_CLIENT_BYTE_STREAM_H_
kinetic::ByteStreamInterface
Definition:
byte_stream.h:32
kinetic::SslByteStream
Definition:
byte_stream.h:55
kinetic::PlainByteStream
Definition:
byte_stream.h:41
kinetic::IncomingValueFactoryInterface
Definition:
incoming_value.h:84
kinetic::IncomingValueInterface
Definition:
incoming_value.h:35
kinetic
Definition:
blocking_smoketest.cc:26
kinetic::OutgoingValueInterface
Definition:
outgoing_value.h:30
Generated on Mon Mar 30 2015 08:24:47 for Kinetic C/C++ Client by
1.8.8