1 
2 #include "nx_api.h"
3 
4 #ifdef __PRODUCT_NETXDUO__
5 
6 #include "netx_mdns_test.h"
7 
8 /* Frame (140 bytes) */
9 static const unsigned char pkt1[140] = {
10 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0xec, 0x17, /* ..^..... */
11 0x2f, 0xbd, 0xa4, 0xb1, 0x08, 0x00, 0x45, 0x00, /* /.....E. */
12 0x00, 0x7e, 0x01, 0x4c, 0x00, 0x00, 0xff, 0x11, /* .~.L.... */
13 0x11, 0x75, 0xc0, 0xa8, 0x07, 0x0a, 0xe0, 0x00, /* .u...... */
14 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x6a, /* .......j */
15 0x06, 0xdb, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* ........ */
16 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x08, 0x43, /* .......C */
17 0x61, 0x74, 0x72, 0x6f, 0x2d, 0x50, 0x43, 0x05, /* atro-PC. */
18 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x01, /* local... */
19 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x04, /* .....x.. */
20 0xc0, 0xa8, 0x07, 0x0a, 0x02, 0x31, 0x30, 0x01, /* .....10. */
21 0x37, 0x03, 0x31, 0x36, 0x38, 0x03, 0x31, 0x39, /* 7.168.19 */
22 0x32, 0x07, 0x69, 0x6e, 0x2d, 0x61, 0x64, 0x64, /* 2.in-add */
23 0x72, 0x04, 0x61, 0x72, 0x70, 0x61, 0x00, 0x00, /* r.arpa.. */
24 0x0c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, /* ......x. */
25 0x02, 0xc0, 0x0c, 0xc0, 0x0c, 0x00, 0x2f, 0x80, /* ....../. */
26 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x05, 0xc0, /* ....x... */
27 0x0c, 0x00, 0x01, 0x40                          /* ...@ */
28 };
29 
30 /* Frame (79 bytes) */
31 static const unsigned char pkt2[79] = {
32 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0xec, 0x17, /* ..^..... */
33 0x2f, 0xbd, 0xa4, 0xb1, 0x08, 0x00, 0x45, 0x00, /* /.....E. */
34 0x00, 0x41, 0x01, 0x4d, 0x00, 0x00, 0xff, 0x11, /* .A.M.... */
35 0x11, 0xb1, 0xc0, 0xa8, 0x07, 0x0a, 0xe0, 0x00, /* ........ */
36 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x2d, /* .......- */
37 0xbe, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* .H...... */
38 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x5f, /* ......._ */
39 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x04, /* printer. */
40 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, /* _tcp.loc */
41 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01        /* al..... */
42 };
43 
44 /* Frame (79 bytes) */
45 static const unsigned char pkt3[79] = {
46 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0xec, 0x17, /* ..^..... */
47 0x2f, 0xbd, 0xa4, 0xb1, 0x08, 0x00, 0x45, 0x00, /* /.....E. */
48 0x00, 0x41, 0x01, 0x4e, 0x00, 0x00, 0xff, 0x11, /* .A.N.... */
49 0x11, 0xb0, 0xc0, 0xa8, 0x07, 0x0a, 0xe0, 0x00, /* ........ */
50 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x2d, /* .......- */
51 0xbe, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* .H...... */
52 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x5f, /* ......._ */
53 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x04, /* printer. */
54 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, /* _tcp.loc */
55 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01        /* al..... */
56 };
57 
58 /* Frame (75 bytes) */
59 static const unsigned char pkt4[75] = {
60 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0xec, 0x17, /* ..^..... */
61 0x2f, 0xbd, 0xa4, 0xb1, 0x08, 0x00, 0x45, 0x00, /* /.....E. */
62 0x00, 0x3d, 0x01, 0x4f, 0x00, 0x00, 0xff, 0x11, /* .=.O.... */
63 0x11, 0xb3, 0xc0, 0xa8, 0x07, 0x0a, 0xe0, 0x00, /* ........ */
64 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x29, /* .......) */
65 0xa9, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* .&...... */
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x5f, /* ......._ */
67 0x69, 0x70, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ipp._tcp */
68 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
69 0x0c, 0x00, 0x01                                /* ... */
70 };
71 
72 /* Frame (632 bytes) */
73 static const unsigned char pkt5[632] = {
74 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
75 0x22, 0x33, 0x44, 0x57, 0x08, 0x00, 0x45, 0x00, /* "3DW..E. */
76 0x02, 0x6a, 0x00, 0x07, 0x40, 0x00, 0xff, 0x11, /* .j..@... */
77 0x8e, 0x3e, 0x0a, 0x00, 0x00, 0x42, 0xe0, 0x00, /* .>...B.. */
78 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x02, 0x56, /* .......V */
79 0x66, 0x0b, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* f....... */
80 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x08, 0x5f, /* ......._ */
81 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x04, /* printer. */
82 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, /* _tcp.loc */
83 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01, 0x00, /* al...... */
84 0x00, 0x00, 0x64, 0x00, 0x21, 0x0b, 0x41, 0x52, /* ..d.!.AR */
85 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, /* MMDNSTes */
86 0x74, 0x08, 0x5f, 0x70, 0x72, 0x69, 0x6e, 0x74, /* t._print */
87 0x65, 0x72, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* er._tcp. */
88 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x04, 0x5f, /* local.._ */
89 0x69, 0x70, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ipp._tcp */
90 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
91 0x0c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, /* ......d. */
92 0x1d, 0x0b, 0x41, 0x52, 0x4d, 0x4d, 0x44, 0x4e, /* ..ARMMDN */
93 0x53, 0x54, 0x65, 0x73, 0x74, 0x04, 0x5f, 0x69, /* STest._i */
94 0x70, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* pp._tcp. */
95 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x0b, 0x41, /* local..A */
96 0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, /* RMMDNSTe */
97 0x73, 0x74, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, /* st.local */
98 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, /* ........ */
99 0x78, 0x00, 0x04, 0x0a, 0x00, 0x00, 0x42, 0x0b, /* x.....B. */
100 0x41, 0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, /* ARMMDNST */
101 0x65, 0x73, 0x74, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* est.loca */
102 0x6c, 0x00, 0x00, 0x2f, 0x80, 0x01, 0x00, 0x00, /* l../.... */
103 0x00, 0x78, 0x00, 0x16, 0x0b, 0x41, 0x52, 0x4d, /* .x...ARM */
104 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, /* MDNSTest */
105 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
106 0x01, 0x40, 0x0b, 0x41, 0x52, 0x4d, 0x4d, 0x44, /* .@.ARMMD */
107 0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, 0x08, 0x5f, /* NSTest._ */
108 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x04, /* printer. */
109 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, /* _tcp.loc */
110 0x61, 0x6c, 0x00, 0x00, 0x21, 0x80, 0x01, 0x00, /* al..!... */
111 0x00, 0x00, 0x64, 0x00, 0x19, 0x00, 0x00, 0x00, /* ..d..... */
112 0x00, 0x00, 0x50, 0x0b, 0x41, 0x52, 0x4d, 0x4d, /* ..P.ARMM */
113 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, 0x05, /* DNSTest. */
114 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x0b, 0x41, /* local..A */
115 0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, /* RMMDNSTe */
116 0x73, 0x74, 0x08, 0x5f, 0x70, 0x72, 0x69, 0x6e, /* st._prin */
117 0x74, 0x65, 0x72, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ter._tcp */
118 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
119 0x10, 0x80, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, /* ......d. */
120 0x01, 0x00, 0x0b, 0x41, 0x52, 0x4d, 0x4d, 0x44, /* ...ARMMD */
121 0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, 0x08, 0x5f, /* NSTest._ */
122 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x04, /* printer. */
123 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, /* _tcp.loc */
124 0x61, 0x6c, 0x00, 0x00, 0x2f, 0x80, 0x01, 0x00, /* al../... */
125 0x00, 0x00, 0x78, 0x00, 0x28, 0x0b, 0x41, 0x52, /* ..x.(.AR */
126 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, /* MMDNSTes */
127 0x74, 0x08, 0x5f, 0x70, 0x72, 0x69, 0x6e, 0x74, /* t._print */
128 0x65, 0x72, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* er._tcp. */
129 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x05, /* local... */
130 0x00, 0x00, 0x80, 0x00, 0x40, 0x0b, 0x41, 0x52, /* ....@.AR */
131 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, /* MMDNSTes */
132 0x74, 0x04, 0x5f, 0x69, 0x70, 0x70, 0x04, 0x5f, /* t._ipp._ */
133 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */
134 0x6c, 0x00, 0x00, 0x21, 0x80, 0x01, 0x00, 0x00, /* l..!.... */
135 0x00, 0x64, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, /* .d...... */
136 0x00, 0x50, 0x0b, 0x41, 0x52, 0x4d, 0x4d, 0x44, /* .P.ARMMD */
137 0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, 0x05, 0x6c, /* NSTest.l */
138 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x0b, 0x41, 0x52, /* ocal..AR */
139 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, /* MMDNSTes */
140 0x74, 0x04, 0x5f, 0x69, 0x70, 0x70, 0x04, 0x5f, /* t._ipp._ */
141 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */
142 0x6c, 0x00, 0x00, 0x10, 0x80, 0x01, 0x00, 0x00, /* l....... */
143 0x00, 0x64, 0x00, 0x01, 0x00, 0x0b, 0x41, 0x52, /* .d....AR */
144 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, /* MMDNSTes */
145 0x74, 0x04, 0x5f, 0x69, 0x70, 0x70, 0x04, 0x5f, /* t._ipp._ */
146 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */
147 0x6c, 0x00, 0x00, 0x2f, 0x80, 0x01, 0x00, 0x00, /* l../.... */
148 0x00, 0x78, 0x00, 0x24, 0x0b, 0x41, 0x52, 0x4d, /* .x.$.ARM */
149 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, /* MDNSTest */
150 0x04, 0x5f, 0x69, 0x70, 0x70, 0x04, 0x5f, 0x74, /* ._ipp._t */
151 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, /* cp.local */
152 0x00, 0x00, 0x05, 0x00, 0x00, 0x80, 0x00, 0x40  /* .......@ */
153 };
154 
155 /* Frame (101 bytes) */
156 static const unsigned char pkt6[101] = {
157 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0xec, 0x17, /* ..^..... */
158 0x2f, 0xbd, 0xa4, 0xb1, 0x08, 0x00, 0x45, 0x00, /* /.....E. */
159 0x00, 0x57, 0x01, 0x50, 0x00, 0x00, 0xff, 0x11, /* .W.P.... */
160 0x11, 0x98, 0xc0, 0xa8, 0x07, 0x0a, 0xe0, 0x00, /* ........ */
161 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x43, /* .......C */
162 0x10, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* ........ */
163 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x5f, /* ......._ */
164 0x69, 0x70, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ipp._tcp */
165 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
166 0x0c, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x0c, 0x00, /* ........ */
167 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x0e, 0x0b, /* ....d... */
168 0x41, 0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, /* ARMMDNST */
169 0x65, 0x73, 0x74, 0xc0, 0x0c                    /* est.. */
170 };
171 
172 /* Frame (105 bytes) */
173 static const unsigned char pkt7[105] = {
174 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0xec, 0x17, /* ..^..... */
175 0x2f, 0xbd, 0xa4, 0xb1, 0x08, 0x00, 0x45, 0x00, /* /.....E. */
176 0x00, 0x5b, 0x01, 0x51, 0x00, 0x00, 0xff, 0x11, /* .[.Q.... */
177 0x11, 0x93, 0xc0, 0xa8, 0x07, 0x0a, 0xe0, 0x00, /* ........ */
178 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x47, /* .......G */
179 0x26, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* &....... */
180 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x5f, /* ......._ */
181 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x04, /* printer. */
182 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, /* _tcp.loc */
183 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01, 0xc0, /* al...... */
184 0x0c, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, 0x00, /* ........ */
185 0x63, 0x00, 0x0e, 0x0b, 0x41, 0x52, 0x4d, 0x4d, /* c...ARMM */
186 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, 0xc0, /* DNSTest. */
187 0x0c                                            /* . */
188 };
189 
190 static MDNS_SERVICE mdns_service_0 = {"ARMMDNSTest", "_printer._tcp", NX_NULL, NX_NULL, 100, 0, 0, 80, NX_MDNS_RR_SET_UNIQUE, 0};
191 static MDNS_SERVICE mdns_service_1 = {"ARMMDNSTest", "_ipp._tcp", NX_NULL, NX_NULL, 100, 0, 0, 80, NX_MDNS_RR_SET_UNIQUE, 0};
192 
193 
194 MDNS_TEST_SEQ mdns_response_aggregation[] = {
195     {TITLE, "Response aggregation", 20, 0},
196     {MDNS_SERVICE_ADD, (char*)&mdns_service_0, 0, 0},
197     {MDNS_SERVICE_ADD, (char*)&mdns_service_1, 0, 0},
198     {WAIT, NX_NULL, 0, 5},
199     {DUMP, NX_NULL, 0, 0},
200 
201     /* Inject two queries. */
202     {INJECT, (char*)&pkt3[0], sizeof(pkt3), 0},
203 
204     /* Sleep 10ms. */
205     {MDNS_WAIT_TICK, NX_NULL, 0, 1},
206 
207     {INJECT, (char*)&pkt4[0], sizeof(pkt4), 0},
208 
209     /* Check response. */
210     {MDNS_CHECK_DATA_V4, (char*)&pkt5[0], sizeof(pkt5), 2},
211 };
212 
213 int mdns_response_aggregation_size = sizeof(mdns_response_aggregation) / sizeof(MDNS_TEST_SEQ);
214 
215 #endif /* __PRODUCT_NETXDUO__  */
216 
217