Filter Creation
184
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
Rx Filters
Usage notes on pattern-matching filters:
•
L4_PAYLOAD_EXACT_PATTERN_FIELD type filter only applies to STA or AP (not to transceiver
mode)
•
L1_PAYLOAD_EXACT_PATTERN_FIELD type filter can be in any mode (such as to a STA in
transceiver mode or to a connected STA or to an AP)
Usage note for pattern matching while the device connected to 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);
11.4.4 Rule Structure for Combined Filters
The rule for combined filters is built from the following parameters:
•
Compare function: not, and, or, defines the compare method of the parent filters.
•
Parent filters, the filters which are compared when the compare function is not only filter supplied.
The following example demonstrates a combined filter (the parent filters are already created):
SlWlanRxFilterRule_u RuleCombination;
RuleType = SL_WLAN_RX_FILTER_COMBINATION;
RuleCombination.Combination.CombinationFilterId[0] = ParentFilter1;
RuleCombination.Combination.CombinationFilterId[1] = ParentFilter2;
RuleCombination.Combination.Operator = SL_WLAN_RX_FILTER_COMBINED_FUNC_OR;
RetVal = sl_WlanRxFilterAdd(
RuleType,
FilterFlags,
(
const
SlWlanRxFilterRule_u*
const
)&RuleCombination,
(
const
SlWlanRxFilterTrigger_t*
const
) &Trigger,
(
const
SlWlanRxFilterAction_t*
const
)&Action,
&FilterId);
11.4.5 Filter Trigger
The trigger is the environment conditions verified before the matcher tests the rule. If the environment is
not fulfilling, the rule is not tested and the matching result is FALSE.
A list of parameters that define a trigger follows: