00001 // OSB library ********************************************* -*- C++ -*- 00012 /* 00013 AUTHOR(S): Stephan Broennimann (vb) 00014 00015 RCS information 00016 $Name: OSB_060808 $ 00017 $Revision: 1.13 $ 00018 00019 License 00020 OSB rating and billing library for communication networks 00021 Copyright (C) 2004, 2005, 2006 OSB systems 00022 00023 This file may be distributed and/or modify under the terms of the 00024 GNU General Public License (GPL) as published by the Free Software 00025 Foundation which is provided in the file LICENSE.GPL included in the 00026 packaging of this file. 00027 00028 The file is distributed in the hope that it will be useful, but WITHOUT 00029 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00030 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00031 for more details. 00032 00033 Holders of a OSB Commercial License may use this file under the terms 00034 and conditions of this commercial license. 00035 */ 00036 #ifndef _IPASSIGNMENT_H_ 00037 #define _IPASSIGNMENT_H_ 00038 00039 // ********************************************************************* 00040 // included header files 00041 // + standard includes 00042 #include <string> 00043 00044 // + local headers 00045 #include "chrono.h" 00046 #include "resource.h" 00047 #include "ipaddress.h" 00048 00049 // ********************************************************************* 00050 // class declarations 00051 namespace OSB_LIB { 00052 template<typename T> class Id; 00053 } 00054 00055 namespace OSB_DB { 00056 class IpAssignmentGw; 00057 } 00058 00059 // ********************************************************************* 00060 // namespace extensions 00061 namespace OSB_LIB { 00062 00063 // ********************************************************************* 00064 // class definitions 00074 class IpAssignments { 00075 friend class OSB_DB::IpAssignmentGw; 00076 public: 00083 struct Entry { 00085 Id<Resource> ipId_; 00087 ResourceKey addressKey_; 00089 Id<Resource> groupId_; 00091 ResourceKey groupKey_; 00093 IpGroup::Direction dir_; 00095 DateTime assigned_; 00097 DateTime deassigned_; 00107 bool withinPeriod( 00108 const DateTime& ts 00109 ) const; 00110 }; 00111 00113 typedef std::vector<Entry> Entries; 00114 public: 00116 const Entries entries() const; 00118 void read( 00119 const OSB_DB::Session& session 00120 ); 00134 const Entry* find( 00135 const std::string& ip, 00136 IpGroup::Direction dir, 00137 const DateTime& ts 00138 ) const; 00139 00140 private: 00142 Entries entries_; 00143 }; 00144 } // namespace OSB_LIB 00145 #endif // #ifndef _IPASSIGNMENT_H_