diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-10 13:09:43 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-10 13:09:43 +0000 |
commit | fa859275c66afc639cd3d2ea8a74cfdc63be8b99 (patch) | |
tree | 81d3e957f53a7a8d5b4d973d693a026ae5d087ad /msg.c | |
parent | 8a861afefac51ab495e5ba7946fe4fd986f0dd3c (diff) | |
download | rsyslog-fa859275c66afc639cd3d2ea8a74cfdc63be8b99.tar.gz rsyslog-fa859275c66afc639cd3d2ea8a74cfdc63be8b99.tar.xz rsyslog-fa859275c66afc639cd3d2ea8a74cfdc63be8b99.zip |
- added write functions for several types to stream class
- changed objSerialize methods to work directly on the stream class
Diffstat (limited to 'msg.c')
-rw-r--r-- | msg.c | 54 |
1 files changed, 25 insertions, 29 deletions
@@ -387,40 +387,36 @@ msg_t* MsgDup(msg_t* pOld) * during msg construction - and never again used later. * rgerhards, 2008-01-03 */ -static rsRetVal MsgSerialize(msg_t *pThis, rsCStrObj **ppCStr) +static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm) { DEFiRet; - rsCStrObj *pCStr; - assert(ppCStr != NULL); - - CHKiRet(objBeginSerialize(&pCStr, (obj_t*) pThis, 1024)); - objSerializeSCALAR(iProtocolVersion, SHORT); - objSerializeSCALAR(iSeverity, SHORT); - objSerializeSCALAR(iFacility, SHORT); - objSerializeSCALAR(msgFlags, INT); - objSerializeSCALAR(tRcvdAt, SYSLOGTIME); - objSerializeSCALAR(tTIMESTAMP, SYSLOGTIME); - - objSerializePTR(pszRawMsg, PSZ); - objSerializePTR(pszMSG, PSZ); - objSerializePTR(pszUxTradMsg, PSZ); - objSerializePTR(pszTAG, PSZ); - objSerializePTR(pszHOSTNAME, PSZ); - objSerializePTR(pszRcvFrom, PSZ); - - objSerializePTR(pCSStrucData, CSTR); - objSerializePTR(pCSAPPNAME, CSTR); - objSerializePTR(pCSPROCID, CSTR); - objSerializePTR(pCSMSGID, CSTR); - - CHKiRet(objEndSerialize((&pCStr), (obj_t*) pThis)); - *ppCStr = pCStr; + assert(pThis != NULL); + assert(pStrm != NULL); + + CHKiRet(objBeginSerialize(pStrm, (obj_t*) pThis)); + objSerializeSCALAR(pStrm, iProtocolVersion, SHORT); + objSerializeSCALAR(pStrm, iSeverity, SHORT); + objSerializeSCALAR(pStrm, iFacility, SHORT); + objSerializeSCALAR(pStrm, msgFlags, INT); + objSerializeSCALAR(pStrm, tRcvdAt, SYSLOGTIME); + objSerializeSCALAR(pStrm, tTIMESTAMP, SYSLOGTIME); + + objSerializePTR(pStrm, pszRawMsg, PSZ); + objSerializePTR(pStrm, pszMSG, PSZ); + objSerializePTR(pStrm, pszUxTradMsg, PSZ); + objSerializePTR(pStrm, pszTAG, PSZ); + objSerializePTR(pStrm, pszHOSTNAME, PSZ); + objSerializePTR(pStrm, pszRcvFrom, PSZ); + + objSerializePTR(pStrm, pCSStrucData, CSTR); + objSerializePTR(pStrm, pCSAPPNAME, CSTR); + objSerializePTR(pStrm, pCSPROCID, CSTR); + objSerializePTR(pStrm, pCSMSGID, CSTR); + + CHKiRet(objEndSerialize(pStrm, (obj_t*) pThis)); finalize_it: - if(iRet != RS_RET_OK && pCStr != NULL) - rsCStrDestruct(pCStr); - return iRet; } |