Decode an IMSI, IMEI or IMEISV type, which are all encoded the same. The result ByteVector size is a multiple of 4 bits, so use sizeBits() not size().
| 442 | // Decode an IMSI, IMEI or IMEISV type, which are all encoded the same. |
| 443 | // The result ByteVector size is a multiple of 4 bits, so use sizeBits() not size(). |
| 444 | void GmmMobileIdentityIE::decodeIM(ByteVector &result) const |
| 445 | { |
| 446 | result.setAppendP(0); |
| 447 | bool isodd = (mIdData[0] & 0x8); |
| 448 | result.appendField(mIdData[0]>>4,4); // First nibble is in the high nibble of first byte. |
| 449 | for (unsigned i = 1; i < mLen; i++) { |
| 450 | // The dang nibbles are backwards. What nimrods. |
| 451 | result.appendField(mIdData[i]&0xf,4); |
| 452 | // Last byte may only have one nibble: |
| 453 | // Note that the even/odd indication includes the single nibble |
| 454 | // in the first byte, so we counter-intuitively check isodd here |
| 455 | // instead of iseven. |
| 456 | if (i < mLen-1 || isodd) { |
| 457 | result.appendField((mIdData[i]>>4)&0xf,4); |
| 458 | } |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | // 24.008 10.5.1.4 Mobile Identity |
| 463 | //void GmmMobileIdentityIE::setIMSI(ByteVector &imsi) |
nothing calls this directly
no test coverage detected