smgpapi.h 文件;<br>-----------------------------------------------------------------<br>/********************************************************************<br>ModuleName: SMGW Client API<br>FileName: smgpapi.h <br>DESCRIPTION: The Function ProtoType And Struct Definition Of API <br>History: <br>Date Version Modifier Activies<br>2002/02/27 1.0 Zhang Jiebin Create<br>2002/10/18 3.5 Li Jianfu Modify<br>********************************************************************/<br>#ifndef _SMGP_API_H_<br>#define _SMGP_API_H_<br><br>/*#define SMGP_CLIENT_VERSION10*/<br>#ifdef SMGP_API_EXPORTS<br>#define SMGPAPI_EXPORTS int __stdcall<br>#else<br>#define SMGPAPI_EXPORTS int <br>#endif<br><br><br>#ifdef _WIN32<br> #pragma pack(push,1)<br>#elif defined _AIX<br> #pragma options align=packed<br>#elif defined _HPUX<br> #pragma pack 1<br>#else<br> #pragma pack (1)<br>#endif<br><br><br>/* Send Batch Message Responce Which Is Written In File */<br>typedef struct<br>{<br> char sMsgID[10+1]; <br> int nErrorCode;<br> char sPhoneNo[21+1];<br>}SendBatchResp;<br><br>/* Query Message Responce Struct */<br>typedef struct<br>{<br> int nMT_TLMsg;<br> int nMT_TLusr;<br> int nMT_Scs;<br> int nMT_WT;<br> int nMT_FL;<br> int nMO_Scs;<br> int nMO_WT;<br> int nMO_FL;<br>}QueryResp;<br><br>/* Receive Message Responce Struct */<br>#ifdef SMGP_API_EXPORTS<br>/*DLL VERSION*/<br>typedef struct<br>{<br> unsigned int nIsReport;<br> unsigned int nMsgFormat;<br> unsigned int nMsgLength;<br> char sMsgID[10+1];<br> char sRecvTime[14+1];<br> char sSrcTermID[21+1];<br> char sDestTermID[21+1];<br> char sMsgContent[252+1];<br> char sReserve[8+1];<br>}DeliverResp;<br><br>typedef struct<br>{<br> unsigned int nSerialNo; /*消息头中的流水号*/<br> unsigned int nStatus;<br> unsigned int nMsgType;<br> unsigned int nMsgFormat;<br> unsigned int nDesMode;<br> unsigned int nKeySerialNo; <br> unsigned int nIIType;<br> unsigned int nMsgLength;<br> char sMsgID[20+1]; <br> char sSrcTermID[21+1];<br> char sDestTermID[21+1];<br> char sSessionID[20+1];<br> char sServiceID[10+1];<br> char sCpID[8+1];<br> char sTermID[9+1];<br> char sICCardID[15+1];<br> char sMsgContent[254+1];<br>}TransactionRecv;<br><br>#else<br>/*NOT DLL VERSION*/<br>typedef struct<br>{<br> char sMsgID[10+1];<br> unsigned int nIsReport;<br> unsigned int nMsgFormat;<br> char sRecvTime[14+1];<br> char sSrcTermID[21+1];<br> char sDestTermID[21+1];<br> unsigned int nMsgLength;<br> char sMsgContent[252+1];<br> char sReserve[8+1];<br>}DeliverResp;<br><br>typedef struct<br>{<br> unsigned int nSerialNo; /*消息头中的流水号*/<br> unsigned int nStatus;<br> char sMsgID[20+1]; <br> unsigned int nMsgType;<br> unsigned int nMsgFormat;<br> char sSrcTermID[21+1];<br> char sDestTermID[21+1];<br> char sSessionID[20+1];<br> char sServiceID[10+1];<br> char sCpID[8+1];<br> unsigned int nDesMode;<br> char sTermID[9+1];<br> char sICCardID[15+1];<br> unsigned int nKeySerialNo;<br> unsigned int nIIType;<br> unsigned int nMsgLength;<br> char sMsgContent[254+1];<br>}TransactionRecv;<br><br>#endif /*SMGP_API_EXPORTS*/<br><br>#ifdef _WIN32<br> #pragma pack(pop)<br>#elif defined _AIX<br> #pragma options align=reset<br>#elif defined _HPUX<br> #pragma pack 4<br>#else<br> #pragma pack ()<br>#endif<br><br><br>#ifdef __cplusplus <br>extern "C"{<br>#endif<br><br>/********************************************************************<br>The Function Prototype<br>********************************************************************/<br><br>/********************************************************************<br>FunctionName: InitSMGPAPI <br>DESCRIPTION: Must call this initiate function before <br> calling others SMGP API functions if standard c is <br> used, param sINIFile must be specfied. <br>Input: sINIFile:The address of init file name <br>Output: None<br>Return: 0=OK, 1=fail<br>History: <br>Date Version Modifier Activies<br><br>*******************************************************************/<br>SMGPAPI_EXPORTS InitSMGPAPI(const char *sINIFile);<br><br><br>/********************************************************************<br>FunctionName: SMGPSendSingle <br>DESCRIPTION: Send a short message to single user,if succeed, message<br> id is filled in sMsgID.if fail, error code is filled in <br> nErrorCode. <br>Input: nNeedReply:Need reply the status?0:no,1:yes<br> nMsgLevel:Message level:0:the lowest, 1:normal,<br> 2:above normal 3:the highest<br> sServiceID:Server type<br> nMsgFormat:Message format<br> sFeeType:Fee type<br> sFeeCode:Fee code<br> sValidTime:Valid time,format following smpp3.3<br> sAtTime:The time of sending,format following smpp3.3<br> sChargeTermID
aying User number<br> sDestTermID:Reveive Message number<br> sReplyPath:User reply number<br> nMsgLen:Message length<br> sMsgContent:Message Content<br> <br>Output: sMsgID:If succeed, message id is filled in sMsgID<br> nErrorCode:If fail, error code is filled in nErrorCode<br>Return: 0=OK, 1=fail<br>History: <br>Date Version Modifier Activies<br><br>*******************************************************************/<br>SMGPAPI_EXPORTS SMGPSendSingle( const int nNeedReply, const int nMsgLevel,<br> const char *sServiceID, const int nMsgFormat,<br> const char *sFeeType, const char *sFeeCode, const char *sFixedFee,<br> const char *sValidTime, const char *sAtTime,<br> const char *sChargeTermID, const char *sDestTermID,<br> const char *sReplyPath, const int nMsgLen,<br> const char *sMsgContent,char *sMsgID, <br> int *nErrorCode,const int nMsgType,const char *sReserve);<br><br><br>/********************************************************************<br>FunctionName: SMGPSendBatch <br>DESCRIPTION: Send a short message to multiple users,if succeed, message<br> id is filled in sMsgID.if fail, error code is filled in <br> nErrorCode.<br> If nMsgLen is 0, then sMsgFile is the filename which contains <br> message content, if not, then sMsgFile contains the message. <br> If Both of them are 0, SMGPSendBatch fail.<br><br>Input: nNeedReply:Need reply the status?0:no,1:yes<br> nMsgLevel:Message level:0:the lowest, 1:normal,<br> 2:above normal 3:the highest<br> sServiceID:Server type<br> nMsgFormat:Message format<br> sFeeType:Fee type<br> sFeeCode:Fee code<br> sValidTime:Valid time,format following smpp3.3<br> sAtTime:The time of sending,format following smpp3.3<br> sChargeTermID
aying User number<br> sDestTermID:Reveive Message number<br> sReplyPath:User reply number<br> nMsgLen:Message length<br> sMsgFile:The file which contains the message content or<br> message Content,see description.<br> sMsgIDFile:The file name which save the all message id<br> or error code.<br> <br>Output: None<br>Return: 0=OK, 1=fail<br>History: <br>Date Version Modifier Activies<br><br>*******************************************************************/<br>SMGPAPI_EXPORTS SMGPSendBatch( const int nNeedReply, const int nMsgLevel,<br> const char *sServiceID, const int nMsgFormat,<br> const char *sFeeType, const char *sFeeCode,const char *sFixedFee,<br> const char *sValidTime, const char *sAtTime,<br> const char *sChargeTermID, const char *sDestTermIDFile,<br> const char *sReplyPath, const int nMsgLen,<br> const char *sMsgFile, const char *sMsgIDFile,const int nMsgType,const char *sReserve);<br><br>/********************************************************************<br>FunctionName: GetSendBatchResp <br>DESCRIPTION: Give a MSGID file which is created by Batch send, <br> specify position of the record, then get response from <br> the file. each field of the param SendBatchResp will<br> filled. nPos start from 0<br>Input: sMsgIDFile:The file name which save the all message id<br> or error code.<br> <br>Output: pSendBatchResp:The message id and error code<br>Return: 0=OK, 1=fail<br>History: <br>Date Version Modifier Activies<br><br>*******************************************************************/<br>SMGPAPI_EXPORTS GetSendBatchResp(char *sMsgIDFile, int nPos, SendBatchResp *pSendBatchResp);<br><br>/********************************************************************<br>FunctionName: SMGPDeliver <br>DESCRIPTION: Get ShortMessage from SMGW<br>Input: nTimeout:how many seconds the function keep waiting short<br> message, 0 means wait forever. <br>Output: pDeliverResp:the delivered short message is filled in pDeliverResp<br>Return: 0=OK, 1=fail<br>History: <br>Date Version Modifier Activies<br><br>*******************************************************************/<br>SMGPAPI_EXPORTS SMGPDeliver(const int nTimeoutIn, DeliverResp *pDeliverResp);<br><br>/********************************************************************<br>FunctionName: CMMPActiveTest <br>DESCRIPTION: See if the SMGW is available<br>Input: <br>Output: nErrorCode:Response error code,0 is ok <br>Return: 0=OK, 1=fail<br>History: <br>Date Version Modifier Activies<br><br>*******************************************************************/<br>SMGPAPI_EXPORTS SMGPActiveTest(int *nErrorCode);<br><br>/********************************************************************<br>FunctionName: SMGPRecvTransaction<br>DESCRIPTION: Get Electric Transation ShortMessage from SMGW<br>Input: nTimeout:how many seconds the function keep waiting short<br> message, 0 means wait forever. <br>Output: pTransactionRecv:the received electric transaction short message is filled in pTransactionRecv<br>Return: 0=OK, 1=fail<br>History: <br>Date Version Modifier Activies<br><br>*******************************************************************/<br>SMGPAPI_EXPORTS SMGPRecvTransaction(const int nTimeoutIn, TransactionRecv *pTransactionRecv);<br><br>/********************************************************************<br>FunctionName: SMGPSendTransactionResp<br>DESCRIPTION: Support Electric Transaction.<br> Send a short message to single user,if succeed, message<br> id is filled in sMsgID.if fail, error code is filled in <br> nErrorCode. <br> <br>Input: nSerialNo,<br> nStatus,<br> sMessageID, <br> nMsgType,<br> nNeedReport,sFeeType,<br> sFeeCode, sFixedFee,<br> nMsgFormat, sSrcTermID,<br> sChargeTermID, sDestTermID,<br> sSessionID, sServiceID,<br> sCpID, nDesMode,<br> nAckDesMode, const char *sTermID,<br> sICCardID, nKeySerialNo,<br> nIIType,nMsgLength,<br> sMsgContent<br> <br>Output: nErrorCode:If fail, error code is filled in nErrorCode<br>Return: 0=OK, 1=fail<br>History: <br>Date Version Modifier Activies<br><br>*******************************************************************/<br>SMGPAPI_EXPORTS SMGPSendTransactionResp(<br> const int nSerialNo, const int nStatus,<br> const char *sMessageID, const int nMsgType,<br> const int nNeedReport, const char *sFeeType,<br> const char *sFeeCode, const char *sFixedFee,<br> const int nMsgFormat, const char *sSrcTermID,<br> const char *sChargeTermID, const char *sDestTermID,<br> const char *sSessionID, const char *sServiceID,<br> const char *sCpID, const int nDesMode,<br> const int nAckDesMode, const char *sTermID,<br> const char *sICCardID, const int nKeySerialNo,<br> const int nIIType, const int nMsgLength,<br> const char *sMsgContent);<br><br><br>#ifdef __cplusplus<br>}<br>#endif<br><br><br>#endif /* _SMGP_API_H_ */<br><br>-----------------------------------------------------------------