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


#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(_EP_INFO EPInfo, uint8 userState); 
	bool updatePUserState(_ACF &ACF, uint8 callType); 
///	bool updateGroupProfit( 
 
	uint32 getDurationLimit(_ARQ &ARQ); 
	bool GetPhonePasswd(_EP_INFO &EPInfo, char *szPasswd); 
 
	bool validateRCF(_RCF &RCF); 
	bool validateUser(_EP_INFO &EPInfo); 
 
	void IPPhoneDBDestory(); 
 
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 updateGroupInfo(uint16 &groupID, uint16 &areaCode,  
		uint32 &duration, float &userBill); 
	bool getPhoneInfo(const char *userID, float &balance,  
		uint8 &priceID, uint16 &groupID); 
	bool getGroupInfo(uint16 &groupID, uint8 &priceID, float &profit); 
 
	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;} 
 
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, 
	}; 
}; 
 
#endif