1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

substitute all TAB with 4spaces.

This commit is contained in:
winlin 2014-03-18 11:32:58 +08:00
parent e5770b10b1
commit c85dde7f3f
64 changed files with 14105 additions and 14105 deletions

View file

@ -46,46 +46,46 @@ SrsBuffer::~SrsBuffer()
int SrsBuffer::size()
{
return (int)data.size();
return (int)data.size();
}
char* SrsBuffer::bytes()
{
return &data.at(0);
return &data.at(0);
}
void SrsBuffer::erase(int size)
{
data.erase(data.begin(), data.begin() + size);
data.erase(data.begin(), data.begin() + size);
}
void SrsBuffer::append(char* bytes, int size)
{
data.insert(data.end(), bytes, bytes + size);
data.insert(data.end(), bytes, bytes + size);
}
int SrsBuffer::ensure_buffer_bytes(ISrsBufferReader* skt, int required_size)
{
int ret = ERROR_SUCCESS;
int ret = ERROR_SUCCESS;
if (required_size < 0) {
ret = ERROR_SYSTEM_SIZE_NEGATIVE;
srs_error("size is negative. size=%d, ret=%d", required_size, ret);
return ret;
}
if (required_size < 0) {
ret = ERROR_SYSTEM_SIZE_NEGATIVE;
srs_error("size is negative. size=%d, ret=%d", required_size, ret);
return ret;
}
while (size() < required_size) {
char buffer[SOCKET_READ_SIZE];
ssize_t nread;
if ((ret = skt->read(buffer, SOCKET_READ_SIZE, &nread)) != ERROR_SUCCESS) {
return ret;
}
srs_assert((int)nread > 0);
append(buffer, (int)nread);
}
return ret;
while (size() < required_size) {
char buffer[SOCKET_READ_SIZE];
ssize_t nread;
if ((ret = skt->read(buffer, SOCKET_READ_SIZE, &nread)) != ERROR_SUCCESS) {
return ret;
}
srs_assert((int)nread > 0);
append(buffer, (int)nread);
}
return ret;
}

View file

@ -38,8 +38,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class ISrsBufferReader
{
public:
ISrsBufferReader();
virtual ~ISrsBufferReader();
ISrsBufferReader();
virtual ~ISrsBufferReader();
// for protocol/amf0/msg-codec
public:
virtual int read(const void* buf, size_t size, ssize_t* nread) = 0;
@ -53,18 +53,18 @@ public:
class SrsBuffer
{
private:
std::vector<char> data;
std::vector<char> data;
public:
SrsBuffer();
virtual ~SrsBuffer();
SrsBuffer();
virtual ~SrsBuffer();
public:
virtual int size();
virtual char* bytes();
virtual void erase(int size);
virtual int size();
virtual char* bytes();
virtual void erase(int size);
private:
virtual void append(char* bytes, int size);
virtual void append(char* bytes, int size);
public:
virtual int ensure_buffer_bytes(ISrsBufferReader* skt, int required_size);
virtual int ensure_buffer_bytes(ISrsBufferReader* skt, int required_size);
};
#endif

View file

@ -25,13 +25,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
bool srs_is_system_control_error(int error_code)
{
return error_code == ERROR_CONTROL_RTMP_CLOSE
|| error_code == ERROR_CONTROL_REPUBLISH;
return error_code == ERROR_CONTROL_RTMP_CLOSE
|| error_code == ERROR_CONTROL_REPUBLISH;
}
bool srs_is_client_gracefully_close(int error_code)
{
return error_code == ERROR_SOCKET_READ
|| error_code == ERROR_SOCKET_READ_FULLY
|| error_code == ERROR_SOCKET_WRITE;
return error_code == ERROR_SOCKET_READ
|| error_code == ERROR_SOCKET_READ_FULLY
|| error_code == ERROR_SOCKET_WRITE;
}

View file

@ -30,133 +30,133 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp>
#define ERROR_SUCCESS 0
#define ERROR_SUCCESS 0
#define ERROR_ST_SET_EPOLL 100
#define ERROR_ST_INITIALIZE 101
#define ERROR_ST_OPEN_SOCKET 102
#define ERROR_ST_CREATE_LISTEN_THREAD 103
#define ERROR_ST_CREATE_CYCLE_THREAD 104
#define ERROR_ST_CONNECT 105
#define ERROR_ST_SET_EPOLL 100
#define ERROR_ST_INITIALIZE 101
#define ERROR_ST_OPEN_SOCKET 102
#define ERROR_ST_CREATE_LISTEN_THREAD 103
#define ERROR_ST_CREATE_CYCLE_THREAD 104
#define ERROR_ST_CONNECT 105
#define ERROR_SOCKET_CREATE 200
#define ERROR_SOCKET_SETREUSE 201
#define ERROR_SOCKET_BIND 202
#define ERROR_SOCKET_LISTEN 203
#define ERROR_SOCKET_CLOSED 204
#define ERROR_SOCKET_GET_PEER_NAME 205
#define ERROR_SOCKET_GET_PEER_IP 206
#define ERROR_SOCKET_READ 207
#define ERROR_SOCKET_READ_FULLY 208
#define ERROR_SOCKET_WRITE 209
#define ERROR_SOCKET_WAIT 210
#define ERROR_SOCKET_TIMEOUT 211
#define ERROR_SOCKET_CREATE 200
#define ERROR_SOCKET_SETREUSE 201
#define ERROR_SOCKET_BIND 202
#define ERROR_SOCKET_LISTEN 203
#define ERROR_SOCKET_CLOSED 204
#define ERROR_SOCKET_GET_PEER_NAME 205
#define ERROR_SOCKET_GET_PEER_IP 206
#define ERROR_SOCKET_READ 207
#define ERROR_SOCKET_READ_FULLY 208
#define ERROR_SOCKET_WRITE 209
#define ERROR_SOCKET_WAIT 210
#define ERROR_SOCKET_TIMEOUT 211
#define ERROR_SOCKET_GET_LOCAL_IP 212
#define ERROR_RTMP_PLAIN_REQUIRED 300
#define ERROR_RTMP_CHUNK_START 301
#define ERROR_RTMP_MSG_INVLIAD_SIZE 302
#define ERROR_RTMP_AMF0_DECODE 303
#define ERROR_RTMP_AMF0_INVALID 304
#define ERROR_RTMP_REQ_CONNECT 305
#define ERROR_RTMP_REQ_TCURL 306
#define ERROR_RTMP_MESSAGE_DECODE 307
#define ERROR_RTMP_MESSAGE_ENCODE 308
#define ERROR_RTMP_AMF0_ENCODE 309
#define ERROR_RTMP_CHUNK_SIZE 310
#define ERROR_RTMP_TRY_SIMPLE_HS 311
#define ERROR_RTMP_CH_SCHEMA 312
#define ERROR_RTMP_PACKET_SIZE 313
#define ERROR_RTMP_VHOST_NOT_FOUND 314
#define ERROR_RTMP_ACCESS_DENIED 315
#define ERROR_RTMP_HANDSHAKE 316
#define ERROR_RTMP_NO_REQUEST 317
#define ERROR_RTMP_PLAIN_REQUIRED 300
#define ERROR_RTMP_CHUNK_START 301
#define ERROR_RTMP_MSG_INVLIAD_SIZE 302
#define ERROR_RTMP_AMF0_DECODE 303
#define ERROR_RTMP_AMF0_INVALID 304
#define ERROR_RTMP_REQ_CONNECT 305
#define ERROR_RTMP_REQ_TCURL 306
#define ERROR_RTMP_MESSAGE_DECODE 307
#define ERROR_RTMP_MESSAGE_ENCODE 308
#define ERROR_RTMP_AMF0_ENCODE 309
#define ERROR_RTMP_CHUNK_SIZE 310
#define ERROR_RTMP_TRY_SIMPLE_HS 311
#define ERROR_RTMP_CH_SCHEMA 312
#define ERROR_RTMP_PACKET_SIZE 313
#define ERROR_RTMP_VHOST_NOT_FOUND 314
#define ERROR_RTMP_ACCESS_DENIED 315
#define ERROR_RTMP_HANDSHAKE 316
#define ERROR_RTMP_NO_REQUEST 317
// if user use complex handshake, but without ssl,
// 1. srs is ok, ignore and turn to simple handshake.
// 2. srs-librtmp return error, to terminate the program.
#define ERROR_RTMP_HS_SSL_REQUIRE 318
#define ERROR_RTMP_HS_SSL_REQUIRE 318
#define ERROR_SYSTEM_STREAM_INIT 400
#define ERROR_SYSTEM_PACKET_INVALID 401
#define ERROR_SYSTEM_CLIENT_INVALID 402
#define ERROR_SYSTEM_ASSERT_FAILED 403
#define ERROR_SYSTEM_SIZE_NEGATIVE 404
#define ERROR_SYSTEM_CONFIG_INVALID 405
#define ERROR_SYSTEM_CONFIG_DIRECTIVE 406
#define ERROR_SYSTEM_CONFIG_BLOCK_START 407
#define ERROR_SYSTEM_CONFIG_BLOCK_END 408
#define ERROR_SYSTEM_CONFIG_EOF 409
#define ERROR_SYSTEM_STREAM_BUSY 410
#define ERROR_SYSTEM_IP_INVALID 411
#define ERROR_SYSTEM_FORWARD_LOOP 412
#define ERROR_SYSTEM_WAITPID 413
#define ERROR_SYSTEM_BANDWIDTH_KEY 414
#define ERROR_SYSTEM_BANDWIDTH_DENIED 415
#define ERROR_SYSTEM_STREAM_INIT 400
#define ERROR_SYSTEM_PACKET_INVALID 401
#define ERROR_SYSTEM_CLIENT_INVALID 402
#define ERROR_SYSTEM_ASSERT_FAILED 403
#define ERROR_SYSTEM_SIZE_NEGATIVE 404
#define ERROR_SYSTEM_CONFIG_INVALID 405
#define ERROR_SYSTEM_CONFIG_DIRECTIVE 406
#define ERROR_SYSTEM_CONFIG_BLOCK_START 407
#define ERROR_SYSTEM_CONFIG_BLOCK_END 408
#define ERROR_SYSTEM_CONFIG_EOF 409
#define ERROR_SYSTEM_STREAM_BUSY 410
#define ERROR_SYSTEM_IP_INVALID 411
#define ERROR_SYSTEM_FORWARD_LOOP 412
#define ERROR_SYSTEM_WAITPID 413
#define ERROR_SYSTEM_BANDWIDTH_KEY 414
#define ERROR_SYSTEM_BANDWIDTH_DENIED 415
// see librtmp.
// failed when open ssl create the dh
#define ERROR_OpenSslCreateDH 500
#define ERROR_OpenSslCreateDH 500
// failed when open ssl create the Private key.
#define ERROR_OpenSslCreateP 501
#define ERROR_OpenSslCreateP 501
// when open ssl create G.
#define ERROR_OpenSslCreateG 502
#define ERROR_OpenSslCreateG 502
// when open ssl parse P1024
#define ERROR_OpenSslParseP1024 503
#define ERROR_OpenSslParseP1024 503
// when open ssl set G
#define ERROR_OpenSslSetG 504
#define ERROR_OpenSslSetG 504
// when open ssl generate DHKeys
#define ERROR_OpenSslGenerateDHKeys 505
#define ERROR_OpenSslGenerateDHKeys 505
// when open ssl share key already computed.
#define ERROR_OpenSslShareKeyComputed 506
#define ERROR_OpenSslShareKeyComputed 506
// when open ssl get shared key size.
#define ERROR_OpenSslGetSharedKeySize 507
#define ERROR_OpenSslGetSharedKeySize 507
// when open ssl get peer public key.
#define ERROR_OpenSslGetPeerPublicKey 508
#define ERROR_OpenSslGetPeerPublicKey 508
// when open ssl compute shared key.
#define ERROR_OpenSslComputeSharedKey 509
#define ERROR_OpenSslComputeSharedKey 509
// when open ssl is invalid DH state.
#define ERROR_OpenSslInvalidDHState 510
#define ERROR_OpenSslInvalidDHState 510
// when open ssl copy key
#define ERROR_OpenSslCopyKey 511
#define ERROR_OpenSslCopyKey 511
// when open ssl sha256 digest key invalid size.
#define ERROR_OpenSslSha256DigestSize 512
#define ERROR_OpenSslSha256DigestSize 512
#define ERROR_HLS_METADATA 600
#define ERROR_HLS_DECODE_ERROR 601
#define ERROR_HLS_CREATE_DIR 602
#define ERROR_HLS_OPEN_FAILED 603
#define ERROR_HLS_WRITE_FAILED 604
#define ERROR_HLS_AAC_FRAME_LENGTH 605
#define ERROR_HLS_AVC_SAMPLE_SIZE 606
#define ERROR_HLS_METADATA 600
#define ERROR_HLS_DECODE_ERROR 601
#define ERROR_HLS_CREATE_DIR 602
#define ERROR_HLS_OPEN_FAILED 603
#define ERROR_HLS_WRITE_FAILED 604
#define ERROR_HLS_AAC_FRAME_LENGTH 605
#define ERROR_HLS_AVC_SAMPLE_SIZE 606
#define ERROR_ENCODER_VCODEC 700
#define ERROR_ENCODER_OUTPUT 701
#define ERROR_ENCODER_ACHANNELS 702
#define ERROR_ENCODER_ASAMPLE_RATE 703
#define ERROR_ENCODER_ABITRATE 704
#define ERROR_ENCODER_ACODEC 705
#define ERROR_ENCODER_VPRESET 706
#define ERROR_ENCODER_VPROFILE 707
#define ERROR_ENCODER_VTHREADS 708
#define ERROR_ENCODER_VHEIGHT 709
#define ERROR_ENCODER_VWIDTH 710
#define ERROR_ENCODER_VFPS 711
#define ERROR_ENCODER_VBITRATE 712
#define ERROR_ENCODER_FORK 713
#define ERROR_ENCODER_LOOP 714
#define ERROR_ENCODER_OPEN 715
#define ERROR_ENCODER_DUP2 716
#define ERROR_ENCODER_VCODEC 700
#define ERROR_ENCODER_OUTPUT 701
#define ERROR_ENCODER_ACHANNELS 702
#define ERROR_ENCODER_ASAMPLE_RATE 703
#define ERROR_ENCODER_ABITRATE 704
#define ERROR_ENCODER_ACODEC 705
#define ERROR_ENCODER_VPRESET 706
#define ERROR_ENCODER_VPROFILE 707
#define ERROR_ENCODER_VTHREADS 708
#define ERROR_ENCODER_VHEIGHT 709
#define ERROR_ENCODER_VWIDTH 710
#define ERROR_ENCODER_VFPS 711
#define ERROR_ENCODER_VBITRATE 712
#define ERROR_ENCODER_FORK 713
#define ERROR_ENCODER_LOOP 714
#define ERROR_ENCODER_OPEN 715
#define ERROR_ENCODER_DUP2 716
#define ERROR_HTTP_PARSE_URI 800
#define ERROR_HTTP_DATA_INVLIAD 801
#define ERROR_HTTP_PARSE_HEADER 802
#define ERROR_HTTP_PARSE_URI 800
#define ERROR_HTTP_DATA_INVLIAD 801
#define ERROR_HTTP_PARSE_HEADER 802
// system control message,
// not an error, but special control logic.
// sys ctl: rtmp close stream, support replay.
#define ERROR_CONTROL_RTMP_CLOSE 900
#define ERROR_CONTROL_RTMP_CLOSE 900
// FMLE stop publish and republish.
#define ERROR_CONTROL_REPUBLISH 901
#define ERROR_CONTROL_REPUBLISH 901
/**
* whether the error code is an system control error.

View file

@ -65,6 +65,6 @@ void ISrsThreadContext::generate_id()
int ISrsThreadContext::get_id()
{
return 0;
return 0;
}

View file

@ -110,16 +110,16 @@ extern ISrsThreadContext* _srs_context;
#endif
#if 1
#undef srs_verbose
#define srs_verbose(msg, ...) (void)0
#undef srs_verbose
#define srs_verbose(msg, ...) (void)0
#endif
#if 1
#undef srs_info
#define srs_info(msg, ...) (void)0
#undef srs_info
#define srs_info(msg, ...) (void)0
#endif
#if 0
#undef srs_trace
#define srs_trace(msg, ...) (void)0
#undef srs_trace
#define srs_trace(msg, ...) (void)0
#endif
#endif

View file

@ -28,8 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SrsStream::SrsStream()
{
p = bytes = NULL;
size = 0;
p = bytes = NULL;
size = 0;
}
SrsStream::~SrsStream()
@ -38,113 +38,113 @@ SrsStream::~SrsStream()
int SrsStream::initialize(char* _bytes, int _size)
{
int ret = ERROR_SUCCESS;
if (!_bytes) {
ret = ERROR_SYSTEM_STREAM_INIT;
srs_error("stream param bytes must not be NULL. ret=%d", ret);
return ret;
}
if (_size <= 0) {
ret = ERROR_SYSTEM_STREAM_INIT;
srs_error("stream param size must be positive. ret=%d", ret);
return ret;
}
int ret = ERROR_SUCCESS;
if (!_bytes) {
ret = ERROR_SYSTEM_STREAM_INIT;
srs_error("stream param bytes must not be NULL. ret=%d", ret);
return ret;
}
if (_size <= 0) {
ret = ERROR_SYSTEM_STREAM_INIT;
srs_error("stream param size must be positive. ret=%d", ret);
return ret;
}
size = _size;
p = bytes = _bytes;
size = _size;
p = bytes = _bytes;
return ret;
return ret;
}
void SrsStream::reset()
{
p = bytes;
p = bytes;
}
bool SrsStream::empty()
{
return !p || !bytes || (p >= bytes + size);
return !p || !bytes || (p >= bytes + size);
}
bool SrsStream::require(int required_size)
{
return !empty() && (required_size <= bytes + size - p);
return !empty() && (required_size <= bytes + size - p);
}
void SrsStream::skip(int size)
{
p += size;
p += size;
}
int SrsStream::pos()
{
return p - bytes;
return p - bytes;
}
int SrsStream::left()
{
return size - pos();
return size - pos();
}
char* SrsStream::current()
{
return p;
return p;
}
int8_t SrsStream::read_1bytes()
{
srs_assert(require(1));
return (int8_t)*p++;
srs_assert(require(1));
return (int8_t)*p++;
}
int16_t SrsStream::read_2bytes()
{
srs_assert(require(2));
int16_t value;
pp = (char*)&value;
pp[1] = *p++;
pp[0] = *p++;
return value;
srs_assert(require(2));
int16_t value;
pp = (char*)&value;
pp[1] = *p++;
pp[0] = *p++;
return value;
}
int32_t SrsStream::read_3bytes()
{
srs_assert(require(3));
int32_t value = 0x00;
pp = (char*)&value;
pp[2] = *p++;
pp[1] = *p++;
pp[0] = *p++;
return value;
srs_assert(require(3));
int32_t value = 0x00;
pp = (char*)&value;
pp[2] = *p++;
pp[1] = *p++;
pp[0] = *p++;
return value;
}
int32_t SrsStream::read_4bytes()
{
srs_assert(require(4));
int32_t value;
pp = (char*)&value;
pp[3] = *p++;
pp[2] = *p++;
pp[1] = *p++;
pp[0] = *p++;
return value;
srs_assert(require(4));
int32_t value;
pp = (char*)&value;
pp[3] = *p++;
pp[2] = *p++;
pp[1] = *p++;
pp[0] = *p++;
return value;
}
int64_t SrsStream::read_8bytes()
{
srs_assert(require(8));
int64_t value;
pp = (char*)&value;
srs_assert(require(8));
int64_t value;
pp = (char*)&value;
pp[7] = *p++;
pp[6] = *p++;
pp[5] = *p++;
@ -153,69 +153,69 @@ int64_t SrsStream::read_8bytes()
pp[2] = *p++;
pp[1] = *p++;
pp[0] = *p++;
return value;
return value;
}
std::string SrsStream::read_string(int len)
{
srs_assert(require(len));
std::string value;
value.append(p, len);
p += len;
return value;
srs_assert(require(len));
std::string value;
value.append(p, len);
p += len;
return value;
}
void SrsStream::write_1bytes(int8_t value)
{
srs_assert(require(1));
*p++ = value;
srs_assert(require(1));
*p++ = value;
}
void SrsStream::write_2bytes(int16_t value)
{
srs_assert(require(2));
pp = (char*)&value;
*p++ = pp[1];
*p++ = pp[0];
srs_assert(require(2));
pp = (char*)&value;
*p++ = pp[1];
*p++ = pp[0];
}
void SrsStream::write_4bytes(int32_t value)
{
srs_assert(require(4));
pp = (char*)&value;
*p++ = pp[3];
*p++ = pp[2];
*p++ = pp[1];
*p++ = pp[0];
srs_assert(require(4));
pp = (char*)&value;
*p++ = pp[3];
*p++ = pp[2];
*p++ = pp[1];
*p++ = pp[0];
}
void SrsStream::write_8bytes(int64_t value)
{
srs_assert(require(8));
pp = (char*)&value;
*p++ = pp[7];
*p++ = pp[6];
*p++ = pp[5];
*p++ = pp[4];
*p++ = pp[3];
*p++ = pp[2];
*p++ = pp[1];
*p++ = pp[0];
srs_assert(require(8));
pp = (char*)&value;
*p++ = pp[7];
*p++ = pp[6];
*p++ = pp[5];
*p++ = pp[4];
*p++ = pp[3];
*p++ = pp[2];
*p++ = pp[1];
*p++ = pp[0];
}
void SrsStream::write_string(std::string value)
{
srs_assert(require(value.length()));
memcpy(p, value.data(), value.length());
p += value.length();
srs_assert(require(value.length()));
memcpy(p, value.data(), value.length());
p += value.length();
}

View file

@ -36,95 +36,95 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class SrsStream
{
private:
char* p;
char* pp;
char* bytes;
int size;
char* p;
char* pp;
char* bytes;
int size;
public:
SrsStream();
virtual ~SrsStream();
SrsStream();
virtual ~SrsStream();
public:
/**
* initialize the stream from bytes.
* @_bytes, must not be NULL, or return error.
* @_size, must be positive, or return error.
* @remark, stream never free the _bytes, user must free it.
*/
virtual int initialize(char* _bytes, int _size);
/**
* reset the position to beginning.
*/
virtual void reset();
/**
* whether stream is empty.
* if empty, never read or write.
*/
virtual bool empty();
/**
* whether required size is ok.
* @return true if stream can read/write specified required_size bytes.
*/
virtual bool require(int required_size);
/**
* to skip some size.
* @size can be any value. positive to forward; nagetive to backward.
*/
virtual void skip(int size);
/**
* tell the current pos.
*/
virtual int pos();
/**
* left size of bytes.
*/
virtual int left();
virtual char* current();
/**
* initialize the stream from bytes.
* @_bytes, must not be NULL, or return error.
* @_size, must be positive, or return error.
* @remark, stream never free the _bytes, user must free it.
*/
virtual int initialize(char* _bytes, int _size);
/**
* reset the position to beginning.
*/
virtual void reset();
/**
* whether stream is empty.
* if empty, never read or write.
*/
virtual bool empty();
/**
* whether required size is ok.
* @return true if stream can read/write specified required_size bytes.
*/
virtual bool require(int required_size);
/**
* to skip some size.
* @size can be any value. positive to forward; nagetive to backward.
*/
virtual void skip(int size);
/**
* tell the current pos.
*/
virtual int pos();
/**
* left size of bytes.
*/
virtual int left();
virtual char* current();
public:
/**
* get 1bytes char from stream.
*/
virtual int8_t read_1bytes();
/**
* get 2bytes int from stream.
*/
virtual int16_t read_2bytes();
/**
* get 3bytes int from stream.
*/
virtual int32_t read_3bytes();
/**
* get 4bytes int from stream.
*/
virtual int32_t read_4bytes();
/**
* get 8bytes int from stream.
*/
virtual int64_t read_8bytes();
/**
* get string from stream, length specifies by param len.
*/
virtual std::string read_string(int len);
/**
* get 1bytes char from stream.
*/
virtual int8_t read_1bytes();
/**
* get 2bytes int from stream.
*/
virtual int16_t read_2bytes();
/**
* get 3bytes int from stream.
*/
virtual int32_t read_3bytes();
/**
* get 4bytes int from stream.
*/
virtual int32_t read_4bytes();
/**
* get 8bytes int from stream.
*/
virtual int64_t read_8bytes();
/**
* get string from stream, length specifies by param len.
*/
virtual std::string read_string(int len);
public:
/**
* write 1bytes char to stream.
*/
virtual void write_1bytes(int8_t value);
/**
* write 2bytes int to stream.
*/
virtual void write_2bytes(int16_t value);
/**
* write 4bytes int to stream.
*/
virtual void write_4bytes(int32_t value);
/**
* write 8bytes int to stream.
*/
virtual void write_8bytes(int64_t value);
/**
* write string to stream
*/
virtual void write_string(std::string value);
/**
* write 1bytes char to stream.
*/
virtual void write_1bytes(int8_t value);
/**
* write 2bytes int to stream.
*/
virtual void write_2bytes(int16_t value);
/**
* write 4bytes int to stream.
*/
virtual void write_4bytes(int32_t value);
/**
* write 8bytes int to stream.
*/
virtual void write_8bytes(int64_t value);
/**
* write string to stream
*/
virtual void write_string(std::string value);
};
#endif