www.pudn.com > RadiusSrv.rar > IPPhoneDB.h, change:2003-10-22,size:1707b


#ifndef _IP_PHONE_DB_H 
#define _IP_PHONE_DB_H 
 
#include "..\database\DBManager.h" 
#include "..\common\GKCommon.h" 
 
using namespace std; 
 
//费率表 
struct _IP_PRICE 
{ 
	float price;                 //费率 
	uint16 areaCode;             //国家或者地区的号码 
	uint8 priceID;               //对应于哪套费率表 
}; 
 
class IPPhoneDB 
{ 
public: 
	IPPhoneDB(); 
	~IPPhoneDB(); 
 
public: 
	bool IPPhoneDBInit(_DB_INFO &dbMaster); 
	bool addDialedInfo(_CDR &CDR); 
	bool updateGKVersion(char *version); 
	bool updateGKInfo(_STATISTICS &statistics); 
	bool updatePUserState(const char *userID, uint8 userState); 
	bool updatePUserState(_ACF &ACF, uint8 callType); 
 
	uint32 getDurationLimit(_ARQ &ARQ); 
 
	_PHONE_DIALING *validateACF(_ACF &ACF); 
	bool validateUser(_EP_INFO &EPInfo); 
 
	void IPPhoneDBDestory(); 
 
private: 
	PtrList IPPriceTable; 
	DBManager DBManagerLink; 
	Uint16List areaCodeList; 
 
//	string internationalPrefix;  //国际前缀 
//	string internalPrefix;       //国内前缀 
 
	enum AREA_CODE 
	{ 
		AREA_CODE_ERROR=-1, 
		GUO_JI=1, 
		GUO_NEI=86, 
		WANG_NEI=0, 
	}; 
 
private: 
	bool getIPPrice(const uint8 &areaCode, const uint8 &priceID, float &price); 
	bool getAreaCodeList(Uint16List &areaCodeList); 
	bool insertDialedHistory(_CDR &CDR, uint16 areaCode); 
	bool updatePhoneInfo(_CDR &CDR, float &balance); 
	bool updatePhoneTime(_CDR &CDR); 
	bool getPhoneInfo(const char *userID, float &balance, uint8 &priceID); 
 
	int parseAreaCode(const char *dialedDigits); 
	uint8 skipDailPrefix(const char *dialedDigits); 
 
	inline uint16 SecToMin(uint32 sec) 
	{ return ((sec%60==0)?(sec/60):(sec/60+1));} 
	inline uint32 SinToSec(uint16 sec) 
	{ return  sec*60;} 
 
 
}; 
 
#endif