liblogging: syslogmessage.c File Reference

Main Page | Compound List | File List | Compound Members | File Members | Related Pages

# syslogmessage.c File Reference

Implementation of the syslog message object. More...

`#include <ctype.h>`
`#include <assert.h>`
`#include "config.h"`
`#include "liblogging.h"`
`#include "srAPI.h"`
`#include "syslogmessage.h"`
`#include "namevaluetree.h"`
`#include "stringbuf.h"`
`#include "oscalls.h"`

## Functions
srRetVal | srSLMGConstruct (srSLMGObj **ppThis)
void | srSLMGDestroy (srSLMGObj *pThis)
int | srSLMGParseInt32 (unsigned char **ppsz)
| Parse a 32 bit integer number from a string.
srRetVal | srSLMGParseMesg (srSLMGObj *pThis)
srRetVal | srSLMGGetPriority (srSLMGObj *pThis, int *piPrio)
srRetVal | srSLMGGetFacility (srSLMGObj *pThis, int *piFac)
srRetVal | srSLMGGetRemoteHost (srSLMGObj *pThis, char **ppsz)
srRetVal | srSLMGGetHostname (srSLMGObj *pThis, char **ppsz)
srRetVal | srSLMGGetTag (srSLMGObj *pThis, unsigned char **ppsz)
srRetVal | srSLMGGetMSG (srSLMGObj *pThis, unsigned char **ppsz)
srRetVal | srSLMGGetRawMSG (srSLMGObj *pThis, unsigned char **ppsz)
| Provide the caller back with the raw message.
srRetVal | srSLMGGetTIMESTAMP (srSLMGObj *pThis, int *piYear, int *piMonth, int *piDay, int *piHour, int *piMinute, int *piSecond, int *piSecFrac, int *piSecFracPrecision, int *piOffsetHour, int *piOffsetMinute, char *pcOffsetMode, int *pbHasTZ)
| Provide the caller back with the message timestamp.
srRetVal | srSLMGSetRemoteHostIP (srSLMGObj *pThis, char *pszRemHostIP, int bCopyRemHost)
srRetVal | srSLMGSetRawMsg (srSLMGObj *pThis, char *pszRawMsg, int bCopyRawMsg)
srRetVal | srSLMGSetMSG (srSLMGObj *pThis, char *pszMSG, int bCopyMSG)
srRetVal | srSLMGSetTIMESTAMPtoCurrent (srSLMGObj *pThis)
srRetVal | srSLMGSetHOSTNAMEtoCurrent (srSLMGObj *pThis)
| Set the HOSTNAME to the current hostname.
srRetVal | srSLMGFormatRawMsg (srSLMGObj *pThis, srSLMGFormat iFmtToUse)
srRetVal | srSLMGSetFacility (srSLMGObj *pThis, int iNewVal)
srRetVal | srSLMGSetSeverity (srSLMGObj *pThis, int iNewVal)
srRetVal | srSLMGSetTAG (srSLMGObj *pThis, char *pszNewTag)

## Detailed Description

Implementation of the syslog message object.

Author:
  Rainer Gerhards <rgerhards@adiscon.com>

Date:
  2003-09-01 coding begun.

Copyright 2002-2003 Rainer Gerhards and Adiscon GmbH. All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of Adiscon GmbH or Rainer Gerhards nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

## Function Documentation

srRetVal srSLMGGetRawMSG | ( | srSLMGObj * | pThis,
|  | unsigned char ** | ppsz
| ) |

  | Provide the caller back with the raw message. This is especially useful for syslog-sign, where the raw message must be stored in order to keep the sig intact! Note: The returned string is read-only. It is valid only until the srSLMGObj is destroyed. If the caller intends to use it for a prolonged period of time, it needs to copy it! Parameters:
  ppsz | Pointer to Pointer to unsigned char to receive the return string.

srRetVal srSLMGGetTIMESTAMP | ( | srSLMGObj * | pThis,
|  | int * | piYear,
|  | int * | piMonth,
|  | int * | piDay,
|  | int * | piHour,
|  | int * | piMinute,
|  | int * | piSecond,
|  | int * | piSecFrac,
|  | int * | piSecFracPrecision,
|  | int * | piOffsetHour,
|  | int * | piOffsetMinute,
|  | char * | pcOffsetMode,
|  | int * | pbHasTZ
| ) |

  | Provide the caller back with the message timestamp. The timestamp is provided in separate fields. Parameters:
  ppsz | Pointer to Pointer to unsigned char to receive the return string.

int srSLMGParseInt32 | ( | unsigned char ** | ppsz | ) |

  | Parse a 32 bit integer number from a string. Parameters:
  ppsz | Pointer to the Pointer to the string being parsed. It must be positioned at the first digit. Will be updated so that on return it points to the first character AFTER the integer parsed.
  Return values:
  The | number parsed.