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
|
/***************************************************************************/
/* 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 (75 bytes) */
static const unsigned char pkt1[75] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0xec, 0x17, /* ..^..... */
0x2f, 0xbd, 0xa4, 0xb1, 0x08, 0x00, 0x45, 0x00, /* /.....E. */
0x00, 0x3d, 0x01, 0x81, 0x00, 0x00, 0xff, 0x11, /* .=...... */
0x11, 0x81, 0xc0, 0xa8, 0x07, 0x0a, 0xe0, 0x00, /* ........ */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x29, /* .......) */
0xa9, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* .&...... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x5f, /* ......._ */
0x69, 0x70, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ipp._tcp */
0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
0x0c, 0x00, 0x01 /* ... */
};
/* Frame (110 bytes) */
static const unsigned char pkt2[110] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
0x22, 0x33, 0x44, 0x57, 0x08, 0x00, 0x45, 0x00, /* "3DW..E. */
0x00, 0x60, 0x00, 0x08, 0x40, 0x00, 0xff, 0x11, /* .g..@... */
0x90, 0x47, 0x0a, 0x00, 0x00, 0x42, 0xe0, 0x00, /* [email protected].. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x4c, /* .......S */
0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* .9...... */
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x5f, /* ......._ */
0x69, 0x70, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ipp._tcp */
0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
0x0c, 0x00, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, /* ......d. */
0x1d, 0x0b, 0x41, 0x52, 0x4d, 0x4d, 0x44, 0x4e, /* ..ARMMDN */
0x53, 0x54, 0x65, 0x73, 0x74, 0x04, 0x5f, 0x69, /* STest._i */
0x70, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* pp._tcp. */
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00 /* local... */
};
/* Frame (110 bytes) */
static const unsigned char pkt3[110] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
0x22, 0x33, 0x44, 0x57, 0x08, 0x00, 0x45, 0x00, /* "3DW..E. */
0x00, 0x60, 0x00, 0x08, 0x40, 0x00, 0xff, 0x11, /* .g..@... */
0x90, 0x47, 0x0a, 0x00, 0x00, 0x42, 0xe0, 0x00, /* [email protected].. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x4c, /* .......S */
0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* .9...... */
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x5f, /* ......._ */
0x69, 0x70, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ipp._tcp */
0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
0x0c, 0x00, 0x01, 0x00, 0x00, 0x11, 0x93, 0x00, /* ......d. */
0x1d, 0x0b, 0x41, 0x52, 0x4d, 0x4d, 0x44, 0x4e, /* ..ARMMDN */
0x53, 0x54, 0x65, 0x73, 0x74, 0x04, 0x5f, 0x69, /* STest._i */
0x70, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* pp._tcp. */
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00 /* local... */
};
static MDNS_SERVICE mdns_service = {"ARMMDNSTest", "_ipp._tcp", NX_NULL, NX_NULL, 4500, 0, 0, 80, NX_MDNS_RR_SET_UNIQUE, 0};
MDNS_TEST_SEQ mdns_duplicate_answer_suppression[] = {
{TITLE, "Duplicate answer suppression", 28, 0},
{MDNS_SERVICE_ADD, (char*)&mdns_service, 0, 0},
{WAIT, NX_NULL, 0, 5},
{DUMP, NX_NULL, 0, 0},
/* Inject query. */
{INJECT, (char*)&pkt1[0], sizeof(pkt1), 0},
/* Check response. */
{MDNS_CHECK_ANY_V4, NX_NULL, MDNS_FLAG_RESPONSE, 1},
{WAIT, NX_NULL, 0, 3},
{DUMP, NX_NULL, 0, 0},
/* Inject query and response. */
{INJECT, (char*)&pkt1[0], sizeof(pkt1), 0},
{INJECT, (char*)&pkt2[0], sizeof(pkt2), 0},
/* No response should be received. */
{MDNS_REJECT_ANY_V4, NX_NULL, MDNS_FLAG_RESPONSE, 1},
{WAIT, NX_NULL, 0, 3},
{DUMP, NX_NULL, 0, 0},
/* Inject query and response. The TTL in response is 100 which is less than 101. */
{INJECT, (char*)&pkt1[0], sizeof(pkt1), 0},
{INJECT, (char*)&pkt3[0], sizeof(pkt3), 0},
/* Expect a response. */
{MDNS_CHECK_ANY_V4, NX_NULL, MDNS_FLAG_RESPONSE, 1}
};
int mdns_duplicate_answer_suppression_size = sizeof(mdns_duplicate_answer_suppression) / sizeof(MDNS_TEST_SEQ);
#endif /* __PRODUCT_NETXDUO__ */
|