1 2 #include "nx_api.h" 3 4 #ifdef __PRODUCT_NETXDUO__ 5 6 #include "netx_mdns_test.h" 7 8 /* Frame (90 bytes) */ 9 static const unsigned char pkt1[90] = { 10 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */ 11 0x22, 0x33, 0x44, 0x57, 0x08, 0x00, 0x45, 0x00, /* "3DW..E. */ 12 0x00, 0x4c, 0x00, 0x07, 0x40, 0x00, 0xff, 0x11, /* .L..@... */ 13 0x90, 0x5c, 0x0a, 0x00, 0x00, 0x42, 0xe0, 0x00, /* .\...B.. */ 14 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x38, /* .......8 */ 15 0x46, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* F....... */ 16 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x5f, /* ......._ */ 17 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x04, /* printer. */ 18 0x5f, 0x73, 0x75, 0x62, 0x05, 0x5f, 0x68, 0x74, /* _sub._ht */ 19 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* tp._tcp. */ 20 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, /* local... */ 21 0x00, 0x01 /* .. */ 22 }; 23 24 /* Frame (199 bytes) */ 25 static const unsigned char pkt2[199] = { 26 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0xec, 0x17, /* ..^..... */ 27 0x2f, 0xbd, 0xa4, 0xb1, 0x08, 0x00, 0x45, 0x00, /* /.....E. */ 28 0x00, 0xb9, 0x1d, 0xbb, 0x00, 0x00, 0xff, 0x11, /* ........ */ 29 0xf4, 0xca, 0xc0, 0xa8, 0x07, 0x0a, 0xe0, 0x00, /* ........ */ 30 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0xa5, /* ........ */ 31 0x3b, 0x23, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* ;#...... */ 32 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x08, 0x5f, /* ......._ */ 33 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x04, /* printer. */ 34 0x5f, 0x73, 0x75, 0x62, 0x05, 0x5f, 0x68, 0x74, /* _sub._ht */ 35 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* tp._tcp. */ 36 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, /* local... */ 37 0x00, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, 0x07, /* ........ */ 38 0x04, 0x74, 0x65, 0x73, 0x74, 0xc0, 0x1a, 0x08, /* .test... */ 39 0x43, 0x61, 0x74, 0x72, 0x6f, 0x2d, 0x50, 0x43, /* Catro-PC */ 40 0xc0, 0x25, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, /* .%...... */ 41 0x00, 0x78, 0x00, 0x04, 0xc0, 0xa8, 0x07, 0x0a, /* .x...... */ 42 0xc0, 0x36, 0x00, 0x21, 0x80, 0x01, 0x00, 0x00, /* .6.!.... */ 43 0x00, 0x78, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, /* .x...... */ 44 0x00, 0x50, 0xc0, 0x3d, 0xc0, 0x36, 0x00, 0x10, /* .P.=.6.. */ 45 0x80, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, 0x01, /* ........ */ 46 0x00, 0xc0, 0x3d, 0x00, 0x2f, 0x80, 0x01, 0x00, /* ..=./... */ 47 0x00, 0x00, 0x78, 0x00, 0x05, 0xc0, 0x3d, 0x00, /* ..x...=. */ 48 0x01, 0x40, 0xc0, 0x36, 0x00, 0x2f, 0x80, 0x01, /* .@.6./.. */ 49 0x00, 0x00, 0x00, 0x78, 0x00, 0x09, 0xc0, 0x36, /* ...x...6 */ 50 0x00, 0x05, 0x00, 0x00, 0x80, 0x00, 0x40 /* ......@ */ 51 }; 52 53 /* Frame (155 bytes) */ 54 static const unsigned char pkt3[155] = { 55 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */ 56 0x22, 0x33, 0x44, 0x57, 0x08, 0x00, 0x45, 0x00, /* "3DW..E. */ 57 0x00, 0x8d, 0x00, 0x08, 0x40, 0x00, 0xff, 0x11, /* ....@... */ 58 0x90, 0x1a, 0x0a, 0x00, 0x00, 0x42, 0xe0, 0x00, /* .....B.. */ 59 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x79, /* .......y */ 60 0xd4, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* .~...... */ 61 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x5f, /* ......._ */ 62 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x04, /* printer. */ 63 0x5f, 0x73, 0x75, 0x62, 0x05, 0x5f, 0x68, 0x74, /* _sub._ht */ 64 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* tp._tcp. */ 65 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, /* local... */ 66 0x00, 0x01, 0x08, 0x5f, 0x70, 0x72, 0x69, 0x6e, /* ..._prin */ 67 0x74, 0x65, 0x72, 0x04, 0x5f, 0x73, 0x75, 0x62, /* ter._sub */ 68 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, /* ._http._ */ 69 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */ 70 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, /* l....... */ 71 0x11, 0x93, 0x00, 0x17, 0x04, 0x74, 0x65, 0x73, /* .....tes */ 72 0x74, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, /* t._http. */ 73 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, /* _tcp.loc */ 74 0x61, 0x6c, 0x00 /* al. */ 75 }; 76 77 /* Frame (81 bytes) */ 78 static const unsigned char pkt4[81] = { 79 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */ 80 0x22, 0x33, 0x44, 0x57, 0x08, 0x00, 0x45, 0x00, /* "3DW..E. */ 81 0x00, 0x43, 0x00, 0x09, 0x40, 0x00, 0xff, 0x11, /* .C..@... */ 82 0x90, 0x63, 0x0a, 0x00, 0x00, 0x42, 0xe0, 0x00, /* .c...B.. */ 83 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x2f, /* ......./ */ 84 0x2f, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* /....... */ 85 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x74, /* .......t */ 86 0x65, 0x73, 0x74, 0x05, 0x5f, 0x68, 0x74, 0x74, /* est._htt */ 87 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, /* p._tcp.l */ 88 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0xff, 0x00, /* ocal.... */ 89 0x01 /* . */ 90 }; 91 92 /* Frame (171 bytes) */ 93 static const unsigned char pkt5[171] = { 94 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0xec, 0x17, /* ..^..... */ 95 0x2f, 0xbd, 0xa4, 0xb1, 0x08, 0x00, 0x45, 0x00, /* /.....E. */ 96 0x00, 0x9d, 0x1d, 0xbc, 0x00, 0x00, 0xff, 0x11, /* ........ */ 97 0xf4, 0xe5, 0xc0, 0xa8, 0x07, 0x0a, 0xe0, 0x00, /* ........ */ 98 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x89, /* ........ */ 99 0x2c, 0xb0, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* ,....... */ 100 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x04, 0x74, /* .......t */ 101 0x65, 0x73, 0x74, 0x05, 0x5f, 0x68, 0x74, 0x74, /* est._htt */ 102 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, /* p._tcp.l */ 103 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x21, 0x80, /* ocal..!. */ 104 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x11, 0x00, /* ....x... */ 105 0x00, 0x00, 0x00, 0x00, 0x50, 0x08, 0x43, 0x61, /* ....P.Ca */ 106 0x74, 0x72, 0x6f, 0x2d, 0x50, 0x43, 0xc0, 0x1c, /* tro-PC.. */ 107 0xc0, 0x0c, 0x00, 0x10, 0x80, 0x01, 0x00, 0x00, /* ........ */ 108 0x11, 0x94, 0x00, 0x01, 0x00, 0xc0, 0x33, 0x00, /* ......3. */ 109 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, /* ......x. */ 110 0x04, 0xc0, 0xa8, 0x07, 0x0a, 0xc0, 0x33, 0x00, /* ......3. */ 111 0x2f, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, /* /.....x. */ 112 0x05, 0xc0, 0x33, 0x00, 0x01, 0x40, 0xc0, 0x0c, /* ..3..@.. */ 113 0x00, 0x2f, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, /* ./.....x */ 114 0x00, 0x09, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x00, /* ........ */ 115 0x80, 0x00, 0x40 /* ..@ */ 116 }; 117 118 static MDNS_QUERY_INFO mdns_query_0 = {"test", "_http._tcp", NX_NULL}; 119 static MDNS_QUERY_INFO mdns_query_1 = {NX_NULL, "_http._tcp", "_printer"}; 120 121 MDNS_TEST_SEQ mdns_query_start_stop[] = { 122 {TITLE, "Query start and stop", 20, 0}, 123 {WAIT, NX_NULL, 0, 5}, 124 {DUMP, NX_NULL, 0, 0}, 125 126 /* Add a query*/ 127 {MDNS_QUERY, (char*)&mdns_query_0, 0, 0}, 128 129 /* Check the query packet. */ 130 {MDNS_CHECK_DATA_V4, (char*)&pkt4[0], sizeof(pkt4), 5}, 131 132 /* Delete the query. */ 133 {MDNS_QUERY_DELETE, NX_NULL, 0, 0}, 134 135 /* Reject any queries. */ 136 {MDNS_REJECT_ANY_V4, NX_NULL, MDNS_FLAG_QUERY, 5}, 137 138 /* Add a query*/ 139 {MDNS_QUERY, (char*)&mdns_query_0, 0, 0}, 140 141 /* Check the query packet. */ 142 {MDNS_CHECK_DATA_V4, (char*)&pkt4[0], sizeof(pkt4), 5}, 143 144 /* Inject a response. */ 145 {INJECT, (char*)&pkt5[0], sizeof(pkt5), 0}, 146 147 /* Reject any queries. */ 148 {MDNS_REJECT_ANY_V4, NX_NULL, MDNS_FLAG_QUERY, 5}, 149 150 /* Delete the query. */ 151 {MDNS_QUERY_DELETE, NX_NULL, 0, 0}, 152 153 154 /* Add a query*/ 155 {MDNS_QUERY, (char*)&mdns_query_1, 0, 0}, 156 157 /* Check the query packet. */ 158 {MDNS_CHECK_DATA_V4, (char*)&pkt1[0], sizeof(pkt1), 5}, 159 160 /* Delete the query. */ 161 {MDNS_QUERY_DELETE, NX_NULL, 0, 0}, 162 163 /* Reject any queries. */ 164 {MDNS_REJECT_ANY_V4, NX_NULL, MDNS_FLAG_QUERY, 5}, 165 166 /* Add a query*/ 167 {MDNS_QUERY, (char*)&mdns_query_1, 0, 0}, 168 169 /* Check the query packet. */ 170 {MDNS_CHECK_DATA_V4, (char*)&pkt1[0], sizeof(pkt1), 5}, 171 172 /* Inject a response. */ 173 {INJECT, (char*)&pkt2[0], sizeof(pkt2), 0}, 174 175 /* Check the query packet with known answer. */ 176 {MDNS_CHECK_DATA_V4, (char*)&pkt3[0], sizeof(pkt3), 5}, 177 178 /* Delete the query. */ 179 {MDNS_QUERY_DELETE, NX_NULL, 0, 0}, 180 181 /* Reject any queries. */ 182 {MDNS_REJECT_ANY_V4, NX_NULL, MDNS_FLAG_QUERY, 5}, 183 184 }; 185 186 int mdns_query_start_stop_size = sizeof(mdns_query_start_stop) / sizeof(MDNS_TEST_SEQ); 187 188 #endif /* __PRODUCT_NETXDUO__ */ 189 190