summaryrefslogtreecommitdiff
path: root/test/regression/mdns_test/mdns_basic_ipv6_query_test.c
blob: 05a2b1b6dfed8378cffdc241863baf3029df7a6c (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/***************************************************************************/
/* 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 (96 bytes) */
static const unsigned char pkt1[96] = {
0x33, 0x33, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x11, /* 33...... */
0x22, 0x33, 0x44, 0x56, 0x86, 0xdd, 0x60, 0x00, /* "3DV..`. */
0x00, 0x00, 0x00, 0x2a, 0x11, 0xff, 0xfe, 0x80, /* ...*.... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, /* ........ */
0x22, 0xff, 0xfe, 0x33, 0x44, 0x56, 0xff, 0x02, /* "..3DV.. */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0xfb, 0x14, 0xe9, /* ........ */
0x14, 0xe9, 0x00, 0x2a, 0x68, 0xc4, 0x00, 0x00, /* ...*h... */
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, /* ..._http */
0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, /* ._tcp.lo */
0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01  /* cal..... */
};

/* Frame (185 bytes) */
static const unsigned char pkt2[185] = {
0x33, 0x33, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x1e, /* 33...... */
0x8f, 0xb1, 0x7a, 0xd4, 0x86, 0xdd, 0x60, 0x00, /* ..z...`. */
0x00, 0x00, 0x00, 0x83, 0x11, 0x40, 0xfe, 0x80, /* .....@.. */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1e, /* ........ */
0x8f, 0xff, 0xfe, 0xb1, 0x7a, 0xd4, 0xff, 0x02, /* ....z... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0xfb, 0x14, 0xe9, /* ........ */
0x14, 0xe9, 0x00, 0x83, 0x30, 0x75, 0x00, 0x00, /* ....0u.. */
0x84, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, /* ........ */
0x00, 0x03, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, /* ..._http */
0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, /* ._tcp.lo */
0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01, /* cal..... */
0x00, 0x00, 0x11, 0x94, 0x00, 0x0f, 0x0c, 0x43, /* .......C */
0x61, 0x6e, 0x6f, 0x6e, 0x4d, 0x46, 0x34, 0x35, /* anonMF45 */
0x30, 0x30, 0x77, 0xc0, 0x0c, 0x06, 0x72, 0x6f, /* 00w...ro */
0x75, 0x74, 0x65, 0x72, 0xc0, 0x17, 0x00, 0x1c, /* uter.... */
0x80, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x10, /* .....x.. */
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x02, 0x1e, 0x8f, 0xff, 0xfe, 0xb1, 0x7a, 0xd4, /* ......z. */
0xc0, 0x28, 0x00, 0x21, 0x80, 0x01, 0x00, 0x00, /* .(.!.... */
0x00, 0x78, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, /* .x...... */
0x00, 0x50, 0xc0, 0x37, 0xc0, 0x28, 0x00, 0x10, /* .P.7.(.. */
0x80, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, 0x01, /* ........ */
0x00                                            /* . */
};

/* Frame (155 bytes) */
static const unsigned char pkt3[155] = {
0x33, 0x33, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x11, /* 33...... */
0x22, 0x33, 0x44, 0x56, 0x86, 0xdd, 0x60, 0x00, /* "3DV..`. */
0x00, 0x00, 0x00, 0x65, 0x11, 0xff, 0xfe, 0x80, /* ...e.... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, /* ........ */
0x22, 0xff, 0xfe, 0x33, 0x44, 0x56, 0xff, 0x02, /* "..3DV.. */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0xfb, 0x14, 0xe9, /* ........ */
0x14, 0xe9, 0x00, 0x65, 0x6c, 0xde, 0x00, 0x00, /* ...el... */
0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, /* ..._http */
0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, /* ._tcp.lo */
0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01, /* cal..... */
0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, /* ._http._ */
0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */
0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, /* l....... */
0x11, 0x93, 0x00, 0x1f, 0x0c, 0x43, 0x61, 0x6e, /* .....Can */
0x6f, 0x6e, 0x4d, 0x46, 0x34, 0x35, 0x30, 0x30, /* onMF4500 */
0x77, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, /* w._http. */
0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, /* _tcp.loc */
0x61, 0x6c, 0x00                                /* al. */
};

static MDNS_QUERY_INFO mdns_query = {NX_NULL, "_http._tcp", NX_NULL};

MDNS_TEST_SEQ mdns_basic_ipv6_query[] = {
    {TITLE, "Basic IPv6 query", 16, 0},

    /* Add link local address. */
    {MDNS_LLA_ADD, NX_NULL, 0x00000011, 0x22334456},
    {WAIT, NX_NULL, 0, 5},

    /* Recreate mDNS. */
    {MDNS_RECREATE, "ARMMDNSTest-0", 0, 0},

    /* Add query. */
    {MDNS_QUERY, (char*)&mdns_query, 0, 0},

    /* Check query. */
    {MDNS_CHECK_DATA_V6, (char*)&pkt1[0], sizeof(pkt1), 3},

    /* Inject response. */
    {INJECT, (char*)&pkt2[0], sizeof(pkt2), 0},

    /* Check query with known-answer. */
    {MDNS_CHECK_DATA_V6, (char*)&pkt3[0], sizeof(pkt3), 3},

    /* Delete link local address. */
    {MDNS_LLA_DELETE, NX_NULL, 0, 0},
};

int mdns_basic_ipv6_query_size = sizeof(mdns_basic_ipv6_query) / sizeof(MDNS_TEST_SEQ);

#endif /* __PRODUCT_NETXDUO__  */