CPMessage * SMS::parseSMS( const GSM::L3Frame& frame ) { CPMessage::MessageType MTI = (CPMessage::MessageType)(frame.MTI()); LOG(DEBUG) << "MTI="<<MTI; CPMessage * retVal = CPFactory(MTI); if( retVal==NULL ) return NULL; retVal->TI(frame.TI()); retVal->parse(frame); LOG(DEBUG) << *retVal; return retVal; }
// (pat) This parses an incoming SMS message from the MS, called from CPMessage * SMS::parseSMS( const GSM::L3Frame& frame ) { CPMessage::MessageType MTI = (CPMessage::MessageType)(frame.MTI()); LOG(DEBUG) << "MTI="<<MTI; CPMessage * retVal = CPFactory(MTI); if( retVal==NULL ) return NULL; retVal->TI(frame.TI()); // Documentation courtesy pat: // The L3Message::CPMessage is a base class for CPData, CPAck, CPError, one of which is created by the CPFactory above. // The below calls L3Message::parse which calls the parseBody from the derived class. // For CPAck and CPError, parseBody is null (or worse, assert out - a former bug.) // For CPData messages: calls CPData::parseBody which then calls L3ProtocolElement::parseLV which calls: // CPUserData::parseV, which just copies the data into CPUserData::mRPDU; which is an L3Frame::RLFrame retVal->parse(frame); LOG(DEBUG) << *retVal; return retVal; }