syslog.hh

Go to the documentation of this file.
00001 // Copyright (C) 2003, 2004, 2005 Laboratoire de Recherche en Informatique
00002 
00003 // This file is part of Qolyester.
00004 
00005 // Qolyester is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 // Qolyester is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 
00019 #ifndef QOLYESTER_UTL_SYSLOG_HH
00020 # define QOLYESTER_UTL_SYSLOG_HH 1
00021 
00022 # include <streambuf>
00023 # include <syslog.h>
00024 # include <cassert>
00025 # include <cstring>
00026 
00027 namespace olsr {
00028 
00029   namespace utl {
00030 
00031 # define SYSLOG_BUFFER_SIZE 4096
00032 
00033     class SyslogBuf : public std::streambuf {
00034       typedef std::streambuf    Super;
00035       typedef Super::char_type          char_type;
00036       typedef Super::traits_type        traits_type;
00037       typedef Super::int_type           int_type;
00038       typedef Super::pos_type           pos_type;
00039       typedef Super::off_type           off_type;
00040     public:
00041       SyslogBuf(int prio);
00042       ~SyslogBuf();
00043       int_type  overflow(int_type c = traits_type::eof());
00044       Super*    setbuf(char_type* s, std::streamsize n);
00045       int       sync();
00046     private:
00047       int               prio_;
00048       bool              ours_;
00049       unsigned          size_;
00050       char_type*        buffer_;
00051     };
00052 
00053   } // namespace utl
00054 
00055 } // namespace olsr
00056 
00057 #endif // !QOLYESTER_UTL_SYSLOG_HH

Generated on Mon Sep 4 00:02:16 2006 for Qolyester daemon by  doxygen 1.4.6