gloox
1.0.22
src
bytestream.h
1
/*
2
Copyright (c) 2006-2017 by Jakob Schröter <js@camaya.net>
3
This file is part of the gloox library. http://camaya.net/gloox
4
5
This software is distributed under a license. The full license
6
agreement can be found in the file LICENSE in this distribution.
7
This software may not be copied, modified, sold or distributed
8
other than expressed in the named license agreement.
9
10
This software is distributed without any warranty.
11
*/
12
13
14
#ifndef BYTESTREAM_H__
15
#define BYTESTREAM_H__
16
17
#include "jid.h"
18
#include "logsink.h"
19
20
#include <string>
21
22
namespace
gloox
23
{
24
25
class
BytestreamDataHandler;
26
36
class
GLOOX_API
Bytestream
37
{
38
public
:
42
enum
StreamType
43
{
44
S5B
,
45
IBB
46
};
47
56
Bytestream
(
StreamType
type,
LogSink
& logInstance,
const
JID
& initiator,
const
JID
& target,
57
const
std::string& sid )
58
: m_handler( 0 ), m_logInstance( logInstance ), m_initiator( initiator ), m_target( target ),
59
m_type( type ), m_sid( sid ), m_open( false )
60
{}
61
65
virtual
~Bytestream
() {}
66
72
bool
isOpen
()
const
{
return
m_open; }
73
83
virtual
bool
connect() = 0;
84
88
virtual
void
close() = 0;
89
99
virtual
bool
send(
const
std::string& data ) = 0;
100
108
virtual
ConnectionError
recv(
int
timeout = -1 ) = 0;
109
114
const
std::string&
sid
()
const
{
return
m_sid; }
115
120
StreamType
type
()
const
{
return
m_type; }
121
127
const
JID
&
target
()
const
{
return
m_target; }
128
134
const
JID
&
initiator
()
const
{
return
m_initiator; }
135
142
void
registerBytestreamDataHandler
(
BytestreamDataHandler
* bdh )
143
{ m_handler = bdh; }
144
148
void
removeBytestreamDataHandler
()
149
{ m_handler = 0; }
150
151
protected
:
153
BytestreamDataHandler
*
m_handler
;
154
156
const
LogSink
&
m_logInstance
;
157
159
const
JID
m_initiator
;
160
162
const
JID
m_target
;
163
165
StreamType
m_type
;
166
168
std::string
m_sid
;
169
171
bool
m_open
;
172
173
private
:
174
Bytestream
& operator=(
const
Bytestream
& );
175
176
};
177
178
}
179
180
#endif // BYTESTREAM_H__
gloox::Bytestream::~Bytestream
virtual ~Bytestream()
Definition:
bytestream.h:65
gloox::Bytestream::isOpen
bool isOpen() const
Definition:
bytestream.h:72
gloox::Bytestream::m_sid
std::string m_sid
Definition:
bytestream.h:168
gloox::Bytestream::sid
const std::string & sid() const
Definition:
bytestream.h:114
gloox::Bytestream::type
StreamType type() const
Definition:
bytestream.h:120
gloox::Bytestream::S5B
@ S5B
Definition:
bytestream.h:44
gloox::Bytestream::initiator
const JID & initiator() const
Definition:
bytestream.h:134
gloox::Bytestream::m_logInstance
const LogSink & m_logInstance
Definition:
bytestream.h:156
gloox::Bytestream::registerBytestreamDataHandler
void registerBytestreamDataHandler(BytestreamDataHandler *bdh)
Definition:
bytestream.h:142
gloox::Bytestream::m_open
bool m_open
Definition:
bytestream.h:171
gloox::Bytestream
An abstraction of a single bytestream.
Definition:
bytestream.h:36
gloox::LogSink
An implementation of log sink and source.
Definition:
logsink.h:38
gloox::JID
An abstraction of a JID.
Definition:
jid.h:30
gloox
The namespace for the gloox library.
Definition:
adhoc.cpp:27
gloox::Bytestream::Bytestream
Bytestream(StreamType type, LogSink &logInstance, const JID &initiator, const JID &target, const std::string &sid)
Definition:
bytestream.h:56
gloox::Bytestream::m_initiator
const JID m_initiator
Definition:
bytestream.h:159
gloox::Bytestream::StreamType
StreamType
Definition:
bytestream.h:42
gloox::Bytestream::m_handler
BytestreamDataHandler * m_handler
Definition:
bytestream.h:153
gloox::ConnectionError
ConnectionError
Definition:
gloox.h:683
gloox::Bytestream::removeBytestreamDataHandler
void removeBytestreamDataHandler()
Definition:
bytestream.h:148
gloox::Bytestream::m_target
const JID m_target
Definition:
bytestream.h:162
gloox::Bytestream::target
const JID & target() const
Definition:
bytestream.h:127
gloox::BytestreamDataHandler
A virtual interface that allows implementors to receive data sent over a SOCKS5 Bytestream as defined...
Definition:
bytestreamdatahandler.h:39
gloox::Bytestream::m_type
StreamType m_type
Definition:
bytestream.h:165
Generated on Mon Apr 25 2022 14:03:04 for gloox by
1.8.17