| 578 | } |
| 579 | |
| 580 | static void csl3HandleFrame(const GSM::L3Frame *frame, L3LogicalChannel *lch) |
| 581 | { |
| 582 | L3Message *l3msg = NULL; |
| 583 | // The primitives apply directly to the L3LogicalChannel and a specific SAPI, rather than to the MMContext. |
| 584 | if (! checkPrimitive(frame->primitive(), lch, frame->getSAPI())) { return; } |
| 585 | // Everything else runs on the MMContext. |
| 586 | MMContext *mmchan = lch->chanGetContext(true); |
| 587 | if (frame->isData()) { |
| 588 | l3msg = parseL3(*frame); |
| 589 | if (l3msg) { |
| 590 | WATCHINFO(lch <<" received L3 message "<<*l3msg); |
| 591 | } else { |
| 592 | LOG(ERR) <<lch<< " received unparseable Layer3 frame "<<*frame; |
| 593 | // We pass unparseable messages through to machineRunState1 to provide an error indication to |
| 594 | // any state machine that uses that function, but the default machrineRunState1 eliminates them |
| 595 | // so machineRunState never sees them. |
| 596 | } |
| 597 | bool deleteit; |
| 598 | if (l3msg && handleCommonMessages(l3msg, mmchan, &deleteit)) { |
| 599 | LOG(DEBUG) << "message handled by handleCommonMessagse"<<LOGVAR(l3msg); |
| 600 | if (deleteit) { delete l3msg; } |
| 601 | return; |
| 602 | } |
| 603 | } |
| 604 | mmchan->mmDispatchL3Frame(frame,l3msg); |
| 605 | if (l3msg) delete l3msg; |
| 606 | #if UNUSED |
| 607 | L3Message *msg = NULL; |
| 608 | try { |
| 609 | // Even through parseL3 catches L3ReadError, looks to me like this can still throw SMS_READ_ERROR, so catch it: |
| 610 | msg = parseL3(*frame); |
| 611 | } catch (...) { |
| 612 | msg = NULL; |
| 613 | } |
| 614 | if (msg) { |
| 615 | LOG(DEBUG) <<lch <<" received L3 message "<<*msg; |
| 616 | csl3HandleLCHMsg(msg,lch); |
| 617 | } else { |
| 618 | L3PD PD = frame->PD(); |
| 619 | int MTI = frame->MTI(); |
| 620 | LOG(ERR) << "unparseable Layer3 message with"<<LOGVAR(PD)<<LOGVAR(MTI); |
| 621 | // Give the state machine a chance to do something about an error: |
| 622 | lch->chanGetContext(true)->mmDispatchError(PD,MTI,lch); |
| 623 | } |
| 624 | #endif |
| 625 | } |
| 626 | |
| 627 | #if UNUSED |
| 628 | // Handle timeouts. Return the next timeout or -1 if no timeout is pending. |
no test coverage detected