diff options
-rw-r--r-- | runtime/msg.c | 86 | ||||
-rw-r--r-- | runtime/msg.h | 1 |
2 files changed, 0 insertions, 87 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index e52d2c14..34f7ba76 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -3751,92 +3751,6 @@ msgGetMsgVarNew(msg_t *pThis, uchar *name) } -/* This function can be used as a generic way to set properties. - * We have to handle a lot of legacy, so our return value is not always - * 100% correct (called functions do not always provide one, should - * change over time). - * rgerhards, 2008-01-07 - */ -#undef isProp -#define isProp(name) !rsCStrSzStrCmp(pProp->pcsName, (uchar*) name, sizeof(name) - 1) -rsRetVal MsgSetProperty(msg_t *pThis, var_t *pProp) -{ - prop_t *myProp; - prop_t *propRcvFrom = NULL; - prop_t *propRcvFromIP = NULL; - struct json_tokener *tokener; - struct json_object *json; - DEFiRet; - - ISOBJ_TYPE_assert(pThis, msg); - assert(pProp != NULL); - - if(isProp("iProtocolVersion")) { - setProtocolVersion(pThis, pProp->val.num); - } else if(isProp("iSeverity")) { - pThis->iSeverity = pProp->val.num; - } else if(isProp("iFacility")) { - pThis->iFacility = pProp->val.num; - } else if(isProp("msgFlags")) { - pThis->msgFlags = pProp->val.num; - } else if(isProp("offMSG")) { - MsgSetMSGoffs(pThis, pProp->val.num); - } else if(isProp("pszRawMsg")) { - MsgSetRawMsg(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr), cstrLen(pProp->val.pStr)); - } else if(isProp("pszTAG")) { - MsgSetTAG(pThis, rsCStrGetSzStrNoNULL(pProp->val.pStr), cstrLen(pProp->val.pStr)); - } else if(isProp("pszInputName")) { - /* we need to create a property */ - CHKiRet(prop.Construct(&myProp)); - CHKiRet(prop.SetString(myProp, rsCStrGetSzStrNoNULL(pProp->val.pStr), rsCStrLen(pProp->val.pStr))); - CHKiRet(prop.ConstructFinalize(myProp)); - MsgSetInputName(pThis, myProp); - prop.Destruct(&myProp); - } else if(isProp("pszRcvFromIP")) { - MsgSetRcvFromIPStr(pThis, rsCStrGetSzStrNoNULL(pProp->val.pStr), rsCStrLen(pProp->val.pStr), &propRcvFromIP); - prop.Destruct(&propRcvFromIP); - } else if(isProp("pszRcvFrom")) { - MsgSetRcvFromStr(pThis, rsCStrGetSzStrNoNULL(pProp->val.pStr), rsCStrLen(pProp->val.pStr), &propRcvFrom); - prop.Destruct(&propRcvFrom); - } else if(isProp("pszHOSTNAME")) { - MsgSetHOSTNAME(pThis, rsCStrGetSzStrNoNULL(pProp->val.pStr), rsCStrLen(pProp->val.pStr)); - } else if(isProp("pCSStrucData")) { - MsgSetStructuredData(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr)); - } else if(isProp("pCSAPPNAME")) { - MsgSetAPPNAME(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr)); - } else if(isProp("pCSPROCID")) { - MsgSetPROCID(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr)); - } else if(isProp("pCSMSGID")) { - MsgSetMSGID(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr)); - } else if(isProp("ttGenTime")) { - pThis->ttGenTime = pProp->val.num; - } else if(isProp("tRcvdAt")) { - memcpy(&pThis->tRcvdAt, &pProp->val.vSyslogTime, sizeof(struct syslogTime)); - } else if(isProp("tTIMESTAMP")) { - memcpy(&pThis->tTIMESTAMP, &pProp->val.vSyslogTime, sizeof(struct syslogTime)); - } else if(isProp("pszRuleset")) { - MsgSetRulesetByName(pThis, pProp->val.pStr); - } else if(isProp("json")) { - tokener = json_tokener_new(); - json = json_tokener_parse_ex(tokener, (char*)rsCStrGetSzStrNoNULL(pProp->val.pStr), - cstrLen(pProp->val.pStr)); - json_tokener_free(tokener); - msgAddJSON(pThis, (uchar*)"!", json); - } else if(isProp("pszMSG")) { - dbgprintf("no longer supported property pszMSG silently ignored\n"); - } else if(isProp("pszUxTradMsg")) { - /*IGNORE*/; /* this *was* a property, but does no longer exist */ - } else { - dbgprintf("unknown supported property '%s' silently ignored\n", - rsCStrGetSzStrNoNULL(pProp->pcsName)); - } - -finalize_it: - RETiRet; -} -#undef isProp - - /* This is a construction finalizer that must be called after all properties * have been set. It does some final work on the message object. After this * is done, the object is considered ready for full processing. diff --git a/runtime/msg.h b/runtime/msg.h index 97bcc645..338139be 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -150,7 +150,6 @@ rsRetVal msgConstructWithTime(msg_t **ppThis, struct syslogTime *stTime, time_t rsRetVal msgConstructForDeserializer(msg_t **ppThis); rsRetVal msgConstructFinalizer(msg_t *pThis); rsRetVal msgDestruct(msg_t **ppM); -rsRetVal MsgSetProperty(msg_t *pThis, var_t *pProp); msg_t* MsgDup(msg_t* pOld); msg_t *MsgAddRef(msg_t *pM); void setProtocolVersion(msg_t *pM, int iNewVersion); |