summaryrefslogtreecommitdiff
path: root/test/regression/mdns_test/mdns_response_no_delay_test.c
blob: 8462e0ffa340e670c3c771346a13e04cbac97479 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/***************************************************************************/
/* Copyright (c) 2024 Microsoft Corporation                                */
/* Copyright (c) 2026 Eclipse ThreadX contributors                         */
/*                                                                         */
/* This program and the accompanying materials are made available under    */
/* the terms of the MIT License which is available at                      */
/* https://opensource.org/licenses/MIT.                                    */
/*                                                                         */
/* SPDX-License-Identifier: MIT                                            */
/***************************************************************************/


#include "nx_api.h"

#ifdef __PRODUCT_NETXDUO__

#include "netx_mdns_test.h"

/* Frame (77 bytes) */
static const unsigned char pkt1[77] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x18, 0x03, /* ..^..... */
0x73, 0x29, 0x5f, 0x66, 0x08, 0x00, 0x45, 0x00, /* s)_f..E. */
0x00, 0x3f, 0x48, 0x48, 0x00, 0x00, 0xff, 0x11, /* .?HH.... */
0xd1, 0x57, 0xc0, 0xa8, 0x00, 0x6a, 0xe0, 0x00, /* .W...j.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x2b, /* .......+ */
0x9a, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* .J...... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x41, /* .......A */
0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, /* RMMDNSTe */
0x73, 0x74, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, /* st.local */
0x00, 0x00, 0x01, 0x00, 0x01                    /* ..... */
};

/* Frame (138 bytes) */
static const unsigned char pkt2[138] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
0x22, 0x33, 0x44, 0x57, 0x08, 0x00, 0x45, 0x00, /* "3DW..E. */
0x00, 0x7c, 0x00, 0x07, 0x40, 0x00, 0xff, 0x11, /* .|..@... */
0x90, 0x2c, 0x0a, 0x00, 0x00, 0x42, 0xe0, 0x00, /* .,...B.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x68, /* .......h */
0xb9, 0x74, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* .t...... */
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0b, 0x41, /* .......A */
0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, /* RMMDNSTe */
0x73, 0x74, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, /* st.local */
0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, /* ........ */
0x78, 0x00, 0x04, 0x0a, 0x00, 0x00, 0x42, 0x0b, /* x.....B. */
0x41, 0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, /* ARMMDNST */
0x65, 0x73, 0x74, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* est.loca */
0x6c, 0x00, 0x00, 0x2f, 0x80, 0x01, 0x00, 0x00, /* l../.... */
0x00, 0x78, 0x00, 0x16, 0x0b, 0x41, 0x52, 0x4d, /* .x...ARM */
0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, /* MDNSTest */
0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
0x01, 0x40                                      /* .@ */
};

MDNS_TEST_SEQ mdns_response_no_delay[] = {
    {TITLE, "Response no delay", 17, 0},
    {WAIT, NX_NULL, 0, 5},
    {DUMP, NX_NULL, 0, 0},

    /* Inject a query. */
    {INJECT, (char*)&pkt1[0], sizeof(pkt1), 0},

    /* Reset timer. */
    {MDNS_TIMER_RESET, NX_NULL, 0, 0},

    /* Check the response. */
    {MDNS_CHECK_DATA_V4, (char*)&pkt2[0], sizeof(pkt2), 1},

    /* Check timer in range 0~10ms. Resonable error is 30ms. */
    {MDNS_TIMER_MAX_CHECK, NX_NULL, 0, 1 + 3},
};

int mdns_response_no_delay_size = sizeof(mdns_response_no_delay) / sizeof(MDNS_TEST_SEQ);

#endif /* __PRODUCT_NETXDUO__  */