ipaddress-gw.h

Go to the documentation of this file.
00001 // OSB library ********************************************* -*- C++ -*-
00009 /*
00010   AUTHOR(S): Lilian Qin Lan (lan)
00011 
00012   RCS information
00013    $Name: OSB_060808 $
00014    $Revision: 1.19 $
00015 
00016   License
00017    OSB rating and billing library for communication networks
00018    Copyright (C) 2004, 2005, 2006  OSB systems
00019 
00020    This file may be distributed and/or modify under the terms of the
00021    GNU General Public License (GPL) as published by the Free Software
00022    Foundation which is provided in the file LICENSE.GPL included in the
00023    packaging of this file.
00024 
00025    The file is distributed in the hope that it will be useful, but WITHOUT
00026    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00027    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00028    for more details.
00029 
00030    Holders of a OSB Commercial License may use this file under the terms
00031    and conditions of this commercial license.
00032  */
00033 #ifndef _IPADDRESSGW_H_
00034 #define _IPADDRESSGW_H_
00035 
00036 // *********************************************************************
00037 // included header files
00038 // + standard includes
00039 #include <utility>
00040 
00041 // + local headers
00042 #include "ipaddress.h"
00043 #include "resourcefwd.h"
00044 
00045 // *********************************************************************
00046 // class declarations
00047 namespace OSB_LIB {
00048     template<typename I> class Id;
00049     class Ip4Address;
00050     class IpGroup;
00051 }
00052 
00053 namespace OSB_DB {
00054     class Session;
00055 }
00056 
00057 // ************************************************************************
00058 // namespace extensions
00059 namespace OSB_DB {
00060 
00061 // *********************************************************************
00062 // class definitions
00063 
00064     // *****************************************************************
00065     // class Ip4AddressGw
00069     class Ip4AddressGw {
00071         friend class OSB_LIB::Ip4Address;
00073         friend class OSB_DB::IpGroupGw;
00075         typedef OSB_LIB::ResourceList<OSB_LIB::Ip4Address> Ip4List;
00077         typedef OSB_LIB::Id<OSB_LIB::Network> NwOid;
00078     public:
00096         void fetch(
00097             const Session& session,
00098                   Ip4List& dest,
00099             const NwOid&   nwId,
00100                   bool     availOnly
00101         );
00102 
00113         void fetch(
00114             const Session&                 session,
00115                   OSB_LIB::AssignableIp4s& dest
00116         );
00117 
00118     private:
00120         bool read(
00121             const Session&             session,
00122                   OSB_LIB::Ip4Address& ip4
00123         ) const;
00124 
00126         bool insert(
00127             const Session&             session,
00128             const OSB_LIB::Ip4Address& ip4
00129         ) const;
00130 
00132         bool update(
00133             const Session&             session,
00134             const OSB_LIB::Ip4Address& ip4
00135         ) const;
00136 
00138         bool remove(
00139             const Session&             session,
00140             const OSB_LIB::Ip4Address& ip4
00141         ) const;
00142     };
00143 
00144     // *****************************************************************
00145     // class IpGroupGw
00149     class IpGroupGw {
00151         friend class OSB_LIB::IpGroup;
00153         typedef
00154         OSB_LIB::ResourceList<OSB_LIB::IpGroup> IpGroupList;
00156         typedef OSB_LIB::Id<OSB_LIB::Network> NwOid;
00157     public:
00175         void fetch(
00176             const Session&     session,
00177                   IpGroupList& dest,
00178             const NwOid&       nwId,
00179                   bool         availOnly
00180         );
00181 
00182     private:
00184         bool read(
00185             const Session&          session,
00186                   OSB_LIB::IpGroup& ipg
00187         ) const;
00188 
00190         bool insert(
00191             const Session&          session,
00192             const OSB_LIB::IpGroup& ipg
00193         ) const;
00194 
00196         bool update(
00197             const Session&          session,
00198             const OSB_LIB::IpGroup& ipg
00199         ) const;
00200 
00202         bool remove(
00203             const Session&          session,
00204             const OSB_LIB::IpGroup& ipg
00205         ) const;
00206 
00218         std::pair<bool, bool> getCurIp4Assignments(
00219             const Session&                  session,
00220             const OSB_LIB::Ip4Address::Oid& ip4Id
00221         ) const;
00222 
00232         bool insIp4(
00233             const Session&                       session,
00234             const OSB_LIB::IpGroup::Oid&         ipgId,
00235             const OSB_LIB::IpGroup::AssignedIp4& assignedIp4
00236         ) const;
00237 
00247         bool updIp4(
00248             const Session&                  session,
00249             const OSB_LIB::IpGroup::Oid&    ipgId,
00250             const OSB_LIB::Ip4Address::Oid& ip4Id,
00251             OSB_LIB::IpGroup::Direction     dir
00252         ) const;
00253 
00254     };
00255 
00256 
00257 // *********************************************************************
00258 // inline definitions
00259 }
00260 #endif                                  // #ifndef _IPADDRESSGW_H_

Generated on Sat Sep 2 14:06:33 2006 for OSB Library by  doxygen 1.4.7