1 #ifndef _NETX_MDNS_TEST_H_ 2 #define _NETX_MDNS_TEST_H_ 3 4 5 #include "tx_api.h" 6 #include "nx_api.h" 7 8 #ifdef __PRODUCT_NETXDUO__ 9 #include "nxd_mdns.h" 10 11 #ifndef NX_MDNS_RR_SET_UNIQUE 12 #define NX_MDNS_RR_SET_UNIQUE 0 13 #endif 14 15 /* Define the test command. */ 16 /* basic command. */ 17 #define TITLE 1 /* This entry contains the name of the test. */ 18 #define INJECT 2 /* This entry contains packet that needs to be injected into the system.*/ 19 #define CHECK 3 /* This entry contains packet that needs to be matched. */ 20 #define WAIT 4 /* This entry is to place a wait. */ 21 #define DUMP 5 /* This entry flushes the incoming packet queue. */ 22 #define CLEANUP 6 /* This is a marker, indicating the beginning sequeuence of cleanup procedure. */ 23 #define N_CHECK 7 /* This entry contains packet that do not want to be received. */ 24 25 #ifdef NX_IPSEC_ENABLE 26 #define D_CHECK 8 /* This entry contains packet that needs to be matched after decryption. */ 27 #define ASSEMBLE 9 /* This entry contains packet that needs to be assembled. */ 28 #define AD_CHECK 10 /* This entry contains packet that needs to be assembled and be matched after decryption. */ 29 #define TD_CHECK 11 /* This entry contains packet that needs to be matched after decryption which is tunneled. */ 30 #endif 31 32 #define NS 12 /* NS packet. */ 33 #define NA 13 /* NA packet. */ 34 #define RS 14 /* RS packet. */ 35 #define ER 15 /* ECHO REPLY packet. */ 36 #define CLEAN_HOP_LIMIT 16 /* This is a marker, indicating the hop limit should be initial to 0xff. */ 37 #define NS_UNSPEC 17 /* This is a marker, indicating the NS is being check. */ 38 #define CHECK_V6REQUEST 18 /* This is a marker, indicating the ping6_request has been send. */ 39 #define REBOOT 19 /* This is a marker, indicating the reboot process. */ 40 41 /*mDNS command. */ 42 #define MDNS_CHECK_DATA_V4 0x50 /* This entry contains packet that needs to be matched by IPv4 UDP data. */ 43 #define MDNS_CHECK_DATA_V6 0x51 /* This entry contains packet that needs to be matched by IPv6 UDP data. */ 44 #define MDNS_CHECK_RR_COUNT_REMOTE 0x52 /* This entry checks remote resource record count. */ 45 #define MDNS_CHECK_RR_COUNT_LOCAL 0x53 /* This entry checks local resource record count. */ 46 #define MDNS_CHECK_RR_DATA 0x54 /* This entry checks local resource record data. */ 47 #define MDNS_CHECK_ANY_V4 0x55 /* This entry contains packet that needs to be matched by IPv4 mDNS data. */ 48 #define MDNS_CHECK_ANY_V6 0x56 /* This entry contains packet that needs to be matched by IPv6 mDNS data. */ 49 #define MDNS_CHECK_PROBING_CALLBACK_INVOKED 0x57 /* This entry checks the value of probing callback invoked. */ 50 #define MDNS_CHECK_SERVICE_CALLBACK_INVOKED 0x58 /* This entry checks the value of callback invoked. */ 51 #define MDNS_REJECT_DATA_V4 0x59 /* This entry contains packet that is not expected matched by IPv4 UDP data. */ 52 #define MDNS_REJECT_DATA_V6 0x5A /* This entry contains packet that is not expected matched by IPv6 UDP data. */ 53 #define MDNS_REJECT_ANY_V4 0x5B /* This entry contains packet that is not expected matched by IPv4 mDNS data. */ 54 #define MDNS_REJECT_ANY_V6 0x5C /* This entry contains packet that is not expected matched by IPv6 mDNS data. */ 55 #define MDNS_SET_IPV4_ADDRESS 0x5D /* This entry sets the ipv4 address. */ 56 #define MDNS_SET_SERVICE_CALLBACK 0x5E /* This entry sets the service callback function. */ 57 #define MDNS_SET_SERVICE_CALLBACK_STATE 0x5F /* This entry sets the callback state. */ 58 #define MDNS_SET_PROBING_CALLBACK_STATE 0x60 /* This entry sets the probing state. */ 59 #define MDNS_TIMER_RESET 0x61 /* This entry resets the timer. */ 60 #define MDNS_TIMER_CHECK 0x62 /* This entry checks the timer. */ 61 #define MDNS_TIMER_MAX_CHECK 0x63 /* This entry checks the max timer. */ 62 #define MDNS_QUERY 0x64 /* This entry adds query to mDNS. */ 63 #define MDNS_QUERY_ONESHOT 0x65 /* This entry adds one-shot query to mDNS. */ 64 #define MDNS_QUERY_DELETE 0x66 /* This entry deletes query to mDNS. */ 65 #define MDNS_QUERY_HOST_ADDRESS 0x67 /* This entry adds query to mDNS. */ 66 #define MDNS_SERVICE_ADD 0x68 /* This entry adds a service to mDNS. */ 67 #define MDNS_SERVICE_DELETE 0x69 /* This entry deletes all services to mDNS. */ 68 #define MDNS_INTERFACE_DISABLE 0x6A /* This entry disable interface. */ 69 #define MDNS_INTERFACE_ENABLE 0x6B /* This entry enable interface. */ 70 #define MDNS_LLA_ADD 0x6C /* This entry adds link local address. */ 71 #define MDNS_LLA_DELETE 0x6D /* This entry deletes link local address. */ 72 #define MDNS_RECREATE 0x6F /* This entry deletes and creates mdns instance. */ 73 #define MDNS_WAIT_TICK 0x70 /* This entry sleep specified ticks. */ 74 75 76 #define MDNS_FLAG_QUERY 0x0000 /* Define flag for standard query. */ 77 #define MDNS_FLAG_RESPONSE 0x8400 /* Define flag for standard query response, No error. */ 78 79 80 typedef struct MDNS_TEST_SEQ_struct 81 { 82 /* The command. Only INJECT and CHECK carries valid pkt_data and pkt_size. */ 83 int command; 84 85 /* Only INJECT and CHECK carries valid pkt_data and pkt_size. */ 86 /* For TITLE, pkt_data carries a const string, which is used as the name of the test case. */ 87 char *pkt_data; 88 int pkt_size; 89 90 /* Used for CHECK and WAIT. */ 91 /* WAIT command: wait this amount of time. */ 92 /* CHECK command: during the timeout period, check any incoming packets against the pkt_data in this entry. */ 93 int timeout; 94 95 /*Used in D_CHECK to lookup the sa */ 96 /* Next layer protocol*/ 97 UCHAR protocol; 98 99 /* Used when the next layer protocol is UDP*/ 100 ULONG src_port; 101 ULONG dst_port; 102 103 /*Used when the next layer protocol is ICMP or ICMPv6*/ 104 UINT option; 105 } MDNS_TEST_SEQ; 106 107 typedef struct MDNS_TEST_SUITE_struct 108 { 109 MDNS_TEST_SEQ *test_case; 110 int *test_case_size; 111 } MDNS_TEST_SUITE; 112 113 typedef struct MDNS_RR_DATA_STRUCT 114 { 115 char *mdns_rr_data_name; 116 char *mdns_rr_data_type; 117 char *mdns_rr_data_domain_name; 118 }MDNS_RR_DATA; 119 120 typedef struct MDNS_SERVICE_STRUCT 121 { 122 char *name; 123 char *type; 124 char *sub_type; 125 UCHAR *txt; 126 ULONG ttl; 127 USHORT priority; 128 USHORT weights; 129 USHORT port; 130 UCHAR set; 131 UINT if_index; 132 }MDNS_SERVICE; 133 134 typedef struct MDNS_QUERY_INFO_STRUCT 135 { 136 char *name; 137 char *type; 138 char *sub_type; 139 }MDNS_QUERY_INFO; 140 141 void netx_mdns_run_test_case(NX_IP *ip_ptr, NX_MDNS *mdns_ptr, MDNS_TEST_SEQ *test_case, int test_case_size); 142 void netx_mdns_probing_notify(struct NX_MDNS_STRUCT *mdns_ptr, UCHAR *name, UINT state); 143 144 #endif /* __PRODUCT_NETXDUO__ */ 145 #endif 146