CMPP DELIVER
发布时间:2006-10-14 3:03:10   收集提供:gaoqian

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;
}

 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50