downlink data from internet comes in here. It needs to be segmented and sent to LLC Entity for yet another header.
| 623 | // downlink data from internet comes in here. |
| 624 | // It needs to be segmented and sent to LLC Entity for yet another header. |
| 625 | void Sndcp::sndcpWriteHighSide(ByteVector &sdu) |
| 626 | { |
| 627 | // Set the first byte flags. |
| 628 | unsigned flags = mNSapi; |
| 629 | flags |= T_BIT; // UNITDATA PDU |
| 630 | flags |= F_BIT; // First segment. |
| 631 | // Segment the pdu. |
| 632 | unsigned segnum = 0; |
| 633 | unsigned segsize = getMaxPduSize(); |
| 634 | segsize -= 12; // be safe. If you dont do this, the blackberry rejects the packets. |
| 635 | for (; sdu.size() > segsize; segnum++) { |
| 636 | flags |= M_BIT; // Not last segment. |
| 637 | ByteVector seg(sdu.segment(0,segsize)); |
| 638 | sndcpWriteSegment(seg,segnum,flags); |
| 639 | sdu.trimLeft(segsize); |
| 640 | flags &= ~F_BIT; // Not first segment. |
| 641 | } |
| 642 | flags &= ~M_BIT; // Now it is the last segment. |
| 643 | sndcpWriteSegment(sdu,segnum,flags); |
| 644 | mSendNPdu = (mSendNPdu+1) % mSNS; |
| 645 | } |
| 646 | |
| 647 | // invert the low width bits of x. |
| 648 | static uint32_t revbits(uint32_t x, unsigned width) |
no test coverage detected