⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.h

📁 电信的97接口程序,用于把话单入库。这里是采用FTP方式采集话单
💻 H
字号:
/////////////////////////////////////////////////////////////////
//
// global.h
//
// Version 1.0.0
//
// History:
//	2001.10.24.   started by (shencan@263.net)
//
// History:
//  2001.11.02.   started by (zoohoo@163.com)
//
// History:
//  2002.01.05.	  Add the class of UserInterface by (zoohoo@163.com)
//
// History:
//  2002.02.05.   Add the MAXDBNUM to 50 by (zoohoo@163.com)
/////////////////////////////////////////////////////////////////
 
#if !defined(GLOBAL_H_INCLUDED_)
#define GLOBAL_H_INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "ptlib.h"
#include <ptlib/sockets.h>
#include "log.h"

#define GBLEN 255
//#define MAXFTPSRV	10	//the max number of ftp server
#define MAXDBNUM	50	//the max number of oracle database
#define MAXFTPSRV	20	//the max number of ftp server
#define SQL_SIZE	1024 // the size of sql express
#define MESSAGE_LEN	128	// the packet size of send by socket

#define	BUFSIZE			1024

#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) < (y) ? (y) : (x))


#define STRCPY(dest, src, len) strncpy(dest, src, len); dest[len]=0;
#define STRNCPY(dest, src, len, len2) \
		{ int i = MIN(len, len2); strncpy(dest, src, i); dest[i]=0; }


class IPAddress : public PObject
{
	PCLASSINFO(IPAddress, PObject)
public:
	DWORD	m_ip;
	WORD	m_port;
};

PARRAY (IPAddressArray, IPAddress);

class OraInfo : public PObject
{
public:
	char username[GBLEN];
	char password[GBLEN];
	char connect[GBLEN];
};

PARRAY (OraInfoArray, OraInfo);


class CGlobal
{
public:
	CGlobal();
	~CGlobal();

	int		GetDebugLevel(void);
	int		SetDebugLevel(int level);
	char *	GetLogFileName(void);
	int		SetLogFileName(const char * log);
	int		ReadConfigFile();

	void	NowDateTime(char * now);
private:
	void Init();
	void Exit();

	int		m_totalLogSize;
	char	m_logFile[GBLEN+1];	// save log file name
	IPAddress * m_iPAddress[MAXFTPSRV];
	OraInfo * m_oraInfo[MAXDBNUM];

	char	m_verString[20];
	int		TransVer(int version);
public:
	int		m_debugLevel;
	int		m_irrFrequency;		// IRR response time interval
	int		m_unicastRASPort;	//1719
	int		m_oradbNum;			// the number of oracle server
	int		m_ftpNum;			// the number of ftp server
	int		m_rollback;			// the long of rollback can process
								// the unit is day
	int		m_deleteNow;		// whether delete number now.
	int		m_useNow;			// whether use number now.

	int		m_maxDisconnectTimes;	// the max disconnect database times.
									// beyond the times the watch dog service 
									// will restart the service of interface97
	int		m_disconnectTimes;	// the times of disconnect database.

	int		m_port;				// the socket port for watchdog
	int     m_serverport ;       // the socket port for client connect
	int		m_areacode;			// area code 0:normal 1:Henan 2:Shenzhen

	int		m_connectTime;		// the times of connect database

//	char	m_username[MAXFTPSRV][GBLEN+1];	// save log file name
//	char	m_password[MAXFTPSRV][GBLEN+1];	// save log file name
	char	m_execDir[GBLEN+1]; // the execute file path

	char	m_localDir[GBLEN+1]; // the directory for saving the file 
	char	m_shareDir[GBLEN+1]; // the directory for sharing the file 

	char	m_username[MAXFTPSRV][GBLEN+1];	// save log file name
	char	m_password[MAXFTPSRV][GBLEN+1];	// save log file name

	// the directory for get the files from ftp server
	char	m_getFilePath[GBLEN+1];
	// the directory for put the files to ftp server
	char	m_putFilePath[GBLEN+1];

	// the directory for backup the files to ftp server
	char	m_backupFilePath[GBLEN+1];

	char	m_dbServer[GBLEN+1];
	char	m_dbAccount[GBLEN+1];
	char	m_dbPassword[GBLEN+1];
	char	m_dbName[GBLEN+1];

	//add by zjl for shanghai 97 2002-09-11
	char	m_AccountsType[GBLEN+1];
	char	m_UserType[GBLEN+1];

	IPAddressArray	m_negGkList;	// used by top level gatekeeper, neighbor gatekeeper list

	void	Rtrim(char *str, size_t size);	// get rid of blanket from line
	void	Ltrim(char* str, size_t size);

//	int		m_serviceType;
//	void	GetServiceTypeFromFileName(PString fileName);

	OraInfoArray m_oraList;
	static CGlobal*	m_instance;

	static CGlobal* Instance(void)
	{
		if (m_instance == NULL)
			m_instance = new CGlobal;
		return m_instance;
	};

	char * ConvertQuote(char * express);

	static int		m_isShutdown;

	RadLogFile		m_radLog;
};

class UserInterface
{
public:
	char	serviceId[18];
	char	userGroup[4];
	char	areaNo[6];
	char	teleNumber[13];
	char	oldTeleNum[13];
	int		operateType;
	char	genTime[20];
	char	sendTime[20];
	char	backTime[20];
	char	userType[2];
	char	password[17];
	int		flag;
	int		remainTime;
	char	aCLICP[33];
	char	aCLContent[33];
	int		sendRecv;

	char	endTime[20];
	char	addString[256];

	int		isBackSheet; //是否是退单 0否 ,1 是

    char    groupList[71];
    char    protocolType[2];
    int     userSource;

};

#endif // !defined(GLOBAL_H_INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -