Return true if it was an l3 message or or a primitive that we pass on to state machines, false otherwise. After calling us the caller should test chanRunning to see if the channel is still up.
| 521 | // Return true if it was an l3 message or or a primitive that we pass on to state machines, false otherwise. |
| 522 | // After calling us the caller should test chanRunning to see if the channel is still up. |
| 523 | static bool checkPrimitive(Primitive prim, L3LogicalChannel *lch, int sapi) |
| 524 | { |
| 525 | LOG(DEBUG)<<lch<<LOGVAR(prim); |
| 526 | // Process 'naked' primitives. |
| 527 | switch (prim) { |
| 528 | case GSM::ESTABLISH: |
| 529 | // Indicates SABM mode establishment. |
| 530 | // Most state machines can ignore these, but the MT-SMS controller has to wait for channel |
| 531 | // establishment so we will pass it on. |
| 532 | // One of these comes in when the channel is inited. |
| 533 | // Pat took out this gReports temporarily because it is delaying channel establishment. |
| 534 | // gReports.incr("OpenBTS.GSM.RR.ChannelSeized"); |
| 535 | return true; |
| 536 | case GSM::HANDOVER_ACCESS: |
| 537 | LOG(ALERT) << "Received HANDOVER_ACCESS on established channel"; |
| 538 | // TODO: test that this is on TCHFACH not SDCCH. |
| 539 | // This does not return until the channel is ready to start running a state machine. |
| 540 | //ProcessHandoverAccess(lch); |
| 541 | return false; |
| 542 | |
| 543 | case DATA: |
| 544 | case UNIT_DATA: |
| 545 | return true; |
| 546 | |
| 547 | case ERROR: ///< channel error |
| 548 | // The LAPDM controller was aborted. |
| 549 | //gNewTransactionTable.ttLostChannel(lch); |
| 550 | //lch->chanLost(); // Kill off all the transactions associated with this channel. |
| 551 | LOG(ERR) << "Layer3 received ERROR from layer2 on channel "<<lch<<LOGVAR(sapi); |
| 552 | lch->chanRelease(RELEASE); // Kill off all the transactions associated with this channel. |
| 553 | return false; |
| 554 | |
| 555 | case HARDRELEASE: ///< forced release after an assignment |
| 556 | if (sapi == 0) lch->chanRelease(HARDRELEASE); // Release the channel. |
| 557 | return false; |
| 558 | case RELEASE: ///< normal channel release |
| 559 | //if (lch->mChState == L3LogicalChannel::chReassignPending || lch->mChState == L3LogicalChannel::chReassignComplete) { |
| 560 | // // This is what we wanted. |
| 561 | // // We will exit and the service loop will change the L3LogicahChannel mChState. |
| 562 | //} else { |
| 563 | // // This is a bad thing when happening on an active channel. |
| 564 | // // Link either closed by peer or lost due to timeout in a lower layer. |
| 565 | // // The LAPDm is already released so we cannot send any more messages. |
| 566 | // // Just drop the channel. |
| 567 | // lch->chanLost(); // Kill off all the transactions associated with this channel. |
| 568 | //} |
| 569 | if (sapi == 0) lch->chanRelease(RELEASE); |
| 570 | return false; |
| 571 | default: |
| 572 | LOG(ERR) <<lch<<"unhandled primitive: " << prim; // oops! But lets warn instead of crashing. |
| 573 | // Something horrible happened. |
| 574 | lch->chanRelease(RELEASE); // Kill off all the transactions associated with this channel. |
| 575 | //lch->freeContext(); |
| 576 | return false; |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | static void csl3HandleFrame(const GSM::L3Frame *frame, L3LogicalChannel *lch) |
no test coverage detected