00001 // OSB library ********************************************* -*- C++ -*- 00014 /* 00015 AUTHOR(S): Stephan Broennimann (vb) 00016 00017 RCS information 00018 $Name: OSB_060808 $ 00019 $Revision: 1.40 $ 00020 00021 License 00022 OSB rating and billing library for communication networks 00023 Copyright (C) 2004, 2005, 2006 OSB systems 00024 00025 This file may be distributed and/or modify under the terms of the 00026 GNU General Public License (GPL) as published by the Free Software 00027 Foundation which is provided in the file LICENSE.GPL included in the 00028 packaging of this file. 00029 00030 The file is distributed in the hope that it will be useful, but WITHOUT 00031 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00032 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00033 for more details. 00034 00035 Holders of a OSB Commercial License may use this file under the terms 00036 and conditions of this commercial license. 00037 */ 00038 #ifndef _OSB_E164_H_ 00039 #define _OSB_E164_H_ 00040 00041 // ********************************************************************* 00042 // included header files 00043 // + standard includes 00044 #include <list> 00045 00046 // + local headers 00047 #include "osbid.h" 00048 #include "nwaddress.h" 00049 #include "tariffobject.h" 00050 00051 // ********************************************************************* 00052 // class declarations 00053 namespace OSB_LIB { 00054 class TariffCatalogue; 00055 class ConnectionPt; 00056 } 00057 00058 namespace OSB_DB { 00059 struct E164Gw; 00060 } 00061 00062 // ************************************************************************ 00063 // namespace extensions 00064 namespace OSB_LIB { 00065 00066 // ********************************************************************* 00067 // type definitions 00068 00069 // ********************************************************************* 00070 // class forward declarations 00071 00072 // ********************************************************************* 00073 // class definitions 00074 00075 // ***************************************************************** 00076 // class E164 00084 class E164 : public ToNameOnly, 00085 public ToCfgPeriodBase 00086 { 00091 friend class OSB_DB::E164Gw; 00092 00097 friend class TariffCatalogue; 00098 public: 00100 static const std::string catchall_; 00101 00103 typedef Id<E164> Oid; 00105 typedef Id<ConnectionPt> CpId; 00106 public: 00108 explicit E164(const Oid& oid = Oid()); 00109 public: 00111 00112 00113 const Oid& oid() const; 00115 const CpId& cpId() const; 00117 NwAddress::Ton ton() const; 00119 const std::string& value() const; 00121 00123 00124 00132 void setTon(NwAddress::Ton ton); 00141 void setValue(const std::string& value); 00150 void setCpId(const CpId& cpId); 00152 00154 00155 00164 bool read(const OSB_DB::Session& session); 00165 00166 private: 00180 bool insert(const OSB_DB::Session& session); 00181 00198 bool remove(const OSB_DB::Session& session); 00199 00212 bool update(const OSB_DB::Session& session); 00214 00216 00217 00229 bool freeze( 00230 const OSB_DB::Session& session, 00231 OsbErrors& errors 00232 ); 00233 00248 bool release( 00249 const OSB_DB::Session& session, 00250 OsbErrors& errors 00251 ); 00252 00265 bool revoke( 00266 const OSB_DB::Session& session, 00267 OsbErrors& errors 00268 ); 00269 00281 bool unfreeze( 00282 const OSB_DB::Session& session, 00283 OsbErrors& errors 00284 ); 00286 00287 private: 00289 Oid oid_; 00291 NwAddress::Ton ton_; 00293 std::string value_; 00295 CpId cpId_; 00296 }; 00297 00299 typedef std::list<E164> E164s; 00300 } // namespace OSB_LIB 00301 #endif // #ifndef _OSB_E164_H_