SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
Pattern matching can be used to look for a specific payload on the frame. The SimpleLink Wi-Fi device currently supports two types of pattern matching:
The inputs to this field header rule are as follows:
Usage notes on pattern-matching filters:
Usage note for pattern matching while the device is connected to a TCP transmitter:
To ensure that an application frame arrives with high probability as sent by the transmitter host application, use a long interval (and short time-out) between the TCP sends, because TCP by nature is a streaming protocol. The TCP stack may aggregate or fragment frames into bytes, and send them in accordance with the current network or receiver congestion conditions.
Therefore, when a stream of bytes representing an application frame is sent over a TCP socket of the SimpleLink Wi-Fi device, there is no guarantee that this application frame will arrive in a single WLAN frame, as when it was sent by the transmitter host to the SimpleLink device; in these cases, the filter may not be relevant.
The following example demonstrates a definition of a rule that finds a frame from a specific MAC address. In this example, the rule searches for the MAC address: 0x08, 0x09, 0x76, 0x54, 0x32, 0x45:
_u8 MacMask[6] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
_u8 MacAddress[6] = {0x08,0x09,0x76,0x54,0x32,0x45};
Rule.CompareFunc = SL_WLAN_RX_FILTER_CMP_FUNC_EQUAL_TO;
Rule.Field = SL_WLAN_RX_FILTER_HFIELD_MAC_SRC_ADDR;
memcpy( Rule.Args.Value.Mac[0], MacAddress, 6 );
memcpy( Rule.Args.Mask, MacMAsk , 6 );
The following example demonstrates a definition of a rule that finds a frame from a specific group of MAC addresses by address mask. In this example, the rule searches for MAC addresses that end with 0x45:
_u8 MacMask[6] = {0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0xFF};
_u8 MacAddress[6] = {0x08,0x09,0x76,0x54,0x32,0x45};
Rule.CompareFunc = SL_WLAN_RX_FILTER_CMP_FUNC_EQUAL_TO;
Rule.Field = SL_WLAN_RX_FILTER_HFIELD_MAC_SRC_ADDR;
memcpy(Rule.Args.Value.Mac[0], MacAddress, 6);
memcpy(Rule.Args.Mask, MacMask , 6);