00001 // -*- C++ -*- 00002 // logfile.h - This package defines a LogFile class. This is a 00003 // subclass of Outlet, and is typically a receiver of data from 00004 // a Connection. 00005 // 00006 // ***** BEGIN LICENSE BLOCK ***** 00007 // Version: MPL 1.1/GPL 2.0/LGPL 2.1 00008 // 00009 // The contents of this file are subject to the Mozilla Public License 00010 // Version 1.1 (the "License"); you may not use this file except in 00011 // compliance with the License. You may obtain a copy of the License at 00012 // http://www.mozilla.org/MPL/ 00013 // 00014 // Software distributed under the License is distributed on an "AS IS" 00015 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00016 // the License for the specific language governing rights and limitations 00017 // under the License. 00018 // 00019 // The Original Code is the consmgr network/serial-line monitoring package. 00020 // 00021 // The Initial Developer of the Original Code is Chris P. Ross. 00022 // Portions created by the Initial Developer are Copyright (C) 2000-2008 00023 // the Initial Developer. All Rights Reserved. 00024 // 00025 // Contributor(s): 00026 // 00027 // Alternatively, the contents of this file may be used under the terms of 00028 // either the GNU General Public License Version 2 or later (the "GPL"), or 00029 // the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 00030 // in which case the provisions of the GPL or the LGPL are applicable instead 00031 // of those above. If you wish to allow use of your version of this file only 00032 // under the terms of either the GPL or the LGPL, and not to allow others to 00033 // use your version of this file under the terms of the MPL, indicate your 00034 // decision by deleting the provisions above and replace them with the notice 00035 // and other provisions required by the GPL or the LGPL. If you do not delete 00036 // the provisions above, a recipient may use your version of this file under 00037 // the terms of any one of the MPL, the GPL or the LGPL. 00038 // 00039 // ***** END LICENSE BLOCK ***** 00040 00041 #ifndef __LOGFILE_H 00042 #define __LOGFILE_H 00043 00044 extern "C" { 00045 #include <pthread.h> 00046 } 00047 00048 #include <string> 00049 00050 #include "fdconnector.h" 00051 00062 class LogFile : public FDConnector { 00063 public: 00064 LogFile(string, mode_t=0640); 00065 ~LogFile() { disconnect(); } 00066 00067 string class_name(void) { return("LogFile"); } 00068 std::string get_id(void) const; 00069 00070 private: 00071 void connect(void); 00072 void disconnect(void); 00073 00074 string path; 00075 mode_t mode; 00076 }; 00077 00078 #endif /* __LOGFILE_H */