1 
2 #include "nx_api.h"
3 
4 #ifdef __PRODUCT_NETXDUO__
5 
6 #include "netx_mdns_test.h"
7 /* Frame (76 bytes) */
8 static const unsigned char pkt1[76] = {
9 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
10 0x22, 0x33, 0x44, 0x56, 0x08, 0x00, 0x45, 0x00, /* "3DV..E. */
11 0x00, 0x3e, 0x00, 0x07, 0x40, 0x00, 0xff, 0x11, /* .>..@... */
12 0xd9, 0xc1, 0xc0, 0xa8, 0x00, 0x42, 0xe0, 0x00, /* .....B.. */
13 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x2a, /* .......* */
14 0x2c, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* ,....... */
15 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */
16 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
17 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
18 0x00, 0x0c, 0x00, 0x01                          /* .... */
19 };
20 
21 /* Frame (153 bytes) */
22 static const unsigned char pkt2[153] = {
23 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x1e, /* ..^..... */
24 0x8f, 0xb1, 0x7a, 0xd4, 0x08, 0x00, 0x45, 0x00, /* ..z...E. */
25 0x00, 0x8b, 0x76, 0xbf, 0x00, 0x00, 0xff, 0x11, /* ..v..... */
26 0xa2, 0xfa, 0xc0, 0xa8, 0x00, 0x04, 0xe0, 0x00, /* ........ */
27 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x77, /* .......w */
28 0xe2, 0xa6, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* ........ */
29 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x05, 0x5f, /* ......._ */
30 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
31 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
32 0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, 0x11, 0x94, /* ........ */
33 0x00, 0x0f, 0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, /* ...Canon */
34 0x4d, 0x46, 0x34, 0x35, 0x30, 0x30, 0x77, 0xc0, /* MF4500w. */
35 0x0c, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, /* ..router */
36 0xc0, 0x17, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, /* ........ */
37 0x00, 0x78, 0x00, 0x04, 0xc0, 0xa8, 0x00, 0x04, /* .x...... */
38 0xc0, 0x28, 0x00, 0x21, 0x80, 0x01, 0x00, 0x00, /* .(.!.... */
39 0x00, 0x78, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, /* .x...... */
40 0x00, 0x50, 0xc0, 0x37, 0xc0, 0x28, 0x00, 0x10, /* .P.7.(.. */
41 0x80, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, 0x01, /* ........ */
42 0x00                                            /* . */
43 };
44 
45 /* Frame (135 bytes) */
46 static const unsigned char pkt3[135] = {
47 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
48 0x22, 0x33, 0x44, 0x56, 0x08, 0x00, 0x45, 0x00, /* "3DV..E. */
49 0x00, 0x79, 0x00, 0x08, 0x40, 0x00, 0xff, 0x11, /* .y..@... */
50 0xd9, 0x85, 0xc0, 0xa8, 0x00, 0x42, 0xe0, 0x00, /* .....B.. */
51 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x65, /* .......e */
52 0x31, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 1....... */
53 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */
54 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
55 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
56 0x00, 0x0c, 0x00, 0x01, 0x05, 0x5f, 0x68, 0x74, /* ....._ht */
57 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* tp._tcp. */
58 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, /* local... */
59 0x00, 0x01, 0x00, 0x00, 0x11, 0x93, 0x00, 0x1f, /* ........ */
60 0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x4d, 0x46, /* .CanonMF */
61 0x34, 0x35, 0x30, 0x30, 0x77, 0x05, 0x5f, 0x68, /* 4500w._h */
62 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ttp._tcp */
63 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00        /* .local. */
64 };
65 
66 static MDNS_QUERY_INFO mdns_query = {NX_NULL, "_http._tcp", NX_NULL};
67 
68 MDNS_TEST_SEQ mdns_query_http_tcp[] = {
69     {TITLE, "Query _http._tcp", 16, 0},
70 
71     /* Add a query. */
72     {MDNS_QUERY, (char*)&mdns_query, 0, 0},
73     {MDNS_CHECK_DATA_V4, (char*)&pkt1[0], sizeof(pkt1), 5},
74 
75     /* Set callback for mask 2. */
76     {MDNS_SET_SERVICE_CALLBACK, (UCHAR*)2, NX_MDNS_PEER_SERVICE_RECEIVED, 0},
77 
78     /* Inject a response. */
79     {INJECT, (char*)&pkt2[0], sizeof(pkt2), 0},
80 
81     /* Check query with known answer. */
82     {MDNS_CHECK_DATA_V4, (char*)&pkt3[0], sizeof(pkt3), 5},
83 
84     /* Check callback invoked. */
85     {MDNS_SET_SERVICE_CALLBACK_STATE, NX_NULL, 0, 3},
86 };
87 
88 int mdns_query_http_tcp_size = sizeof(mdns_query_http_tcp) / sizeof(MDNS_TEST_SEQ);
89 
90 #endif /* __PRODUCT_NETXDUO__  */
91 
92