00001
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef _OSB_CDR_H_
00048 #define _OSB_CDR_H_
00049
00050
00051
00052
00053
00054
00055 #include "chargetraits.h"
00056 #include "chrono.h"
00057 #include "decimal.h"
00058 #include "fraction.h"
00059 #include "money.h"
00060 #include "nwaddress.h"
00061 #include "osberrors.h"
00062 #include "osbtype.h"
00063 #include "ratedparty.h"
00064 #include "resource.h"
00065 #include "service.h"
00066
00067
00068
00069 namespace OSB_LIB {
00070 class ConnectionPt;
00071 class Contract;
00072 class Network;
00073 class NetworkElement;
00074 class PersProduct;
00075 class ProductNode;
00076 class RatedService;
00077 class RecordStreamInfo;
00078 class ScsVersion;
00079 class ServiceClass;
00080 class TariffClass;
00081 class TariffPeriod;
00082 class TariffZone;
00083 class TcsVersion;
00084 class TfVersion;
00085 class TpsVersion;
00086 class TsVersion;
00087 class Unit;
00088 }
00089
00090
00091
00092 namespace OSB_LIB {
00093
00094
00095
00096
00103 struct ExternalTax {
00104 public:
00108 Money amount_;
00115 std::string type_;
00124 Decimal rate_;
00125 };
00126
00136 struct ExternalCharge {
00137 public:
00139 typedef std::vector<ExternalTax> Taxes;
00140 public:
00144 Money charge_;
00146 Taxes taxes_;
00147 };
00148
00156 struct ExtChargeInfo {
00157 public:
00159 static const long noTariffCode_ = -1;
00160 public:
00167 ExtChargeInfo();
00168 public:
00170 long tariffCode_;
00172 std::string dest_;
00174 std::vector<ExternalCharge> charges_;
00175
00176 public:
00178 bool available() const;
00179 };
00180
00194 struct MoneyInfo {
00204 MoneyInfo(
00205 const Money& money,
00206 const ChargeTraits::Oid& chargeTraitsId):
00207 money_(money), chargeTraitsId_(chargeTraitsId) {}
00208
00210 Money money_;
00211
00213 ChargeTraits::Oid chargeTraitsId_;
00214 };
00215
00217 typedef std::vector<MoneyInfo> MoneyInfoList;
00218
00234 struct ChargeDetail {
00236 ChargeDetail(): volume_(0), roundedVolume_(-1) {}
00238 TypeId<Unit> unitId_;
00240 Decimal volume_;
00246 Decimal roundedVolume_;
00251 MoneyInfoList moneyInfoList_;
00252 };
00253
00255 typedef std::vector<ChargeDetail> ChargeDetails;
00256
00257
00258
00266 class UsedService {
00267 public:
00269 UsedService() {}
00270
00276 UsedService(const ServiceTuple& st) : serviceTuple_(st) {}
00277
00284 void resetTariffInfo();
00285
00291 ServiceTuple serviceTuple_;
00292
00298 Id<ProductNode> productNodeId_;
00299
00307 ExtChargeInfo extCharge_;
00308
00318
00319 Id2<ScsVersion> scsVersion_;
00321 Id2<TcsVersion> tcsVersion_;
00323 Id2<TpsVersion> tpsVersion_;
00325 Id2<TfVersion> flatTfVersion_;
00327 Id2<TfVersion> massTfVersion_;
00328
00330 Id<RatedService> ratedService_;
00332 Id<ServiceClass> serviceClass_;
00334 Id<TariffClass> tariffClass_;
00336 Id<TariffPeriod> tariffPeriod_;
00338
00349
00350 Id<ConnectionPt> mappedOrigin_;
00352 Id<ConnectionPt> mappedDestination_;
00354 Id2<TcsVersion> distTcsVersion_;
00356 Id<TariffZone> tariffZone_;
00358 Id<ConnectionPt> ratedOrigin_;
00360 Id<ConnectionPt> ratedDestination_;
00362
00364 ChargeDetails chargeDetails_;
00365
00367 OsbErrors errors_;
00368 };
00369
00371 typedef std::vector<UsedService> UsedServices;
00372
00373
00374
00382 class Udr {
00383 public:
00385 virtual ~Udr() {}
00386
00388 enum UdrType {
00389 unknownUdr = 0,
00390 cdrCommon = 1,
00391 sumcdrPng = 2,
00392 sumcdr01 = 3
00393 };
00394
00414 virtual UdrType udrType() const = 0;
00415
00441 template<typename T> T* isa(T*& ptr);
00442
00444 template<typename T> const T* isa(const T*& ptr) const;
00445
00446 protected:
00454 virtual Udr& operator=(const Udr& rhs);
00455 };
00456
00458 typedef std::list<Udr*> UdrList;
00459
00460
00461
00493 class Cdr : public Udr {
00495 static const UdrType udrType_ = Udr::cdrCommon;
00496
00497 public:
00499 UdrType udrType() const;
00500
00507 Cdr();
00508
00526 void clear();
00527
00532 void clearErrors();
00533
00534 public:
00541 typedef TypeId<Cdr, 1> UsageType;
00552 enum UsageSubtype {
00554 ustUnknown = 0x00,
00562 ustIn = 0x0001,
00570 ustOut = 0x0002,
00572 ustCisco1 = 0x0011,
00574 ustCisco2 = 0x0012,
00576 ustCisco3 = 0x0013,
00578 ustCisco4 = 0x0014,
00579
00581 ustSpecific = 0x1000,
00583 ustMax = 0xffff
00584 };
00585
00587 enum RecordType {
00588 rtUnknown = 0,
00589 rtNormal = 1,
00590 rtFirstPartial = 2,
00591 rtPartial = 3,
00592 rtLastPartial = 4,
00593 rtAssembled = 5
00594 };
00595
00597 enum ChargeInd {
00598 ciNormal = 0,
00599 ciReverse = 1,
00600 ciTollFree = 2,
00601 ciOther = 3,
00602 ciUnknown = 4
00603 };
00604
00620 enum Status {
00622 rsUnknown = 0xffff,
00623
00625 rsSuccess = 0x0000,
00626
00631 rsFailure = 0x8000,
00632
00634 rsSpecific = 0x4000,
00636 rsMax = 0xfffe
00637 };
00638
00645 struct ServedParty {
00652 NwAddress address_;
00653
00655
00656
00657 std::string imsi_;
00659 std::string msrn_;
00661 std::string imei_;
00663 std::string cgi_;
00665
00667 std::string ccNumber_;
00668
00670 void clear();
00671 };
00672
00687 typedef std::map<Id<RecordStreamInfo>, Fraction> OrigCountList;
00688
00689 public:
00691 UsageType usageType_;
00693 RecordType recordType_;
00695 UsageSubtype usageSubtype_;
00697 Status status_;
00698
00706 DateTime timeStamp_;
00717 DateTime initTime_;
00718
00730 std::string transactionId_;
00731
00737 std::string partRecRef_;
00738
00744 long partRecNo_;
00745
00747 RatedParty ratedParty_;
00753
00754 ServedParty servedParty_;
00756 NwAddress calledParty_;
00758 NwAddress callingParty_;
00760
00766 ChargeInd chargeInd_;
00767
00769
00770
00776 Id2<NetworkElement> networkElementId_;
00781 std::string switchId_;
00783
00785
00786
00787 std::string inTrkGroup_;
00793 long inTrkNumber_;
00795 std::string outTrkGroup_;
00801 long outTrkNumber_;
00827 std::string remoteIpAddress_;
00829
00831 UsedServices usedServices_;
00832
00834 OrigCountList origCountList_;
00835
00842 long numErroredOut_;
00843
00845 long numErrors_;
00846
00848 OsbErrors errors_;
00849
00850 public:
00861 static UsageSubtype mkUsageSubtype(long st) throw();
00870 static long toLong(UsageSubtype st) throw();
00871
00878 static ChargeInd mkChargeInd(long ci) throw();
00885 static long toLong(ChargeInd ci) throw();
00886
00888
00889
00900 static Status mkStatus(long s) throw();
00908 static long toLong(Status s) throw();
00910 static bool isSuccess(Status s) { return !isFailure(s); }
00912 static bool isFailure(Status s)
00913 {
00914 return (rsFailure == (s & rsFailure));
00915 }
00917 static bool isSpecific(Status s)
00918 {
00919 return (rsSpecific == (s & rsSpecific));
00920 }
00922
00923 private:
00937 void defaultPods();
00938 };
00939
00940
00941
00942
00943
00944
00945 template<typename T> T* Udr::isa(T*& ptr)
00946 {
00947 ptr = dynamic_cast<T*>(this);
00948 return ptr;
00949 }
00950
00951 template<typename T> const T* Udr::isa(const T*& ptr) const
00952 {
00953 ptr = dynamic_cast<const T*>(this);
00954 return ptr;
00955 }
00956 }
00957 #endif // #ifndef _OSB_CDR_H_