From d4ca9a48d6ae23f0036372563f4480baab361858 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 17 Jul 2013 09:47:14 +0200 Subject: refactor in preparation of local variables local variables require a second json root; this refactoring makes sure we can basically use common functions for json handling --- runtime/msg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/msg.h') diff --git a/runtime/msg.h b/runtime/msg.h index 6faf066a..efa36d91 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -208,7 +208,7 @@ uchar *propIDToName(propid_t propID); rsRetVal msgGetCEEPropJSON(msg_t *pM, es_str_t *propName, struct json_object **pjson); rsRetVal msgSetJSONFromVar(msg_t *pMsg, uchar *varname, struct var *var); rsRetVal msgDelJSON(msg_t *pMsg, uchar *varname); -rsRetVal jsonFind(msg_t *pM, es_str_t *propName, struct json_object **jsonres); +rsRetVal jsonFind(struct json_object *jroot, es_str_t *propName, struct json_object **jsonres); static inline rsRetVal msgUnsetJSON(msg_t *pMsg, uchar *varname) { -- cgit v1.2.3 From 4c2bef51d1517ad469e0ecf837ec7e87309ba1dd Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 17 Jul 2013 11:37:53 +0200 Subject: milestone: basic local variable functionality available but some nits, like do not work with disk queues --- runtime/msg.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/msg.h') diff --git a/runtime/msg.h b/runtime/msg.h index efa36d91..f9ffc5e3 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -108,6 +108,7 @@ struct msg { struct syslogTime tRcvdAt;/* time the message entered this program */ struct syslogTime tTIMESTAMP;/* (parsed) value of the timestamp */ struct json_object *json; + struct json_object *localvars; /* some fixed-size buffers to save malloc()/free() for frequently used fields (from the default templates) */ uchar szRawMsg[CONF_RAWMSG_BUFSIZE]; /* most messages are small, and these are stored here (without malloc/free!) */ uchar szHOSTNAME[CONF_HOSTNAME_BUFSIZE]; @@ -186,6 +187,7 @@ char *getPRI(msg_t *pMsg); void getRawMsg(msg_t *pM, uchar **pBuf, int *piLen); rsRetVal msgGetCEEVar(msg_t *pThis, cstr_t *propName, var_t **ppVar); es_str_t* msgGetCEEVarNew(msg_t *pMsg, char *name); +es_str_t* msgGetLocalVarNew(msg_t *pMsg, char *name); rsRetVal msgAddJSON(msg_t *pM, uchar *name, struct json_object *json); rsRetVal getCEEPropVal(msg_t *pM, es_str_t *propName, uchar **pRes, rs_size_t *buflen, unsigned short *pbMustBeFreed); rsRetVal MsgGetSeverity(msg_t *pThis, int *piSeverity); @@ -206,6 +208,7 @@ uchar *getRcvFrom(msg_t *pM); rsRetVal propNameToID(cstr_t *pCSPropName, propid_t *pPropID); uchar *propIDToName(propid_t propID); rsRetVal msgGetCEEPropJSON(msg_t *pM, es_str_t *propName, struct json_object **pjson); +rsRetVal msgGetLocalVarJSON(msg_t *pM, es_str_t *propName, struct json_object **pjson); rsRetVal msgSetJSONFromVar(msg_t *pMsg, uchar *varname, struct var *var); rsRetVal msgDelJSON(msg_t *pMsg, uchar *varname); rsRetVal jsonFind(struct json_object *jroot, es_str_t *propName, struct json_object **jsonres); -- cgit v1.2.3