Lines Matching +full:num +full:- +full:ss +full:- +full:bits

4  *	Dmitry Eremin-Solenikov (dbaryshkov@gmail.com)
27 #include "netdissect-stdinc.h"
35 #define CHECK_BIT(num,bit) (((num) >> (bit)) & 0x1)
39 /* Frame types from Table 7-1 of 802.15.4-2015 */
51 /* Element IDs for Header IEs from Table 7-7 of 802.15.4-2015 */
183 /* Payload IE Group IDs from Table 7-15 of 802.15.4-2015 */
203 /* Sub-ID for short format from Table 7-16 of 802.15.4-2015 */
243 "O-QPSK PHY Mode IE", /* 0x26 */
335 /* Sub-ID for long format from Table 7-17 of 802.15.4-2015 */
355 /* MAC commands from Table 7-49 of 802.15.4-2015 */
420 * but the initial value is 0, and the bits are reversed for both in and out.
421 * See section 7.2.10 of 802.15.4-2015 for more information.
435 /* Reverse bits on input */
446 data_len--;
448 /* Reverse bits on output */
457 * Reverses the bits of the 32-bit word.
471 * IEEE 802.15.4 CRC 32 function. This is using the ANSI X3.66-1979 polynomial of
472 * 0x04C11DB7, but the initial value is 0, and the bits are reversed for both
473 * in and out. See section 7.2.10 of 802.15.4-2015 for more information.
487 /* Reverse bits on input */
497 data_len--;
499 /* Reverse bits on output */
505 * Find out the address length based on the address type. See table 7-3 of
506 * 802.15.4-2015. Returns the address length.
515 case FC_ADDRESSING_MODE_RESERVED: /* Reserved, there used to be 8-bit
518 * removed during 802.15.4-2015
520 return -1;
555 * 802.15.4-2015.
559 uint16_t ss)
561 if (ndo->ndo_vflag < 1) {
565 (ss & 0xf), ((ss >> 4) & 0xf));
567 ((ss >> 8) & 0xf));
568 if (CHECK_BIT(ss, 12)) { ND_PRINT(", BLE enabled"); }
569 if (CHECK_BIT(ss, 14)) { ND_PRINT(", PAN Coordinator"); }
570 if (CHECK_BIT(ss, 15)) { ND_PRINT(", Association Permit"); }
575 * in the DSME PAN Descriptor IE. See section 7.3.1.4 of 802.15.4-2015.
577 * Returns number of byts consumed from the packet or -1 in case of error.
592 if (ndo->ndo_vflag > 0) {
601 return -1;
603 if (ndo->ndo_vflag < 2) {
623 * in the DSME PAN Descriptor IE. See section 7.3.1.5 of 802.15.4-2015.
625 * Returns number of byts consumed from the packet or -1 in case of error.
638 if (ndo->ndo_vflag > 0) {
645 return -1;
647 if (ndo->ndo_vflag < 2) {
725 uint16_t ss, ptr, ulen;
731 ss = GET_LE_U_2(p);
732 ieee802_15_4_print_superframe_specification(ndo, ss);
740 ie_len -
753 ss = GET_LE_U_2(p + ptr);
755 ND_PRINT("Multi-superframe Order = %d", ss & 0xff);
756 ND_PRINT(", %s", ((ss & 0x100) ?
759 if (ss & 0x400) {
762 if (ss & 0x800) {
765 if (ss & 0x1000) {
774 ss = GET_U_1(p + ptr);
776 ND_PRINT("Multi-superframe Order = %d",
777 ss & 0x0f);
778 ND_PRINT(", %s", ((ss & 0x10) ?
781 if (ss & 0x40) {
784 if (ss & 0x80) {
871 ND_PRINT("Rendezvous time = %d, Wake-up Interval = %d",
920 * Parse and print Header IE list. See 7.4.2 of 802.15.4-2015 for
923 * Returns number of byts consumed from the packet or -1 in case of error.
939 return -1;
962 return -1;
968 if (ndo->ndo_vflag > 3 && ie_len != 0) {
982 caplen -= 2 + ie_len;
1029 sub_ie_len--;
1035 sub_ie_len--;
1047 sub_ie_len -= 7;
1060 sub_ie_len -= len;
1068 sub_ie_len -= 2;
1080 sub_ie_len -= len * 2;
1202 case 0x26: /* O-QPSK PHY Mode IE */
1244 * MLME IE list parsing and printing. See 7.4.3.2 of 802.15.4-2015
1288 if (ndo->ndo_vflag > 3) {
1290 } else if (ndo->ndo_vflag > 2) {
1299 ie_len -= 2 + sub_ie_len;
1306 * Returns number of bytes consumed from packet or -1 in case of error.
1407 * Payload IE list parsing and printing. See 7.4.3 of 802.15.4-2015
1410 * Returns number of byts consumed from the packet or -1 in case of error.
1424 return -1;
1444 return -1;
1446 if (ndo->ndo_vflag > 3 && ie_len != 0) {
1499 caplen -= 2 + ie_len;
1510 * Returns number of byts consumed from the packet or -1 in case of error.
1522 return -1;
1529 caplen -= 1;
1532 if (ndo->ndo_vflag > 0) {
1539 return -1;
1541 if (ndo->ndo_vflag > 1) {
1546 caplen -= 4;
1551 if (ndo->ndo_vflag > 1) {
1561 return -1;
1563 if (ndo->ndo_vflag > 1) {
1568 caplen -= 4;
1574 return -1;
1576 if (ndo->ndo_vflag > 1) {
1580 caplen -= 4;
1586 return -1;
1588 if (ndo->ndo_vflag > 1) {
1591 caplen -= 1;
1600 * Returns number of byts consumed from the packet or -1 in case of error.
1614 return -1;
1637 return -1;
1668 return -1;
1697 return -1;
1728 return -1;
1736 "Receive-only GTS" : "Transmit-only GTS"),
1816 fcs = GET_LE_U_4(p + caplen - 4);
1817 crc_check = ieee802_15_4_crc32(ndo, p, caplen - 4);
1820 caplen -= 4;
1823 fcs = GET_LE_U_2(p + caplen - 2);
1824 crc_check = ieee802_15_4_crc16(ndo, p, caplen - 2);
1827 caplen -= 2;
1840 if (ndo->ndo_vflag > 2) {
1857 if (ndo->ndo_vflag)
1864 caplen -= 2;
1867 if (ndo->ndo_vflag)
1874 caplen -= 3;
1984 caplen -= 2;
1986 ND_PRINT("-:");
1994 caplen -= dst_addr_len;
2006 caplen -= 2;
2008 ND_PRINT("-:");
2017 caplen -= src_addr_len;
2020 * XXX - if frame_version is 0, this is the 2003
2023 * for the AES-CTR and AES-CCM security suites but
2024 * not for the AES-CBC-MAC security suite.
2033 caplen -= len;
2063 caplen -= miclen;
2076 caplen -= len;
2088 caplen -= len;
2093 if (ndo->ndo_vflag > 2 && miclen != 0) {
2103 if (ndo->ndo_vflag > 2) {
2120 uint16_t ss;
2122 ss = GET_LE_U_2(p);
2123 ieee802_15_4_print_superframe_specification(ndo, ss);
2125 caplen -= 2;
2139 caplen -= len;
2152 caplen -= len;
2155 if (!ndo->ndo_suppress_default_print)
2161 if (!ndo->ndo_suppress_default_print)
2179 caplen--;
2184 caplen -= len;
2188 if (!ndo->ndo_suppress_default_print)
2228 fcs = GET_LE_U_4(p + caplen - 4);
2229 crc_check = ieee802_15_4_crc32(ndo, p, caplen - 4);
2232 caplen -= 4;
2234 fcs = GET_LE_U_2(p + caplen - 2);
2235 crc_check = ieee802_15_4_crc16(ndo, p, caplen - 2);
2238 caplen -= 2;
2242 fcs = GET_LE_U_2(p + caplen - 2);
2243 crc_check = ieee802_15_4_crc16(ndo, p, caplen - 2);
2246 caplen -= 2;
2262 if (ndo->ndo_vflag > 2) {
2281 caplen -= 2;
2284 if (ndo->ndo_vflag)
2291 caplen -= 3;
2297 caplen -= 2;
2298 if (ndo->ndo_vflag)
2322 caplen -= 2;
2324 ND_PRINT("-:");
2332 caplen -= dst_addr_len;
2337 ND_PRINT(" -:");
2345 caplen -= src_addr_len;
2355 caplen -= len;
2385 caplen -= miclen;
2398 caplen -= len;
2411 caplen -= len;
2416 if (ndo->ndo_vflag > 2 && miclen != 0) {
2427 if (ndo->ndo_vflag > 2) {
2436 if (!ndo->ndo_suppress_default_print)
2472 ndo->ndo_protocol = "802.15.4";
2519 u_int caplen = h->caplen;
2520 ndo->ndo_protocol = "802.15.4";
2521 ndo->ndo_ll_hdr_len += ieee802_15_4_print(ndo, p, caplen);
2525 /* https://github.com/jkcko/ieee802.15.4-tap */
2533 ndo->ndo_protocol = "802.15.4_tap";
2534 if (h->caplen < 4) {
2536 ndo->ndo_ll_hdr_len += h->caplen;
2547 if (h->caplen < length) {
2549 ndo->ndo_ll_hdr_len += h->caplen;
2553 ndo->ndo_ll_hdr_len += ieee802_15_4_print(ndo, p+length, h->caplen-length) + length;