Lines Matching refs:test_ctx

47 } test_ctx;  variable
67 test_ctx.iface = iface; in server_iface_init()
96 zassert_ok(net_recv_data(test_ctx.iface, reply), "Failed to receive data"); in send_icmp_echo_reply()
108 if (test_ctx.send_echo_reply) { in server_send()
109 test_ctx.send_echo_reply = false; in server_send()
110 memcpy(&test_ctx.declined_ip, ipv4_hdr->dst, in server_send()
118 test_ctx.pkt = pkt; in server_send()
121 k_sem_give(&test_ctx.test_proceed); in server_send()
139 if (test_ctx.pkt != NULL) { in test_pkt_free()
140 net_pkt_unref(test_ctx.pkt); in test_pkt_free()
141 test_ctx.pkt = NULL; in test_pkt_free()
154 pkt = net_pkt_alloc_with_buffer(test_ctx.iface, NET_IPV4_MTU, AF_INET, in client_prepare_test_msg()
170 if (test_ctx.broadcast) { in client_prepare_test_msg()
211 if (test_ctx.client_id) { in client_prepare_test_msg()
213 net_pkt_write_u8(pkt, strlen(test_ctx.client_id)); in client_prepare_test_msg()
214 net_pkt_write(pkt, test_ctx.client_id, strlen(test_ctx.client_id)); in client_prepare_test_msg()
217 if (test_ctx.lease_time != NO_LEASE_TIME) { in client_prepare_test_msg()
220 net_pkt_write_be32(pkt, test_ctx.lease_time); in client_prepare_test_msg()
228 zassert_ok(net_recv_data(test_ctx.iface, pkt), "Failed to receive data"); in client_prepare_test_msg()
240 ret = k_sem_take(&test_ctx.test_proceed, TEST_TIMEOUT); in client_send_discover()
250 NET_DHCPV4_MSG_TYPE_REQUEST, &server_addr, &test_ctx.assigned_ip, in client_send_request_solicit()
254 ret = k_sem_take(&test_ctx.test_proceed, TEST_TIMEOUT); in client_send_request_solicit()
263 &test_ctx.assigned_ip, &server_addr, in client_send_request_renew()
265 &test_ctx.assigned_ip); in client_send_request_renew()
268 ret = k_sem_take(&test_ctx.test_proceed, TEST_TIMEOUT); in client_send_request_renew()
277 &test_ctx.assigned_ip, net_ipv4_broadcast_address(), in client_send_request_rebind()
279 &test_ctx.assigned_ip); in client_send_request_rebind()
282 ret = k_sem_take(&test_ctx.test_proceed, TEST_TIMEOUT); in client_send_request_rebind()
289 &test_ctx.assigned_ip, &server_addr, in client_send_release()
291 &test_ctx.assigned_ip); in client_send_release()
302 &test_ctx.assigned_ip, NULL); in client_send_decline()
317 ret = k_sem_take(&test_ctx.test_proceed, TEST_TIMEOUT); in client_send_inform()
350 ret = net_dhcpv4_server_foreach_lease(test_ctx.iface, lease_count_cb, in test_get_lease_count()
386 ret = net_dhcpv4_server_foreach_lease(test_ctx.iface, in get_reserved_address()
398 get_reserved_address(&test_ctx.assigned_ip); in client_get_lease()
491 struct net_pkt *pkt = test_ctx.pkt; in verify_offer()
554 memcpy(&test_ctx.assigned_ip, msg->yiaddr, sizeof(struct in_addr)); in verify_offer()
570 verify_option(pkt, DHCPV4_OPTIONS_CLIENT_ID, test_ctx.client_id, in verify_offer()
571 strlen(test_ctx.client_id)); in verify_offer()
594 ret = net_dhcpv4_server_foreach_lease(test_ctx.iface, in verify_reserved_address()
608 verify_reserved_address(&test_ctx.assigned_ip); in ZTEST()
622 first_addr = test_ctx.assigned_ip; in ZTEST()
631 zassert_equal(first_addr.s_addr, test_ctx.assigned_ip.s_addr, in ZTEST()
635 test_ctx.client_id = CLIENT_ID_2; in ZTEST()
642 zassert_not_equal(first_addr.s_addr, test_ctx.assigned_ip.s_addr, in ZTEST()
651 test_ctx.broadcast = true; in ZTEST()
665 struct net_pkt *pkt = test_ctx.pkt; in verify_ack()
715 zassert_mem_equal(msg->ciaddr, test_ctx.assigned_ip.s4_addr, in verify_ack()
725 zassert_mem_equal(msg->yiaddr, test_ctx.assigned_ip.s4_addr, in verify_ack()
736 memcpy(&test_ctx.assigned_ip, msg->yiaddr, sizeof(struct in_addr)); in verify_ack()
761 verify_option(pkt, DHCPV4_OPTIONS_CLIENT_ID, test_ctx.client_id, in verify_ack()
762 strlen(test_ctx.client_id)); in verify_ack()
786 ret = net_dhcpv4_server_foreach_lease(test_ctx.iface, in verify_allocated_address()
803 verify_allocated_address(&test_ctx.assigned_ip); in ZTEST()
836 test_ctx.lease_time = 1; in ZTEST()
871 ret = net_dhcpv4_server_foreach_lease(test_ctx.iface, in verify_declined_address()
887 verify_declined_address(&test_ctx.assigned_ip); in ZTEST()
904 oldest_addr = test_ctx.assigned_ip; in ZTEST()
922 zassert_equal(oldest_addr.s_addr, test_ctx.assigned_ip.s_addr, in ZTEST()
941 zassert_equal(test_ctx.declined_ip.s_addr, lease->addr.s_addr, in after_probe_address_cb()
946 zassert_equal(test_ctx.assigned_ip.s_addr, lease->addr.s_addr, in after_probe_address_cb()
955 ret = net_dhcpv4_server_foreach_lease(test_ctx.iface, in verify_address_after_probe()
970 test_ctx.send_echo_reply = true; in ZTEST()
977 zassert_not_equal(test_ctx.assigned_ip.s_addr, in ZTEST()
978 test_ctx.declined_ip.s_addr, in ZTEST()
990 ret = net_dhcpv4_server_start(test_ctx.iface, &base_addr_wrong_subnet); in ZTEST()
993 ret = net_dhcpv4_server_start(test_ctx.iface, &base_addr_overlap); in ZTEST()
996 ret = net_dhcpv4_server_start(test_ctx.iface, &test_base_addr); in ZTEST()
999 net_dhcpv4_server_stop(test_ctx.iface); in ZTEST()
1006 k_sem_init(&test_ctx.test_proceed, 0, 1); in dhcpv4_server_tests_before()
1007 test_ctx.client_id = CLIENT_ID_1; in dhcpv4_server_tests_before()
1008 test_ctx.broadcast = false; in dhcpv4_server_tests_before()
1009 test_ctx.pkt = NULL; in dhcpv4_server_tests_before()
1010 test_ctx.lease_time = NO_LEASE_TIME; in dhcpv4_server_tests_before()
1011 test_ctx.send_echo_reply = false; in dhcpv4_server_tests_before()
1012 memset(&test_ctx.assigned_ip, 0, sizeof(test_ctx.assigned_ip)); in dhcpv4_server_tests_before()
1014 net_dhcpv4_server_start(test_ctx.iface, &test_base_addr); in dhcpv4_server_tests_before()
1023 net_dhcpv4_server_stop(test_ctx.iface); in dhcpv4_server_tests_after()