?? smgateway.h
字號:
#ifndef _WWSMSC_H_
#define _WWSMSC_H_
#include "TcpLib.h"
#include "share.h"
#include "SmgApi.h"
#include "CmppLib.h"
#include "DataQueue.h"
#define CMPP_FEE_INFO_FILE "service.ini"
// for common use
#define MAX_CHANNEL_NUM 2
#define MAX_SERVICE_NUM 100
#define MAX_CLIENT_FOR_SERVICE 4
// for unicode table use
#define MAX_UNICODE_NUM 10000
#define UNICODE_OFFSET 0xa1 /* offset for unicode */
#define ASCII_CODE 0
#define BINARY_CODE 4
#define UCS2_CODE 8
#define GB231_CODE 15
// for TSmscChannel's stat
#define IDLE 0x00
#define OCCUPY 0x01
// for TSmscChannel's child stat
#define WAIT_NULL 0x00
#define WAIT_DELIVER_REP 0x01
#define WAIT_SUBMIT_REQ 0x02
#define WAIT_SUBMIT_REP 0x03
#define WAIT_NEXT_SUBMIT_REQ 0x04
// for login to SMSC respone
#define WAIT_LOGON_REP 0x05
// for timer
#define WAIT_DELIVER_REP_TIME 5000
#define WAIT_SUBMIT_REQ_TIME 5000
#define WAIT_SUBMIT_REP_TIME 2000
#define WAIT_NEXT_SUBMIT_REQ_TIME 5000
#define WAIT_LOGON_REP_TIME 5000
#define WAIT_AGENT_SUBMIT_REP_TIME 120000
// for service fee info
#define MAX_SERVICE_ID 1024
#define MAX_FEETYPE_LEN 4
#define MAX_FEECODE_LEN 8
#define MAX_SERVICEID_LEN 12
#define MAX_SERVICETYPE_LEN 12
#define MAX_PROVINCE_NUM 34
// define the interface type
#define S10109_TYPE 2
#define SGIP_TYPE 1
#define CMPP_TYPE 3
// for mask word
#define MAX_MASK_WORD_NUM 256
#define MAX_MASK_WORD_LEN 32
#define CHECK_CONFIGINFO_TIMEVAL 60 //check maintainance.ini timeval
#define SPACE_MARK "{~}"
typedef CDataQueue<TSmgPacket> TSubmitReqQueue;
class TSmscChannel
{
public:
TSmscChannel() : rSubmitReqQueue(4096)
{
ucStat = IDLE;
ucChildStat = WAIT_NULL;
}
int nIndex;
// for CMPP Api use
int nSeqId;
// for channel's stat use
u_char ucStat;
u_char ucChildStat;
// for channel's action type
u_char ucActionType;
// for Client's MT action
int nClientSeqId;
// for submit service request
int nMsgCounts;
int nMsgNumber;
TSubmitReqQueue rSubmitReqQueue;
// for Timer use
time_t nTimeval;
// for 10109 client services
int nUnicomMoHandle;
u_char nServiceId;
char sMsgId[16];
char sLinkId[20];
// for the sms client services
int nHandle;
char sSmscClientIp[18];
char sMTCDR[1024];
} ;
typedef struct TClientInfo
{
int nNoProcess;
BOOL bHaveSendAlarm;
int nHandle;
char sIp[18];
} TClientInfo;
typedef struct TMoClientTable
{
int nMOCounts;
int nMTCounts;
u_char bRegister;
TClientInfo rClientInfo[MAX_CLIENT_FOR_SERVICE];
u_char nLable;
int nClientCount;
char sServiceNumber[32];
} TMoClientTable;
typedef struct
{
char sFeeType[MAX_FEETYPE_LEN];
char sFeeCode[MAX_FEECODE_LEN];
} TFeeInfo;
typedef struct
{
unsigned char nIsUsed;
TFeeInfo rFeeInfo;
} TProvinceFeeInfo;
typedef struct
{
char sServiceId[MAX_SERVICEID_LEN];
char sServiceType[MAX_SERVICETYPE_LEN];
unsigned char nIsUsed;
TProvinceFeeInfo rProviceFeeInfo[MAX_PROVINCE_NUM];
} TServiceFeeTable;
#define MAX_MONITOR_CLIENT 8
typedef struct
{
char sIp[18];
int nHandle;
BOOL bUse;
BOOL bSetMonitor;
} TMonitorClient;
extern TSmscChannel g_rSmgChan[];
extern TMoClientTable g_rMoClientTab[];
extern unsigned short g_rUnicodeTab[];
extern unsigned short g_uUnicodeNum;
extern char g_sSpId[];
extern char g_sSpPwd[];
extern TMonitorClient g_rMonitorClient[];
void SmgTrace(int, char *, ...);
void CloseProgram(int);
int FindIdleSmscChannel();
int FindSmscChannelBySeqId(int);
void SmgInitSmscChannel(int);
void RemoveTimerEvent(int);
int FindClientByServiceNumber(char *sServiceNumber, char *sClientIp, char *sDstAddr);
void FindClientByServiceNumberAndAddMtCount(char *sServiceNumber);
int FindClientByServiceNumberIndex(char *sServiceNumber);
int ConvertToUnicodeAscStr( char sRcvStr[], int nRcvLen, char sResultStr[], int *nResultLen);
int ConvertUnicodeToAsci(char sRcvStr[], int nRecvLen, char sResultStr[], int *nResultLen);
extern void WriteSmsCDR(char *s);
extern FILE *OpenSmsCDRFile(char *flag);
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -