icinga2/lib/remote/httpchunkedencoding.hpp

38 lines
751 B
C++
Raw Normal View History

/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2015-06-22 11:11:21 +02:00
#ifndef HTTPCHUNKEDENCODING_H
#define HTTPCHUNKEDENCODING_H
2014-05-25 16:23:35 +02:00
#include "remote/i2-remote.hpp"
2015-06-22 11:11:21 +02:00
#include "base/stream.hpp"
namespace icinga
{
2015-06-22 11:11:21 +02:00
struct ChunkReadContext
{
2015-06-22 11:11:21 +02:00
StreamReadContext& StreamContext;
int LengthIndicator;
2015-06-22 11:11:21 +02:00
ChunkReadContext(StreamReadContext& scontext)
: StreamContext(scontext), LengthIndicator(-1)
2015-06-22 11:11:21 +02:00
{ }
};
/**
2015-06-22 11:11:21 +02:00
* HTTP chunked encoding.
*
* @ingroup remote
*/
2017-12-31 07:22:16 +01:00
struct HttpChunkedEncoding
{
2015-06-22 11:11:21 +02:00
static StreamReadStatus ReadChunkFromStream(const Stream::Ptr& stream,
char **data, size_t *size, ChunkReadContext& ccontext, bool may_wait = false);
2015-06-22 11:11:21 +02:00
static void WriteChunkToStream(const Stream::Ptr& stream, const char *data, size_t count);
};
}
2015-06-22 11:11:21 +02:00
#endif /* HTTPCHUNKEDENCODING_H */