00001
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef _IPADDRESSGW_H_
00034 #define _IPADDRESSGW_H_
00035
00036
00037
00038
00039 #include <utility>
00040
00041
00042 #include "ipaddress.h"
00043 #include "resourcefwd.h"
00044
00045
00046
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
00059 namespace OSB_DB {
00060
00061
00062
00063
00064
00065
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
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
00259 }
00260 #endif // #ifndef _IPADDRESSGW_H_