2012-03-28 13:24:49 +02:00
|
|
|
#ifndef I2_JSONRPCMESSAGE_H
|
|
|
|
#define I2_JSONRPCMESSAGE_H
|
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
class JsonRpcMessage : public Object
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
cJSON *m_JSON;
|
|
|
|
|
2012-03-29 20:03:29 +02:00
|
|
|
void InitJson(void);
|
|
|
|
|
2012-03-28 15:56:39 +02:00
|
|
|
void SetFieldString(const char *field, const string& value);
|
2012-03-28 13:24:49 +02:00
|
|
|
string GetFieldString(const char *field);
|
|
|
|
|
2012-03-29 20:03:29 +02:00
|
|
|
void ClearField(const char *field);
|
|
|
|
void SetFieldObject(const char *field, cJSON *object);
|
|
|
|
cJSON *GetFieldObject(const char *field);
|
|
|
|
|
2012-03-28 13:24:49 +02:00
|
|
|
public:
|
|
|
|
typedef shared_ptr<JsonRpcMessage> RefType;
|
|
|
|
typedef weak_ptr<JsonRpcMessage> WeakRefType;
|
|
|
|
|
|
|
|
JsonRpcMessage(void);
|
|
|
|
~JsonRpcMessage(void);
|
|
|
|
|
2012-03-28 21:20:13 +02:00
|
|
|
void SetJSON(cJSON *object);
|
|
|
|
cJSON *GetJSON(void);
|
|
|
|
|
2012-03-28 15:56:39 +02:00
|
|
|
void SetVersion(const string& version);
|
|
|
|
string GetVersion(void);
|
|
|
|
|
|
|
|
void SetID(const string& id);
|
2012-03-28 13:24:49 +02:00
|
|
|
string GetID(void);
|
|
|
|
|
2012-03-28 15:56:39 +02:00
|
|
|
void SetMethod(const string& method);
|
2012-03-28 13:24:49 +02:00
|
|
|
string GetMethod(void);
|
|
|
|
|
2012-03-29 20:03:29 +02:00
|
|
|
void ClearParams(void);
|
|
|
|
cJSON *GetParams(void);
|
2012-03-28 13:24:49 +02:00
|
|
|
|
2012-03-29 20:03:29 +02:00
|
|
|
void ClearResult();
|
|
|
|
cJSON *GetResult(void);
|
2012-03-28 13:24:49 +02:00
|
|
|
|
2012-03-28 15:56:39 +02:00
|
|
|
void SetError(const string& error);
|
2012-03-28 13:24:49 +02:00
|
|
|
string GetError(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* I2_JSONRPCMESSAGE_H */
|