summaryrefslogtreecommitdiffstats
path: root/runtime/msg.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-18 14:30:21 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-18 14:30:21 +0200
commit2f86678c577ee469852ffae35123c4a90b12d214 (patch)
treee1ff06f634189b2248bae72347cde25d4f5f242d /runtime/msg.h
parent8628312396b1535c41124e499d292f4d1e77d955 (diff)
downloadrsyslog-2f86678c577ee469852ffae35123c4a90b12d214.tar.gz
rsyslog-2f86678c577ee469852ffae35123c4a90b12d214.tar.xz
rsyslog-2f86678c577ee469852ffae35123c4a90b12d214.zip
optimized TAG handling in msg object
Diffstat (limited to 'runtime/msg.h')
-rw-r--r--runtime/msg.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/msg.h b/runtime/msg.h
index f2701780..13c2c4ea 100644
--- a/runtime/msg.h
+++ b/runtime/msg.h
@@ -30,6 +30,7 @@
/* some configuration constants */
#define CONF_RAWMSG_BUFSIZE 101
+#define CONF_TAG_BUFSIZE 33 /* RFC says 32 chars (+ \0), but in practice we see longer ones... */
#include <pthread.h>
#include "obj.h"
@@ -74,7 +75,6 @@ struct msg {
short offAfterPRI; /* offset, at which raw message WITHOUT PRI part starts in pszRawMsg */
uchar *pszMSG; /* the MSG part itself */
int iLenMSG; /* Length of the MSG part */
- uchar *pszTAG; /* pointer to tag value */
int iLenTAG; /* Length of the TAG part */
uchar *pszHOSTNAME; /* HOSTNAME from syslog message */
int iLenHOSTNAME; /* Length of HOSTNAME */
@@ -113,6 +113,10 @@ struct msg {
ruleset_t *pRuleset; /* ruleset to be used for processing this message */
/* 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!) */
+ union {
+ uchar *pszTAG; /* pointer to tag value */
+ uchar szBuf[CONF_TAG_BUFSIZE];
+ } TAG;
char pszTimestamp3164[16];
char pszTimestamp3339[33];
};
@@ -143,7 +147,7 @@ rsRetVal MsgSetAPPNAME(msg_t *pMsg, char* pszAPPNAME);
rsRetVal MsgSetPROCID(msg_t *pMsg, char* pszPROCID);
rsRetVal MsgSetMSGID(msg_t *pMsg, char* pszMSGID);
void MsgAssignTAG(msg_t *pMsg, uchar *pBuf);
-void MsgSetTAG(msg_t *pMsg, char* pszTAG);
+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);