Lines Matching +full:header +full:- +full:payload
4 * SPDX-License-Identifier: Apache-2.0
51 0x7b, 0x09, /* IPHC Header */
52 0x3a, /* Next Header: ICMPv6 */
109 0x00, 0x00 /* Payload */
132 0x98, 0x49, 0x1f, 0x57, /* Encrypted Payload */
142 .payload_length = 4U /* encrypted payload */ + 16U /* MIC */,
149 /* Construct raw packet payload, length and FCS gets added in the radio driver,
150 * see https://github.com/linux-wpan/wpan-tools/blob/master/examples/af_packet_tx.c
160 0xAA, 0xBB, 0xCC, /* MAC Payload */
176 printk(" -> Packet content:\n"); in pkt_hexdump()
196 printk(" -> IEEE 802.15.4 Address: "); in ieee_addr_hexdump()
198 for (i = 0; i < length-1; i++) { in ieee_addr_hexdump()
211 if (ctx->short_addr == IEEE802154_SHORT_ADDRESS_NOT_ASSOCIATED) { in disassociate()
231 if (ctx->short_addr == short_addr) { in associate()
232 return -EALREADY; in associate()
275 if (ctx->linkaddr.len != IEEE802154_SHORT_ADDR_LENGTH) { in tear_down_short_addr()
295 /* Incoming IEEE 802.15.4 packet with payload header compression. */ in get_data_pkt_with_ar()
303 /* IEEE 802.15.4 MAC Payload */ in get_data_pkt_with_ar()
304 0x7b, 0x39, /* IPHC header, SAM: compressed, DAM: 48-bits inline */ in get_data_pkt_with_ar()
305 0x3a, /* Next header: ICMPv6 */ in get_data_pkt_with_ar()
327 net_buf_add_mem(pkt->frags, data_pkt_with_ar, sizeof(data_pkt_with_ar)); in get_data_pkt_with_ar()
336 uint16_t saved_short_addr = ctx->short_addr; in set_up_security()
372 uint16_t saved_short_addr = ctx->short_addr; in tear_down_security()
428 return -EFAULT; in set_up_recv_socket()
436 NET_INFO("- Parsing packet 0x%p of frame %s", t->pkt, t->name); in test_packet_parsing()
438 if (!ieee802154_validate_frame(t->pkt, t->length, &mpdu)) { in test_packet_parsing()
439 NET_ERR("*** Could not validate frame %s", t->name); in test_packet_parsing()
443 if (mpdu.mhr.fs != t->mhr_check.fc_seq || in test_packet_parsing()
444 mpdu.mhr.dst_addr != t->mhr_check.dst_addr || in test_packet_parsing()
445 mpdu.mhr.src_addr != t->mhr_check.src_addr) { in test_packet_parsing()
446 NET_INFO("d: %p vs %p -- s: %p vs %p", in test_packet_parsing()
447 mpdu.mhr.dst_addr, t->mhr_check.dst_addr, in test_packet_parsing()
448 mpdu.mhr.src_addr, t->mhr_check.src_addr); in test_packet_parsing()
449 NET_ERR("*** Wrong MPDU information on frame %s", t->name); in test_packet_parsing()
454 if (mpdu.mhr.fs->sequence != t->sequence) { in test_packet_parsing()
455 NET_ERR("*** Invalid sequence number for frame %s", t->name); in test_packet_parsing()
459 if (mpdu.payload_length != t->payload_length) { in test_packet_parsing()
460 NET_ERR("*** Invalid payload length for frame %s", t->name); in test_packet_parsing()
473 NET_INFO("- Sending NS packet"); in test_ns_sending()
476 ctx->sequence = t->sequence; in test_ns_sending()
482 if (net_ipv6_send_ns(net_iface, NULL, &t->src, &t->dst, &t->dst, false)) { in test_ns_sending()
493 if (!current_pkt->frags) { in test_ns_sending()
501 if (net_pkt_get_len(current_pkt) != t->length || in test_ns_sending()
502 memcmp(net_pkt_data(current_pkt), t->pkt, t->length)) { in test_ns_sending()
517 net_pkt_frag_unref(current_pkt->frags); in test_ns_sending()
518 current_pkt->frags = NULL; in test_ns_sending()
531 NET_INFO("- Waiting for ACK reply when sending a data packet"); in test_wait_for_ack()
538 ack_required = ieee802154_prepare_for_ack(net_iface, tx_pkt, tx_pkt->frags); in test_wait_for_ack()
556 if (!ieee802154_create_ack_frame(net_iface, one_ack_pkt, mpdu.mhr.fs->sequence)) { in test_wait_for_ack()
588 NET_INFO("- Cloning packet"); in test_packet_cloning_with_cb()
622 NET_INFO("- RSSI conversion between unsigned and signed representation"); in test_packet_rssi_conversion()
653 /* Test setting/getting of signed RSSI (special value - "no RSSI available"). */ in test_packet_rssi_conversion()
659 * two-complements value in uint8_t (explicit cast required). in test_packet_rssi_conversion()
661 raw_signed_rssi_dbm = (uint8_t)-2; in test_packet_rssi_conversion()
664 zassert_equal(net_pkt_ieee802154_rssi_dbm(pkt), -2); in test_packet_rssi_conversion()
669 signed_rssi_dbm = -2; in test_packet_rssi_conversion()
672 zassert_equal(net_pkt_ieee802154_rssi_dbm(pkt), -2); in test_packet_rssi_conversion()
690 uint8_t payload[] = {0x01, 0x02, 0x03, 0x04}; in test_dgram_packet_sending() local
699 NET_INFO("- Sending DGRAM packet via AF_PACKET socket"); in test_dgram_packet_sending()
723 if (zsock_sendto(fd, payload, sizeof(payload), 0, (const struct sockaddr *)&pkt_dst_sll, in test_dgram_packet_sending()
724 sizeof(struct sockaddr_ll)) != sizeof(payload)) { in test_dgram_packet_sending()
732 if (!current_pkt->frags) { in test_dgram_packet_sending()
745 net_pkt_lladdr_src(current_pkt)->addr = net_if_get_link_addr(net_iface)->addr; in test_dgram_packet_sending()
746 net_pkt_lladdr_src(current_pkt)->len = net_if_get_link_addr(net_iface)->len; in test_dgram_packet_sending()
753 if (memcmp(mpdu.payload, payload, sizeof(payload)) != 0) { in test_dgram_packet_sending()
754 NET_ERR("*** Payload of sent packet is incorrect"); in test_dgram_packet_sending()
761 net_pkt_frag_unref(current_pkt->frags); in test_dgram_packet_sending()
762 current_pkt->frags = NULL; in test_dgram_packet_sending()
778 uint8_t payload[] = {0x01, 0x02, 0x03, 0x04}; in test_dgram_packet_reception() local
779 uint16_t our_short_addr = ctx->short_addr; /* CPU byte order */ in test_dgram_packet_reception()
793 sys_memcpy_swap(our_ext_addr, ctx->ext_addr, sizeof(our_ext_addr)); in test_dgram_packet_reception()
799 NET_INFO("- Receiving DGRAM packet via AF_PACKET socket"); in test_dgram_packet_reception()
812 pkt->lladdr_dst.type = NET_LINK_IEEE802154; in test_dgram_packet_reception()
813 pkt->lladdr_dst.addr = is_broadcast ? NULL : our_ext_addr; in test_dgram_packet_reception()
814 pkt->lladdr_dst.len = is_broadcast ? 0 : sizeof(ctx->ext_addr); in test_dgram_packet_reception()
818 pkt->lladdr_src.addr = src_ll_addr; in test_dgram_packet_reception()
823 pkt->lladdr_src.len = src_ll_addr_len; in test_dgram_packet_reception()
836 net_buf_add_mem(frame_buf, payload, sizeof(payload)); in test_dgram_packet_reception()
843 ctx->short_addr = ntohs(*(uint16_t *)src_ll_addr); in test_dgram_packet_reception()
845 sys_memcpy_swap(ctx->ext_addr, src_ll_addr, sizeof(ctx->ext_addr)); in test_dgram_packet_reception()
855 ctx->short_addr = our_short_addr; in test_dgram_packet_reception()
857 sys_memcpy_swap(ctx->ext_addr, our_ext_addr, sizeof(ctx->ext_addr)); in test_dgram_packet_reception()
872 if (current_pkt->frags) { in test_dgram_packet_reception()
874 net_pkt_frag_unref(current_pkt->frags); in test_dgram_packet_reception()
875 current_pkt->frags = NULL; in test_dgram_packet_reception()
889 if (received_len != sizeof(payload) || memcmp(received_payload, payload, sizeof(payload))) { in test_dgram_packet_reception()
890 NET_ERR("*** Payload of received packet is incorrect"); in test_dgram_packet_reception()
925 NET_INFO("- Sending RAW packet via AF_PACKET socket"); in test_raw_packet_sending()
955 if (!current_pkt->frags) { in test_raw_packet_sending()
968 if (memcmp(mpdu.payload, &raw_payload[RAW_MAC_PAYLOAD_START_INDEX], in test_raw_packet_sending()
970 NET_ERR("*** Payload of sent packet is incorrect"); in test_raw_packet_sending()
977 net_pkt_frag_unref(current_pkt->frags); in test_raw_packet_sending()
978 current_pkt->frags = NULL; in test_raw_packet_sending()
996 NET_INFO("- Receiving RAW packet via AF_PACKET socket"); in test_raw_packet_reception()
1023 if (current_pkt->frags) { in test_raw_packet_reception()
1025 net_pkt_frag_unref(current_pkt->frags); in test_raw_packet_reception()
1026 current_pkt->frags = NULL; in test_raw_packet_reception()
1030 /* TODO: For POSIX compliance raw packets should be parsed and a LL header be in test_raw_packet_reception()
1052 NET_ERR("*** Payload of received packet is incorrect"); in test_raw_packet_reception()
1068 /* Expected uncompressed IPv6 payload. */ in test_recv_and_send_ack_reply()
1071 0x00, 0x28, /* Payload Length */ in test_recv_and_send_ack_reply()
1072 0x3a, /* Next header: ICMPv6 */ in test_recv_and_send_ack_reply()
1109 NET_INFO("- Sending ACK reply to a data packet"); in test_recv_and_send_ack_reply()
1149 sys_memcpy_swap(mac_be, ctx->ext_addr, IEEE802154_EXT_ADDR_LENGTH); in test_recv_and_send_ack_reply()
1155 NET_ERR("*** Received socket address does not compare (%d)", -errno); in test_recv_and_send_ack_reply()
1163 NET_ERR("*** Received uncompressed IPv6 payload does not compare"); in test_recv_and_send_ack_reply()
1171 if (!current_pkt->frags) { in test_recv_and_send_ack_reply()
1184 if (memcmp(mpdu.mhr.fs, t->mhr_check.fc_seq, in test_recv_and_send_ack_reply()
1190 if (mpdu.mhr.fs->sequence != t->sequence) { in test_recv_and_send_ack_reply()
1198 net_pkt_frag_unref(current_pkt->frags); in test_recv_and_send_ack_reply()
1199 current_pkt->frags = NULL; in test_recv_and_send_ack_reply()
1244 ieee_addr_hexdump(net_if_get_link_addr(net_iface)->addr, 8); in initialize_test_environment()