summaryrefslogtreecommitdiffstats
path: root/queue.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-04 16:05:42 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-04 16:05:42 +0000
commitfaf8e5a3849621acfbd0a0887f2e924a40cb029a (patch)
tree2cc3b3c4342ccded98f56f6ec7bc72cf46c35dc5 /queue.c
parentb95b5ab28407b75467c6cff63359cba9a0a3bd70 (diff)
downloadrsyslog-faf8e5a3849621acfbd0a0887f2e924a40cb029a.tar.gz
rsyslog-faf8e5a3849621acfbd0a0887f2e924a40cb029a.tar.xz
rsyslog-faf8e5a3849621acfbd0a0887f2e924a40cb029a.zip
- begun some work on Msg Object serializiation
- created a kind of general base class
Diffstat (limited to 'queue.c')
-rw-r--r--queue.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/queue.c b/queue.c
index bf0d1261..c972af6c 100644
--- a/queue.c
+++ b/queue.c
@@ -230,9 +230,12 @@ rsRetVal qAddDisk(queue_t *pThis, void* pUsr)
{
DEFiRet;
int i;
+ long lenBuf;
+ uchar *pBuf;
assert(pThis != NULL);
dbgprintf("writing to file %d\n", pThis->tVars.disk.fd);
+ CHKiRet(pThis->serializer(pBuf, &lenBuf, pUsr)); // TODO: hier weiter machen!
i = write(pThis->tVars.disk.fd, "entry\n", 6);
dbgprintf("write wrote %d bytes, errno: %d, err %s\n", i, errno, strerror(errno));
@@ -354,7 +357,10 @@ queueWorker(void *arg)
}
/* Constructor for the queue object */
-rsRetVal queueConstruct(queue_t **ppThis, queueType_t qType, int iMaxQueueSize, rsRetVal (*pConsumer)(void*))
+rsRetVal queueConstruct(queue_t **ppThis, queueType_t qType, int iMaxQueueSize, rsRetVal (*pConsumer)(void*),
+ rsRetVal (*serializer)(uchar **ppOutBuf, size_t *lenBuf, void *pUsr),
+ rsRetVal (*deSerializer)(void *ppUsr, uchar *ppBuf, size_t lenBuf)
+ )
{
DEFiRet;
queue_t *pThis;
@@ -378,6 +384,8 @@ rsRetVal queueConstruct(queue_t **ppThis, queueType_t qType, int iMaxQueueSize,
pThis->notEmpty = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
pthread_cond_init (pThis->notEmpty, NULL);
pThis->qType = qType;
+ pThis->serializer = serializer;
+ pThis->deSerializer = deSerializer;
/* set type-specific handlers */
switch(qType) {