/***************************************************************************/ /* 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 (76 bytes) */ static const unsigned char pkt1[76] = { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */ 0x22, 0x33, 0x44, 0x56, 0x08, 0x00, 0x45, 0x00, /* "3DV..E. */ 0x00, 0x3e, 0x00, 0x07, 0x40, 0x00, 0xff, 0x11, /* .>..@... */ 0xd9, 0xc1, 0xc0, 0xa8, 0x00, 0x42, 0xe0, 0x00, /* .....B.. */ 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x2a, /* .......* */ 0x2c, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* ,....... */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */ 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */ 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */ 0x00, 0x0c, 0x00, 0x01 /* .... */ }; /* Frame (153 bytes) */ static const unsigned char pkt2[153] = { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x1e, /* ..^..... */ 0x8f, 0xb1, 0x7a, 0xd4, 0x08, 0x00, 0x45, 0x00, /* ..z...E. */ 0x00, 0x8b, 0x76, 0xbf, 0x00, 0x00, 0xff, 0x11, /* ..v..... */ 0xa2, 0xfa, 0xc0, 0xa8, 0x00, 0x04, 0xe0, 0x00, /* ........ */ 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x77, /* .......w */ 0xe2, 0xa6, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* ........ */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x05, 0x5f, /* ......._ */ 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */ 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */ 0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, 0x11, 0x94, /* ........ */ 0x00, 0x0f, 0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, /* ...Canon */ 0x4d, 0x46, 0x34, 0x35, 0x30, 0x30, 0x77, 0xc0, /* MF4500w. */ 0x0c, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, /* ..router */ 0xc0, 0x17, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, /* ........ */ 0x00, 0x78, 0x00, 0x04, 0xc0, 0xa8, 0x00, 0x04, /* .x...... */ 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 (135 bytes) */ static const unsigned char pkt3[135] = { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */ 0x22, 0x33, 0x44, 0x56, 0x08, 0x00, 0x45, 0x00, /* "3DV..E. */ 0x00, 0x79, 0x00, 0x08, 0x40, 0x00, 0xff, 0x11, /* .y..@... */ 0xd9, 0x85, 0xc0, 0xa8, 0x00, 0x42, 0xe0, 0x00, /* .....B.. */ 0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x65, /* .......e */ 0x31, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 1....... */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */ 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */ 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */ 0x00, 0x0c, 0x00, 0x01, 0x05, 0x5f, 0x68, 0x74, /* ....._ht */ 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* tp._tcp. */ 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, /* local... */ 0x00, 0x01, 0x00, 0x00, 0x11, 0x93, 0x00, 0x1f, /* ........ */ 0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x4d, 0x46, /* .CanonMF */ 0x34, 0x35, 0x30, 0x30, 0x77, 0x05, 0x5f, 0x68, /* 4500w._h */ 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ttp._tcp */ 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00 /* .local. */ }; static MDNS_QUERY_INFO mdns_query = {NX_NULL, "_http._tcp", NX_NULL}; MDNS_TEST_SEQ mdns_query_http_tcp[] = { {TITLE, "Query _http._tcp", 16, 0}, /* Add a query. */ {MDNS_QUERY, (char*)&mdns_query, 0, 0}, {MDNS_CHECK_DATA_V4, (char*)&pkt1[0], sizeof(pkt1), 5}, /* Set callback for mask 2. */ {MDNS_SET_SERVICE_CALLBACK, (UCHAR*)2, NX_MDNS_PEER_SERVICE_RECEIVED, 0}, /* Inject a response. */ {INJECT, (char*)&pkt2[0], sizeof(pkt2), 0}, /* Check query with known answer. */ {MDNS_CHECK_DATA_V4, (char*)&pkt3[0], sizeof(pkt3), 5}, /* Check callback invoked. */ {MDNS_SET_SERVICE_CALLBACK_STATE, NX_NULL, 0, 3}, }; int mdns_query_http_tcp_size = sizeof(mdns_query_http_tcp) / sizeof(MDNS_TEST_SEQ); #endif /* __PRODUCT_NETXDUO__ */