bool CSmsCmpp::DecodeDeliver(string& sMsgID, string& sDestID, string& sServiceID, int& nTP_pid, int& nTP_udhi,
int& nMsgFmt, string& sSrc_terminalID, int& nRegDel, int& nMsgLen, vector<BYTE>& sMsgContent,vector<BYTE>& vMsgID)
{
if(int(m_Body.size())<64) {
gRunInfo.error_package(m_Body);
return false;
}
std::copy(m_Body.begin(),m_Body.begin()+8,back_inserter(vMsgID));
sMsgID = gtMsgID(vMsgID);
sDestID = FetchOct(8,21);
sServiceID = FetchOct(29,10);
nTP_pid = FetchInt8(39);
nTP_udhi = FetchInt8(40);
nMsgFmt = FetchInt8(41);
sSrc_terminalID = FetchOct(42,21);
if(strlen(sSrc_terminalID.c_str()) == 13) {
sSrc_terminalID = sSrc_terminalID.substr(2,11);
}
nRegDel = FetchInt8(63);
nMsgLen = FetchInt8(64);
if(nMsgLen>160||nMsgLen<0) return false;
if(int(m_Body.size()) >= (65+nMsgLen+8))
{
std::copy(m_Body.begin()+65,m_Body.begin()+65+nMsgLen,back_inserter(sMsgContent));
}
else {
gRunInfo.error_package(m_Body);
return false;
}
return true;
}
文章来源于领测软件测试网 https://www.ltesting.net/
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073