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

📄 ylfsriphostsock.h

📁 移动
💻 H
字号:
// ylfSRIPHostSock.h: interface for the ylfSRIPHostSock class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_YLFSRIPHOSTSOCK_H__3CB3ADBE_D036_48CF_BB6C_4F020A8C7E25__INCLUDED_)
#define AFX_YLFSRIPHOSTSOCK_H__3CB3ADBE_D036_48CF_BB6C_4F020A8C7E25__INCLUDED_

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

#define SRIP_MAX_SEND_BUF		2000

#define SRIP_BIND_RECEIVER		0x0001
#define SRIP_BIND_RECEIVER_RESP	0x8001
#define SRIP_SUBMIT				0x0003
#define SRIP_ALIVE_TEST			0x0010
#define SRIP_ALIVE_TEST_RESP	0x8010

#define SRIP_MAX_LOGINTIME	10

#define NEXTALIVETSTTIME 10
class ylfSRIPHostSock  : public CSmsSock
{
public:
	ylfSRIPHostSock();
	virtual ~ylfSRIPHostSock();

private:
	BYTE buffer[SRIP_MAX_SEND_BUF];

	CTime nextAliveTstTime;
	int nReceiveError;
	unsigned int sequence;

	int msisdnPos;
public:
	int Send(unsigned char *pBuffer,int cLength);
	int Receive(unsigned char *lpBuf, int nBufLen);
	void ReadAllMsg();

	int  fDisconnect();
	int  fConnect(char* host,unsigned int port);
	int  fAliveTst();

	int  fLogin(char* usrname,char* passwd);

	bool AddMsisdn(int msisdn,int hlrCity,int vlr,int vlrCity,int stime,bool begin=false);
	int  Submit();
private:
	int  fReceive(BYTE* lpBuf, int nBufLen);
	void network_head(struct Smpp_MESSAGE_HEAD* phead);
	inline DWORD network_dword(DWORD v)	 //转换网络字节序
	{
		return ((v)<<24) | (((v)&0xff00)<<8) | (((v)>>8)&0xff00) | ((v)>>24);
	}

	void networkByte(BYTE *buf,int pos,int len);

	int CreateSocket();
};

#endif // !defined(AFX_YLFSRIPHOSTSOCK_H__3CB3ADBE_D036_48CF_BB6C_4F020A8C7E25__INCLUDED_)

⌨️ 快捷键说明

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