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

📄 func.h

📁 本程序是实现中国移动中国联通的网关程序.代码比较完整.
💻 H
字号:
#if !defined(FUNC_H)
#define FUNC_H
#include <winsock2.h>
#include "cmppe_proto.h"
#define SMPPMAXLENGTH 512
#define ONESECTION1 0//send access
#define ONESECTION2 0//recv access
#define ONESECTION3 0//winlen

#define 	CMPPE_NACK_RESP		0x80000000
#define 	CMPPE_LOGIN			0x00000001
#define 	CMPPE_LOGIN_RESP	0x80000001
#define 	CMPPE_LOGOUT		0x00000002
#define 	CMPPE_LOGOUT_RESP	0x80000002
#define 	CMPPE_SUBMIT		0x00000004
#define 	CMPPE_SUBMIT_RESP	0x80000004
#define 	CMPPE_DELIVER		0x00000005
#define 	CMPPE_DELIVER_RESP	0x80000005
#define 	CMPPE_ACTIVE		0x00000008
#define 	CMPPE_ACTIVE_RESP	0x80000008




//Exit Code
#define NOERROR 0
#define ExitFromGetCallBack 1
#define ExitFromLinkCallBack 2
#define ExitFromInitDatabase 3
#define ExitFromInit 4
#define ExitFromSender 5   
#define ExitFromWSAStartup 6
#define ExitFromWaitFailed 7
#define ExitFromNetClose 100008
#define ExitFromDeliver 9
#define ExitFromReceiver 10

#define MOBILELEN 20
#define MSGLEN 320
#define MSGLENP1 321
#define SPACE '\d'
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF", "EndOfFile")
inline void TESTHR(HRESULT x) {if FAILED(x) _com_issue_error(x);};
#define COUNT2SEND 250
#define COUNT2CHANGE 30
#define COUNT2SMSC 19
class CMSG
{
public:
	DWORD dwCommand;
	DWORD dwSequence;
	DWORD dwSequence2;
	DWORD dwSequence3,seq;
	//the head is 12 bytes
	
	char SrcTermId[21];
	char DstTermId[21];
	char FeeUser[22];
	char szContent[321];
	char szServiceID[11];
	char ExpireTime[16];
	char ScheduleTime[16];
	DWORD dwResult;
	DWORD dwState;
	int nStation;
	BYTE msg_format,bPID,bUDHI;
	BYTE bPK_TOTAL,bPK_NUM;
	int msg_len;
	char sLinkID[32];
	BYTE FeeType;
	DWORD FeeCode;
	BYTE bReason,isReply,bFeeUserType;
	unsigned int seq_id;
};
class CArg
{
public:
	DWORD dwSend,dwRecv;
	char szSub[50];
	HANDLE hGW;
	int iChannelNum,iSelectInterval;
	char	strCnn[256];
	char	spid[7];//=EHOO11
	short	SMSCPORT;//=7890
	char	password[11];//=ehoonet456
	char	SMSCIP[20];//=10.0.0.170
	short	nMaxInterval;
	int isDebug;
	conn_desc conn;
	BYTE nMaxReconnect,nMaxResend,isActive;
	int iSendOneTime;
	CMSG* sms;
#if ONESECTION1
	CRITICAL_SECTION syc1;
#endif
#if ONESECTION2
	CRITICAL_SECTION syc2;
#endif
#if ONESECTION3
	CRITICAL_SECTION syc3;
#endif
};
void PutNByte(char* buffer,BYTE,DWORD);
DWORD GetNByte(char* buffer,BYTE);
void	PutByteString(char* dest,char* source,int length);
bool	GetArg(CArg*);
DWORD	WINAPI MTThread(LPVOID);
DWORD	WINAPI MOThread(LPVOID);
DWORD WINAPI MOFun(CMSG *msg,_ConnectionPtr pCnnGSM);
void AddBinLog(char*,int,int);
DWORD SendData(CMSG *msg);
int SendBuffer(SOCKET s,char* buffer,int buf_len);
void SendCheck(char*);
int UCS2toGB(char* src,char* dst,int len);
int GBtoUCS2(char* src,char* dst);

#endif

⌨️ 快捷键说明

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