Lines Matching +full:dummy +full:- +full:bytes +full:- +full:count

1 /* main.c - Application main entry point */
6 * SPDX-License-Identifier: Apache-2.0
26 #include <zephyr/net/dummy.h>
215 #define IPV6_DISPATCH_DIFF -1
256 struct net_6lo_context *net_6lo_context = dev->data; in net_6lo_dev_init()
296 res = memcmp((uint8_t *)ipv6_hdr, (uint8_t *)&data->ipv6, in compare_ipv6_hdr()
319 res = memcmp((uint8_t *)udp_hdr, (uint8_t *)&data->nh.udp, in compare_udp_hdr()
342 res = memcmp((uint8_t *)icmp_hdr, (uint8_t *)&data->nh.icmp, in compare_icmp_hdr()
365 res = memcmp(test_data->data, data, sizeof(struct user_data_small)); in compare_data_small()
387 res = memcmp(test_data->data, data, sizeof(struct user_data_large)); in compare_data_large()
398 int remaining = data->small ? SIZE_OF_SMALL_DATA : SIZE_OF_LARGE_DATA; in compare_pkt()
400 if (data->nh_udp) { in compare_pkt()
410 } else if (data->nh_icmp) { in compare_pkt()
438 if (data->nh_udp) { in compare_pkt()
442 } else if (data->nh_icmp) { in compare_pkt()
448 if (data->small) { in compare_pkt()
465 uint8_t bytes, pos; in create_pkt() local
470 net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY)), K_FOREVER); in create_pkt()
477 net_pkt_lladdr_src(pkt)->addr = src_mac; in create_pkt()
478 net_pkt_lladdr_src(pkt)->len = 8U; in create_pkt()
480 net_pkt_lladdr_dst(pkt)->addr = dst_mac; in create_pkt()
481 net_pkt_lladdr_dst(pkt)->len = 8U; in create_pkt()
489 if (data->nh_udp) { in create_pkt()
490 memcpy(frag->data, (uint8_t *) data, NET_IPV6UDPH_LEN); in create_pkt()
492 } else if (data->nh_icmp) { in create_pkt()
493 memcpy(frag->data, (uint8_t *) data, NET_IPV6ICMPH_LEN); in create_pkt()
497 memcpy(frag->data, (uint8_t *) data, NET_IPV6H_LEN); in create_pkt()
502 remaining = data->small ? SIZE_OF_SMALL_DATA : SIZE_OF_LARGE_DATA; in create_pkt()
504 if (data->nh_udp) { in create_pkt()
506 } else if (data->nh_icmp) { in create_pkt()
515 frag->data[4] = len >> 8; in create_pkt()
516 frag->data[5] = (uint8_t) len; in create_pkt()
518 data->ipv6.len = htons(len); in create_pkt()
520 if (data->nh_udp) { in create_pkt()
521 frag->data[44] = len >> 8; in create_pkt()
522 frag->data[45] = (uint8_t) len; in create_pkt()
524 data->nh.udp.len = htons(len); in create_pkt()
530 bytes = net_buf_tailroom(frag); in create_pkt()
531 copy = remaining > bytes ? bytes : remaining; in create_pkt()
535 remaining -= copy; in create_pkt()
537 if (net_buf_tailroom(frag) - (bytes - copy)) { in create_pkt()
565 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
566 (TF_11 + NHC_1 + CID_0 + SAC0_SAM00 + M0_DAC0_DAM00) -
567 UDP_CHKSUM_0 - UDP_P11,
587 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
588 (TF_01 + NHC_1 + CID_0 + SAC0_SAM01 + M0_DAC0_DAM01) -
589 UDP_CHKSUM_0 - UDP_P10,
609 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
610 (TF_01 + NHC_1 + CID_0 + SAC0_SAM10 + M0_DAC0_DAM10) -
611 UDP_CHKSUM_0 - UDP_P01,
631 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
632 (TF_10 + NHC_1 + CID_0 + SAC0_SAM00 + M1_DAC0_DAM00) -
633 UDP_CHKSUM_0 - UDP_P00,
653 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
654 (TF_00 + NHC_1 + CID_0 + SAC0_SAM01 + M1_DAC0_DAM01) -
655 UDP_CHKSUM_0 - UDP_P00,
675 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
676 (TF_11 + NHC_1 + CID_0 + SAC0_SAM10 + M1_DAC0_DAM10) -
677 UDP_CHKSUM_0 - UDP_P00,
693 .hdr_diff = NET_IPV6H_LEN - IPHC_SIZE -
713 .hdr_diff = NET_IPV6H_LEN - IPHC_SIZE -
809 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
810 (TF_01 + NHC_1 + CID_0 + SAC0_SAM11 + M0_DAC0_DAM11) -
811 UDP_CHKSUM_0 - UDP_P01,
827 .hdr_diff = NET_IPV6H_LEN - IPHC_SIZE -
849 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
850 (TF_01 + NHC_1 + CID_1 + SAC1_SAM01 + M0_DAC1_DAM01) -
851 UDP_CHKSUM_0 - UDP_P10,
871 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
872 (TF_01 + NHC_1 + CID_1 + SAC1_SAM10 + M0_DAC1_DAM10) -
873 UDP_CHKSUM_0 - UDP_P01,
893 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
894 (TF_01 + NHC_1 + CID_1 + SAC1_SAM11 + M0_DAC1_DAM11) -
895 UDP_CHKSUM_0 - UDP_P10,
915 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
916 (TF_01 + NHC_1 + CID_1 + SAC0_SAM01 + M0_DAC1_DAM01) -
917 UDP_CHKSUM_0 - UDP_P10,
937 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
938 (TF_01 + NHC_1 + CID_1 + SAC1_SAM01 + M0_DAC0_DAM01) -
939 UDP_CHKSUM_0 - UDP_P10,
959 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
960 (TF_00 + NHC_1 + CID_1 + SAC1_SAM01 + M1_DAC0_DAM00) -
961 UDP_CHKSUM_0 - UDP_P00,
980 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
981 (TF_00 + NHC_1 + CID_1 + SAC1_SAM01 + M1_DAC0_DAM01) -
982 UDP_CHKSUM_0 - UDP_P00,
1002 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
1003 (TF_11 + NHC_1 + CID_1 + SAC1_SAM10 + M1_DAC0_DAM10) -
1004 UDP_CHKSUM_0 - UDP_P00,
1020 .hdr_diff = NET_IPV6H_LEN - IPHC_SIZE -
1041 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
1042 (TF_01 + NHC_1 + CID_1 + SAC0_SAM00 + M0_DAC1_DAM01) -
1043 UDP_CHKSUM_0 - UDP_P10,
1063 .hdr_diff = NET_IPV6UDPH_LEN - IPHC_SIZE - NHC_SIZE -
1064 (TF_11 + NHC_1 + CID_0 + SAC1_SAM00 + M1_DAC0_DAM00) -
1065 UDP_CHKSUM_0 - UDP_P10,
1084 net_pkt_hexdump(pkt, "before-compression"); in test_6lo()
1089 zassert_true((net_6lo_compress(pkt, data->iphc) >= 0), in test_6lo()
1095 net_pkt_hexdump(pkt, "after-compression"); in test_6lo()
1099 zassert_true(diff == data->hdr_diff, "unexpected HDR diff"); in test_6lo()
1106 net_pkt_hexdump(pkt, "after-uncompression"); in test_6lo()
1153 int count; in ZTEST() local
1157 K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)); in ZTEST()
1163 net_6lo_set_context(net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY)), in ZTEST()
1165 net_6lo_set_context(net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY)), in ZTEST()
1169 for (count = 0; count < ARRAY_SIZE(tests); count++) { in ZTEST()
1170 TC_PRINT("Starting %s\n", tests[count].name); in ZTEST()
1172 test_6lo(tests[count].data); in ZTEST()