2012-04-02 08:56:30 +02:00
|
|
|
#ifndef NETSTRING_H
|
|
|
|
#define NETSTRING_H
|
2012-03-28 13:24:49 +02:00
|
|
|
|
2012-04-19 11:29:36 +02:00
|
|
|
struct cJSON;
|
|
|
|
|
2012-03-28 13:24:49 +02:00
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2012-04-19 11:29:36 +02:00
|
|
|
typedef ::cJSON json_t;
|
|
|
|
|
2012-04-06 08:56:52 +02:00
|
|
|
class I2_JSONRPC_API Netstring : public Object
|
2012-03-28 13:24:49 +02:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
size_t m_Length;
|
|
|
|
void *m_Data;
|
|
|
|
|
2012-04-19 11:29:36 +02:00
|
|
|
static Dictionary::Ptr GetDictionaryFromJson(json_t *json);
|
|
|
|
static json_t *GetJsonFromDictionary(const Dictionary::Ptr& dictionary);
|
2012-04-18 15:22:25 +02:00
|
|
|
|
2012-03-28 13:24:49 +02:00
|
|
|
public:
|
2012-04-02 20:50:35 +02:00
|
|
|
typedef shared_ptr<Netstring> Ptr;
|
|
|
|
typedef weak_ptr<Netstring> WeakPtr;
|
2012-03-28 13:24:49 +02:00
|
|
|
|
2012-04-18 15:22:25 +02:00
|
|
|
static bool ReadMessageFromFIFO(FIFO::Ptr fifo, Message *message);
|
|
|
|
static void WriteMessageToFIFO(FIFO::Ptr fifo, const Message& message);
|
2012-03-28 13:24:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-04-02 08:56:30 +02:00
|
|
|
#endif /* NETSTRING_H */
|