From d5f3ab3117e56136dbef2fc974916fc991b02fec Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 23 Sep 2013 12:15:15 +0200 Subject: mmrfc5424addhmac milestone: do not process non-rfc5424 messages --- runtime/msg.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'runtime/msg.h') diff --git a/runtime/msg.h b/runtime/msg.h index ac220b63..e220922d 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -142,6 +142,9 @@ struct msg { #define NEEDS_ACLCHK_U 0x080 /* check UDP ACLs after DNS resolution has been done in main queue consumer */ #define NO_PRI_IN_RAW 0x100 /* rawmsg does not include a PRI (Solaris!), but PRI is already set correctly in the msg object */ +/* (syslog) protocol types */ +#define MSG_LEGACY_PROTOCOL 0 +#define MSG_RFC5424_PROTOCOL 1 /* function prototypes */ @@ -215,6 +218,12 @@ msgUnsetJSON(msg_t *pMsg, uchar *varname) { return msgDelJSON(pMsg, varname+1); } +static inline int +msgGetProtocolVersion(msg_t *pM) +{ + return(pM->iProtocolVersion); +} + /* ------------------------------ some inline functions ------------------------------ */ -- cgit v1.2.3 From 90e1478f11b7a9d253899104b20900bd999970f1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 23 Sep 2013 12:47:21 +0200 Subject: expose so-far msg-internal method to query structured data This also lead to a slight performance optimization in the msg.c module (when it comes to querying structured data). This is stage work in order to provide the capability to fully parse structured data. --- runtime/msg.h | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/msg.h') diff --git a/runtime/msg.h b/runtime/msg.h index e220922d..5254f785 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -166,6 +166,7 @@ void MsgSetTAG(msg_t *pMsg, uchar* pszBuf, size_t lenBuf); void MsgSetRuleset(msg_t *pMsg, ruleset_t*); rsRetVal MsgSetFlowControlType(msg_t *pMsg, flowControl_t eFlowCtl); rsRetVal MsgSetStructuredData(msg_t *pMsg, char* pszStrucData); +void MsgGetStructuredData(msg_t *pM, uchar **pBuf, rs_size_t *len); rsRetVal msgSetFromSockinfo(msg_t *pThis, struct sockaddr_storage *sa); void MsgSetRcvFrom(msg_t *pMsg, prop_t*); void MsgSetRcvFromStr(msg_t *pMsg, uchar* pszRcvFrom, int, prop_t **); -- cgit v1.2.3 From 593c8e41d156da2a26c209efd8da452874b73b4c Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 23 Sep 2013 16:10:12 +0200 Subject: milestone: mmpstrucdata parses STRUCTURED-DATA (but does not yet store it) --- runtime/msg.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'runtime/msg.h') diff --git a/runtime/msg.h b/runtime/msg.h index 5254f785..d912a25d 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -225,6 +225,12 @@ msgGetProtocolVersion(msg_t *pM) return(pM->iProtocolVersion); } +/* returns non-zero if the message has structured data, 0 otherwise */ +static inline sbool +MsgHasStructuredData(msg_t *pM) +{ + return (pM->pCSStrucData == NULL) ? 0 : 1; +} /* ------------------------------ some inline functions ------------------------------ */ -- cgit v1.2.3 From c787fb9ce9064cf2047287c2610a0090d5f692c6 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 25 Sep 2013 16:48:21 +0200 Subject: simplify STRUCTURED-DATA representation in msg object --- runtime/msg.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'runtime/msg.h') diff --git a/runtime/msg.h b/runtime/msg.h index d912a25d..f4c54731 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -30,6 +30,7 @@ #include #include +#include #include #include "obj.h" #include "syslogd-types.h" @@ -86,7 +87,8 @@ struct msg { char *pszTIMESTAMP3339; /* TIMESTAMP as RFC3339 formatted string (32 charcters at most) */ char *pszTIMESTAMP_MySQL;/* TIMESTAMP as MySQL formatted string (always 14 charcters) */ char *pszTIMESTAMP_PgSQL;/* TIMESTAMP as PgSQL formatted string (always 21 characters) */ - cstr_t *pCSStrucData; /* STRUCTURED-DATA */ + uchar *pszStrucData; /* STRUCTURED-DATA */ + uint16_t lenStrucData; /* (cached) length of STRUCTURED-DATA */ cstr_t *pCSAPPNAME; /* APP-NAME */ cstr_t *pCSPROCID; /* PROCID */ cstr_t *pCSMSGID; /* MSGID */ @@ -229,7 +231,7 @@ msgGetProtocolVersion(msg_t *pM) static inline sbool MsgHasStructuredData(msg_t *pM) { - return (pM->pCSStrucData == NULL) ? 0 : 1; + return (pM->pszStrucData == NULL) ? 0 : 1; } /* ------------------------------ some inline functions ------------------------------ */ -- cgit v1.2.3 From b810f0dd3ade85efeb7dc9b99fade798764d0ac2 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 25 Sep 2013 17:15:58 +0200 Subject: mmrfc5424addhmac: complete initial implementation hash is now also persisted back to structured-data rsyslog property --- runtime/msg.h | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/msg.h') diff --git a/runtime/msg.h b/runtime/msg.h index f4c54731..f434a8fc 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -168,6 +168,7 @@ void MsgSetTAG(msg_t *pMsg, uchar* pszBuf, size_t lenBuf); void MsgSetRuleset(msg_t *pMsg, ruleset_t*); rsRetVal MsgSetFlowControlType(msg_t *pMsg, flowControl_t eFlowCtl); rsRetVal MsgSetStructuredData(msg_t *pMsg, char* pszStrucData); +rsRetVal MsgAddToStructuredData(msg_t *pMsg, uchar *toadd, rs_size_t len); void MsgGetStructuredData(msg_t *pM, uchar **pBuf, rs_size_t *len); rsRetVal msgSetFromSockinfo(msg_t *pThis, struct sockaddr_storage *sa); void MsgSetRcvFrom(msg_t *pMsg, prop_t*); -- cgit v1.2.3