summaryrefslogtreecommitdiffstats
path: root/obj.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-06 17:12:41 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-06 17:12:41 +0000
commit22ea87ec597245df9216aa6a6b9da2a379ca1a40 (patch)
tree01f82f358e10223a723542e1b0e370935f4577c8 /obj.c
parent8a04b69478118219b0456b1b212e895dceedc36f (diff)
downloadrsyslog-22ea87ec597245df9216aa6a6b9da2a379ca1a40.tar.gz
rsyslog-22ea87ec597245df9216aa6a6b9da2a379ca1a40.tar.xz
rsyslog-22ea87ec597245df9216aa6a6b9da2a379ca1a40.zip
completed serializer for msg (but needs review)
Diffstat (limited to 'obj.c')
-rw-r--r--obj.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/obj.c b/obj.c
index 87b84359..658c301c 100644
--- a/obj.c
+++ b/obj.c
@@ -27,11 +27,13 @@
*/
#include "config.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "rsyslog.h"
+#include "syslogd-types.h"
#include "srUtils.h"
#include "obj.h"
@@ -149,8 +151,10 @@ rsRetVal objSerializeProp(rsCStrObj *pCStr, uchar *pszPropName, propertyType_t p
* TODO: think if that's the righ point of view
* rgerhards, 2008-01-06
*/
- if(pUsr == NULL)
+ if(pUsr == NULL) {
+dbgprintf("ptr is NULL\n");
ABORT_FINALIZE(RS_RET_OK);
+ }
switch(propType) {
case PROPTYPE_PSZ:
@@ -167,6 +171,33 @@ rsRetVal objSerializeProp(rsCStrObj *pCStr, uchar *pszPropName, propertyType_t p
pszBuf = szBuf;
lenBuf = strlen((char*) szBuf);
break;
+ case PROPTYPE_LONG:
+ CHKiRet(srUtilItoA((char*) szBuf, sizeof(szBuf), *((long*) pUsr)));
+ pszBuf = szBuf;
+ lenBuf = strlen((char*) szBuf);
+ break;
+ case PROPTYPE_CSTR:
+ pszBuf = rsCStrGetSzStrNoNULL((rsCStrObj *) pUsr);
+ lenBuf = strlen((char*) pszBuf);
+ break;
+ case PROPTYPE_SYSLOGTIME:
+ lenBuf = snprintf((char*) szBuf, sizeof(szBuf), "%d %d %d %d %d %d %d %d %d %c %d %d",
+ ((struct syslogTime*)pUsr)->timeType,
+ ((struct syslogTime*)pUsr)->year,
+ ((struct syslogTime*)pUsr)->month,
+ ((struct syslogTime*)pUsr)->day,
+ ((struct syslogTime*)pUsr)->hour,
+ ((struct syslogTime*)pUsr)->minute,
+ ((struct syslogTime*)pUsr)->second,
+ ((struct syslogTime*)pUsr)->secfrac,
+ ((struct syslogTime*)pUsr)->secfracPrecision,
+ ((struct syslogTime*)pUsr)->OffsetMode,
+ ((struct syslogTime*)pUsr)->OffsetHour,
+ ((struct syslogTime*)pUsr)->OffsetMinute);
+ if(lenBuf > sizeof(szBuf) - 1)
+ ABORT_FINALIZE(RS_RET_PROVIDED_BUFFER_TOO_SMALL);
+ pszBuf = szBuf;
+ break;
}
/* name */