├── AUTHORS ├── NEWS ├── m4 └── .gitignore ├── rfc3195 ├── doc │ ├── Makefile.am │ └── html │ │ ├── doxygen.png │ │ ├── pages.html │ │ ├── template_8h-source.html │ │ ├── structsbPSSRObject__-members.html │ │ ├── srUtils_8h-source.html │ │ ├── structsbPSRCObject__-members.html │ │ ├── structsbStrBObject-members.html │ │ ├── globals_type.html │ │ ├── globals_enum.html │ │ ├── structsrAPIObject-members.html │ │ ├── resource_8h-source.html │ │ ├── structsbProfObject-members.html │ │ ├── oscalls_8h-source.html │ │ ├── lstnprof-3195raw_8h-source.html │ │ ├── lstnprof-3195cooked_8h-source.html │ │ ├── structsbLstnObject-members.html │ │ ├── structsbPSSRObject__.html │ │ ├── annotated.html │ │ ├── Makefile.am │ │ ├── structsbMesgObject-members.html │ │ ├── structsbSockObject-members.html │ │ ├── structsbPSRCObject__.html │ │ ├── structsbChanObject-members.html │ │ ├── structsbNVTEObject-members.html │ │ ├── globals_defs.html │ │ ├── structsbStrBObject.html │ │ ├── oscalls_8c.html │ │ ├── structsbSessObject-members.html │ │ ├── clntprof-3195raw_8h-source.html │ │ ├── clntprof-3195cooked_8h-source.html │ │ ├── stringbuf_8h-source.html │ │ ├── structsbFramObject-members.html │ │ ├── structsbProfObject.html │ │ ├── lstnprof-3195raw_8h.html │ │ ├── lstnprof-3195cooked_8h.html │ │ ├── structsrAPIObject.html │ │ ├── syslogmessage_8h.html │ │ ├── lstnprof-3195raw_8c.html │ │ ├── lstnprof-3195cooked_8c.html │ │ └── doxygen.css ├── src │ ├── template.h │ ├── resource.h │ ├── template.c │ ├── Makefile.am │ ├── win32 │ │ └── liblogging.sln │ ├── lstnprof-3195raw.h │ ├── lstnprof-3195cooked.h │ ├── oscalls.h │ ├── srUtils.h │ ├── oscalls.c │ ├── clntprof-3195raw.h │ ├── srUtils.c │ ├── oscallsWin32.c │ ├── clntprof-3195cooked.h │ ├── oscallsUnix.c │ ├── stringbuf.h │ ├── testsrvr.c │ └── clntprof-3195raw.c ├── liblogging-rfc3195.pc.in ├── AUTHORS └── README ├── README ├── .travis.yml ├── stdlog ├── liblogging-stdlog.pc.in ├── README.md ├── stdlogctl.rst ├── tester.c ├── Makefile.am ├── stdlogctl.c ├── jrnldrvr.c ├── stdlog-intern.h ├── file.c ├── stdlog.h └── uxsock.c ├── .gitignore ├── Makefile.am ├── autogen.sh ├── COPYING ├── HISTORY.md └── README.md /AUTHORS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /m4/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rfc3195/doc/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = html 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | See README.md (this file here exists for autotools, only) 2 | -------------------------------------------------------------------------------- /rfc3195/doc/html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsyslog/liblogging/HEAD/rfc3195/doc/html/doxygen.png -------------------------------------------------------------------------------- /rfc3195/src/template.h: -------------------------------------------------------------------------------- 1 | /*! \file beepchan.h 2 | * \brief global objects and defines 3 | * 4 | */ 5 | #ifndef __LIB3195_BEEPCHAN_H_INCLUDED__ 6 | #define __LIB3195_BEEPCHAN_H_INCLUDED__ 1 7 | 8 | #endif -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: c 4 | 5 | compiler: 6 | - gcc 7 | - clang 8 | 9 | addons: 10 | apt: 11 | packages: 12 | - python-docutils 13 | 14 | script: 15 | - export CFLAGS="-Wall" 16 | - autoreconf -fvi && ./configure && make distcheck 17 | -------------------------------------------------------------------------------- /rfc3195/liblogging-rfc3195.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: liblogging-rfc3195 7 | Description: RFC 3195 logging library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -llogging-rfc3195 @rt_libs@ 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /stdlog/liblogging-stdlog.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: liblogging-stdlog 7 | Description: an enhanced replacement for the syslog() API with admin-configurable destinations 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -llogging-stdlog 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | aclocal.m4 4 | autom4te.cache 5 | config.guess 6 | config.h 7 | config.h.in 8 | config.log 9 | config.status 10 | config.sub 11 | configure 12 | depcomp 13 | install-sh 14 | libtool 15 | ltmain.sh 16 | missing 17 | stamp-h1 18 | .deps 19 | .libs 20 | *.o 21 | *.lo 22 | *.la 23 | testdrvr 24 | testsrvr 25 | *~ 26 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = 2 | pkgconfig_DATA = 3 | 4 | pkgconfigdir = $(libdir)/pkgconfig 5 | 6 | if ENABLE_STDLOG 7 | pkgconfig_DATA += stdlog/liblogging-stdlog.pc 8 | SUBDIRS += stdlog 9 | endif 10 | 11 | if ENABLE_RFC3195 12 | pkgconfig_DATA += rfc3195/liblogging-rfc3195.pc 13 | SUBDIRS += rfc3195/doc rfc3195/src 14 | endif 15 | 16 | ACLOCAL_AMFLAGS=-I m4 17 | -------------------------------------------------------------------------------- /rfc3195/AUTHORS: -------------------------------------------------------------------------------- 1 | Maintainer(s): 2 | Rainer Gerhards 3 | 4 | Original Authors: 5 | Rainer Gerhards 6 | Devin Kowatch - *nix port 7 | 8 | 9 | Although not an author of this library, I would 10 | like to give special credits to Marshall T. Rose 11 | for insisting on BEEP being simple ;) 12 | Rainer Gerhards -------------------------------------------------------------------------------- /rfc3195/src/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by liblogging.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /rfc3195/src/template.c: -------------------------------------------------------------------------------- 1 | /*! \file beepchan.c 2 | * \brief The BEEP channel object. 3 | * 4 | */ 5 | 6 | #include "settings.h" 7 | #include "lib3195.h" 8 | #include 9 | 10 | // ################################################################# 11 | // private members 12 | // ################################################################# 13 | 14 | 15 | // ################################################################# 16 | // public members 17 | // ################################################################# 18 | 19 | -------------------------------------------------------------------------------- /stdlog/README.md: -------------------------------------------------------------------------------- 1 | This is the standard log component of liblognorm. 2 | 3 | Supported Platforms: 4 | -------------------- 5 | The library has at least successfully been build and 6 | passed a short test on these platforms: 7 | 8 | * Linux 9 | * FreeBSD 10 | * Solaris (10) 11 | 12 | More platforms will be added as work progresses. In general, 13 | we use fairly common C constructs, so chances are high that 14 | the library builds on your platform even if it is not yet 15 | listed. 16 | 17 | If you run in to problems, please report them. If you know 18 | how to fix problems, send a patch or pull request (e.g. via 19 | github). 20 | -------------------------------------------------------------------------------- /stdlog/stdlogctl.rst: -------------------------------------------------------------------------------- 1 | ========= 2 | stdlogctl 3 | ========= 4 | 5 | ---------------------------------------- 6 | utility for the standard logging library 7 | ---------------------------------------- 8 | 9 | :Author: Rainer Gerhards 10 | :Date: 2014-02-21 11 | :Manual section: 1 12 | :Manual group: standard logging library 13 | 14 | SYNOPSIS 15 | ======== 16 | 17 | :: 18 | 19 | stdlogctl 20 | 21 | 22 | DESCRIPTION 23 | =========== 24 | 25 | The stdlogctl utility prints out the version of the currently 26 | installed liblogging-stdlog as well as some of its built-time 27 | constants and runtime defaults. 28 | 29 | SEE ALSO 30 | ======== 31 | **stdlog(3)** 32 | 33 | COPYRIGHT 34 | ========= 35 | 36 | This page is part of the *liblogging* project, and is available under 37 | the same BSD 2-clause license as the rest of the project. 38 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | # Licensed under ASL 2.0 (as of email conversation with original 4 | # author Michael Biebl on 2016-12-04). 5 | 6 | srcdir=`dirname $0` 7 | test -z "$srcdir" && srcdir=. 8 | 9 | (test -f $srcdir/configure.ac) || { 10 | echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" 11 | echo " top-level package directory" 12 | exit 1 13 | } 14 | 15 | if test -z "$*"; then 16 | echo "**Warning**: I am going to run \`configure' with no arguments." 17 | echo "If you wish to pass any to it, please specify them on the" 18 | echo \`$0\'" command line." 19 | echo 20 | fi 21 | 22 | (cd $srcdir && autoreconf --verbose --force --install) || exit 1 23 | 24 | conf_flags="--cache-file=config.cache" 25 | 26 | if test x$NOCONFIGURE = x; then 27 | echo Running $srcdir/configure $conf_flags "$@" ... 28 | $srcdir/configure $conf_flags "$@" \ 29 | && echo Now type \`make\' to compile. || exit 1 30 | else 31 | echo Skipping configure process. 32 | fi 33 | 34 | 35 | -------------------------------------------------------------------------------- /stdlog/tester.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "stdlog.h" 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | char buf[40]; 9 | stdlog_channel_t ch; 10 | stdlog_channel_t ch2; 11 | int dflt_option = STDLOG_SIGSAFE; 12 | int option = 0; 13 | char *chanspec = NULL; 14 | 15 | if (3 == argc && (0 == strcmp(argv[1], "-p"))) { 16 | dflt_option |= STDLOG_PID; 17 | option |= STDLOG_PID; 18 | chanspec = argv[2]; 19 | } else if (2 == argc) { 20 | chanspec = argv[1]; 21 | } else if(argc < 2 || argc > 3) { 22 | fprintf(stderr, "Usage: tester [-p] channelspec\n"); 23 | exit(1); 24 | } 25 | 26 | stdlog_init(dflt_option); 27 | ch = stdlog_open("tester", option, STDLOG_LOCAL0, chanspec); 28 | ch2 = stdlog_open("tester", STDLOG_USE_DFLT_OPTS, STDLOG_LOCAL0, chanspec); 29 | stdlog_log(ch, STDLOG_DEBUG, "Test %10.6s, %u, %d, %c, %x, %p, %f", 30 | "abc", 4712, -4712, 'T', 0x129abcf0, NULL, 12.0345); 31 | stdlog_log_b(ch2, STDLOG_DEBUG, buf, sizeof(buf), "Test %100.50s, %u, %d, %c, %x, %p, %f", 32 | "abc", 4712, -4712, 'T', 0x129abcf0, NULL, 12.03); 33 | stdlog_deinit(); 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /rfc3195/doc/html/pages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Page Index 4 | 5 | 6 | 7 | 8 |

liblogging Related Pages

Here is a list of all related documentation pages: 12 |
Generated on Mon Oct 3 12:29:57 2005 for liblogging by 13 | 14 | doxygen 15 | 1.3.2
16 | 17 | 18 | -------------------------------------------------------------------------------- /rfc3195/doc/html/template_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: template.h Source File 4 | 5 | 6 | 7 | 8 |

template.h

00001 
 9 | 00005 #ifndef __LIB3195_BEEPCHAN_H_INCLUDED__
10 | 00006 #define __LIB3195_BEEPCHAN_H_INCLUDED__ 1
11 | 00007 
12 | 00008 #endif
13 | 

Generated on Mon Oct 3 12:29:55 2005 for liblogging by 14 | 15 | doxygen 16 | 1.3.2
17 | 18 | 19 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright 2002-2014 2 | Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in 13 | the documentation and/or other materials provided with the 14 | distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 17 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 20 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /rfc3195/src/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = liblogging-rfc3195.la 2 | 3 | liblogging_rfc3195_la_CFLAGS = ${AM_CFLAGS} 4 | liblogging_rfc3195_la_LDFLAGS = \ 5 | -version-info 0:0:0 \ 6 | -export-symbols-regex '(^(srAPI|srSLMG).*)' 7 | liblogging_rfc3195_la_SOURCES = \ 8 | beepchannel.c \ 9 | beepframe.c \ 10 | beeplisten.c \ 11 | beepmessage.c \ 12 | beepprofile.c \ 13 | beepsession.c \ 14 | beepsession-lstn.c \ 15 | clntprof-3195cooked.c \ 16 | clntprof-3195raw.c \ 17 | lstnprof-3195raw.c \ 18 | lstnprof-3195cooked.c \ 19 | namevaluetree.c \ 20 | oscalls.c \ 21 | sockets.c \ 22 | srAPI.c \ 23 | srAPI-lstn.c \ 24 | srUtils.c \ 25 | stringbuf.c \ 26 | syslogmessage.c 27 | 28 | os_sources = \ 29 | oscallsUnix.c \ 30 | oscallsWin32.c \ 31 | socketsUnix.c \ 32 | socketsWin32.c 33 | 34 | 35 | pkginclude_HEADERS = \ 36 | liblogging.h \ 37 | srAPI.h \ 38 | settings.h \ 39 | syslogmessage.h 40 | 41 | noinst_HEADERS = \ 42 | beepchannel.h \ 43 | beepframe.h \ 44 | beeplisten.h \ 45 | beepmessage.h \ 46 | beepprofile.h \ 47 | beepsession.h \ 48 | clntprof-3195cooked.h \ 49 | clntprof-3195raw.h \ 50 | lstnprof-3195cooked.h \ 51 | lstnprof-3195raw.h \ 52 | namevaluetree.h \ 53 | oscalls.h \ 54 | sockets.h \ 55 | srUtils.h \ 56 | stringbuf.h 57 | 58 | noinst_PROGRAMS = testsrvr testdrvr 59 | 60 | testsrvr_SOURCES = testsrvr.c 61 | testsrvr_la_CFLAGS = ${AM_CFLAGS} 62 | testsrvr_LDADD = liblogging-rfc3195.la 63 | 64 | testdrvr_SOURCES = testdrvr.c 65 | testdrvr_la_CFLAGS = ${AM_CFLAGS} 66 | testdrvr_LDADD = liblogging-rfc3195.la 67 | 68 | EXTRA_DIST = $(os_sources) 69 | -------------------------------------------------------------------------------- /stdlog/Makefile.am: -------------------------------------------------------------------------------- 1 | CLEANFILES = 2 | 3 | lib_LTLIBRARIES = liblogging-stdlog.la 4 | liblogging_stdlog_la_CPPFLAGS = 5 | liblogging_stdlog_la_CFLAGS = ${AM_CFLAGS} 6 | liblogging_stdlog_la_LIBADD = $(SOL_LIBS) 7 | liblogging_stdlog_la_LDFLAGS = \ 8 | -version-info 1:0:1 \ 9 | -export-symbols-regex '(^stdlog_.*)' 10 | # For instructions on how to increment --version-info see: 11 | # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html 12 | 13 | liblogging_stdlog_la_SOURCES = \ 14 | stdlog.c \ 15 | uxsock.c \ 16 | file.c \ 17 | formatter.c \ 18 | timeutils.c 19 | EXTRA_DIST = stdlog-intern.h \ 20 | stdlog.rst \ 21 | stdlogctl.rst 22 | 23 | pkginclude_HEADERS = \ 24 | stdlog.h 25 | 26 | noinst_HEADERS = 27 | noinst_PROGRAMS = tester 28 | bin_PROGRAMS = 29 | 30 | tester_SOURCES = tester.c 31 | tester_LDADD = liblogging-stdlog.la $(SOL_LIBS) 32 | 33 | bin_PROGRAMS += stdlogctl 34 | stdlogctl_SOURCES = stdlogctl.c 35 | stdlogctl_CPPFLAGS = 36 | stdlogctl_la_CFLAGS = ${AM_CFLAGS} 37 | stdlogctl_LDADD = liblogging-stdlog.la $(SOL_LIBS) 38 | 39 | if ENABLE_JOURNAL 40 | liblogging_stdlog_la_LIBADD += $(LIBSYSTEMD_JOURNAL_LIBS) 41 | liblogging_stdlog_la_SOURCES += jrnldrvr.c 42 | tester_LDADD += $(LIBSYSTEMD_JOURNAL_LIBS) 43 | stdlogctl_LDADD += $(LIBSYSTEMD_JOURNAL_LIBS) 44 | endif 45 | 46 | if ENABLE_MAN_PAGES 47 | man1_MANS = stdlogctl.1 48 | CLEANFILES += stdlogctl.1 49 | EXTRA_DIST += stdlogctl.1 50 | 51 | man3_MANS = stdlog.3 52 | CLEANFILES += stdlog.3 53 | EXTRA_DIST += stdlog.3 54 | 55 | stdlogctl.1: stdlogctl.rst 56 | $(AM_V_GEN) $(RST2MAN) stdlogctl.rst $@ 57 | 58 | stdlog.3: stdlog.rst 59 | $(AM_V_GEN) $(RST2MAN) stdlog.rst $@ 60 | endif 61 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbPSSRObject__-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbPSSRObject_ Member List

This is the complete list of members for sbPSSRObject_, including all inherited members. 9 | 10 | 11 | 12 |
OIDsbPSSRObject_
uAnsnosbPSSRObject_
uMsgno4rawsbPSSRObject_

Generated on Mon Oct 3 12:29:56 2005 for liblogging by 13 | 14 | doxygen 15 | 1.3.2
16 | 17 | 18 | -------------------------------------------------------------------------------- /rfc3195/doc/html/srUtils_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: srUtils.h Source File 4 | 5 | 6 | 7 | 8 |

srUtils.h

Go to the documentation of this file.
00001 
 9 | 00040 #ifndef __LIB3195_SRUTILS_H_INCLUDED__
10 | 00041 #define __LIB3195_SRUTILS_H_INCLUDED__ 1
11 | 00042 
12 | 00043 #include "config.h"
13 | 00044 
14 | 00062 srRetVal srUtilItoA(char *pBuf, int iLenBuf, int iToConv);
15 | 00063 
16 | 00064 #endif
17 | 

Generated on Mon Oct 3 12:29:55 2005 for liblogging by 18 | 19 | doxygen 20 | 1.3.2
21 | 22 | 23 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbPSRCObject__-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbPSRCObject_ Member List

This is the complete list of members for sbPSRCObject_, including all inherited members. 9 | 10 | 11 | 12 | 13 |
OIDsbPSRCObject_
pszMyHostNamesbPSRCObject_
pszMyIPsbPSRCObject_
uNextMsgnosbPSRCObject_

Generated on Mon Oct 3 12:29:56 2005 for liblogging by 14 | 15 | doxygen 16 | 1.3.2
17 | 18 | 19 | -------------------------------------------------------------------------------- /rfc3195/src/win32/liblogging.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 9.00 2 | # Visual Studio 2005 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblogging", "liblogging.vcproj", "{FEF17E17-E510-448A-8E4C-E9DC58DFED85}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestDrvr", "TestDrvr.vcproj", "{C929E5A5-AAFA-4702-877D-37A4A608595E}" 6 | ProjectSection(ProjectDependencies) = postProject 7 | {FEF17E17-E510-448A-8E4C-E9DC58DFED85} = {FEF17E17-E510-448A-8E4C-E9DC58DFED85} 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsrvr", "testsrvr.vcproj", "{1B06F4E8-CBCD-415C-87FD-7DDF13230E23}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | {FEF17E17-E510-448A-8E4C-E9DC58DFED85} = {FEF17E17-E510-448A-8E4C-E9DC58DFED85} 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Win32 = Debug|Win32 18 | Release|Win32 = Release|Win32 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {FEF17E17-E510-448A-8E4C-E9DC58DFED85}.Debug|Win32.ActiveCfg = Debug|Win32 22 | {FEF17E17-E510-448A-8E4C-E9DC58DFED85}.Debug|Win32.Build.0 = Debug|Win32 23 | {FEF17E17-E510-448A-8E4C-E9DC58DFED85}.Release|Win32.ActiveCfg = Release|Win32 24 | {FEF17E17-E510-448A-8E4C-E9DC58DFED85}.Release|Win32.Build.0 = Release|Win32 25 | {C929E5A5-AAFA-4702-877D-37A4A608595E}.Debug|Win32.ActiveCfg = Debug|Win32 26 | {C929E5A5-AAFA-4702-877D-37A4A608595E}.Debug|Win32.Build.0 = Debug|Win32 27 | {C929E5A5-AAFA-4702-877D-37A4A608595E}.Release|Win32.ActiveCfg = Release|Win32 28 | {C929E5A5-AAFA-4702-877D-37A4A608595E}.Release|Win32.Build.0 = Release|Win32 29 | {1B06F4E8-CBCD-415C-87FD-7DDF13230E23}.Debug|Win32.ActiveCfg = Debug|Win32 30 | {1B06F4E8-CBCD-415C-87FD-7DDF13230E23}.Release|Win32.ActiveCfg = Release|Win32 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbStrBObject-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbStrBObject Member List

This is the complete list of members for sbStrBObject, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 |
iAllocIncrementsbStrBObject
iBufPtrsbStrBObject
iBufSizesbStrBObject
OIDsbStrBObject
pBufsbStrBObject

Generated on Mon Oct 3 12:29:57 2005 for liblogging by 15 | 16 | doxygen 17 | 1.3.2
18 | 19 | 20 | -------------------------------------------------------------------------------- /rfc3195/doc/html/globals_type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: File Member Index 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 |

22 |
Generated on Mon Oct 3 12:29:57 2005 for liblogging by 23 | 24 | doxygen 25 | 1.3.2
26 | 27 | 28 | -------------------------------------------------------------------------------- /stdlog/stdlogctl.c: -------------------------------------------------------------------------------- 1 | /* A small utility for handling stdlog functions. 2 | * Right now, it only spits out version information and buffer 3 | * sizes, but we could evolve it into something to manipulate 4 | * system default config files (once we have them). 5 | * 6 | * Copyright (C) 2014 Adiscon GmbH 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY ADISCON AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL ADISCON OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | #include 31 | #include 32 | #include "stdlog.h" 33 | 34 | int 35 | main(int __attribute__((unused)) argc, char __attribute__((unused)) *argv[]) 36 | { 37 | printf("liblogging-stdlog version %s:\n", stdlog_version()); 38 | 39 | stdlog_init(0); 40 | printf("\tmax message size: %d\n", (int) stdlog_get_msgbuf_size()); 41 | printf("\tdefault channel.: \"%s\"\n", stdlog_get_dflt_chanspec()); 42 | stdlog_deinit(); 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /rfc3195/doc/html/globals_enum.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: File Member Index 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 |

22 |
Generated on Mon Oct 3 12:29:57 2005 for liblogging by 23 | 24 | doxygen 25 | 1.3.2
26 | 27 | 28 | -------------------------------------------------------------------------------- /rfc3195/README: -------------------------------------------------------------------------------- 1 | **This is documentation for liblogging's rfc3195 component** 2 | 3 | Note that it is unlikely that you actually want to use this 4 | component in a new program. RFC3195 has failed, and almost 5 | nobody supports it. However, if you actually need to implement 6 | rfc3195 inside a new program, this library is for you. 7 | 8 | NOTE: for historical reasons, this component's library files 9 | are called "liblogging". Again, you do NOT need this component 10 | for anything other than rfc3195 processing! 11 | 12 | 13 | With that said: 14 | See doc/index.html for the full documentation. 15 | 16 | IMPORTANT: if you intend to just USE the library 17 | (and NOT modify or port it), YOU NEED 18 | TO READ ONLY THE API DOCUMENTATION. 19 | There is a link to it directly from the 20 | documentation home page. If you don't find 21 | it, go to the file srAPI.h and syslogmessage.h 22 | for a description. 23 | 24 | File testdrvr.c is a working sample program. You must edit 25 | it because it contains a hardcoded IP address. 26 | 27 | File testsrvr.c is a working sample server program. It is used to 28 | demo the API - please don't expect it to be a full syslogd ;) 29 | All it does is dump the message plus a few properties out to 30 | stdout. 31 | 32 | Thanks to Devin Kowatch, the library now compiles not 33 | only under Win32, but also Linux, Solaris, FreeBSD and AIX. I will 34 | move some more details on setting those things up. 35 | 36 | There are two ways to build liblogging under linux/solaris. 37 | Method 1: 38 | Edit the 'makefile' to uncomment the needed bits to make it compile 39 | under your desired platform. 40 | run 'make' 41 | 42 | Method 2: 43 | % cd 44 | % make 45 | Where is either linux or solaris 46 | 47 | 48 | For AIX and FreeBSD, use the linux platform. 49 | 50 | Many thanks to Albert Mietus for providing comments as well as some 51 | syslog-sign code that I can use to pull ideas from. 52 | 53 | Updates are always posted at the project web 54 | site at 55 | 56 | http://www.liblogging.org/ 57 | 58 | I hope you will find the library useful, 59 | Rainer Gerhards 60 | 61 | 62 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsrAPIObject-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

srAPIObject Member List

This is the complete list of members for srAPIObject, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 |
iUse3195ProfilessrAPIObject
OIDsrAPIObject
pChansrAPIObject
pProfsSupportedsrAPIObject
pSesssrAPIObject
pUsrsrAPIObject

Generated on Mon Oct 3 12:29:57 2005 for liblogging by 16 | 17 | doxygen 18 | 1.3.2
19 | 20 | 21 | -------------------------------------------------------------------------------- /rfc3195/doc/html/resource_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: resource.h Source File 4 | 5 | 6 | 7 | 8 |

resource.h

00001 //{{NO_DEPENDENCIES}}
 9 | 00002 // Microsoft Visual C++ generated include file.
10 | 00003 // Used by liblogging.rc
11 | 00004 
12 | 00005 // Next default values for new objects
13 | 00006 // 
14 | 00007 #ifdef APSTUDIO_INVOKED
15 | 00008 #ifndef APSTUDIO_READONLY_SYMBOLS
16 | 00009 #define _APS_NEXT_RESOURCE_VALUE        101
17 | 00010 #define _APS_NEXT_COMMAND_VALUE         40001
18 | 00011 #define _APS_NEXT_CONTROL_VALUE         1001
19 | 00012 #define _APS_NEXT_SYMED_VALUE           101
20 | 00013 #endif
21 | 00014 #endif
22 | 

Generated on Mon Oct 3 12:29:55 2005 for liblogging by 23 | 24 | doxygen 25 | 1.3.2
26 | 27 | 28 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbProfObject-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbProfObject Member List

This is the complete list of members for sbProfObject, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 |
OIDsbProfObject
OnClntCloseLogChansbProfObject
OnClntOpenLogChansbProfObject
OnClntSendLogMsgsbProfObject
OnClntSendSLMGsbProfObject
pszProfileURIsbProfObject

Generated on Mon Oct 3 12:29:56 2005 for liblogging by 16 | 17 | doxygen 18 | 1.3.2
19 | 20 | 21 | -------------------------------------------------------------------------------- /rfc3195/doc/html/oscalls_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: oscalls.h Source File 4 | 5 | 6 | 7 | 8 |

oscalls.h

Go to the documentation of this file.
00001 
 9 | 00040 #ifndef __LIB3195_OSCALLS_H_INCLUDED__
10 | 00041 #define __LIB3195_OSCALLS_H_INCLUDED__ 1
11 | 00042 
12 | 00043 #include "config.h"
13 | 00044 
14 | 00056 srRetVal getCurrTime(int* year, int* month, int* day, int *hour, int* minute, int *second,
15 | 00057                                          int* millisec, int *bHasMS, char* pcOffsetMode, int* pOffsetHour, 
16 | 00058                                          int* pOffsetMinute);
17 | 00059 
18 | 00060 #endif
19 | 

Generated on Mon Oct 3 12:29:55 2005 for liblogging by 20 | 21 | doxygen 22 | 1.3.2
23 | 24 | 25 | -------------------------------------------------------------------------------- /rfc3195/src/lstnprof-3195raw.h: -------------------------------------------------------------------------------- 1 | /*! \file lstnprof-3195raw.h 2 | * \brief The 3195 raw listener profile. 3 | * 4 | * Listener profiles are specific in that they do not support their 5 | * own full blown objects but only the callback code. 6 | * 7 | * \author Rainer Gerhards 8 | * \date 2003-08-22 9 | * coding begun 10 | * 11 | * Copyright 2002-2014 12 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions are 16 | * met: 17 | * 18 | * * Redistributions of source code must retain the above copyright 19 | * notice, this list of conditions and the following disclaimer. 20 | * 21 | * * Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in 23 | * the documentation and/or other materials provided with the 24 | * distribution. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 27 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 29 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 31 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 32 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 33 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 34 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | #ifndef __LIB3195_LISTNPROF_3195RAW_H_INCLUDED__ 39 | #define __LIB3195_LISTNPROF_3195RAW_H_INCLUDED__ 1 40 | 41 | struct sbMesgObject; 42 | 43 | srRetVal psrrOnChanCreate(struct sbProfObject *pThis, struct sbSessObject* pSess, struct sbChanObject* pChan); 44 | srRetVal psrrOnMesgRecv(struct sbProfObject *pThis, int* pbAbort, struct sbSessObject* pSess, struct sbChanObject* pChan, struct sbMesgObject *pMesg); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /rfc3195/src/lstnprof-3195cooked.h: -------------------------------------------------------------------------------- 1 | /*! \file lstnprof-3195cooked.h 2 | * \brief The 3195 COOKED listener profile. 3 | * 4 | * Listener profiles are specific in that they do not support their 5 | * own full blown objects but only the callback code. 6 | * 7 | * \author Rainer Gerhards 8 | * \date 2003-09-05 9 | * file creatd, but coding not yet begun 10 | * 11 | * Copyright 2002-2014 12 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions are 16 | * met: 17 | * 18 | * * Redistributions of source code must retain the above copyright 19 | * notice, this list of conditions and the following disclaimer. 20 | * 21 | * * Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in 23 | * the documentation and/or other materials provided with the 24 | * distribution. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 27 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 29 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 31 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 32 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 33 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 34 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | #ifndef __LIB3195_LISTNPROF_3195COOKED_H_INCLUDED__ 39 | #define __LIB3195_LISTNPROF_3195COOKED_H_INCLUDED__ 1 40 | 41 | struct sbMesgObject; 42 | 43 | srRetVal psrcOnChanCreate(struct sbProfObject *pThis, struct sbSessObject* pSess, struct sbChanObject* pChan); 44 | srRetVal psrcOnMesgRecv(struct sbProfObject *pThis, int* pbAbort, struct sbSessObject* pSess, struct sbChanObject* pChan, struct sbMesgObject *pMesg); 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /rfc3195/src/oscalls.h: -------------------------------------------------------------------------------- 1 | /*! \file oscalls.h 2 | * \brief slim wrapper for OS API calls. 3 | * 4 | * \author Rainer Gerhards 5 | * \date 2003-09-02 6 | * Coding begun. 7 | * 8 | * Copyright 2002-2014 9 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions are 13 | * met: 14 | * 15 | * * Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 18 | * * Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimer in 20 | * the documentation and/or other materials provided with the 21 | * distribution. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 24 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 26 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 27 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | #ifndef __LIB3195_OSCALLS_H_INCLUDED__ 36 | #define __LIB3195_OSCALLS_H_INCLUDED__ 1 37 | 38 | #include "settings.h" 39 | 40 | /** 41 | * Get the current date/time in the best resolution the operating 42 | * system has to offer (well, actually at most down to the milli- 43 | * second level. 44 | * 45 | * The date and time is returned in separate fields as this is 46 | * most portable and removes the need for additional structures 47 | * (but I have to admit it is somewhat "bulky";)). 48 | * 49 | * Obviously, all caller-provided pointers must not be NULL... 50 | */ 51 | srRetVal getCurrTime(int* year, int* month, int* day, int *hour, int* minute, int *second, 52 | int* millisec, int *bHasMS, char* pcOffsetMode, int* pOffsetHour, 53 | int* pOffsetMinute); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /rfc3195/doc/html/lstnprof-3195raw_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: lstnprof-3195raw.h Source File 4 | 5 | 6 | 7 | 8 |

lstnprof-3195raw.h

Go to the documentation of this file.
00001 
 9 | 00043 #ifndef __LIB3195_LISTNPROF_3195RAW_H_INCLUDED__
10 | 00044 #define __LIB3195_LISTNPROF_3195RAW_H_INCLUDED__ 1
11 | 00045 
12 | 00046 struct sbMesgObject;
13 | 00047 
14 | 00048 srRetVal psrrOnChanCreate(struct sbProfObject *pThis, struct sbSessObject* pSess, struct sbChanObject* pChan);
15 | 00049 srRetVal psrrOnMesgRecv(struct sbProfObject *pThis, int* pbAbort, struct sbSessObject* pSess, struct sbChanObject* pChan, struct sbMesgObject *pMesg);
16 | 00050 
17 | 00051 #endif
18 | 

Generated on Mon Oct 3 12:29:55 2005 for liblogging by 19 | 20 | doxygen 21 | 1.3.2
22 | 23 | 24 | -------------------------------------------------------------------------------- /stdlog/jrnldrvr.c: -------------------------------------------------------------------------------- 1 | /* The stdlog systemd journal driver 2 | * 3 | * Copyright (C) 2014 Adiscon GmbH 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY ADISCON AND CONTRIBUTORS ``AS IS'' AND 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL ADISCON OR CONTRIBUTORS BE LIABLE 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 | * SUCH DAMAGE. 26 | */ 27 | #include "config.h" 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include "stdlog-intern.h" 35 | #include "stdlog.h" 36 | 37 | /* dummies just needed for driver interface */ 38 | static void jrnl_init(stdlog_channel_t __attribute__((unused)) ch) { } 39 | static void jrnl_open(stdlog_channel_t __attribute__((unused)) ch) { } 40 | static void jrnl_close(stdlog_channel_t __attribute__((unused)) ch) { } 41 | 42 | static int 43 | jrnl_log(stdlog_channel_t ch, const int severity, 44 | const char *fmt, va_list ap, 45 | char *__restrict__ const wrkbuf, const size_t buflen) 46 | { 47 | int r; 48 | ch->f_vsnprintf(wrkbuf, buflen, fmt, ap); 49 | r = sd_journal_send("MESSAGE=%s", wrkbuf, 50 | "PRIORITY=%d", severity, 51 | NULL); 52 | if(r) errno = -r; 53 | return r; 54 | } 55 | 56 | void 57 | __stdlog_set_jrnl_drvr(stdlog_channel_t ch) 58 | { 59 | ch->drvr.init = jrnl_init; 60 | ch->drvr.open = jrnl_open; 61 | ch->drvr.close = jrnl_close; 62 | ch->drvr.log = jrnl_log; 63 | } 64 | -------------------------------------------------------------------------------- /rfc3195/doc/html/lstnprof-3195cooked_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: lstnprof-3195cooked.h Source File 4 | 5 | 6 | 7 | 8 |

lstnprof-3195cooked.h

Go to the documentation of this file.
00001 
 9 | 00043 #ifndef __LIB3195_LISTNPROF_3195COOKED_H_INCLUDED__
10 | 00044 #define __LIB3195_LISTNPROF_3195COOKED_H_INCLUDED__ 1
11 | 00045 
12 | 00046 struct sbMesgObject;
13 | 00047 
14 | 00048 srRetVal psrcOnChanCreate(struct sbProfObject *pThis, struct sbSessObject* pSess, struct sbChanObject* pChan);
15 | 00049 srRetVal psrcOnMesgRecv(struct sbProfObject *pThis, int* pbAbort, struct sbSessObject* pSess, struct sbChanObject* pChan, struct sbMesgObject *pMesg);
16 | 00050 
17 | 00051 
18 | 00052 #endif
19 | 

Generated on Mon Oct 3 12:29:55 2005 for liblogging by 20 | 21 | doxygen 22 | 1.3.2
23 | 24 | 25 | -------------------------------------------------------------------------------- /rfc3195/src/srUtils.h: -------------------------------------------------------------------------------- 1 | /*! \file srUtils.h 2 | * \brief General, small utilities that fit nowhere else. 3 | * 4 | * \author Rainer Gerhards 5 | * \date 2003-09-09 6 | * Coding begun. 7 | * 8 | * Copyright 2002-2014 9 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions are 13 | * met: 14 | * 15 | * * Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 18 | * * Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimer in 20 | * the documentation and/or other materials provided with the 21 | * distribution. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 24 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 26 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 27 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | #ifndef __LIB3195_SRUTILS_H_INCLUDED__ 36 | #define __LIB3195_SRUTILS_H_INCLUDED__ 1 37 | 38 | #include "settings.h" 39 | 40 | /** 41 | * A reimplementation of itoa(), as this is not available 42 | * on all platforms. We used the chance to make an interface 43 | * that fits us well, so it is no longer plain itoa(). 44 | * 45 | * This method works with the US-ASCII alphabet. If you port this 46 | * to e.g. EBCDIC, you need to make a small adjustment. Keep in mind, 47 | * that on the wire it MUST be US-ASCII, so basically all you need 48 | * to do is replace the constant '0' with 0x30 ;). 49 | * 50 | * \param pBuf Caller-provided buffer that will receive the 51 | * generated ASCII string. 52 | * 53 | * \param iLenBuf Length of the caller-provided buffer. 54 | * 55 | * \param iToConv The integer to be converted. 56 | */ 57 | srRetVal srUtilItoA(char *pBuf, int iLenBuf, int iToConv); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbLstnObject-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbLstnObject Member List

This is the complete list of members for sbLstnObject, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
bLstnBEEPsbLstnObject
bRunsbLstnObject
OIDsbLstnObject
pAPIsbLstnObject
pProfsSupportedsbLstnObject
pRootSessionssbLstnObject
pSockListeningsbLstnObject
szListenAddrsbLstnObject
uListenPortsbLstnObject

Generated on Mon Oct 3 12:29:56 2005 for liblogging by 19 | 20 | doxygen 21 | 1.3.2
22 | 23 | 24 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | Liblogging was created in 2002 when there was a lot of enthusiasm 2 | about rfc3195 (and the underlying BEEP protocol). It's core mission 3 | was to provide an easy way to do logging, which at that time we 4 | assumed to mean "speak rfc3195". Originally, it was developed as a 5 | closed source solution on Windows, but Adiscon relatively soon 6 | agreed to make it available as an open source library. This was 7 | done in the hope that the library would help spread rfc3195. 8 | 9 | Note that the library's design goal, from the very beginning, was 10 | to be as unintrusive as possible. RFC3195 offers multiplexing 11 | capabilites and multiple channels and the few other existing 12 | library options required dedicated threading models or even 13 | took over the main processing loop from the application. 14 | Liblogging in contrast focussed on an as simple as possible 15 | (for rfc3195 ;)) API and was able to be used with any threading 16 | model. 17 | 18 | In the early days, liblogging was still primarily developed on 19 | Windows until Devin Kowatch helped make it compile under *nix in 20 | 2003. 21 | 22 | In the coming years, liblogging kept a prime library for logging, 23 | albeit mostly in the rfc3195 context. (Not so) unfortuantely, 24 | rfc3195 never took off in the logging world. It had some bright 25 | phases but now (in 2014) I think it's fair to say it was a failure. 26 | 27 | Liblogging was maintained and kept stable over many years. In 2013 28 | we decided that it should be upgraded to support non-rfc3195 logging, 29 | living really up to it's name of "liblogging". In spring 2013 we 30 | looked at emulating systemd journal calls, enabling apps that use 31 | it to be able to run on non-systemd systems. While we prototype things, 32 | we did not dig much deeper into this as by that time (and even today) 33 | there is not much demand for the journal API in any case. 34 | 35 | More important is simple but feature-rich logging. As such, we added 36 | a third component in 2014, libstdlog. It is meant to provide basic 37 | logging services to C programs, but make it possible to use different 38 | sinks without the need to rebuild applications. In a sense, it's like 39 | a very lightweight log4j -- without all the formatting stuff and so. 40 | 41 | We believe that liblogging will play in important role when it comes 42 | to make applications independent from the logging provider. This is 43 | more important with the journal than before, because the journal 44 | structured logging API (while good) is not universally available. 45 | 46 | Future will tell how we reach this goal. In any case, you now know 47 | why there are three components inside liblogging, and you also know 48 | that liblogging's missing is the same as when it was initially designed, 49 | even though the technology to achive these goals has greatly changed. 50 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbPSSRObject__.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: sbPSSRObject_ struct Reference 4 | 5 | 6 | 7 | 8 |

sbPSSRObject_ Struct Reference

The RAW profile object used by the client profile. 9 | More... 10 |

11 | #include <clntprof-3195raw.h> 12 |

13 | List of all members. 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 24 | 26 | 27 | 28 |

Public Attributes

17 | srObjID OID
 object ID

21 | SBansno uAnsno
 ansno

25 | SBmsgno uMsgno4raw
 msgno to be used for rfc3195/RAW messages

29 |


Detailed Description

30 | The RAW profile object used by the client profile. 31 |

32 |


The documentation for this struct was generated from the following file: 34 |
Generated on Mon Oct 3 12:29:56 2005 for liblogging by 35 | 36 | doxygen 37 | 1.3.2
38 | 39 | 40 | -------------------------------------------------------------------------------- /rfc3195/doc/html/annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Annotated Index 4 | 5 | 6 | 7 | 8 |

liblogging Compound List

Here are the classes, structs, unions and interfaces with brief descriptions: 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
sbChanObjectThe BEEP channel object
sbFramObjectThe BEEP frame object
sbLstnObjectThe beep listener object
sbMesgObjectThe BEEP message object
sbNVTEObjectThe list entry object
sbProfObjectThe BEEP Profile object
sbPSRCObject_The COOKED profile object used by the client profile
sbPSSRObject_The RAW profile object used by the client profile
sbSessObjectThe session object
sbSockObjectThe socket object
sbStrBObjectThe dynamic string buffer object
srAPIObjectThe syslog-reliable API object
22 |
Generated on Mon Oct 3 12:29:56 2005 for liblogging by 23 | 24 | doxygen 25 | 1.3.2
26 | 27 | 28 | -------------------------------------------------------------------------------- /rfc3195/src/oscalls.c: -------------------------------------------------------------------------------- 1 | /**\file oscalls.c 2 | * \brief Wrapper "class" for all kinds of utility OS API 3 | * calls. 4 | * 5 | * This file implements includes all the OS API calls which do 6 | * not make up an object in their own right. 7 | * 8 | * Its primary purpose is to easy porting. 9 | * 10 | * \author Rainer Gerhards 11 | * \date 2003-09-02 12 | * Coding begun. 13 | * 14 | * Copyright 2002-2014 15 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 16 | * 17 | * Redistribution and use in source and binary forms, with or without 18 | * modification, are permitted provided that the following conditions are 19 | * met: 20 | * 21 | * * Redistributions of source code must retain the above copyright 22 | * notice, this list of conditions and the following disclaimer. 23 | * 24 | * * Redistributions in binary form must reproduce the above copyright 25 | * notice, this list of conditions and the following disclaimer in 26 | * the documentation and/or other materials provided with the 27 | * distribution. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 30 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 31 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 32 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 33 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 34 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 35 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 36 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 37 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 38 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 39 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | */ 41 | 42 | #include "settings.h" 43 | #include "liblogging.h" 44 | #include "oscalls.h" 45 | #include "assert.h" 46 | 47 | /* Now include the lower level driver so that we have 48 | * private (static) methods available during the rest of 49 | * the file. 50 | * 51 | * We also define some prototpyes of private 52 | * members that follow later in this file (no way 53 | * around this...). 54 | */ 55 | 56 | #ifdef SROS_WIN32 57 | # include "oscallsWin32.c" 58 | #else 59 | # include "oscallsUnix.c" 60 | #endif 61 | 62 | 63 | /* ################################################################# * 64 | * private members * 65 | * ################################################################# */ 66 | 67 | /* As this is not a "real" object, there won't be any private 68 | * members in this file. 69 | */ 70 | 71 | /* ################################################################# * 72 | * public members * 73 | * ################################################################# */ 74 | 75 | -------------------------------------------------------------------------------- /rfc3195/doc/html/Makefile.am: -------------------------------------------------------------------------------- 1 | doc_files = \ 2 | annotated.html \ 3 | beepchannel_8c.html \ 4 | beepchannel_8h.html \ 5 | beepchannel_8h-source.html \ 6 | beepframe_8c.html \ 7 | beepframe_8h.html \ 8 | beepframe_8h-source.html \ 9 | beeplisten_8c.html \ 10 | beeplisten_8h.html \ 11 | beeplisten_8h-source.html \ 12 | beepmessage_8c.html \ 13 | beepmessage_8h.html \ 14 | beepmessage_8h-source.html \ 15 | beepprofile_8c.html \ 16 | beepprofile_8h.html \ 17 | beepprofile_8h-source.html \ 18 | beepsession_8c.html \ 19 | beepsession_8h.html \ 20 | beepsession_8h-source.html \ 21 | beepsession-lstn_8c.html \ 22 | clntprof-3195cooked_8c.html \ 23 | clntprof-3195cooked_8h.html \ 24 | clntprof-3195cooked_8h-source.html \ 25 | clntprof-3195raw_8c.html \ 26 | clntprof-3195raw_8h.html \ 27 | clntprof-3195raw_8h-source.html \ 28 | config_8h.html \ 29 | config_8h-source.html \ 30 | doxygen.css \ 31 | doxygen.png \ 32 | files.html \ 33 | functions.html \ 34 | functions_vars.html \ 35 | globals_defs.html \ 36 | globals_enum.html \ 37 | globals_eval.html \ 38 | globals_func.html \ 39 | globals.html \ 40 | globals_type.html \ 41 | index.html \ 42 | liblogging_8h.html \ 43 | liblogging_8h-source.html \ 44 | lstnprof-3195cooked_8c.html \ 45 | lstnprof-3195cooked_8h.html \ 46 | lstnprof-3195cooked_8h-source.html \ 47 | lstnprof-3195raw_8c.html \ 48 | lstnprof-3195raw_8h.html \ 49 | lstnprof-3195raw_8h-source.html \ 50 | Makefile.am 51 | namevaluetree_8c.html \ 52 | namevaluetree_8h.html \ 53 | namevaluetree_8h-source.html \ 54 | oscalls_8c.html \ 55 | oscalls_8h.html \ 56 | oscalls_8h-source.html \ 57 | oscallsUnix_8c.html \ 58 | oscallsWin32_8c.html \ 59 | pages.html \ 60 | resource_8h-source.html \ 61 | sockets_8c.html \ 62 | sockets_8h.html \ 63 | sockets_8h-source.html \ 64 | socketsUnix_8c.html \ 65 | socketsWin32_8c.html \ 66 | srAPI_8c.html \ 67 | srAPI_8h.html \ 68 | srAPI_8h-source.html \ 69 | srAPI-lstn_8c.html \ 70 | srUtils_8c.html \ 71 | srUtils_8h.html \ 72 | srUtils_8h-source.html \ 73 | stringbuf_8c.html \ 74 | stringbuf_8h.html \ 75 | stringbuf_8h-source.html \ 76 | structsbChanObject.html \ 77 | structsbChanObject-members.html \ 78 | structsbFramObject.html \ 79 | structsbFramObject-members.html \ 80 | structsbLstnObject.html \ 81 | structsbLstnObject-members.html \ 82 | structsbMesgObject.html \ 83 | structsbMesgObject-members.html \ 84 | structsbNVTEObject.html \ 85 | structsbNVTEObject-members.html \ 86 | structsbProfObject.html \ 87 | structsbProfObject-members.html \ 88 | structsbPSRCObject__.html \ 89 | structsbPSRCObject__-members.html \ 90 | structsbPSSRObject__.html \ 91 | structsbPSSRObject__-members.html \ 92 | structsbSessObject.html \ 93 | structsbSessObject-members.html \ 94 | structsbSockObject.html \ 95 | structsbSockObject-members.html \ 96 | structsbStrBObject.html \ 97 | structsbStrBObject-members.html \ 98 | structsrAPIObject.html \ 99 | structsrAPIObject-members.html \ 100 | syslogmessage_8c.html \ 101 | syslogmessage_8h.html \ 102 | syslogmessage_8h-source.html \ 103 | template_8h-source.html \ 104 | todo.html 105 | 106 | EXTRA_DIST = $(doc_files) 107 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbMesgObject-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbMesgObject Member List

This is the complete list of members for sbMesgObject, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
bRawDirtysbMesgObject
idHdrsbMesgObject
iMIMEHdrSizesbMesgObject
iOverallSizesbMesgObject
iPayloadSizesbMesgObject
OIDsbMesgObject
szActualPayloadsbMesgObject
szMIMEHdrsbMesgObject
szRawBufsbMesgObject
uMsgnosbMesgObject
uNxtSeqnosbMesgObject
uSeqnosbMesgObject

Generated on Mon Oct 3 12:29:56 2005 for liblogging by 22 | 23 | doxygen 24 | 1.3.2
25 | 26 | 27 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbSockObject-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbSockObject Member List

This is the complete list of members for sbSockObject, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
bIsInErrorsbSockObject
dwLastErrorsbSockObject
fdsetsbSockObject
iCurInBufPossbSockObject
iInBufLensbSockObject
iLastErrsbSockObject
iRemHostIPBufLensbSockObject
OIDsbSockObject
pRemoteHostIPsbSockObject
RemoteHostAddrsbSockObject
socksbSockObject
szInBufsbSockObject

Generated on Mon Oct 3 12:29:57 2005 for liblogging by 22 | 23 | doxygen 24 | 1.3.2
25 | 26 | 27 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbPSRCObject__.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: sbPSRCObject_ struct Reference 4 | 5 | 6 | 7 | 8 |

sbPSRCObject_ Struct Reference

The COOKED profile object used by the client profile. 9 | More... 10 |

11 | #include <clntprof-3195cooked.h> 12 |

13 | List of all members. 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 24 | 26 | 27 | 28 | 30 | 31 | 32 |

Public Attributes

17 | srObjID OID
 object ID

21 | SBmsgno uNextMsgno
 msgno for next message to be send

25 | char * pszMyIP
 buffered local IP addres (that being used for sending to the remote peer)

29 | char * pszMyHostName
 buffered local host FQDN (that being used for sending to the remote peer)

33 |


Detailed Description

34 | The COOKED profile object used by the client profile. 35 |

36 |


The documentation for this struct was generated from the following file: 38 |
Generated on Mon Oct 3 12:29:56 2005 for liblogging by 39 | 40 | doxygen 41 | 1.3.2
42 | 43 | 44 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbChanObject-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbChanObject Member List

This is the complete list of members for sbChanObject, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
iStatesbChanObject
OIDsbChanObject
pProfsbChanObject
pProfInstancesbChanObject
pSesssbChanObject
pSocksbChanObject
uChanNumsbChanObject
uMsgnosbChanObject
uRXWinsbChanObject
uRXWinLeftsbChanObject
uSeqnosbChanObject
uTXWinsbChanObject
uTXWinLeftsbChanObject

Generated on Mon Oct 3 12:29:56 2005 for liblogging by 23 | 24 | doxygen 25 | 1.3.2
26 | 27 | 28 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbNVTEObject-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbNVTEObject Member List

This is the complete list of members for sbNVTEObject, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
bIsSetUValuesbNVTEObject
OIDsbNVTEObject
pCDATAsbNVTEObject
pChildsbNVTEObject
pNextsbNVTEObject
pszKeysbNVTEObject
pszValuesbNVTEObject
pUsrsbNVTEObject
pUsrDestroysbNVTEObject
pXMLPropssbNVTEObject
uKeysbNVTEObject
uKeyPresentsbNVTEObject
uValuesbNVTEObject

Generated on Mon Oct 3 12:29:56 2005 for liblogging by 23 | 24 | doxygen 25 | 1.3.2
26 | 27 | 28 | -------------------------------------------------------------------------------- /rfc3195/doc/html/globals_defs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: File Member Index 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 |

39 |
Generated on Mon Oct 3 12:29:57 2005 for liblogging by 40 | 41 | doxygen 42 | 1.3.2
43 | 44 | 45 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbStrBObject.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: sbStrBObject struct Reference 4 | 5 | 6 | 7 | 8 |

sbStrBObject Struct Reference

The dynamic string buffer object. 9 | More... 10 |

11 | #include <stringbuf.h> 12 |

13 | List of all members. 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 24 | 26 | 27 | 28 | 30 | 31 | 32 | 34 | 35 | 36 |

Public Attributes

17 | srObjID OID
 object ID

21 | char * pBuf
 pointer to the string buffer, may be NULL if string is empty

25 | int iBufSize
 current maximum size of the string buffer

29 | int iBufPtr
 pointer (index) of next character position to be written to

33 | int iAllocIncrement
 the amount of bytes the string should be expanded if it needs to

37 |


Detailed Description

38 | The dynamic string buffer object. 39 |

40 |


The documentation for this struct was generated from the following file: 42 |
Generated on Mon Oct 3 12:29:57 2005 for liblogging by 43 | 44 | doxygen 45 | 1.3.2
46 | 47 | 48 | -------------------------------------------------------------------------------- /rfc3195/src/clntprof-3195raw.h: -------------------------------------------------------------------------------- 1 | /*! \file clntprof-3195raw.h 2 | * \brief The client profile for RFC 3195 raw. 3 | * 4 | * The prefix for this "object" is psrr which stands for 5 | * *P*rofile *S*yslog *R*eliable *Raw*. This file works in 6 | * conjunction with \ref lstnprof-3195raw.c and shares 7 | * its namespace. 8 | * 9 | * \author Rainer Gerhards 10 | * \date 2003-09-04 11 | * coding begun 12 | * 13 | * Copyright 2002-2014 14 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions are 18 | * met: 19 | * 20 | * * Redistributions of source code must retain the above copyright 21 | * notice, this list of conditions and the following disclaimer. 22 | * 23 | * * Redistributions in binary form must reproduce the above copyright 24 | * notice, this list of conditions and the following disclaimer in 25 | * the documentation and/or other materials provided with the 26 | * distribution. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 29 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 30 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 31 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 32 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 33 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 34 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 35 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 36 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 37 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 38 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | */ 40 | #ifndef __LIB3195_CLNTPROF_3195RAW_H_INCLUDED__ 41 | #define __LIB3195_CLNTPROF_3195RAW_H_INCLUDED__ 1 42 | #define sbPSSRCHECKVALIDOBJECT(x) {assert(x != NULL); assert(x->OID == OIDsbPSSR);} 43 | 44 | /** 45 | * The RAW profile object used by the client profile. 46 | */ 47 | struct sbPSSRObject_ 48 | { 49 | srObjID OID; /**< object ID */ 50 | SBansno uAnsno; /**< ansno */ 51 | SBmsgno uMsgno4raw; /**< msgno to be used for rfc3195/RAW messages */ 52 | }; 53 | typedef struct sbPSSRObject_ sbPSSRObj; 54 | 55 | /** 56 | * Send a message to the remote peer. 57 | */ 58 | srRetVal sbPSSRClntSendMsg(sbChanObj* pChan, char* szLogmsg); 59 | 60 | /** 61 | * Handler to be called when a new channel is 62 | * established. 63 | * 64 | * This handler is the first to be called. So it 65 | * will also create the instance's data object, at least 66 | * for those profiles, that need such. 67 | * 68 | * There is not much to do for RFC 3195/RAW ;) 69 | */ 70 | srRetVal sbPSSRClntOpenLogChan(sbChanObj *pChan); 71 | 72 | /** 73 | * Handler to be called when a channel is to be closed. 74 | */ 75 | srRetVal sbPSSRCOnClntCloseLogChan(sbChanObj *pChan); 76 | 77 | /** 78 | * Handler to send a srSLMGObj to the remote peer. This 79 | * is the preferred way to send things. 80 | * 81 | * For -RAW, it is very easy - it just needs to call the 82 | * SendMesg method with the RAW string. There is nothing 83 | * that -RAW adds to this... ;) 84 | */ 85 | srRetVal sbPSSRClntSendSLMG(struct sbChanObject* pChan, struct srSLMGObject *pSLMG); 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /rfc3195/doc/html/oscalls_8c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: oscalls.c File Reference 4 | 5 | 6 | 7 | 8 |

oscalls.c File Reference

Wrapper "class" for all kinds of utility OS API calls. 9 | More... 10 |

11 | #include "config.h"
12 | #include "liblogging.h"
13 | #include "oscalls.h"
14 | #include "assert.h"
15 | #include "oscallsUnix.c"
16 | 17 | 18 |
19 |


Detailed Description

20 | Wrapper "class" for all kinds of utility OS API calls. 21 |

22 | This file implements includes all the OS API calls which do not make up an object in their own right.

23 | Its primary purpose is to easy porting.

24 |

Author:
Rainer Gerhards <rgerhards@adiscon.com>
25 |
Date:
2003-09-02 Coding begun.
26 | Copyright 2002-2003 Rainer Gerhards and Adiscon GmbH. All Rights Reserved.

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

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

29 | * 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.

30 | * 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.

31 | 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.


Generated on Mon Oct 3 12:29:56 2005 for liblogging by 32 | 33 | doxygen 34 | 1.3.2
35 | 36 | 37 | -------------------------------------------------------------------------------- /rfc3195/src/srUtils.c: -------------------------------------------------------------------------------- 1 | /**\file srUtils.c 2 | * \brief General utilties that fit nowhere else. 3 | * 4 | * The namespace for this file is "srUtil". 5 | * 6 | * \author Rainer Gerhards 7 | * \date 2003-09-09 8 | * Coding begun. 9 | * 10 | * Copyright 2002-2014 11 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are 15 | * met: 16 | * 17 | * * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in 22 | * the documentation and/or other materials provided with the 23 | * distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 26 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 28 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 29 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 30 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 31 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 32 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 33 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 34 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | 38 | #include "settings.h" 39 | #include "liblogging.h" 40 | #include "srUtils.h" 41 | #include "assert.h" 42 | 43 | 44 | /* ################################################################# * 45 | * private members * 46 | * ################################################################# */ 47 | 48 | /* As this is not a "real" object, there won't be any private 49 | * members in this file. 50 | */ 51 | 52 | /* ################################################################# * 53 | * public members * 54 | * ################################################################# */ 55 | 56 | srRetVal srUtilItoA(char *pBuf, int iLenBuf, int iToConv) 57 | { 58 | int i; 59 | int bIsNegative; 60 | char szBuf[32]; /* sufficiently large for my lifespan and those of my children... ;) */ 61 | 62 | assert(pBuf != NULL); 63 | assert(iLenBuf > 1); /* This is actually an app error and as thus checked for... */ 64 | 65 | if(iToConv < 0) 66 | { 67 | bIsNegative = TRUE; 68 | iToConv *= -1; 69 | } 70 | else 71 | bIsNegative = FALSE; 72 | 73 | /* first generate a string with the digits in the reverse direction */ 74 | i = 0; 75 | do 76 | { 77 | szBuf[i] = iToConv % 10 + '0'; 78 | iToConv /= 10; 79 | } while(iToConv > 0); /* warning: do...while()! */ 80 | 81 | /* make sure we are within bounds... */ 82 | if(i + 2 > iLenBuf) /* +2 because: a) i starts at zero! b) the \0 byte */ 83 | return SR_RET_PROVIDED_BUFFER_TOO_SMALL; 84 | 85 | /* then move it to the right direction... */ 86 | if(bIsNegative == TRUE) 87 | *pBuf++ = '-'; 88 | while(i >= 0) 89 | *pBuf++ = szBuf[i--]; 90 | *pBuf = '\0'; /* terminate it!!! */ 91 | 92 | return SR_RET_OK; 93 | } 94 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbSessObject-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbSessObject Member List

This is the complete list of members for sbSessObject, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
bNeedDatasbSessObject
iLastErrsbSessObject
iStatesbSessObject
iTXStatesbSessObject
OIDsbSessObject
pChan0sbSessObject
pChannelssbSessObject
pProfilesSupportedsbSessObject
pRecvFramesbSessObject
pRemoteProfilessbSessObject
pRXQuesbSessObject
pSendQuesbSessObject
pSocksbSessObject
SendFramMethodsbSessObject

Generated on Mon Oct 3 12:29:57 2005 for liblogging by 24 | 25 | doxygen 26 | 1.3.2
27 | 28 | 29 | -------------------------------------------------------------------------------- /rfc3195/src/oscallsWin32.c: -------------------------------------------------------------------------------- 1 | /**\file oscallsWin32.c 2 | * \brief OS API calls wrapper for Win32. 3 | * 4 | * \author Rainer Gerhards 5 | * \date 2003-09-02 6 | * Coding begun. 7 | * 8 | * Copyright 2002-2014 9 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions are 13 | * met: 14 | * 15 | * * Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 18 | * * Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimer in 20 | * the documentation and/or other materials provided with the 21 | * distribution. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 24 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 26 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 27 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include 37 | 38 | 39 | /* ################################################################# * 40 | * private members * 41 | * ################################################################# */ 42 | 43 | /* As this is not a "real" object, there won't be any private 44 | * members in this file. 45 | */ 46 | 47 | /* ################################################################# * 48 | * public members * 49 | * ################################################################# */ 50 | 51 | /** 52 | * Get the current date/time in the best resolution the operating 53 | * system has to offer (well, actually at most down to the milli- 54 | * second level. 55 | * 56 | * The date and time is returned in separate fields as this is 57 | * most portable and removes the need for additional structures 58 | * (but I have to admit it is somewhat "bulky";)). 59 | * 60 | * Obviously, all caller-provided pointers must not be NULL... 61 | */ 62 | srRetVal getCurrTime(int* year, int* month, int* day, int *hour, int* minute, int *second, 63 | int* secfrac, int *secfracPrecison, char* pcOffsetMode, int* pOffsetHour, 64 | int* pOffsetMinute) 65 | { 66 | SYSTEMTIME stTime; 67 | TIME_ZONE_INFORMATION tzInfo; 68 | long lBias; 69 | 70 | GetLocalTime(&stTime); 71 | *year = stTime.wYear; 72 | *month = stTime.wMonth; 73 | *day = stTime.wDay; 74 | *hour = stTime.wHour; 75 | *minute = stTime.wMinute; 76 | *second = stTime.wSecond; 77 | *secfrac = stTime.wMilliseconds; 78 | *secfracPrecison = 3; 79 | 80 | GetTimeZoneInformation(&tzInfo); 81 | lBias = tzInfo.Bias; 82 | if(lBias < 0) 83 | { 84 | *pcOffsetMode = '-'; 85 | lBias *= -1; 86 | } 87 | else 88 | *pcOffsetMode = '+'; 89 | *pOffsetHour = lBias / 60; 90 | *pOffsetMinute = lBias % 60; 91 | 92 | return SR_RET_OK; 93 | } 94 | -------------------------------------------------------------------------------- /rfc3195/doc/html/clntprof-3195raw_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: clntprof-3195raw.h Source File 4 | 5 | 6 | 7 | 8 |

clntprof-3195raw.h

Go to the documentation of this file.
00001 
 9 | 00045 #ifndef __LIB3195_CLNTPROF_3195RAW_H_INCLUDED__
10 | 00046 #define __LIB3195_CLNTPROF_3195RAW_H_INCLUDED__ 1
11 | 00047 #define sbPSSRCHECKVALIDOBJECT(x) {assert(x != NULL); assert(x->OID == OIDsbPSSR);}
12 | 00048 
13 | 00052 struct sbPSSRObject_
14 | 00053 {
15 | 00054         srObjID OID;                                    
16 | 00055         SBansno uAnsno;                                 
17 | 00056         SBmsgno uMsgno4raw;                             
18 | 00057 };
19 | 00058 typedef struct sbPSSRObject_ sbPSSRObj;
20 | 00059 
21 | 00063 srRetVal sbPSSRClntSendMsg(sbChanObj* pChan, char* szLogmsg);
22 | 00064 
23 | 00075 srRetVal sbPSSRClntOpenLogChan(sbChanObj *pChan);
24 | 00076 
25 | 00080 srRetVal sbPSSRCOnClntCloseLogChan(sbChanObj *pChan);
26 | 00081 
27 | 00090 srRetVal sbPSSRClntSendSLMG(struct sbChanObject* pChan, struct srSLMGObject *pSLMG);
28 | 00091 
29 | 00092 #endif
30 | 

Generated on Mon Oct 3 12:29:55 2005 for liblogging by 31 | 32 | doxygen 33 | 1.3.2
34 | 35 | 36 | -------------------------------------------------------------------------------- /rfc3195/src/clntprof-3195cooked.h: -------------------------------------------------------------------------------- 1 | /*! \file clntprof-3195cooked.h 2 | * \brief The client profile for RFC 3195 COOKED. 3 | * 4 | * The prefix for this "object" is psrr which stands for 5 | * *P*rofile *S*yslog *R*eliable *Raw*. This file works in 6 | * conjunction with \ref lstnprof-3195raw.c and shares 7 | * its namespace. 8 | * 9 | * \author Rainer Gerhards 10 | * \date 2003-09-05 11 | * coding begun 12 | * 13 | * Copyright 2002-2014 14 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions are 18 | * met: 19 | * 20 | * * Redistributions of source code must retain the above copyright 21 | * notice, this list of conditions and the following disclaimer. 22 | * 23 | * * Redistributions in binary form must reproduce the above copyright 24 | * notice, this list of conditions and the following disclaimer in 25 | * the documentation and/or other materials provided with the 26 | * distribution. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 29 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 30 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 31 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 32 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 33 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 34 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 35 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 36 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 37 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 38 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | */ 40 | #ifndef __LIB3195_CLNTPROF_3195COOKED_H_INCLUDED__ 41 | #define __LIB3195_CLNTPROF_3195COOKED_H_INCLUDED__ 1 42 | #define sbPSRCCHECKVALIDOBJECT(x) {assert(x != NULL); assert(x->OID == OIDsbPSRC);} 43 | 44 | /** 45 | * The COOKED profile object used by the client profile. 46 | */ 47 | struct sbPSRCObject_ 48 | { 49 | srObjID OID; /**< object ID */ 50 | SBmsgno uNextMsgno; /**< msgno for next message to be send */ 51 | char *pszMyIP; /**< buffered local IP addres (that being used for sending to the remote peer) */ 52 | char *pszMyHostName; /**< buffered local host FQDN (that being used for sending to the remote peer) */ 53 | }; 54 | typedef struct sbPSRCObject_ sbPSRCObj; 55 | 56 | /** 57 | * Handler to send a srSLMGObj to the remote peer. This 58 | * is the preferred way to send things - with COOKED, we would 59 | * otherwise need to re-parse the message just to obtain the 60 | * information that the caller most probably already has... 61 | */ 62 | srRetVal sbPSRCClntSendSLMG(struct sbChanObject* pChan, struct srSLMGObject *pSLMG); 63 | 64 | /** 65 | * Send a message to the remote peer. 66 | */ 67 | srRetVal sbPSRCClntSendMsg(sbChanObj* pChan, char* szLogmsg); 68 | 69 | /** 70 | * Handler to be called when a new channel is 71 | * established. 72 | * 73 | * This handler is the first to be called. So it 74 | * will also create the instance's data object, at least 75 | * for those profiles, that need such. 76 | * 77 | * There is not much to do for RFC 3195/RAW ;) 78 | */ 79 | srRetVal sbPSRCClntOpenLogChan(sbChanObj *pChan); 80 | 81 | /** 82 | * Handler to be called when a channel is to be closed. 83 | */ 84 | srRetVal sbPSRCCOnClntCloseLogChan(sbChanObj *pChan); 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /stdlog/stdlog-intern.h: -------------------------------------------------------------------------------- 1 | /* The stdlog private definitions file. 2 | * 3 | * Copyright (C) 2014 Adiscon GmbH 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY ADISCON AND CONTRIBUTORS ``AS IS'' AND 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL ADISCON OR CONTRIBUTORS BE LIABLE 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 | * SUCH DAMAGE. 26 | */ 27 | #include 28 | #include 29 | #include "stdlog.h" 30 | 31 | #define __STDLOG_MSGBUF_SIZE 4096 32 | #ifndef STDLOG_INTERN_H_INCLUDED 33 | #define STDLOG_INTERN_H_INCLUDED 34 | struct stdlog_channel { 35 | const char *spec; 36 | const char *ident; 37 | int32_t options; 38 | int facility; 39 | char *fmtbuf; 40 | int (*f_vsnprintf)(char *str, size_t size, const char *fmt, va_list ap); 41 | struct { 42 | void (*init)(stdlog_channel_t ch); /* initialize driver */ 43 | void (*open)(stdlog_channel_t ch); 44 | void (*close)(stdlog_channel_t ch); 45 | int (*log)(stdlog_channel_t ch, const int severity, const char *fmt, va_list ap, char *wrkbuf, const size_t buflen); 46 | } drvr; 47 | union { 48 | struct { 49 | char *sockname; 50 | int sock; 51 | struct sockaddr_un addr; 52 | } uxs; /* unix socket (including syslog) */ 53 | struct { 54 | int fd; 55 | char *name; 56 | } file; 57 | } d; /* driver-specific data */ 58 | }; 59 | 60 | /* A useful macro for adding single chars during string building. It ensures 61 | * that the target buffer is not overrun. The index idx must be an lvalue and 62 | * must point to the location where the character is to be inserted. If there 63 | * is sufficient space left, to char is inserted and the index incremented. 64 | * Otherwise, no updates happen. 65 | */ 66 | #define __STDLOG_STRBUILD_ADD_CHAR(buf, lenbuf, idx, c) \ 67 | if(idx < (int) (lenbuf)) { \ 68 | buf[(idx)++] = c; \ 69 | } 70 | 71 | int __stdlog_formatTimestamp3164(const struct tm *const tm, char *const buf); 72 | struct tm * __stdlog_timesub(const time_t * timep, const long offset, struct tm *tmp); 73 | 74 | void __stdlog_set_uxs_drvr(stdlog_channel_t ch); 75 | void __stdlog_set_jrnl_drvr(stdlog_channel_t ch); 76 | void __stdlog_set_file_drvr(stdlog_channel_t ch); 77 | 78 | /* formatter "library" routines */ 79 | void __stdlog_fmt_print_int (char *__restrict__ const buf, const size_t lenbuf, int *idx, int64_t nbr); 80 | void __stdlog_fmt_print_str (char *__restrict__ const buf, const size_t lenbuf, int *__restrict__ const idx, const char *const str); 81 | int __stdlog_sigsafe_printf(char *buf, const size_t lenbuf, const char *fmt, va_list ap); 82 | void __stdlog_sigsafe_memcpy(void *dest, const void *src, size_t n); 83 | int __stdlog_wrapper_vsnprintf(char *buf, size_t lenbuf, const char *fmt, va_list ap); 84 | 85 | #endif /* STDLOG_INTERN_H_INCLUDED */ 86 | -------------------------------------------------------------------------------- /rfc3195/doc/html/clntprof-3195cooked_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: clntprof-3195cooked.h Source File 4 | 5 | 6 | 7 | 8 |

clntprof-3195cooked.h

Go to the documentation of this file.
00001 
 9 | 00045 #ifndef __LIB3195_CLNTPROF_3195COOKED_H_INCLUDED__
10 | 00046 #define __LIB3195_CLNTPROF_3195COOKED_H_INCLUDED__ 1
11 | 00047 #define sbPSRCCHECKVALIDOBJECT(x) {assert(x != NULL); assert(x->OID == OIDsbPSRC);}
12 | 00048 
13 | 00052 struct sbPSRCObject_
14 | 00053 {
15 | 00054         srObjID OID;                                    
16 | 00055         SBmsgno uNextMsgno;                             
17 | 00056         char *pszMyIP;                                  
18 | 00057         char *pszMyHostName;                    
19 | 00058 };
20 | 00059 typedef struct sbPSRCObject_ sbPSRCObj;
21 | 00060 
22 | 00067 srRetVal sbPSRCClntSendSLMG(struct sbChanObject* pChan, struct srSLMGObject *pSLMG);
23 | 00068 
24 | 00072 srRetVal sbPSRCClntSendMsg(sbChanObj* pChan, char* szLogmsg);
25 | 00073 
26 | 00084 srRetVal sbPSRCClntOpenLogChan(sbChanObj *pChan);
27 | 00085 
28 | 00089 srRetVal sbPSRCCOnClntCloseLogChan(sbChanObj *pChan);
29 | 00090 
30 | 00091 #endif
31 | 

Generated on Mon Oct 3 12:29:55 2005 for liblogging by 32 | 33 | doxygen 34 | 1.3.2
35 | 36 | 37 | -------------------------------------------------------------------------------- /rfc3195/src/oscallsUnix.c: -------------------------------------------------------------------------------- 1 | /**\file oscallsUnix.c 2 | * \brief OS API calls wrapper for Unix. 3 | * 4 | * \author Rainer Gerhards 5 | * 6 | * \date 2003-09-02 7 | * rgerhards: coding begun 8 | * 9 | * Copyright 2002-2014 10 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are 14 | * met: 15 | * 16 | * * Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 19 | * * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 25 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 27 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 28 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 29 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 30 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 31 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 32 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 33 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | */ 36 | 37 | #include 38 | #include 39 | 40 | /* ################################################################# */ 41 | /* private members */ 42 | /* ################################################################# */ 43 | 44 | /* As this is not a "real" object, there won't be any private 45 | * members in this file. 46 | */ 47 | 48 | /* ################################################################# */ 49 | /* public members */ 50 | /* ################################################################# */ 51 | 52 | /** 53 | * Get the current date/time in the best resolution the operating 54 | * system has to offer (well, actually at most down to the milli- 55 | * second level. 56 | * 57 | * The date and time is returned in separate fields as this is 58 | * most portable and removes the need for additional structures 59 | * (but I have to admit it is somewhat "bulky";)). 60 | * 61 | * Obviously, all caller-provided pointers must not be NULL... 62 | */ 63 | srRetVal getCurrTime(int* year, int* month, int* day, int *hour, int* minute, int *second, 64 | int* secfrac, int *secfracPrecison, char* pcOffsetMode, int* pOffsetHour, 65 | int* pOffsetMinute) 66 | { 67 | struct timeval tp; 68 | struct tm *tm; 69 | long lBias; 70 | 71 | gettimeofday(&tp, NULL); 72 | tm = localtime(&(tp.tv_sec)); 73 | 74 | *year = tm->tm_year + 1900; 75 | *month = tm->tm_mon + 1; 76 | *day = tm->tm_mday; 77 | *hour = tm->tm_hour; 78 | *minute = tm->tm_min; 79 | *second = tm->tm_sec; 80 | *secfrac = tp.tv_usec; 81 | *secfracPrecison = 6; 82 | 83 | #ifdef SROS_Solaris 84 | /* Solaris uses a different method of exporting the time zone. 85 | * It is UTC - localtime, which is opposite sign of min east of GMT. 86 | */ 87 | lBias = -(daylight ? altzone : timezone); 88 | #elif defined(_AIX) 89 | if (tm->tm_isdst) tzset(); 90 | lBias = tm->tm_isdst ? - timezone : 0; 91 | #else 92 | lBias = tm->tm_gmtoff; 93 | #endif 94 | if(lBias < 0) 95 | { 96 | *pcOffsetMode = '-'; 97 | lBias *= -1; 98 | } 99 | else 100 | *pcOffsetMode = '+'; 101 | 102 | *pOffsetHour = lBias / 3600; 103 | *pOffsetMinute = lBias % 3600; 104 | 105 | return SR_RET_OK; 106 | } 107 | 108 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | What? 2 | ===== 3 | Liblogging is an easy to use library for logging. It offers an enhanced 4 | replacement for the syslog() call, but retains its ease of use. 5 | 6 | If you dig deeper, liblogging actually has three components, which address 7 | different needs. 8 | 9 | stdlog 10 | ------ 11 | This is the core component. **Think of it as a the next version of the 12 | syslog(3) API.** We retain the easy semantics, but make it more sophisticated 13 | "behind the scenes" with better support for multiple threads and flexibility 14 | for different log destinations. It also is **signal-safe** and thus can be used 15 | from within signal handlers. 16 | 17 | Right now, it actually does more or less what syslog() did. In the next couple 18 | of weeks, this will change. It supports different log destionations: 19 | 20 | * syslog() 21 | * systemd journal native API 22 | * unix domain socket 23 | * files 24 | 25 | The key point here is that we provide a **separation of concerns**: the 26 | application developer will do the logging calls, but the sysadmin will 27 | be able to configure where log messages actually are send to. We will 28 | use a driver layer to do so. 29 | 30 | With the current version, the logging driver is set via an environment 31 | variable or directly specified from within the application code. The 32 | latter provides applications the ability to request specific logging 33 | drivers. At the smame time, a single application can log to multiple 34 | channels which in turn use multiple logging providers -- all at the 35 | same time. 36 | 37 | This follows much the successful log4j paradigm. However, we have a 38 | focus on simplicity. No app developer likes logging, and so we really 39 | want to make it as easy, simple and unintrusive as syslog() was. 40 | 41 | An interesting side-effect of that approach is that an application developer 42 | can write code that natively logs to the journal on platforms that support 43 | it but uses different methods on platforms that do not. 44 | 45 | journalemu 46 | ---------- 47 | This component (not yet committed) emulates the most important logging 48 | calls of systemd journal. This permits applications to be written to this 49 | spec, even though the journal is not available on all platforms. Of course, 50 | we recommend writing directly to libstdlog, as this solves the problem 51 | more cleanly. 52 | 53 | rfc3195 54 | ------- 55 | This is liblogging's original component. Back in 2002, we thought that 56 | logging would be taken over by rfc3195 and thus we begun working on a 57 | library -liblogging- that makes this easy. While the lib is there, rfc3195 58 | has turned out to be a big failure. This component is no longer enhanced, 59 | but it is still available for those apps that need it. 60 | 61 | Motivation for this library 62 | =========================== 63 | The syslog(3) API is the de-facto standard for application logging on Linux 64 | and Unix. While very simplistic, this is exactly the main feature the app 65 | developer wants. We want to keep this but improve it to 66 | 67 | * provide separation of concerns as described above under the stdlog component 68 | * support reentrancy 69 | * provide multiple concurrent log channels to different destinations 70 | * provide an interface for structured logging - but only if there 71 | is a real demand for it (to be seen based on feedback) 72 | 73 | Liblogging's goal is also to be a very slim library without any notable memory 74 | or performance footprint (and also simple and small code). 75 | 76 | Note to packagers 77 | ================= 78 | We recommend to create three different packages for this library, one for 79 | each component. As we do not anticipate new applications to use the 80 | rfc3195 component, we do not suggest building a package for it. On systems 81 | where systemd journal is present, there is hardly a point in packaging 82 | the journalemu component. So *in esscence, the stdlog component is the only 83 | one we suggest to be packaged on many platforms*. 84 | 85 | Depending on distro policies, package names like *liblogging1-stdlog* are 86 | suggested. This prevents confusion with liblogging v0, which only supported 87 | rfc3195. 88 | 89 | History 90 | ======= 91 | Liblogging is around since 2002. See [HISTORY](HISTORY.md) file for some 92 | background information on how it evolved and why it is structured like 93 | it currently is. 94 | -------------------------------------------------------------------------------- /rfc3195/doc/html/stringbuf_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: stringbuf.h Source File 4 | 5 | 6 | 7 | 8 |

stringbuf.h

Go to the documentation of this file.
00001 
 9 | 00052 #ifndef __LIB3195_STRINGBUF_H_INCLUDED__
10 | 00053 #define __LIB3195_STRINGBUF_H_INCLUDED__ 1
11 | 00054 
12 | 00055 #define sbSTRBCHECKVALIDOBJECT(x) {assert(x != NULL); assert(x->OID == OIDsbStrB);}
13 | 00056 
14 | 00057 
15 | 00062 struct sbStrBObject
16 | 00063 {       
17 | 00064         srObjID OID;                                    
18 | 00065         char *pBuf;                                             
19 | 00066         int iBufSize;                                   
20 | 00067         int     iBufPtr;                                        
21 | 00068         int iAllocIncrement;                    
22 | 00069 };
23 | 00070 typedef struct sbStrBObject sbStrBObj;
24 | 00071 
25 | 00072 
26 | 00076 sbStrBObj *sbStrBConstruct(void);
27 | 00077 
28 | 00081 void sbStrBDestruct(sbStrBObj *pThis);
29 | 00082 
30 | 00089 srRetVal sbStrBAppendChar(sbStrBObj *pThis, char c);
31 | 00090 
32 | 00104 char* sbStrBFinish(sbStrBObj *pThis);
33 | 00105 
34 | 00111 srRetVal sbStrBAppendStr(sbStrBObj *pThis, char* psz);
35 | 00112 
36 | 00127 void sbStrBSetAllocIncrement(sbStrBObj *pThis, int iNewIncrement);
37 | 00128 
38 | 00133 srRetVal sbStrBAppendInt(sbStrBObj *pThis, int i);
39 | 00134 
40 | 00135 
41 | 00136 #endif
42 | 

Generated on Mon Oct 3 12:29:55 2005 for liblogging by 43 | 44 | doxygen 45 | 1.3.2
46 | 47 | 48 | -------------------------------------------------------------------------------- /stdlog/file.c: -------------------------------------------------------------------------------- 1 | /* The stdlog file driver. 2 | * 3 | * Copyright (C) 2014 Adiscon GmbH 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY ADISCON AND CONTRIBUTORS ``AS IS'' AND 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL ADISCON OR CONTRIBUTORS BE LIABLE 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 | * SUCH DAMAGE. 26 | */ 27 | #include "config.h" 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include "stdlog-intern.h" 39 | #include "stdlog.h" 40 | 41 | static int 42 | build_file_line(stdlog_channel_t ch, 43 | char *__restrict__ const linebuf, 44 | const size_t lenline, 45 | const char *fmt, 46 | va_list ap) 47 | { 48 | int i = 0; 49 | struct tm tm; 50 | const time_t t = time(NULL); 51 | 52 | __stdlog_timesub(&t, 0, &tm); 53 | i += __stdlog_formatTimestamp3164(&tm, linebuf+i); 54 | __STDLOG_STRBUILD_ADD_CHAR(linebuf, lenline, i, ' '); 55 | __stdlog_fmt_print_str(linebuf, lenline, &i, ch->ident); 56 | if (ch->options & STDLOG_PID) { 57 | __STDLOG_STRBUILD_ADD_CHAR(linebuf, lenline, i, '['); 58 | __stdlog_fmt_print_int(linebuf, lenline, &i, getpid()); 59 | __STDLOG_STRBUILD_ADD_CHAR(linebuf, lenline, i, ']'); 60 | } 61 | __STDLOG_STRBUILD_ADD_CHAR(linebuf, lenline, i, ':'); 62 | __STDLOG_STRBUILD_ADD_CHAR(linebuf, lenline, i, ' '); 63 | /* note: we do not need to reserve space for '\0', as we 64 | * will overwrite it with the '\n' below. We don't need 65 | * a string, just a buffer, so we don't need '\0'! 66 | */ 67 | i += ch->f_vsnprintf(linebuf+i, lenline-i, fmt, ap); 68 | linebuf[i++] = '\n'; /* space reserved -- see above */ 69 | return i; 70 | } 71 | 72 | static void 73 | file_init(stdlog_channel_t ch) 74 | { 75 | ch->d.file.fd = -1; 76 | ch->d.file.name = strdup(ch->spec+5); 77 | } 78 | 79 | static void 80 | file_open(stdlog_channel_t ch) 81 | { 82 | if (ch->d.file.fd == -1) { 83 | if((ch->d.file.fd = open(ch->d.file.name, O_WRONLY|O_CREAT|O_APPEND, 0660)) < 0) 84 | return; 85 | } 86 | } 87 | 88 | static void 89 | file_close(stdlog_channel_t ch) 90 | { 91 | if (ch->d.file.fd >= 0) { 92 | close(ch->d.file.fd); 93 | ch->d.file.fd = -1; 94 | } 95 | } 96 | 97 | 98 | static int 99 | file_log(stdlog_channel_t ch, int __attribute__((unused)) severity, 100 | const char *fmt, va_list ap, 101 | char *__restrict__ const wrkbuf, const size_t buflen) 102 | { 103 | ssize_t lenWritten; 104 | size_t lenline; 105 | int r; 106 | 107 | if(ch->d.file.fd < 0) 108 | file_open(ch); 109 | if(ch->d.file.fd < 0) { 110 | r = -1; 111 | goto done; 112 | } 113 | lenline = build_file_line(ch, wrkbuf, buflen, fmt, ap); 114 | lenWritten = write(ch->d.file.fd, wrkbuf, lenline); 115 | if(lenWritten == -1) { 116 | r = -1; 117 | } else if(lenWritten != (ssize_t) lenline) { 118 | r = -1; 119 | errno = EAGAIN; 120 | } else { 121 | r = 0; 122 | } 123 | done: return r; 124 | } 125 | 126 | void 127 | __stdlog_set_file_drvr(stdlog_channel_t ch) 128 | { 129 | ch->drvr.init = file_init; 130 | ch->drvr.open = file_open; 131 | ch->drvr.close = file_close; 132 | ch->drvr.log = file_log; 133 | } 134 | -------------------------------------------------------------------------------- /stdlog/stdlog.h: -------------------------------------------------------------------------------- 1 | /* The stdlog main header file 2 | * 3 | * Copyright (C) 2014 Adiscon GmbH 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY ADISCON AND CONTRIBUTORS ``AS IS'' AND 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL ADISCON OR CONTRIBUTORS BE LIABLE 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 | * SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef LIBLOGGING_STDLOG_H_INCLUDED 29 | #define LIBLOGGING_STDLOG_H_INCLUDED 30 | #include 31 | #include 32 | #include 33 | 34 | /* options for stdlog_open() call */ 35 | #define STDLOG_SIGSAFE 1 /* enforce signal-safe implementation */ 36 | #define STDLOG_PID 2 /* log the PID with each message */ 37 | #define STDLOG_USE_DFLT_OPTS ((int)0x80000000) /* use default options */ 38 | 39 | /* traditional syslog facility codes */ 40 | #define STDLOG_KERN 0 /* kernel messages */ 41 | #define STDLOG_USER 1 /* random user-level messages */ 42 | #define STDLOG_MAIL 2 /* mail system */ 43 | #define STDLOG_DAEMON 3 /* system daemons */ 44 | #define STDLOG_AUTH 4 /* security/authorization messages */ 45 | #define STDLOG_SYSLOG 5 /* messages generated internally by syslogd */ 46 | #define STDLOG_LPR 6 /* line printer subsystem */ 47 | #define STDLOG_NEWS 7 /* network news subsystem */ 48 | #define STDLOG_UUCP 8 /* UUCP subsystem */ 49 | #define STDLOG_CRON 9 /* clock daemon */ 50 | #define STDLOG_AUTHPRIV 10 /* security/authorization messages (private) */ 51 | #define STDLOG_FTP 11 /* ftp daemon */ 52 | /* other codes through 15 reserved for system use */ 53 | #define STDLOG_LOCAL0 16 /* reserved for local use */ 54 | #define STDLOG_LOCAL1 17 /* reserved for local use */ 55 | #define STDLOG_LOCAL2 18 /* reserved for local use */ 56 | #define STDLOG_LOCAL3 19 /* reserved for local use */ 57 | #define STDLOG_LOCAL4 20 /* reserved for local use */ 58 | #define STDLOG_LOCAL5 21 /* reserved for local use */ 59 | #define STDLOG_LOCAL6 22 /* reserved for local use */ 60 | #define STDLOG_LOCAL7 23 /* reserved for local use */ 61 | 62 | /* traditional syslog priorities */ 63 | #define STDLOG_EMERG 0 /* system is unusable */ 64 | #define STDLOG_ALERT 1 /* action must be taken immediately */ 65 | #define STDLOG_CRIT 2 /* critical conditions */ 66 | #define STDLOG_ERR 3 /* error conditions */ 67 | #define STDLOG_WARNING 4 /* warning conditions */ 68 | #define STDLOG_NOTICE 5 /* normal but significant condition */ 69 | #define STDLOG_INFO 6 /* informational */ 70 | #define STDLOG_DEBUG 7 /* debug-level messages */ 71 | 72 | typedef struct stdlog_channel *stdlog_channel_t; 73 | 74 | const char *stdlog_version(void); 75 | size_t stdlog_get_msgbuf_size(void); 76 | const char *stdlog_get_dflt_chanspec(void); 77 | int stdlog_init(uint32_t options); 78 | void stdlog_deinit(void); 79 | stdlog_channel_t stdlog_open(const char *ident, const int option, const int facility, const char *channelspec); 80 | void stdlog_close(stdlog_channel_t channel); 81 | int stdlog_log(stdlog_channel_t channel, const int severity, const char *fmt, ...) __attribute__((format(printf, 3, 4))); 82 | int stdlog_log_b(stdlog_channel_t ch, const int severity, char *wrkbuf, const size_t buflen, const char *fmt, ...); 83 | int stdlog_vlog(stdlog_channel_t ch, const int severity, const char *fmt, va_list ap); 84 | int stdlog_vlog_b(stdlog_channel_t ch, const int severity, char *__restrict__ const wrkbuf, const size_t buflen, const char *fmt, va_list ap); 85 | 86 | #endif /* multi-include protection */ 87 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbFramObject-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: Member List 4 | 5 | 6 | 7 | 8 |

sbFramObject Member List

This is the complete list of members for sbFramObject, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
cMoresbFramObject
idHdrsbFramObject
iFrameLensbFramObject
iStatesbFramObject
OIDsbFramObject
OnFramDestroysbFramObject
pChansbFramObject
pMsgsbFramObject
pStrBufsbFramObject
pUsrsbFramObject
szRawBufsbFramObject
uAcknosbFramObject
uAnsnosbFramObject
uBytesSendsbFramObject
uChannelsbFramObject
uMsgnosbFramObject
uSeqnosbFramObject
uSizesbFramObject
uToReceivesbFramObject
uWindowsbFramObject

Generated on Mon Oct 3 12:29:56 2005 for liblogging by 30 | 31 | doxygen 32 | 1.3.2
33 | 34 | 35 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsbProfObject.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: sbProfObject struct Reference 4 | 5 | 6 | 7 | 8 |

sbProfObject Struct Reference

The BEEP Profile object. 9 | More... 10 |

11 | #include <beepprofile.h> 12 |

13 | List of all members. 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 24 | 26 | 27 | 28 | 30 | 31 | 32 | 34 | 35 | 36 | 38 | 39 | 40 |

Public Attributes

17 | srObjID OID
 object ID

21 | char * pszProfileURI
 pointer to the URI to be used during negotiation

25 | srRetVal(* OnClntOpenLogChan )(struct sbChanObject *pChan)
 method to call if client-side API needs to open a log channel

29 | srRetVal(* OnClntSendLogMsg )(struct sbChanObject *pChan, char *szLogmsg)
 method to call if client-side API needs to send a syslog message

33 | srRetVal(* OnClntSendSLMG )(struct sbChanObject *pChan, struct srSLMGObject *pSLMG)
 method to call if client-side API needs to send a srSLMGObj

37 | srRetVal(* OnClntCloseLogChan )(struct sbChanObject *pChan)
 method to call if client-side API needs to close a log channel

41 |


Detailed Description

42 | The BEEP Profile object. 43 |

44 | Implemented via beepprofile::h and beepprofile::c. 45 |

46 |


The documentation for this struct was generated from the following file: 48 |
Generated on Mon Oct 3 12:29:56 2005 for liblogging by 49 | 50 | doxygen 51 | 1.3.2
52 | 53 | 54 | -------------------------------------------------------------------------------- /rfc3195/doc/html/lstnprof-3195raw_8h.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: lstnprof-3195raw.h File Reference 4 | 5 | 6 | 7 | 8 |

lstnprof-3195raw.h File Reference

The 3195 raw listener profile. 9 | More... 10 |

11 | 12 |

13 | Go to the source code of this file. 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 25 | 26 |

Defines

17 | #define __LIB3195_LISTNPROF_3195RAW_H_INCLUDED__   1

Functions

21 | srRetVal psrrOnChanCreate (struct sbProfObject *pThis, struct sbSessObject *pSess, struct sbChanObject *pChan)
24 | srRetVal psrrOnMesgRecv (struct sbProfObject *pThis, int *pbAbort, struct sbSessObject *pSess, struct sbChanObject *pChan, struct sbMesgObject *pMesg)
27 |


Detailed Description

28 | The 3195 raw listener profile. 29 |

30 | Listener profiles are specific in that they do not support their own full blown objects but only the callback code.

31 |

Author:
Rainer Gerhards <rgerhards@adiscon.com>
32 |
Date:
2003-08-22 coding begun
33 | Copyright 2002-2003 Rainer Gerhards and Adiscon GmbH. All Rights Reserved.

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

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

36 | * 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.

37 | * 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.

38 | 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.


Generated on Mon Oct 3 12:29:56 2005 for liblogging by 39 | 40 | doxygen 41 | 1.3.2
42 | 43 | 44 | -------------------------------------------------------------------------------- /rfc3195/doc/html/lstnprof-3195cooked_8h.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: lstnprof-3195cooked.h File Reference 4 | 5 | 6 | 7 | 8 |

lstnprof-3195cooked.h File Reference

The 3195 COOKED listener profile. 9 | More... 10 |

11 | 12 |

13 | Go to the source code of this file. 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 25 | 26 |

Defines

17 | #define __LIB3195_LISTNPROF_3195COOKED_H_INCLUDED__   1

Functions

21 | srRetVal psrcOnChanCreate (struct sbProfObject *pThis, struct sbSessObject *pSess, struct sbChanObject *pChan)
24 | srRetVal psrcOnMesgRecv (struct sbProfObject *pThis, int *pbAbort, struct sbSessObject *pSess, struct sbChanObject *pChan, struct sbMesgObject *pMesg)
27 |


Detailed Description

28 | The 3195 COOKED listener profile. 29 |

30 | Listener profiles are specific in that they do not support their own full blown objects but only the callback code.

31 |

Author:
Rainer Gerhards <rgerhards@adiscon.com>
32 |
Date:
2003-09-05 file creatd, but coding not yet begun
33 | Copyright 2002-2003 Rainer Gerhards and Adiscon GmbH. All Rights Reserved.

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

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

36 | * 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.

37 | * 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.

38 | 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.


Generated on Mon Oct 3 12:29:56 2005 for liblogging by 39 | 40 | doxygen 41 | 1.3.2
42 | 43 | 44 | -------------------------------------------------------------------------------- /rfc3195/doc/html/structsrAPIObject.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: srAPIObject struct Reference 4 | 5 | 6 | 7 | 8 |

srAPIObject Struct Reference

The syslog-reliable API object. 9 | More... 10 |

11 | #include <srAPI.h> 12 |

13 | List of all members. 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 24 | 26 | 27 | 28 | 30 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | 39 |

Public Attributes

17 | srObjID OID
 object ID

21 | sbChanObjectpChan
 The BEEP channel associated with this API instance.

25 | sbNVTRObject * pProfsSupported
 the supported profiles by this API (initiator only)

29 | sbSessObjectpSess
 the associated session

33 | void * pUsr
 for the user's use - not handled in any way in this lib

srOPTION3195Profiles iUse3195Profiles
 specifies which profiles to use for 3195

40 |


Detailed Description

41 | The syslog-reliable API object. 42 |

43 | Implemented via srAPI::h and srAPI::c. 44 |

45 |


Member Data Documentation

46 |

47 | 48 | 49 | 55 | 56 |
50 | 51 | 52 |
srOPTION3195Profiles srAPIObject::iUse3195Profiles 53 |
54 |
57 | 58 | 59 | 62 | 69 | 70 |
60 |   61 | 63 | 64 |

65 | specifies which profiles to use for 3195 66 |

67 |

Todo:
create the methods for pUsr
68 |
71 |


The documentation for this struct was generated from the following file: 73 |
Generated on Mon Oct 3 12:29:57 2005 for liblogging by 74 | 75 | doxygen 76 | 1.3.2
77 | 78 | 79 | -------------------------------------------------------------------------------- /rfc3195/doc/html/syslogmessage_8h.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: syslogmessage.h File Reference 4 | 5 | 6 | 7 | 8 |

syslogmessage.h File Reference

The syslog message API. 9 | More... 10 |

11 | 12 |

13 | Go to the source code of this file. 14 | 15 | 16 | 18 | 19 | 21 | 22 | 24 | 25 |

Defines

17 | #define __LIB3195_SYSLOGMESSAGE_H_INCLUDED__   1
20 | #define srSLMGCHECKVALIDOBJECT_API(x)   {if((x) == NULL) return SR_RET_NULL_POINTER_PROVIDED; if((x)->OID != OIDsrSLMG) return SR_RET_INVALID_HANDLE;}
23 | #define srSLMGCHECKVALIDOBJECT(x)   {assert((x) != NULL);assert((x)->OID == OIDsrSLMG);}
26 |


Detailed Description

27 | The syslog message API. 28 |

29 | This file describes the syslog message object. This object is also part of the liblogging API and as such a upper-layer caller may directly invoke all public methods of this object.

30 | The syslog message object (srSLMGObj) is the container wrapping the actual syslog message. It wraps any message, be it plain RFC 3164, 3195, -sign or whatever is to come. The message object contains properties used by any and all syslog protocols. The idea is to have the message object independent from the transport (which is taken care of by srAPI::h).

31 |

Note:
This object supports 8-bit syslog message. When sending, the object looks at its settings to see how non-US-ASCII messages should be processed. Idially, it uses syslog-international (which, of course, is not available at the time of this writing).
32 |
Author:
Rainer Gerhards <rgerhards@adiscon.com>
33 |
Date:
2003-09-01 coding begun.
34 | Copyright 2003 Rainer Gerhards and Adiscon GmbH. All Rights Reserved.

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

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

37 | * 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.

38 | * 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.

39 | 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.


Generated on Mon Oct 3 12:29:56 2005 for liblogging by 40 | 41 | doxygen 42 | 1.3.2
43 | 44 | 45 | -------------------------------------------------------------------------------- /rfc3195/doc/html/lstnprof-3195raw_8c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: lstnprof-3195raw.c File Reference 4 | 5 | 6 | 7 | 8 |

lstnprof-3195raw.c File Reference

Implementation of the listener profile for RFC 3195 raw. 9 | More... 10 |

11 | #include <assert.h>
12 | #include "config.h"
13 | #include "liblogging.h"
14 | #include "srAPI.h"
15 | #include "beepsession.h"
16 | #include "beepprofile.h"
17 | #include "lstnprof-3195raw.h"
18 | #include "stringbuf.h"
19 | #include "syslogmessage.h"
20 | 21 | 22 | 23 | 25 | 26 | 28 | 29 |

Functions

24 | srRetVal psrrOnChanCreate (struct sbProfObject *pThis, struct sbSessObject *pSess, struct sbChanObject *pChan)
27 | srRetVal psrrOnMesgRecv (sbProfObj *pThis, int *pbAbort, sbSessObj *pSess, sbChanObj *pChan, sbMesgObj *pMesg)
30 |


Detailed Description

31 | Implementation of the listener profile for RFC 3195 raw. 32 |

33 | The prefix for this "object" is psrr which stands for *P*rofile *S*yslog *R*eliable *Raw*.

34 |

Author:
Rainer Gerhards <rgerhards@adiscon.com>
35 |
Date:
2003-08-22 coding begun.

36 | 2003-09-16 Added a check so that failures sending SEQs now do not go undetected.

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

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

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

40 | * 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.

41 | * 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.

42 | 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.


Generated on Mon Oct 3 12:29:56 2005 for liblogging by 43 | 44 | doxygen 45 | 1.3.2
46 | 47 | 48 | -------------------------------------------------------------------------------- /stdlog/uxsock.c: -------------------------------------------------------------------------------- 1 | /* The stdlog unix socket driver. Syslog protocol is spoken on 2 | * all unix sockets. 3 | * 4 | * Copyright (C) 2014-2017 Adiscon GmbH 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY ADISCON AND CONTRIBUTORS ``AS IS'' AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL ADISCON OR CONTRIBUTORS BE LIABLE 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 | * SUCH DAMAGE. 27 | */ 28 | #include "config.h" 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include "stdlog-intern.h" 39 | #include "stdlog.h" 40 | 41 | #define _PATH_LOG "/dev/log" /* default syslog socket on Linux */ 42 | 43 | static int 44 | build_syslog_frame(stdlog_channel_t ch, 45 | const int severity, 46 | char *__restrict__ const frame, 47 | const size_t lenframe, 48 | const char *fmt, 49 | va_list ap) 50 | { 51 | int i = 0; 52 | struct tm tm; 53 | int64_t pri; 54 | const time_t t = time(NULL); 55 | 56 | pri = (ch->facility << 3) | (severity & 0x07); 57 | __stdlog_timesub(&t, 0, &tm); 58 | __STDLOG_STRBUILD_ADD_CHAR(frame, lenframe, i, '<'); 59 | __stdlog_fmt_print_int(frame, lenframe, &i, pri); 60 | __STDLOG_STRBUILD_ADD_CHAR(frame, lenframe, i, '>'); 61 | i += __stdlog_formatTimestamp3164(&tm, frame+i); 62 | __STDLOG_STRBUILD_ADD_CHAR(frame, lenframe, i, ' '); 63 | __stdlog_fmt_print_str(frame, lenframe, &i, ch->ident); 64 | if (ch->options & STDLOG_PID) { 65 | __STDLOG_STRBUILD_ADD_CHAR(frame, lenframe, i, '['); 66 | __stdlog_fmt_print_int(frame, lenframe, &i, getpid()); 67 | __STDLOG_STRBUILD_ADD_CHAR(frame, lenframe, i, ']'); 68 | } 69 | __STDLOG_STRBUILD_ADD_CHAR(frame, lenframe, i, ':'); 70 | __STDLOG_STRBUILD_ADD_CHAR(frame, lenframe, i, ' '); 71 | i += ch->f_vsnprintf(frame+i, lenframe-i, fmt, ap); 72 | return i; 73 | } 74 | 75 | static void 76 | uxs_init(stdlog_channel_t ch) 77 | { 78 | ch->d.uxs.sock = -1; 79 | /* Note: we handle both "syslog:" as well as "uxsock:" as 80 | * they are essentially the same. Here we configure the 81 | * difference. 82 | */ 83 | if (!strncmp(ch->spec, "uxsock:", 7)) 84 | ch->d.uxs.sockname = strdup(ch->spec+7); 85 | else 86 | ch->d.uxs.sockname = strdup(_PATH_LOG); 87 | } 88 | 89 | static void 90 | uxs_open(stdlog_channel_t ch) 91 | { 92 | if (ch->d.uxs.sock == -1) { 93 | if((ch->d.uxs.sock = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) 94 | return; 95 | memset(&ch->d.uxs.addr, 0, sizeof(ch->d.uxs.addr)); 96 | ch->d.uxs.addr.sun_family = AF_UNIX; 97 | strncpy(ch->d.uxs.addr.sun_path, ch->d.uxs.sockname, 98 | sizeof(ch->d.uxs.addr.sun_path)); 99 | } 100 | } 101 | 102 | static void 103 | uxs_close(stdlog_channel_t ch) 104 | { 105 | if (ch->d.uxs.sock >= 0) { 106 | close(ch->d.uxs.sock); 107 | ch->d.uxs.sock = -1; 108 | } 109 | /* we need to free buffers no matter if the socket was ever 110 | * opened or not. 111 | */ 112 | free(ch->d.uxs.sockname); 113 | } 114 | 115 | 116 | static int 117 | uxs_log(stdlog_channel_t ch, int severity, 118 | const char *fmt, va_list ap, 119 | char *__restrict__ const wrkbuf, const size_t buflen) 120 | { 121 | ssize_t lsent; 122 | size_t lenframe; 123 | int r; 124 | 125 | if(ch->d.uxs.sock < 0) 126 | uxs_open(ch); 127 | if(ch->d.uxs.sock < 0) { 128 | r = -1; 129 | goto done; 130 | } 131 | lenframe = build_syslog_frame(ch, severity, wrkbuf, buflen, fmt, ap); 132 | lsent = sendto(ch->d.uxs.sock, wrkbuf, lenframe, 0, 133 | (struct sockaddr*) &ch->d.uxs.addr, sizeof(ch->d.uxs.addr)); 134 | if(lsent == -1) { 135 | r = -1; 136 | } else if(lsent != (ssize_t)lenframe) { 137 | r = -1; 138 | errno = EAGAIN; 139 | } else { 140 | r = 0; 141 | } 142 | done: return r; 143 | } 144 | 145 | void 146 | __stdlog_set_uxs_drvr(stdlog_channel_t ch) 147 | { 148 | ch->drvr.init = uxs_init; 149 | ch->drvr.open = uxs_open; 150 | ch->drvr.close = uxs_close; 151 | ch->drvr.log = uxs_log; 152 | } 153 | -------------------------------------------------------------------------------- /rfc3195/doc/html/lstnprof-3195cooked_8c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | liblogging: lstnprof-3195cooked.c File Reference 4 | 5 | 6 | 7 | 8 |

lstnprof-3195cooked.c File Reference

Implementation of the listener profile for RFC 3195 COOKED. 9 | More... 10 |

11 | #include <assert.h>
12 | #include "config.h"
13 | #include "liblogging.h"
14 | #include "srAPI.h"
15 | #include "beepsession.h"
16 | #include "beepprofile.h"
17 | #include "lstnprof-3195cooked.h"
18 | #include "stringbuf.h"
19 | #include "syslogmessage.h"
20 | #include "namevaluetree.h"
21 | 22 | 23 | 24 | 26 | 27 | 29 | 30 |

Functions

25 | srRetVal psrcOnChanCreate (struct sbProfObject *pThis, struct sbSessObject *pSess, struct sbChanObject *pChan)
28 | srRetVal psrcOnMesgRecv (sbProfObj *pThis, int *pbAbort, sbSessObj *pSess, sbChanObj *pChan, sbMesgObj *pMesg)
31 |


Detailed Description

32 | Implementation of the listener profile for RFC 3195 COOKED. 33 |

34 | The prefix for this "object" is psrc which stands for *P*rofile *S*yslog *R*eliable *Cooked*.

35 |

Author:
Rainer Gerhards <rgerhards@adiscon.com>
36 |
Date:
2003-09-05 file creatd, but coding not yet begun
37 | Copyright 2002-2003 Rainer Gerhards and Adiscon GmbH. All Rights Reserved.

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

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

40 | * 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.

41 | * 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.

42 | 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.


Generated on Mon Oct 3 12:29:56 2005 for liblogging by 43 | 44 | doxygen 45 | 1.3.2
46 | 47 | 48 | -------------------------------------------------------------------------------- /rfc3195/src/stringbuf.h: -------------------------------------------------------------------------------- 1 | /*! \file stringbuf.h 2 | * \brief The dynamic stringt buffer helper object. 3 | * 4 | * The string buffer object is a slim string handler. It implements 5 | * a dynamically growing string and can be used whereever data needs 6 | * to be appended to a string AND it is not known how large the 7 | * resulting structure is. If you know the string size or can 8 | * retrieve it quickly, you should NOT use the string buffer 9 | * object - because it has some overhead not associated with direct 10 | * string manipulations. 11 | * 12 | * This object is used to grow a string. For performance reasons, 13 | * the termination \0 byte is only written after the caller 14 | * indicates the string is completed. 15 | * 16 | * \author Rainer Gerhards 17 | * \date 2003-08-08 18 | * Initial version begun. 19 | * 20 | * Copyright 2002-2014 21 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions are 25 | * met: 26 | * 27 | * * Redistributions of source code must retain the above copyright 28 | * notice, this list of conditions and the following disclaimer. 29 | * 30 | * * Redistributions in binary form must reproduce the above copyright 31 | * notice, this list of conditions and the following disclaimer in 32 | * the documentation and/or other materials provided with the 33 | * distribution. 34 | * 35 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 36 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 37 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 38 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 39 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 40 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 41 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 42 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 43 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 44 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 45 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | */ 47 | #ifndef __LIB3195_STRINGBUF_H_INCLUDED__ 48 | #define __LIB3195_STRINGBUF_H_INCLUDED__ 1 49 | 50 | #define sbSTRBCHECKVALIDOBJECT(x) {assert(x != NULL); assert(x->OID == OIDsbStrB);} 51 | 52 | 53 | /** 54 | * The dynamic string buffer object. 55 | * 56 | */ 57 | struct sbStrBObject 58 | { 59 | srObjID OID; /**< object ID */ 60 | char *pBuf; /**< pointer to the string buffer, may be NULL if string is empty */ 61 | int iBufSize; /**< current maximum size of the string buffer */ 62 | int iBufPtr; /**< pointer (index) of next character position to be written to. */ 63 | int iAllocIncrement; /**< the amount of bytes the string should be expanded if it needs to */ 64 | }; 65 | typedef struct sbStrBObject sbStrBObj; 66 | 67 | 68 | /** 69 | * Construct a sbStrB object. 70 | */ 71 | sbStrBObj *sbStrBConstruct(void); 72 | 73 | /** 74 | * Destruct the string buffer object. 75 | */ 76 | void sbStrBDestruct(sbStrBObj *pThis); 77 | 78 | /** 79 | * Append a character to an existing string. If necessary, the 80 | * method expands the string buffer. 81 | * 82 | * \param c Character to append to string. 83 | */ 84 | srRetVal sbStrBAppendChar(sbStrBObj *pThis, char c); 85 | 86 | /** 87 | * Finish the string buffer. That means, the string 88 | * is returned to the caller and then the string 89 | * buffer is destroyed. The caller is reponsible for 90 | * freeing the returned string pointer. 91 | * 92 | * After calling this method, the string buffer object 93 | * is destroyed and thus the provided handle (pThis) 94 | * can no longer be used. 95 | * 96 | * \retval pointer to \0 terminated string. May be NULL 97 | * (empty string) and MUST be free()ed by caller. 98 | */ 99 | char* sbStrBFinish(sbStrBObj *pThis); 100 | 101 | /** 102 | * Append a string to the buffer. 103 | * 104 | * \param psz pointer to string to be appended. Must not be NULL. 105 | */ 106 | srRetVal sbStrBAppendStr(sbStrBObj *pThis, char* psz); 107 | 108 | /** 109 | * Set a new allocation incremet. This will influence 110 | * the allocation the next time the string will be expanded. 111 | * It can be set and changed at any time. If done immediately 112 | * after custructing the StrB object, this will also be 113 | * the inital allocation. 114 | * 115 | * \param iNewIncrement The new increment size 116 | * 117 | * \note It is possible to use a very low increment, e.g. 1 byte. 118 | * This can generate a considerable overhead. We highly 119 | * advise not to use an increment below 32 bytes, except 120 | * if you are very well aware why you are doing it ;) 121 | */ 122 | void sbStrBSetAllocIncrement(sbStrBObj *pThis, int iNewIncrement); 123 | 124 | /** 125 | * Append an integer to the string. No special formatting is 126 | * done. 127 | */ 128 | srRetVal sbStrBAppendInt(sbStrBObj *pThis, int i); 129 | 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /rfc3195/doc/html/doxygen.css: -------------------------------------------------------------------------------- 1 | H1 { 2 | text-align: center; 3 | font-family: Arial, Helvetica, sans-serif; 4 | } 5 | H2 { 6 | font-family: Geneva, Arial, Helvetica, sans-serif; 7 | } 8 | CAPTION { font-weight: bold } 9 | DIV.qindex { width: 100%; 10 | background-color: #eeeeff; 11 | border: 4px solid #eeeeff; 12 | text-align: center; 13 | margin-bottom: 2px 14 | } 15 | A.qindex { text-decoration: none; font-weight: bold; } 16 | A.qindex:hover { text-decoration: none; background-color: #ddddff } 17 | A.qindexHL { text-decoration: none; font-weight: bold; 18 | background-color: #6666cc; 19 | color: #ffffff 20 | } 21 | A.qindexHL:hover { text-decoration: none; background-color: #6666cc } 22 | A.qindexRef { text-decoration: none; font-weight: bold; } 23 | A.qindexRef:hover { text-decoration: none; background-color: #ddddff } 24 | A.qindexRefHL { text-decoration: none; font-weight: bold; 25 | background-color: #6666cc; 26 | color: #ffffff 27 | } 28 | A.qindexRefHL:hover { text-decoration: none; background-color: #6666cc } 29 | A.el { text-decoration: none; font-weight: bold } 30 | A.elRef { font-weight: bold } 31 | A.code { text-decoration: none; font-weight: normal; color: #4444ee } 32 | A.codeRef { font-weight: normal; color: #4444ee } 33 | A:hover { text-decoration: none; background-color: #f2f2ff } 34 | DL.el { margin-left: -1cm } 35 | DIV.fragment { 36 | width: 98%; 37 | border: 1px solid #CCCCCC; 38 | background-color: #f5f5f5; 39 | padding-left: 4px; 40 | margin: 4px; 41 | } 42 | DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } 43 | TD.md { background-color: #f2f2ff; font-weight: bold; } 44 | TD.mdname1 { background-color: #f2f2ff; font-weight: bold; color: #602020; } 45 | TD.mdname { background-color: #f2f2ff; font-weight: bold; color: #602020; width: 600px; } 46 | DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold } 47 | DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } 48 | BODY { 49 | background: white; 50 | color: black; 51 | margin-right: 20px; 52 | margin-left: 20px; 53 | } 54 | TD.indexkey { 55 | background-color: #eeeeff; 56 | font-weight: bold; 57 | padding-right : 10px; 58 | padding-top : 2px; 59 | padding-left : 10px; 60 | padding-bottom : 2px; 61 | margin-left : 0px; 62 | margin-right : 0px; 63 | margin-top : 2px; 64 | margin-bottom : 2px 65 | } 66 | TD.indexvalue { 67 | background-color: #eeeeff; 68 | font-style: italic; 69 | padding-right : 10px; 70 | padding-top : 2px; 71 | padding-left : 10px; 72 | padding-bottom : 2px; 73 | margin-left : 0px; 74 | margin-right : 0px; 75 | margin-top : 2px; 76 | margin-bottom : 2px 77 | } 78 | TR.memlist { 79 | background-color: #f0f0f0; 80 | } 81 | P.formulaDsp { text-align: center; } 82 | IMG.formulaDsp { } 83 | IMG.formulaInl { vertical-align: middle; } 84 | SPAN.keyword { color: #008000 } 85 | SPAN.keywordtype { color: #604020 } 86 | SPAN.keywordflow { color: #e08000 } 87 | SPAN.comment { color: #800000 } 88 | SPAN.preprocessor { color: #806020 } 89 | SPAN.stringliteral { color: #002080 } 90 | SPAN.charliteral { color: #008080 } 91 | .mdTable { 92 | border: 1px solid #868686; 93 | background-color: #f2f2ff; 94 | } 95 | .mdRow { 96 | padding: 8px 20px; 97 | } 98 | .mdescLeft { 99 | font-size: smaller; 100 | font-family: Arial, Helvetica, sans-serif; 101 | background-color: #FAFAFA; 102 | padding-left: 8px; 103 | border-top: 1px none #E0E0E0; 104 | border-right: 1px none #E0E0E0; 105 | border-bottom: 1px none #E0E0E0; 106 | border-left: 1px none #E0E0E0; 107 | margin: 0px; 108 | } 109 | .mdescRight { 110 | font-size: smaller; 111 | font-family: Arial, Helvetica, sans-serif; 112 | font-style: italic; 113 | background-color: #FAFAFA; 114 | padding-left: 4px; 115 | border-top: 1px none #E0E0E0; 116 | border-right: 1px none #E0E0E0; 117 | border-bottom: 1px none #E0E0E0; 118 | border-left: 1px none #E0E0E0; 119 | margin: 0px; 120 | padding-bottom: 0px; 121 | padding-right: 8px; 122 | } 123 | .memItemLeft { 124 | padding: 1px 0px 0px 8px; 125 | margin: 4px; 126 | border-top-width: 1px; 127 | border-right-width: 1px; 128 | border-bottom-width: 1px; 129 | border-left-width: 1px; 130 | border-top-style: solid; 131 | border-top-color: #E0E0E0; 132 | border-right-color: #E0E0E0; 133 | border-bottom-color: #E0E0E0; 134 | border-left-color: #E0E0E0; 135 | border-right-style: none; 136 | border-bottom-style: none; 137 | border-left-style: none; 138 | background-color: #FAFAFA; 139 | font-family: Geneva, Arial, Helvetica, sans-serif; 140 | font-size: 12px; 141 | } 142 | .memItemRight { 143 | padding: 1px 0px 0px 8px; 144 | margin: 4px; 145 | border-top-width: 1px; 146 | border-right-width: 1px; 147 | border-bottom-width: 1px; 148 | border-left-width: 1px; 149 | border-top-style: solid; 150 | border-top-color: #E0E0E0; 151 | border-right-color: #E0E0E0; 152 | border-bottom-color: #E0E0E0; 153 | border-left-color: #E0E0E0; 154 | border-right-style: none; 155 | border-bottom-style: none; 156 | border-left-style: none; 157 | background-color: #FAFAFA; 158 | font-family: Geneva, Arial, Helvetica, sans-serif; 159 | font-size: 13px; 160 | } 161 | -------------------------------------------------------------------------------- /rfc3195/src/testsrvr.c: -------------------------------------------------------------------------------- 1 | /** 2 | * testsrvr.cpp : This is a small sample C++ server app 3 | * using liblogging. It just demonstrates how things can be 4 | * done. It accepts incoming messages and just dumps them 5 | * to stdout. It is single-threaded. 6 | * 7 | * \author Rainer Gerhards 8 | * \date 2003-08-13 9 | * file created. 10 | * 11 | * Copyright 2002-2014 12 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions are 16 | * met: 17 | * 18 | * * Redistributions of source code must retain the above copyright 19 | * notice, this list of conditions and the following disclaimer. 20 | * 21 | * * Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in 23 | * the documentation and/or other materials provided with the 24 | * distribution. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 27 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 29 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 31 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 32 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 33 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 34 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | 39 | #include "config.h" 40 | #include 41 | #include 42 | #ifdef WIN32 43 | #include 44 | #endif 45 | #include "liblogging.h" 46 | #include "srAPI.h" 47 | #include "syslogmessage.h" 48 | #ifdef WIN32 49 | #include 50 | #endif 51 | 52 | /* quick hack, so all can access it. Do NOT do this in your server ;-) */ 53 | srAPIObj* pAPI; 54 | 55 | /* This method is called when a message has been fully received. 56 | * In a real sample, you would do all your enqueuing and/or 57 | * processing here. 58 | * 59 | * It is highly recommended that no lengthy processing is done in 60 | * this callback. Please see \ref architecture.c for a suggested 61 | * threading model. 62 | */ 63 | void OnReceive(srAPIObj* pAPI, srSLMGObj* pSLMG) 64 | { 65 | char *pszRemoteHost; 66 | char *pszHost; 67 | unsigned char *pszMSG; 68 | unsigned char *pszRawMsg; 69 | int iFacil; 70 | int iPrio; 71 | char szNotWellformed[] = "(non-wellformed msg)"; 72 | 73 | srSLMGGetRemoteHost(pSLMG, &pszRemoteHost); 74 | srSLMGGetPriority(pSLMG, &iPrio); 75 | srSLMGGetFacility(pSLMG, &iFacil); 76 | srSLMGGetRawMSG(pSLMG, &pszRawMsg); 77 | if(srSLMGGetHostname(pSLMG, &pszHost) == SR_RET_PROPERTY_NOT_AVAILABLE) 78 | pszHost = szNotWellformed; 79 | srSLMGGetMSG(pSLMG, &pszMSG); 80 | 81 | printf("Msg from %s (via %d), host %s, facility %d, priority %d:\n%s\nRAW:%s\n\n", pszRemoteHost, pSLMG->iSource, 82 | pszHost, iFacil, iPrio, pszMSG, pszRawMsg); 83 | } 84 | 85 | 86 | /* As we are single-threaded in this example, we need 87 | * one way to shut down the listener running on this 88 | * single thread. We use SIG_INT to do so - it effectively 89 | * provides a short-lived second thread ;-) 90 | */ 91 | void doSIGINT(int i) 92 | { 93 | printf("SIG_INT - shutting down listener. Be patient, can take up to 30 seconds...\n"); 94 | srAPIShutdownListener(pAPI); 95 | } 96 | 97 | int main(int argc, char* argv[]) 98 | { 99 | srRetVal iRet; 100 | 101 | # ifdef WIN32 102 | _CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); 103 | # endif 104 | 105 | printf("testsrvr test server - just a quick debuging aid and sample....\n"); 106 | printf("Compiled with liblogging version %s\n", VERSION); 107 | printf("See http://www.monitorware.com/liblogging/ for updates.\n"); 108 | printf("Listening for incoming requests....\n"); 109 | 110 | signal(SIGINT, doSIGINT); 111 | 112 | if((pAPI = srAPIInitLib()) == NULL) 113 | { 114 | printf("Error initializing lib!\n"); 115 | exit(1); 116 | } 117 | 118 | /* We now set the options so that the server receives all we desire... */ 119 | if((iRet = srAPISetOption(pAPI, srOPTION_LISTEN_UDP, TRUE)) != SR_RET_OK) 120 | { 121 | printf("Error %d: can't set UDP listener option to true!!\n", iRet); 122 | exit(2); 123 | } 124 | if((iRet = srAPISetOption(pAPI, srOPTION_LISTEN_UXDOMSOCK, TRUE)) != SR_RET_OK) 125 | { 126 | printf("Error %d: can't set UDP listener option to true!!\n", iRet); 127 | exit(2); 128 | } 129 | 130 | if((iRet = srAPISetupListener(pAPI, OnReceive)) != SR_RET_OK) 131 | { 132 | printf("Error %d setting up listener!\n", iRet); 133 | exit(100); 134 | } 135 | 136 | /* now move the listener to running state. Control will only 137 | * return after SIG_INT. 138 | */ 139 | if((iRet = srAPIRunListener(pAPI)) != SR_RET_OK) 140 | { 141 | printf("Error %d running the listener!\n", iRet); 142 | exit(100); 143 | } 144 | 145 | /** control will reach this point after SIG_INT */ 146 | 147 | srAPIExitLib(pAPI); 148 | return 0; 149 | } 150 | 151 | -------------------------------------------------------------------------------- /rfc3195/src/clntprof-3195raw.c: -------------------------------------------------------------------------------- 1 | /*! \file clntprof-3195raw.c 2 | * \brief Implementation of the client profile for RFC 3195 raw. 3 | * 4 | * The prefix for this "object" is psrr which stands for 5 | * *P*rofile *S*yslog *R*eliable *Raw*. This file works in 6 | * conjunction with \ref lstnprof-3195raw.c and shares 7 | * its namespace. 8 | * 9 | * \author Rainer Gerhards 10 | * \date 2003-09-04 11 | * coding begun. 12 | * 13 | * Copyright 2002-2014 14 | * Rainer Gerhards and Adiscon GmbH. All Rights Reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions are 18 | * met: 19 | * 20 | * * Redistributions of source code must retain the above copyright 21 | * notice, this list of conditions and the following disclaimer. 22 | * 23 | * * Redistributions in binary form must reproduce the above copyright 24 | * notice, this list of conditions and the following disclaimer in 25 | * the documentation and/or other materials provided with the 26 | * distribution. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 29 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 30 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 31 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 32 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 33 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 34 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 35 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 36 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 37 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 38 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | */ 40 | 41 | #include 42 | #include "settings.h" 43 | #include "liblogging.h" 44 | #include "srAPI.h" 45 | #include "beepsession.h" 46 | #include "beepchannel.h" 47 | #include "beepprofile.h" 48 | #include "clntprof-3195raw.h" 49 | #include "syslogmessage.h" 50 | 51 | /* ################################################################# * 52 | * private members * 53 | * ################################################################# */ 54 | 55 | /** 56 | * Construct a sbPSSRObj. 57 | */ 58 | static srRetVal sbPSSRConstruct(sbPSSRObj** ppThis) 59 | { 60 | assert(ppThis != NULL); 61 | 62 | if((*ppThis = calloc(1, sizeof(sbPSSRObj))) == NULL) 63 | return SR_RET_OUT_OF_MEMORY; 64 | 65 | (*ppThis)->OID = OIDsbPSSR; 66 | (*ppThis)->uAnsno = 0; 67 | (*ppThis)->uMsgno4raw = 0; 68 | 69 | return SR_RET_OK; 70 | } 71 | 72 | 73 | /** 74 | * Destroy a sbPSSRObj. 75 | * The handler must be called in the ChanClose handler, if instance 76 | * data was assigned. 77 | */ 78 | static void sbPSSRDestroy(sbPSSRObj* pThis) 79 | { 80 | sbPSSRCHECKVALIDOBJECT(pThis); 81 | SRFREEOBJ(pThis); 82 | } 83 | 84 | 85 | /* ################################################################# * 86 | * public members * 87 | * ################################################################# */ 88 | 89 | srRetVal sbPSSRClntSendSLMG(sbChanObj* pChan, srSLMGObj *pSLMG) 90 | { 91 | return sbPSSRClntSendMsg(pChan, pSLMG->pszRawMsg); 92 | } 93 | 94 | srRetVal sbPSSRClntSendMsg(sbChanObj* pChan, char* szLogmsg) 95 | { 96 | sbMesgObj *pMesg; 97 | srRetVal iRet; 98 | sbPSSRObj *pThis; 99 | 100 | sbChanCHECKVALIDOBJECT(pChan); 101 | assert(szLogmsg != NULL); 102 | 103 | pThis = pChan->pProfInstance; 104 | sbPSSRCHECKVALIDOBJECT(pThis); 105 | 106 | if((pMesg = sbMesgConstruct(NULL, szLogmsg)) == NULL) 107 | return SR_RET_ERR; 108 | 109 | iRet = sbMesgSendMesg(pMesg, pChan, "ANS", pThis->uAnsno++); 110 | sbMesgDestroy(pMesg); 111 | 112 | return iRet; 113 | } 114 | 115 | 116 | srRetVal sbPSSRClntOpenLogChan(sbChanObj *pChan) 117 | { 118 | srRetVal iRet; 119 | sbPSSRObj *pThis; 120 | sbMesgObj *pMesgGreeting; 121 | 122 | sbChanCHECKVALIDOBJECT(pChan); 123 | 124 | if((iRet = sbPSSRConstruct(&pThis)) != SR_RET_OK) 125 | return iRet; 126 | 127 | /* channel created, let's wait until the remote peer sends 128 | * the profile-level greeting (intial MSG). 129 | */ 130 | if((pMesgGreeting = sbMesgRecvMesg(pChan)) == NULL) 131 | { 132 | return SR_RET_ERR; 133 | } 134 | 135 | if(pMesgGreeting->idHdr != BEEPHDR_MSG) 136 | { 137 | sbMesgDestroy(pMesgGreeting); 138 | return SR_RET_ERR; 139 | } 140 | sbMesgDestroy(pMesgGreeting); 141 | 142 | pThis->uAnsno = 0; 143 | pThis->uMsgno4raw = pMesgGreeting->uMsgno; 144 | 145 | /* now store the instance pointer */ 146 | pChan->pProfInstance = pThis; 147 | 148 | return SR_RET_OK; 149 | } 150 | 151 | srRetVal sbPSSRCOnClntCloseLogChan(sbChanObj *pChan) 152 | { 153 | srRetVal iRet; 154 | sbPSSRObj *pThis; 155 | sbMesgObj *pMesg; 156 | 157 | sbChanCHECKVALIDOBJECT(pChan); 158 | 159 | pThis = pChan->pProfInstance; 160 | sbPSSRCHECKVALIDOBJECT(pThis); 161 | 162 | if((pMesg = sbMesgConstruct("", "")) == NULL) 163 | { 164 | sbMesgDestroy(pMesg); 165 | return SR_RET_ERR; 166 | } 167 | 168 | iRet = sbMesgSendMesg(pMesg, pChan, "NUL", pThis->uAnsno++); 169 | sbMesgDestroy(pMesg); 170 | 171 | sbPSSRDestroy(pThis); 172 | pChan->pProfInstance = NULL; 173 | 174 | return iRet; 175 | } 176 | --------------------------------------------------------------------------------